mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import type { IWorkflowSettings } from 'n8n-workflow';
|
|
|
|
import config from '@/config';
|
|
|
|
/**
|
|
* Return whether a workflow execution is configured to be saved or not:
|
|
*
|
|
* - `error`: Whether to save failed executions in production.
|
|
* - `success`: Whether to successful executions in production.
|
|
* - `manual`: Whether to save successful or failed manual executions.
|
|
* - `progress`: Whether to save execution progress, i.e. after each node's execution.
|
|
*/
|
|
export function toSaveSettings(workflowSettings: IWorkflowSettings = {}) {
|
|
const DEFAULTS = {
|
|
ERROR: config.getEnv('executions.saveDataOnError'),
|
|
SUCCESS: config.getEnv('executions.saveDataOnSuccess'),
|
|
MANUAL: config.getEnv('executions.saveDataManualExecutions'),
|
|
PROGRESS: config.getEnv('executions.saveExecutionProgress'),
|
|
};
|
|
|
|
return {
|
|
error: workflowSettings.saveDataErrorExecution
|
|
? workflowSettings.saveDataErrorExecution !== 'none'
|
|
: DEFAULTS.ERROR !== 'none',
|
|
success: workflowSettings.saveDataSuccessExecution
|
|
? workflowSettings.saveDataSuccessExecution !== 'none'
|
|
: DEFAULTS.SUCCESS !== 'none',
|
|
manual:
|
|
workflowSettings === undefined || workflowSettings.saveManualExecutions === 'DEFAULT'
|
|
? DEFAULTS.MANUAL
|
|
: (workflowSettings.saveManualExecutions ?? DEFAULTS.MANUAL),
|
|
progress:
|
|
workflowSettings === undefined || workflowSettings.saveExecutionProgress === 'DEFAULT'
|
|
? DEFAULTS.PROGRESS
|
|
: (workflowSettings.saveExecutionProgress ?? DEFAULTS.PROGRESS),
|
|
};
|
|
}
|