Skip to content

Commit

Permalink
fix(core): Move nodeExecute InternalHook calls to hookFunctionsSave (#…
Browse files Browse the repository at this point in the history
…6193)

nodeExecute InternalHooks to hookFunctionsSave
  • Loading branch information
flipswitchingmonkey authored and netroy committed May 15, 2023
1 parent 4993212 commit c4a9499
Showing 1 changed file with 18 additions and 42 deletions.
60 changes: 18 additions & 42 deletions packages/cli/src/WorkflowExecuteAdditionalData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
void Container.get(InternalHooks).onNodeBeforeExecute(
this.executionId,
this.workflowData,
nodeName,
);
},
],
nodeExecuteAfter: [
async function (this: WorkflowHooks, nodeName: string): Promise<void> {
void Container.get(InternalHooks).onNodePostExecute(
this.executionId,
this.workflowData,
nodeName,
);
},
],
workflowExecuteBefore: [],
workflowExecuteAfter: [
async function (
Expand Down Expand Up @@ -1261,26 +1277,6 @@ export function getWorkflowHooksWorkerMain(
hookFunctions.nodeExecuteBefore = [];
hookFunctions.nodeExecuteAfter = [];

hookFunctions.nodeExecuteBefore.push(async function (
this: WorkflowHooks,
nodeName: string,
): Promise<void> {
void Container.get(InternalHooks).onNodeBeforeExecute(
this.executionId,
this.workflowData,
nodeName,
);
});
hookFunctions.nodeExecuteAfter.push(async function (
this: WorkflowHooks,
nodeName: string,
): Promise<void> {
void Container.get(InternalHooks).onNodePostExecute(
this.executionId,
this.workflowData,
nodeName,
);
});
return new WorkflowHooks(hookFunctions, mode, executionId, workflowData, optionalParameters);
}

Expand Down Expand Up @@ -1313,27 +1309,7 @@ export function getWorkflowHooksMain(
}

if (!hookFunctions.nodeExecuteBefore) hookFunctions.nodeExecuteBefore = [];
hookFunctions.nodeExecuteBefore?.push(async function (
this: WorkflowHooks,
nodeName: string,
): Promise<void> {
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> {
void Container.get(InternalHooks).onNodePostExecute(
this.executionId,
this.workflowData,
nodeName,
);
});

return new WorkflowHooks(hookFunctions, data.executionMode, executionId, data.workflowData, {
sessionId: data.sessionId,
Expand Down

0 comments on commit c4a9499

Please sign in to comment.