mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Delete some duplicate code between ActiveWebhooks and ActiveWorkflowRunner (no-changelog) (#6951)
This commit is contained in:
committed by
GitHub
parent
9b27878d8f
commit
41c3cc89ca
@@ -972,12 +972,52 @@ export class Workflow {
|
||||
return this.__getStartNode(Object.keys(this.nodes));
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the Webhooks method of the node
|
||||
*
|
||||
* @param {WebhookSetupMethodNames} method The name of the method to execute
|
||||
*/
|
||||
async runWebhookMethod(
|
||||
async createWebhookIfNotExists(
|
||||
webhookData: IWebhookData,
|
||||
nodeExecuteFunctions: INodeExecuteFunctions,
|
||||
mode: WorkflowExecuteMode,
|
||||
activation: WorkflowActivateMode,
|
||||
isTest?: boolean,
|
||||
): Promise<void> {
|
||||
const webhookExists = await this.runWebhookMethod(
|
||||
'checkExists',
|
||||
webhookData,
|
||||
nodeExecuteFunctions,
|
||||
mode,
|
||||
activation,
|
||||
isTest,
|
||||
);
|
||||
if (!webhookExists) {
|
||||
// If webhook does not exist yet create it
|
||||
await this.runWebhookMethod(
|
||||
'create',
|
||||
webhookData,
|
||||
nodeExecuteFunctions,
|
||||
mode,
|
||||
activation,
|
||||
isTest,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async deleteWebhook(
|
||||
webhookData: IWebhookData,
|
||||
nodeExecuteFunctions: INodeExecuteFunctions,
|
||||
mode: WorkflowExecuteMode,
|
||||
activation: WorkflowActivateMode,
|
||||
isTest?: boolean,
|
||||
) {
|
||||
await this.runWebhookMethod(
|
||||
'delete',
|
||||
webhookData,
|
||||
nodeExecuteFunctions,
|
||||
mode,
|
||||
activation,
|
||||
isTest,
|
||||
);
|
||||
}
|
||||
|
||||
private async runWebhookMethod(
|
||||
method: WebhookSetupMethodNames,
|
||||
webhookData: IWebhookData,
|
||||
nodeExecuteFunctions: INodeExecuteFunctions,
|
||||
|
||||
Reference in New Issue
Block a user