mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
✨ Implement Wait functionality (#1817)
* refactor saving * refactor api layer to be stateless * refactor header details * set variable for menu height * clean up scss * clean up indentation * clean up dropdown impl * refactor no tags view * split away header * Fix tslint issues * Refactor tag manager * add tags to patch request * clean up scss * ⚡ Refactor types to entities * fix issues * update no workflow error * clean up tagscontainer * use getters instead of state * remove imports * use custom colors * clean up tags container * clean up dropdown * clean up focusoncreate * ⚡ Ignore mistaken ID in POST /workflows * ⚡ Fix undefined tag ID in PATCH /workflows * ⚡ Shorten response for POST /tags * remove scss mixins * clean up imports * ⚡ Implement validation with class-validator * address ivan's comments * implement modals * Fix lint issues * fix disabling shortcuts * fix focus issues * fix focus issues * fix focus issues with modal * fix linting issues * use dispatch * use constants for modal keys * fix focus * fix lint issues * remove unused prop * add modal root * fix lint issues * remove unused methods * fix shortcut * remove max width * ⚡ Fix duplicate entry error for pg and MySQL * update rename messaging * update order of buttons * fix firefox overflow on windows * fix dropdown height * 🔨 refactor tag crud controllers * 🧹 remove unused imports * use variable for number of items * fix dropdown spacing * ⚡ Restore type to fix build * ⚡ Fix post-refactor PATCH /workflows/:id * ⚡ Fix PATCH /workflows/:id for zero tags * ⚡ Fix usage count becoming stringified * address max's comments * fix filter spacing * fix blur bug * address most of ivan's comments * address tags type concern * remove defaults * ⚡ return tag id as string * 🔨 add hooks to tag CUD operations * 🏎 simplify timestamp pruning * remove blur event * fix onblur bug * ⚡ Fix fs import to fix build * address max's comments * implement responsive tag container * fix lint issues * update tag limits * address ivan's comments * remove rename, refactor header, implement new designs for save, remove responsive tag container * update styling * update styling * implement responsive tag container * implement header tags edit * implement header tags edit * fix lint issues * implement expandable input * minor fixes * minor fixes * use variable * rename save as * duplicate fixes * minor edit fixes * lint fixes * style fixes * hook up saving name * hook up tags * clean up impl * fix dirty state bug * update limit * update notification messages * on click outside * fix minor bug with count * lint fixes * handle minor edge cases * handle minor edge cases * handle minor bugs; fix firefox dropdown issue * Fix min width * apply tags only after api success * remove count fix * clean up workflow tags impl, fix tags delete bug * fix minor issue * fix minor spacing issue * disable wrap for ops * fix viewport root; save on click in dropdown * save button loading when saving name/tags * implement max width on tags container * implement cleaner create experience * disable edit while updating * codacy hex color * refactor tags container * fix clickability * fix workflow open and count * clean up structure * fix up lint issues * fix button size * increase workflow name limit for larger screen * tslint fixes * disable responsiveness for workflow modal * rename event * change min width for tags * clean up pr * address max's comments on styles * remove success toasts * add hover mode to name * minor fixes * refactor name preview * fix name input not to jiggle * finish up name input * Fix up add tags * clean up param * clean up scss * fix resizing name * fix resizing name * fix resize bug * clean up edit spacing * ignore on esc * fix input bug * focus input on clear * build * fix up add tags clickablity * remove scrollbars * move into folders * clean up multiple patch req * remove padding top from edit * update tags on enter * build * rollout blur on enter behavior * rollout esc behavior * fix tags bug when duplicating tags * move key to reload tags * update header spacing * build * update hex case * refactor workflow title * remove unusued prop * keep focus on error, fix bug on error * Fix bug with name / tags toggle on error * fix connection push bug * :spakles: Implement wait functionality * 🐛 Do not delete waiting executions with prune * ⚡ Improve SQLite migration to not lose execution data anymore * ⚡ Make it possible to restart waiting execution via webhook * ⚡ Add missing file * 🐛 Some more merge fixes * ⚡ Do not show error for Wait-Nodes if in time-mode * ⚡ Make $executionId available in expressions * 👕 Fix lint issue * 👕 Fix lint issue * 👕 Fix lint issue * ⚡ Set the unlimited sleep time as a variable * ⚡ Add also sleeping webhook path to config * ⚡ Make it possible to retrieve restartUrl in workflow * ⚡ Add authentication to Wait-Node in Webhook-Mode * ⚡ Return 404 when trying to restart execution via webhook which does not support it * ✨ Make it possible to set absolute time on Wait-Node * ⚡ Remove not needed imports * ⚡ Fix description format * ✨ Implement missing webhook features on Wait-Node * ⚡ Display webhook variable in NodeWebhooks * ⚡ Include also date in displayed sleep time * ⚡ Make it possible to see sleep time on node * ⚡ Make sure that no executions does get executed twice * ⚡ Add comment * ⚡ Further improvements * ⚡ Make Wait-Node easier to use * ✨ Add support for "notice" parameter type * Fixing wait node to work with queue, improved logging and execution view * Added support for mysql and pg * ✨ Add support for webhook postfix path * ✨ Make it possible to stop sleeping executions * ⚡ Fix issue with webhook paths in not webhook mode * ⚡ Remove not needed console.log * ⚡ Update TODOs * ⚡ Increase min time of workflow staying active to descrease possible issue with overlap * 👕 Fix lint issue * 🐛 Fix issues with webhooks * ⚡ Make error message clearer * ⚡ Fix issue with missing execution ID in scaling mode * Fixed execution list to correctly display waiting executins * Feature: enable webhook wait workflows to continue after specified time * Fixed linting * ⚡ Improve waiting description text * ⚡ Fix parameter display issue and rename * ⚡ Remove comment * ⚡ Do not display webhooks on Wait-Node * Changed wording from restart to resume on wait node * Fixed wording and inconsistent screen when changing resume modes * Removed dots from the descriptions * Changed docs url and renaming postfix to suffix * Changed names from sleep to wait * ⚡ Apply suggestions from ben Co-authored-by: Ben Hesseldieck <1849459+BHesseldieck@users.noreply.github.com> * Some fixes by Ben * ⚡ Remove console.logs * ⚡ Fixes and improvements Co-authored-by: Mutasem <mutdmour@gmail.com> Co-authored-by: Iván Ovejero <ivov.src@gmail.com> Co-authored-by: Ben Hesseldieck <b.hesseldieck@gmail.com> Co-authored-by: Ben Hesseldieck <1849459+BHesseldieck@users.noreply.github.com> Co-authored-by: Omar Ajoue <krynble@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
INodeExecutionData,
|
||||
INodeParameters,
|
||||
IRunExecutionData,
|
||||
IWorkflowDataProxyAdditionalKeys,
|
||||
NodeParameterValue,
|
||||
Workflow,
|
||||
WorkflowDataProxy,
|
||||
@@ -59,7 +60,7 @@ export class Expression {
|
||||
* @returns {(NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[])}
|
||||
* @memberof Workflow
|
||||
*/
|
||||
resolveSimpleParameterValue(parameterValue: NodeParameterValue, siblingParameters: INodeParameters, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], mode: WorkflowExecuteMode, returnObjectAsString = false, selfData = {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] {
|
||||
resolveSimpleParameterValue(parameterValue: NodeParameterValue, siblingParameters: INodeParameters, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], mode: WorkflowExecuteMode, additionalKeys: IWorkflowDataProxyAdditionalKeys, returnObjectAsString = false, selfData = {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] {
|
||||
// Check if it is an expression
|
||||
if (typeof parameterValue !== 'string' || parameterValue.charAt(0) !== '=') {
|
||||
// Is no expression so return value
|
||||
@@ -72,7 +73,7 @@ export class Expression {
|
||||
parameterValue = parameterValue.substr(1);
|
||||
|
||||
// Generate a data proxy which allows to query workflow data
|
||||
const dataProxy = new WorkflowDataProxy(this.workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, siblingParameters, mode, -1, selfData);
|
||||
const dataProxy = new WorkflowDataProxy(this.workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, siblingParameters, mode, additionalKeys, -1, selfData);
|
||||
const data = dataProxy.getDataProxy();
|
||||
|
||||
// Execute the expression
|
||||
@@ -102,7 +103,7 @@ export class Expression {
|
||||
* @returns {(string | undefined)}
|
||||
* @memberof Workflow
|
||||
*/
|
||||
getSimpleParameterValue(node: INode, parameterValue: string | boolean | undefined, mode: WorkflowExecuteMode, defaultValue?: boolean | number | string): boolean | number | string | undefined {
|
||||
getSimpleParameterValue(node: INode, parameterValue: string | boolean | undefined, mode: WorkflowExecuteMode, additionalKeys: IWorkflowDataProxyAdditionalKeys, defaultValue?: boolean | number | string): boolean | number | string | undefined {
|
||||
if (parameterValue === undefined) {
|
||||
// Value is not set so return the default
|
||||
return defaultValue;
|
||||
@@ -118,7 +119,7 @@ export class Expression {
|
||||
},
|
||||
};
|
||||
|
||||
return this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData, mode) as boolean | number | string | undefined;
|
||||
return this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData, mode, additionalKeys) as boolean | number | string | undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +133,7 @@ export class Expression {
|
||||
* @returns {(NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined)}
|
||||
* @memberof Workflow
|
||||
*/
|
||||
getComplexParameterValue(node: INode, parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], mode: WorkflowExecuteMode, defaultValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined = undefined, selfData = {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined {
|
||||
getComplexParameterValue(node: INode, parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], mode: WorkflowExecuteMode, additionalKeys: IWorkflowDataProxyAdditionalKeys, defaultValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined = undefined, selfData = {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined {
|
||||
if (parameterValue === undefined) {
|
||||
// Value is not set so return the default
|
||||
return defaultValue;
|
||||
@@ -149,10 +150,10 @@ export class Expression {
|
||||
};
|
||||
|
||||
// Resolve the "outer" main values
|
||||
const returnData = this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData, mode, false, selfData);
|
||||
const returnData = this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData, mode, additionalKeys, false, selfData);
|
||||
|
||||
// Resolve the "inner" values
|
||||
return this.getParameterValue(returnData, runData, runIndex, itemIndex, node.name, connectionInputData, mode, false, selfData);
|
||||
return this.getParameterValue(returnData, runData, runIndex, itemIndex, node.name, connectionInputData, mode, additionalKeys, false, selfData);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +173,7 @@ export class Expression {
|
||||
* @returns {(NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[])}
|
||||
* @memberof Workflow
|
||||
*/
|
||||
getParameterValue(parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], mode: WorkflowExecuteMode, returnObjectAsString = false, selfData = {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] {
|
||||
getParameterValue(parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], mode: WorkflowExecuteMode, additionalKeys: IWorkflowDataProxyAdditionalKeys, returnObjectAsString = false, selfData = {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] {
|
||||
// Helper function which returns true when the parameter is a complex one or array
|
||||
const isComplexParameter = (value: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[]) => {
|
||||
return typeof value === 'object';
|
||||
@@ -181,15 +182,15 @@ export class Expression {
|
||||
// Helper function which resolves a parameter value depending on if it is simply or not
|
||||
const resolveParameterValue = (value: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], siblingParameters: INodeParameters) => {
|
||||
if (isComplexParameter(value)) {
|
||||
return this.getParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, returnObjectAsString, selfData);
|
||||
return this.getParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, additionalKeys, returnObjectAsString, selfData);
|
||||
} else {
|
||||
return this.resolveSimpleParameterValue(value as NodeParameterValue, siblingParameters, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, returnObjectAsString, selfData);
|
||||
return this.resolveSimpleParameterValue(value as NodeParameterValue, siblingParameters, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, additionalKeys, returnObjectAsString, selfData);
|
||||
}
|
||||
};
|
||||
|
||||
// Check if it value is a simple one that we can get it resolved directly
|
||||
if (!isComplexParameter(parameterValue)) {
|
||||
return this.resolveSimpleParameterValue(parameterValue as NodeParameterValue, {}, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, returnObjectAsString, selfData);
|
||||
return this.resolveSimpleParameterValue(parameterValue as NodeParameterValue, {}, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, additionalKeys, returnObjectAsString, selfData);
|
||||
}
|
||||
|
||||
// The parameter value is complex so resolve depending on type
|
||||
|
||||
@@ -221,6 +221,7 @@ export interface IExecuteFunctions {
|
||||
getTimezone(): string;
|
||||
getWorkflow(): IWorkflowMetadata;
|
||||
prepareOutputData(outputData: INodeExecutionData[], outputIndex?: number): Promise<INodeExecutionData[][]>;
|
||||
putExecutionToWait(waitTill: Date): Promise<void>;
|
||||
sendMessageToUI(message: any): void; // tslint:disable-line:no-any
|
||||
helpers: {
|
||||
[key: string]: (...args: any[]) => any //tslint:disable-line:no-any
|
||||
@@ -403,8 +404,7 @@ export interface INodeParameters {
|
||||
[key: string]: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[];
|
||||
}
|
||||
|
||||
|
||||
export type NodePropertyTypes = 'boolean' | 'collection' | 'color' | 'dateTime' | 'fixedCollection' | 'hidden' | 'json' | 'multiOptions' | 'number' | 'options' | 'string';
|
||||
export type NodePropertyTypes = 'boolean' | 'collection' | 'color' | 'dateTime' | 'fixedCollection' | 'hidden' | 'json' | 'notice' | 'multiOptions' | 'number' | 'options' | 'string';
|
||||
|
||||
export type EditorTypes = 'code';
|
||||
|
||||
@@ -450,8 +450,6 @@ export interface INodeProperties {
|
||||
noDataExpression?: boolean;
|
||||
required?: boolean;
|
||||
}
|
||||
|
||||
|
||||
export interface INodePropertyOptions {
|
||||
name: string;
|
||||
value: string | number;
|
||||
@@ -594,6 +592,7 @@ export interface IWebhookDescription {
|
||||
responsePropertyName?: string;
|
||||
responseMode?: WebhookResponseMode | string;
|
||||
responseData?: WebhookResponseData | string;
|
||||
restartWebhook?: boolean;
|
||||
}
|
||||
|
||||
export interface IWorkflowDataProxyData {
|
||||
@@ -610,6 +609,10 @@ export interface IWorkflowDataProxyData {
|
||||
$workflow: any; // tslint:disable-line:no-any
|
||||
}
|
||||
|
||||
export interface IWorkflowDataProxyAdditionalKeys {
|
||||
[key: string]: string | number | undefined;
|
||||
}
|
||||
|
||||
export interface IWorkflowMetadata {
|
||||
id?: number | string;
|
||||
name?: string;
|
||||
@@ -646,6 +649,7 @@ export interface IRun {
|
||||
data: IRunExecutionData;
|
||||
finished?: boolean;
|
||||
mode: WorkflowExecuteMode;
|
||||
waitTill?: Date;
|
||||
startedAt: Date;
|
||||
stoppedAt?: Date;
|
||||
}
|
||||
@@ -669,6 +673,7 @@ export interface IRunExecutionData {
|
||||
nodeExecutionStack: IExecuteData[];
|
||||
waitingExecution: IWaitingForExecution;
|
||||
};
|
||||
waitTill?: Date;
|
||||
}
|
||||
|
||||
|
||||
@@ -741,6 +746,7 @@ export interface IWorkflowExecuteAdditionalData {
|
||||
encryptionKey: string;
|
||||
executeWorkflow: (workflowInfo: IExecuteWorkflowInfo, additionalData: IWorkflowExecuteAdditionalData, inputData?: INodeExecutionData[], parentExecutionId?: string, loadedWorkflowData?: IWorkflowBase, loadedRunData?: any) => Promise<any>; // tslint:disable-line:no-any
|
||||
// hooks?: IWorkflowExecuteHooks;
|
||||
executionId?: string;
|
||||
hooks?: WorkflowHooks;
|
||||
httpResponse?: express.Response;
|
||||
httpRequest?: express.Request;
|
||||
@@ -748,6 +754,7 @@ export interface IWorkflowExecuteAdditionalData {
|
||||
sendMessageToUI?: (source: string, message: any) => void; // tslint:disable-line:no-any
|
||||
timezone: string;
|
||||
webhookBaseUrl: string;
|
||||
webhookWaitingBaseUrl: string;
|
||||
webhookTestBaseUrl: string;
|
||||
currentNodeParameters?: INodeParameters;
|
||||
executionTimeoutTimestamp?: number;
|
||||
|
||||
@@ -749,7 +749,7 @@ export async function prepareOutputData(outputData: INodeExecutionData[], output
|
||||
* @param {INode} node
|
||||
* @returns {IWebhookData[]}
|
||||
*/
|
||||
export function getNodeWebhooks(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData): IWebhookData[] {
|
||||
export function getNodeWebhooks(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, ignoreRestartWehbooks = false): IWebhookData[] {
|
||||
if (node.disabled === true) {
|
||||
// Node is disabled so webhooks will also not be enabled
|
||||
return [];
|
||||
@@ -767,7 +767,12 @@ export function getNodeWebhooks(workflow: Workflow, node: INode, additionalData:
|
||||
|
||||
const returnData: IWebhookData[] = [];
|
||||
for (const webhookDescription of nodeType.description.webhooks) {
|
||||
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path'], mode);
|
||||
|
||||
if (ignoreRestartWehbooks === true && webhookDescription.restartWebhook === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path'], mode, {});
|
||||
if (nodeWebhookPath === undefined) {
|
||||
// TODO: Use a proper logger
|
||||
console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflowId}".`);
|
||||
@@ -783,10 +788,11 @@ export function getNodeWebhooks(workflow: Workflow, node: INode, additionalData:
|
||||
nodeWebhookPath = nodeWebhookPath.slice(0, -1);
|
||||
}
|
||||
|
||||
const isFullPath: boolean = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], 'internal', false) as boolean;
|
||||
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath);
|
||||
const isFullPath: boolean = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], 'internal', {}, false) as boolean;
|
||||
const restartWebhook: boolean = workflow.expression.getSimpleParameterValue(node, webhookDescription['restartWebhook'], 'internal', {}, false) as boolean;
|
||||
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath, restartWebhook);
|
||||
|
||||
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], mode, 'GET');
|
||||
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], mode, {}, 'GET');
|
||||
|
||||
if (httpMethod === undefined) {
|
||||
// TODO: Use a proper logger
|
||||
@@ -832,7 +838,7 @@ export function getNodeWebhooksBasic(workflow: Workflow, node: INode): IWebhookD
|
||||
|
||||
const returnData: IWebhookData[] = [];
|
||||
for (const webhookDescription of nodeType.description.webhooks) {
|
||||
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path'], mode);
|
||||
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path'], mode, {});
|
||||
if (nodeWebhookPath === undefined) {
|
||||
// TODO: Use a proper logger
|
||||
console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflowId}".`);
|
||||
@@ -848,11 +854,11 @@ export function getNodeWebhooksBasic(workflow: Workflow, node: INode): IWebhookD
|
||||
nodeWebhookPath = nodeWebhookPath.slice(0, -1);
|
||||
}
|
||||
|
||||
const isFullPath: boolean = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], mode, false) as boolean;
|
||||
const isFullPath: boolean = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], mode, {}, false) as boolean;
|
||||
|
||||
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath);
|
||||
|
||||
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], mode);
|
||||
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], mode, {});
|
||||
|
||||
if (httpMethod === undefined) {
|
||||
// TODO: Use a proper logger
|
||||
@@ -883,9 +889,11 @@ export function getNodeWebhooksBasic(workflow: Workflow, node: INode): IWebhookD
|
||||
* @param {string} path
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getNodeWebhookPath(workflowId: string, node: INode, path: string, isFullPath?: boolean): string {
|
||||
export function getNodeWebhookPath(workflowId: string, node: INode, path: string, isFullPath?: boolean, restartWebhook?: boolean): string {
|
||||
let webhookPath = '';
|
||||
if (node.webhookId === undefined) {
|
||||
if (restartWebhook === true) {
|
||||
return path;
|
||||
} else if (node.webhookId === undefined) {
|
||||
webhookPath = `${workflowId}/${encodeURIComponent(node.name.toLowerCase())}/${path}`;
|
||||
} else {
|
||||
if (isFullPath === true) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
INodeExecutionData,
|
||||
INodeParameters,
|
||||
IRunExecutionData,
|
||||
IWorkflowDataProxyAdditionalKeys,
|
||||
IWorkflowDataProxyData,
|
||||
NodeHelpers,
|
||||
NodeParameterValue,
|
||||
@@ -23,10 +24,11 @@ export class WorkflowDataProxy {
|
||||
private siblingParameters: INodeParameters;
|
||||
private mode: WorkflowExecuteMode;
|
||||
private selfData: IDataObject;
|
||||
private additionalKeys: IWorkflowDataProxyAdditionalKeys;
|
||||
|
||||
|
||||
|
||||
constructor(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], siblingParameters: INodeParameters, mode: WorkflowExecuteMode, defaultReturnRunIndex = -1, selfData = {}) {
|
||||
constructor(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], siblingParameters: INodeParameters, mode: WorkflowExecuteMode, additionalKeys: IWorkflowDataProxyAdditionalKeys, defaultReturnRunIndex = -1, selfData = {}) {
|
||||
this.workflow = workflow;
|
||||
this.runExecutionData = runExecutionData;
|
||||
this.defaultReturnRunIndex = defaultReturnRunIndex;
|
||||
@@ -37,6 +39,7 @@ export class WorkflowDataProxy {
|
||||
this.siblingParameters = siblingParameters;
|
||||
this.mode = mode;
|
||||
this.selfData = selfData;
|
||||
this.additionalKeys = additionalKeys;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +134,7 @@ export class WorkflowDataProxy {
|
||||
|
||||
if (typeof returnValue === 'string' && returnValue.charAt(0) === '=') {
|
||||
// The found value is an expression so resolve it
|
||||
return that.workflow.expression.getParameterValue(returnValue, that.runExecutionData, that.runIndex, that.itemIndex, that.activeNodeName, that.connectionInputData, that.mode);
|
||||
return that.workflow.expression.getParameterValue(returnValue, that.runExecutionData, that.runIndex, that.itemIndex, that.activeNodeName, that.connectionInputData, that.mode, that.additionalKeys);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
@@ -371,11 +374,11 @@ export class WorkflowDataProxy {
|
||||
$env: this.envGetter(),
|
||||
$evaluateExpression: (expression: string, itemIndex?: number) => {
|
||||
itemIndex = itemIndex || that.itemIndex;
|
||||
return that.workflow.expression.getParameterValue('=' + expression, that.runExecutionData, that.runIndex, itemIndex, that.activeNodeName, that.connectionInputData, that.mode);
|
||||
return that.workflow.expression.getParameterValue('=' + expression, that.runExecutionData, that.runIndex, itemIndex, that.activeNodeName, that.connectionInputData, that.mode, that.additionalKeys);
|
||||
},
|
||||
$item: (itemIndex: number, runIndex?: number) => {
|
||||
const defaultReturnRunIndex = runIndex === undefined ? -1 : runIndex;
|
||||
const dataProxy = new WorkflowDataProxy(this.workflow, this.runExecutionData, this.runIndex, itemIndex, this.activeNodeName, this.connectionInputData, that.siblingParameters, that.mode, defaultReturnRunIndex);
|
||||
const dataProxy = new WorkflowDataProxy(this.workflow, this.runExecutionData, this.runIndex, itemIndex, this.activeNodeName, this.connectionInputData, that.siblingParameters, that.mode, that.additionalKeys, defaultReturnRunIndex);
|
||||
return dataProxy.getDataProxy();
|
||||
},
|
||||
$items: (nodeName?: string, outputIndex?: number, runIndex?: number) => {
|
||||
@@ -399,6 +402,7 @@ export class WorkflowDataProxy {
|
||||
$runIndex: this.runIndex,
|
||||
$mode: this.mode,
|
||||
$workflow: this.workflowGetter(),
|
||||
...that.additionalKeys,
|
||||
};
|
||||
|
||||
return new Proxy(base, {
|
||||
|
||||
@@ -1097,7 +1097,7 @@ describe('Workflow', () => {
|
||||
|
||||
for (const parameterName of Object.keys(testData.output)) {
|
||||
const parameterValue = nodes.find((node) => node.name === activeNodeName)!.parameters[parameterName];
|
||||
const result = workflow.expression.getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, 'manual');
|
||||
const result = workflow.expression.getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, 'manual', {});
|
||||
// @ts-ignore
|
||||
expect(result).toEqual(testData.output[parameterName]);
|
||||
}
|
||||
@@ -1247,7 +1247,7 @@ describe('Workflow', () => {
|
||||
const parameterName = 'values';
|
||||
|
||||
const parameterValue = nodes.find((node) => node.name === activeNodeName)!.parameters[parameterName];
|
||||
const result = workflow.expression.getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, 'manual');
|
||||
const result = workflow.expression.getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, 'manual', {});
|
||||
|
||||
expect(result).toEqual({
|
||||
string: [
|
||||
|
||||
Reference in New Issue
Block a user