✨ 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:
@@ -34,6 +34,7 @@ import {
|
||||
NodeHelpers,
|
||||
NodeParameterValue,
|
||||
Workflow,
|
||||
WorkflowActivateMode,
|
||||
WorkflowDataProxy,
|
||||
WorkflowExecuteMode,
|
||||
} from 'n8n-workflow';
|
||||
@@ -535,7 +536,7 @@ export function getWorkflowMetadata(workflow: Workflow): IWorkflowMetadata {
|
||||
* @returns {ITriggerFunctions}
|
||||
*/
|
||||
// TODO: Check if I can get rid of: additionalData, and so then maybe also at ActiveWorkflowRunner.add
|
||||
export function getExecutePollFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode): IPollFunctions {
|
||||
export function getExecutePollFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode): IPollFunctions {
|
||||
return ((workflow: Workflow, node: INode) => {
|
||||
return {
|
||||
__emit: (data: INodeExecutionData[][]): void => {
|
||||
@@ -547,6 +548,9 @@ export function getExecutePollFunctions(workflow: Workflow, node: INode, additio
|
||||
getMode: (): WorkflowExecuteMode => {
|
||||
return mode;
|
||||
},
|
||||
getActivationMode: (): WorkflowActivateMode => {
|
||||
return activation;
|
||||
},
|
||||
getNode: () => {
|
||||
return getNode(node);
|
||||
},
|
||||
@@ -598,7 +602,7 @@ export function getExecutePollFunctions(workflow: Workflow, node: INode, additio
|
||||
* @returns {ITriggerFunctions}
|
||||
*/
|
||||
// TODO: Check if I can get rid of: additionalData, and so then maybe also at ActiveWorkflowRunner.add
|
||||
export function getExecuteTriggerFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode): ITriggerFunctions {
|
||||
export function getExecuteTriggerFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode): ITriggerFunctions {
|
||||
return ((workflow: Workflow, node: INode) => {
|
||||
return {
|
||||
emit: (data: INodeExecutionData[][]): void => {
|
||||
@@ -613,6 +617,9 @@ export function getExecuteTriggerFunctions(workflow: Workflow, node: INode, addi
|
||||
getMode: (): WorkflowExecuteMode => {
|
||||
return mode;
|
||||
},
|
||||
getActivationMode: (): WorkflowActivateMode => {
|
||||
return activation;
|
||||
},
|
||||
getNodeParameter: (parameterName: string, fallbackValue?: any): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | object => { //tslint:disable-line:no-any
|
||||
const runExecutionData: IRunExecutionData | null = null;
|
||||
const itemIndex = 0;
|
||||
@@ -910,7 +917,7 @@ export function getLoadOptionsFunctions(workflow: Workflow, node: INode, additio
|
||||
* @param {WorkflowExecuteMode} mode
|
||||
* @returns {IHookFunctions}
|
||||
*/
|
||||
export function getExecuteHookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, isTest?: boolean, webhookData?: IWebhookData): IHookFunctions {
|
||||
export function getExecuteHookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode, isTest?: boolean, webhookData?: IWebhookData): IHookFunctions {
|
||||
return ((workflow: Workflow, node: INode) => {
|
||||
const that = {
|
||||
getCredentials(type: string): ICredentialDataDecryptedObject | undefined {
|
||||
@@ -919,6 +926,9 @@ export function getExecuteHookFunctions(workflow: Workflow, node: INode, additio
|
||||
getMode: (): WorkflowExecuteMode => {
|
||||
return mode;
|
||||
},
|
||||
getActivationMode: (): WorkflowActivateMode => {
|
||||
return activation;
|
||||
},
|
||||
getNode: () => {
|
||||
return getNode(node);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user