Add Activation Trigger (#1570)

*  n8n start trigger node

* first declaration of WorkflowActivationMode

* implement first WorkflowActivationMode: 'init', 'create', 'update', 'activate'

* fix Server missing id

* add activation infos to triggers

* remove WorkflowActivationMode from webhook execution function

* add some missing activation and add manual activation

* clean up and fix some code

* fix UnhandledPromiseRejectionWarning: Error: Overwrite NodeExecuteFunctions.getExecuteTriggerFunctions.emit function!

* fix spaces

* use a better name for the node

* fix ident in package.json

* Contributions to lublak's PR #1287

* Fixed linting issues and change the way parameters are displayed

*  Fix name and minor improvements

Co-authored-by: lublak <lublak.de@gmail.com>
Co-authored-by: lublak <44057030+lublak@users.noreply.github.com>
Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
Omar Ajoue
2021-03-23 19:08:47 +01:00
committed by GitHub
parent 11fb97223c
commit 726a99bf69
10 changed files with 134 additions and 41 deletions

View File

@@ -17,6 +17,7 @@ import {
IWorkflowExecuteAdditionalData,
WebhookHttpMethod,
Workflow,
WorkflowActivateMode,
WorkflowExecuteMode,
} from 'n8n-workflow';
@@ -161,7 +162,7 @@ export class TestWebhooks {
* @returns {(Promise<IExecutionDb | undefined>)}
* @memberof TestWebhooks
*/
async needsWebhookData(workflowData: IWorkflowDb, workflow: Workflow, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, sessionId?: string, destinationNode?: string): Promise<boolean> {
async needsWebhookData(workflowData: IWorkflowDb, workflow: Workflow, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode, sessionId?: string, destinationNode?: string): Promise<boolean> {
const webhooks = WebhookHelpers.getWorkflowWebhooks(workflow, additionalData, destinationNode);
if (webhooks.length === 0) {
@@ -193,7 +194,7 @@ export class TestWebhooks {
};
try {
await this.activeWebhooks!.add(workflow, webhookData, mode);
await this.activeWebhooks!.add(workflow, webhookData, mode, activation);
} catch (error) {
activatedKey.forEach(deleteKey => delete this.testWebhookData[deleteKey] );
await this.activeWebhooks!.removeWorkflow(workflow);