feat(core): Implement webhook-only manual execution (#4960)

*  Implement webhook-only manual execution

* ♻️ Apply feedback
This commit is contained in:
Iván Ovejero 2022-12-27 12:50:50 +01:00 committed by GitHub
parent d6bc760ab4
commit d113977b10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -27,6 +27,7 @@ export class TestWebhooks {
timeout: NodeJS.Timeout;
workflowData: IWorkflowDb;
workflow: Workflow;
destinationNode?: string;
};
} = {};
@ -128,6 +129,7 @@ export class TestWebhooks {
}
resolve(data);
},
this.testWebhookData[webhookKey].destinationNode,
);
if (executionId === undefined) {
@ -230,6 +232,7 @@ export class TestWebhooks {
timeout,
workflow,
workflowData,
destinationNode,
};
try {

View file

@ -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(
@ -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.