Skip to content

Commit

Permalink
feat(core): Implement webhook-only manual execution (#4960)
Browse files Browse the repository at this point in the history
* ⚡ Implement webhook-only manual execution

* ♻️ Apply feedback
  • Loading branch information
ivov authored Dec 27, 2022
1 parent d6bc760 commit d113977
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/cli/src/TestWebhooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class TestWebhooks {
timeout: NodeJS.Timeout;
workflowData: IWorkflowDb;
workflow: Workflow;
destinationNode?: string;
};
} = {};

Expand Down Expand Up @@ -128,6 +129,7 @@ export class TestWebhooks {
}
resolve(data);
},
this.testWebhookData[webhookKey].destinationNode,
);

if (executionId === undefined) {
Expand Down Expand Up @@ -230,6 +232,7 @@ export class TestWebhooks {
timeout,
workflow,
workflowData,
destinationNode,
};

try {
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/WebhookHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export async function executeWebhook(
req: express.Request,
res: express.Response,
responseCallback: (error: Error | null, data: IResponseCallbackData) => void,
destinationNode?: string,
): Promise<string | undefined> {
// Get the nodeType to know which responseMode is set
const nodeType = workflow.nodeTypes.getByNameAndVersion(
Expand Down Expand Up @@ -379,6 +380,10 @@ export async function executeWebhook(
},
} as IRunExecutionData);

if (destinationNode && runExecutionData.startData) {
runExecutionData.startData.destinationNode = destinationNode;
}

if (executionId !== undefined) {
// Set the data the webhook node did return on the waiting node if executionId
// already exists as it means that we are restarting an existing execution.
Expand Down

0 comments on commit d113977

Please sign in to comment.