diff --git a/packages/cli/src/WorkflowExecuteAdditionalData.ts b/packages/cli/src/WorkflowExecuteAdditionalData.ts index 7f6f26f64b51b..9cc7aac265e1a 100644 --- a/packages/cli/src/WorkflowExecuteAdditionalData.ts +++ b/packages/cli/src/WorkflowExecuteAdditionalData.ts @@ -515,8 +515,24 @@ export function hookFunctionsPreExecute(parentProcessMode?: string): IWorkflowEx */ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks { return { - nodeExecuteBefore: [], - nodeExecuteAfter: [], + nodeExecuteBefore: [ + async function (this: WorkflowHooks, nodeName: string): Promise { + void Container.get(InternalHooks).onNodeBeforeExecute( + this.executionId, + this.workflowData, + nodeName, + ); + }, + ], + nodeExecuteAfter: [ + async function (this: WorkflowHooks, nodeName: string): Promise { + void Container.get(InternalHooks).onNodePostExecute( + this.executionId, + this.workflowData, + nodeName, + ); + }, + ], workflowExecuteBefore: [], workflowExecuteAfter: [ async function ( @@ -1261,26 +1277,6 @@ export function getWorkflowHooksWorkerMain( hookFunctions.nodeExecuteBefore = []; hookFunctions.nodeExecuteAfter = []; - hookFunctions.nodeExecuteBefore.push(async function ( - this: WorkflowHooks, - nodeName: string, - ): Promise { - void Container.get(InternalHooks).onNodeBeforeExecute( - this.executionId, - this.workflowData, - nodeName, - ); - }); - hookFunctions.nodeExecuteAfter.push(async function ( - this: WorkflowHooks, - nodeName: string, - ): Promise { - void Container.get(InternalHooks).onNodePostExecute( - this.executionId, - this.workflowData, - nodeName, - ); - }); return new WorkflowHooks(hookFunctions, mode, executionId, workflowData, optionalParameters); } @@ -1313,27 +1309,7 @@ export function getWorkflowHooksMain( } if (!hookFunctions.nodeExecuteBefore) hookFunctions.nodeExecuteBefore = []; - hookFunctions.nodeExecuteBefore?.push(async function ( - this: WorkflowHooks, - nodeName: string, - ): Promise { - void Container.get(InternalHooks).onNodeBeforeExecute( - this.executionId, - this.workflowData, - nodeName, - ); - }); if (!hookFunctions.nodeExecuteAfter) hookFunctions.nodeExecuteAfter = []; - hookFunctions.nodeExecuteAfter.push(async function ( - this: WorkflowHooks, - nodeName: string, - ): Promise { - void Container.get(InternalHooks).onNodePostExecute( - this.executionId, - this.workflowData, - nodeName, - ); - }); return new WorkflowHooks(hookFunctions, data.executionMode, executionId, data.workflowData, { sessionId: data.sessionId,