n8n-workflow
Advanced tools
Comparing version 0.50.0 to 0.51.0
@@ -1,2 +0,2 @@ | ||
import { INode, INodeExecutionData, INodeParameters, IRunExecutionData, NodeParameterValue, Workflow } from './'; | ||
import { INode, INodeExecutionData, INodeParameters, IRunExecutionData, NodeParameterValue, Workflow, WorkflowExecuteMode } from './'; | ||
export declare class Expression { | ||
@@ -6,6 +6,6 @@ workflow: Workflow; | ||
convertObjectValueToString(value: object): string; | ||
resolveSimpleParameterValue(parameterValue: NodeParameterValue, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], returnObjectAsString?: boolean, selfData?: {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[]; | ||
getSimpleParameterValue(node: INode, parameterValue: string | boolean | undefined, defaultValue?: boolean | number | string): boolean | number | string | undefined; | ||
getComplexParameterValue(node: INode, parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], defaultValue?: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined, selfData?: {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined; | ||
getParameterValue(parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], returnObjectAsString?: boolean, selfData?: {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[]; | ||
resolveSimpleParameterValue(parameterValue: NodeParameterValue, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], mode: WorkflowExecuteMode, returnObjectAsString?: boolean, selfData?: {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[]; | ||
getSimpleParameterValue(node: INode, parameterValue: string | boolean | undefined, mode: WorkflowExecuteMode, defaultValue?: boolean | number | string): boolean | number | string | undefined; | ||
getComplexParameterValue(node: INode, parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], mode: WorkflowExecuteMode, defaultValue?: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined, selfData?: {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined; | ||
getParameterValue(parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], mode: WorkflowExecuteMode, returnObjectAsString?: boolean, selfData?: {}): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[]; | ||
} |
@@ -16,3 +16,3 @@ "use strict"; | ||
} | ||
resolveSimpleParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString = false, selfData = {}) { | ||
resolveSimpleParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, returnObjectAsString = false, selfData = {}) { | ||
if (typeof parameterValue !== 'string' || parameterValue.charAt(0) !== '=') { | ||
@@ -22,3 +22,3 @@ return parameterValue; | ||
parameterValue = parameterValue.substr(1); | ||
const dataProxy = new _1.WorkflowDataProxy(this.workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, -1, selfData); | ||
const dataProxy = new _1.WorkflowDataProxy(this.workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, -1, selfData); | ||
const data = dataProxy.getDataProxy(); | ||
@@ -41,3 +41,3 @@ try { | ||
} | ||
getSimpleParameterValue(node, parameterValue, defaultValue) { | ||
getSimpleParameterValue(node, parameterValue, mode, defaultValue) { | ||
if (parameterValue === undefined) { | ||
@@ -54,5 +54,5 @@ return defaultValue; | ||
}; | ||
return this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData); | ||
return this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData, mode); | ||
} | ||
getComplexParameterValue(node, parameterValue, defaultValue = undefined, selfData = {}) { | ||
getComplexParameterValue(node, parameterValue, mode, defaultValue = undefined, selfData = {}) { | ||
if (parameterValue === undefined) { | ||
@@ -69,6 +69,6 @@ return defaultValue; | ||
}; | ||
const returnData = this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData, false, selfData); | ||
return this.getParameterValue(returnData, runData, runIndex, itemIndex, node.name, connectionInputData, false, selfData); | ||
const returnData = this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData, mode, false, selfData); | ||
return this.getParameterValue(returnData, runData, runIndex, itemIndex, node.name, connectionInputData, mode, false, selfData); | ||
} | ||
getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString = false, selfData = {}) { | ||
getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, returnObjectAsString = false, selfData = {}) { | ||
const isComplexParameter = (value) => { | ||
@@ -79,10 +79,10 @@ return typeof value === 'object'; | ||
if (isComplexParameter(value)) { | ||
return this.getParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString, selfData); | ||
return this.getParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, returnObjectAsString, selfData); | ||
} | ||
else { | ||
return this.resolveSimpleParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString, selfData); | ||
return this.resolveSimpleParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, returnObjectAsString, selfData); | ||
} | ||
}; | ||
if (!isComplexParameter(parameterValue)) { | ||
return this.resolveSimpleParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString, selfData); | ||
return this.resolveSimpleParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, returnObjectAsString, selfData); | ||
} | ||
@@ -89,0 +89,0 @@ if (Array.isArray(parameterValue)) { |
@@ -74,3 +74,3 @@ import { Workflow } from './Workflow'; | ||
abstract getCredentials(name: string, type: string): ICredentials; | ||
abstract getDecrypted(name: string, type: string, raw?: boolean, expressionResolveValues?: ICredentialsExpressionResolveValues): ICredentialDataDecryptedObject; | ||
abstract getDecrypted(name: string, type: string, mode: WorkflowExecuteMode, raw?: boolean, expressionResolveValues?: ICredentialsExpressionResolveValues): ICredentialDataDecryptedObject; | ||
abstract updateCredentials(name: string, type: string, data: ICredentialDataDecryptedObject): Promise<void>; | ||
@@ -77,0 +77,0 @@ } |
@@ -542,5 +542,6 @@ "use strict"; | ||
const workflowId = workflow.id || '__UNSAVED__'; | ||
const mode = 'internal'; | ||
const returnData = []; | ||
for (const webhookDescription of nodeType.description.webhooks) { | ||
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path']); | ||
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path'], mode); | ||
if (nodeWebhookPath === undefined) { | ||
@@ -554,5 +555,5 @@ console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflowId}".`); | ||
} | ||
const isFullPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], false); | ||
const isFullPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], 'internal', false); | ||
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath); | ||
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], 'GET'); | ||
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], mode, 'GET'); | ||
if (httpMethod === undefined) { | ||
@@ -588,5 +589,6 @@ console.error(`The webhook "${path}" for node "${node.name}" in workflow "${workflowId}" could not be added because the httpMethod is not defined.`); | ||
const workflowId = workflow.id || '__UNSAVED__'; | ||
const mode = 'internal'; | ||
const returnData = []; | ||
for (const webhookDescription of nodeType.description.webhooks) { | ||
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path']); | ||
let nodeWebhookPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['path'], mode); | ||
if (nodeWebhookPath === undefined) { | ||
@@ -600,5 +602,5 @@ console.error(`No webhook path could be found for node "${node.name}" in workflow "${workflowId}".`); | ||
} | ||
const isFullPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], false); | ||
const isFullPath = workflow.expression.getSimpleParameterValue(node, webhookDescription['isFullPath'], mode, false); | ||
const path = getNodeWebhookPath(workflowId, node, nodeWebhookPath, isFullPath); | ||
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod']); | ||
const httpMethod = workflow.expression.getSimpleParameterValue(node, webhookDescription['httpMethod'], mode); | ||
if (httpMethod === undefined) { | ||
@@ -605,0 +607,0 @@ console.error(`The webhook "${path}" for node "${node.name}" in workflow "${workflowId}" could not be added because the httpMethod is not defined.`); |
@@ -1,2 +0,2 @@ | ||
import { INodeExecutionData, IRunExecutionData, IWorkflowDataProxyData, Workflow } from './'; | ||
import { INodeExecutionData, IRunExecutionData, IWorkflowDataProxyData, Workflow, WorkflowExecuteMode } from './'; | ||
export declare class WorkflowDataProxy { | ||
@@ -10,4 +10,5 @@ private workflow; | ||
private connectionInputData; | ||
private mode; | ||
private selfData; | ||
constructor(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], defaultReturnRunIndex?: number, selfData?: {}); | ||
constructor(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], mode: WorkflowExecuteMode, defaultReturnRunIndex?: number, selfData?: {}); | ||
private nodeContextGetter; | ||
@@ -14,0 +15,0 @@ private selfGetter; |
@@ -6,3 +6,3 @@ "use strict"; | ||
class WorkflowDataProxy { | ||
constructor(workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, defaultReturnRunIndex = -1, selfData = {}) { | ||
constructor(workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, mode, defaultReturnRunIndex = -1, selfData = {}) { | ||
this.workflow = workflow; | ||
@@ -15,2 +15,3 @@ this.runExecutionData = runExecutionData; | ||
this.connectionInputData = connectionInputData; | ||
this.mode = mode; | ||
this.selfData = selfData; | ||
@@ -64,3 +65,3 @@ } | ||
if (typeof returnValue === 'string' && returnValue.charAt(0) === '=') { | ||
return that.workflow.expression.getParameterValue(returnValue, that.runExecutionData, that.runIndex, that.itemIndex, that.activeNodeName, that.connectionInputData); | ||
return that.workflow.expression.getParameterValue(returnValue, that.runExecutionData, that.runIndex, that.itemIndex, that.activeNodeName, that.connectionInputData, that.mode); | ||
} | ||
@@ -200,7 +201,7 @@ return returnValue; | ||
itemIndex = itemIndex || that.itemIndex; | ||
return that.workflow.expression.getParameterValue('=' + expression, that.runExecutionData, that.runIndex, itemIndex, that.activeNodeName, that.connectionInputData); | ||
return that.workflow.expression.getParameterValue('=' + expression, that.runExecutionData, that.runIndex, itemIndex, that.activeNodeName, that.connectionInputData, that.mode); | ||
}, | ||
$item: (itemIndex, runIndex) => { | ||
const defaultReturnRunIndex = runIndex === undefined ? -1 : runIndex; | ||
const dataProxy = new WorkflowDataProxy(this.workflow, this.runExecutionData, this.runIndex, itemIndex, this.activeNodeName, this.connectionInputData, defaultReturnRunIndex); | ||
const dataProxy = new WorkflowDataProxy(this.workflow, this.runExecutionData, this.runIndex, itemIndex, this.activeNodeName, this.connectionInputData, that.mode, defaultReturnRunIndex); | ||
return dataProxy.getDataProxy(); | ||
@@ -225,2 +226,3 @@ }, | ||
$runIndex: this.runIndex, | ||
$mode: this.mode, | ||
$workflow: this.workflowGetter(), | ||
@@ -227,0 +229,0 @@ }; |
@@ -1018,3 +1018,3 @@ "use strict"; | ||
const parameterValue = nodes.find((node) => node.name === activeNodeName).parameters[parameterName]; | ||
const result = workflow.expression.getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData); | ||
const result = workflow.expression.getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, 'manual'); | ||
expect(result).toEqual(testData.output[parameterName]); | ||
@@ -1080,3 +1080,3 @@ } | ||
const parameterValue = nodes.find((node) => node.name === activeNodeName).parameters[parameterName]; | ||
const result = workflow.expression.getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData); | ||
const result = workflow.expression.getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, 'manual'); | ||
expect(result).toEqual({ | ||
@@ -1083,0 +1083,0 @@ string: [ |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.50.0", | ||
"version": "0.51.0", | ||
"description": "Workflow base code of n8n", | ||
@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
424396
6733