mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
25 lines
879 B
TypeScript
25 lines
879 B
TypeScript
import config from '@/config';
|
|
import type { IWorkflowSettings } from 'n8n-workflow';
|
|
|
|
/**
|
|
* Return whether a workflow execution is configured to be saved or not,
|
|
* for error executions, success executions, and manual executions.
|
|
*/
|
|
export function toSaveSettings(workflowSettings: IWorkflowSettings = {}) {
|
|
const DEFAULTS = {
|
|
ERROR: config.getEnv('executions.saveDataOnError'),
|
|
SUCCESS: config.getEnv('executions.saveDataOnSuccess'),
|
|
MANUAL: config.getEnv('executions.saveDataManualExecutions'),
|
|
};
|
|
|
|
return {
|
|
error: workflowSettings.saveDataErrorExecution
|
|
? workflowSettings.saveDataErrorExecution !== 'none'
|
|
: DEFAULTS.ERROR !== 'none',
|
|
success: workflowSettings.saveDataSuccessExecution
|
|
? workflowSettings.saveDataSuccessExecution !== 'none'
|
|
: DEFAULTS.SUCCESS !== 'none',
|
|
manual: workflowSettings?.saveManualExecutions ?? DEFAULTS.MANUAL,
|
|
};
|
|
}
|