n8n-workflow
Advanced tools
Comparing version 0.27.0 to 0.28.0
@@ -433,5 +433,2 @@ "use strict"; | ||
const data = dataProxy.getDataProxy(); | ||
data.$evaluateExpression = (expression) => { | ||
return this.resolveSimpleParameterValue('=' + expression, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString); | ||
}; | ||
try { | ||
@@ -438,0 +435,0 @@ const returnValue = tmpl.tmpl(parameterValue, data); |
@@ -5,2 +5,3 @@ import { INodeExecutionData, IRunExecutionData, IWorkflowDataProxyData, Workflow } from './'; | ||
private runExecutionData; | ||
private defaultReturnRunIndex; | ||
private runIndex; | ||
@@ -10,3 +11,3 @@ private itemIndex; | ||
private connectionInputData; | ||
constructor(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[]); | ||
constructor(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], defaultReturnRunIndex?: number); | ||
private nodeContextGetter; | ||
@@ -13,0 +14,0 @@ private nodeParameterGetter; |
@@ -5,5 +5,6 @@ "use strict"; | ||
class WorkflowDataProxy { | ||
constructor(workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData) { | ||
constructor(workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, defaultReturnRunIndex = -1) { | ||
this.workflow = workflow; | ||
this.runExecutionData = runExecutionData; | ||
this.defaultReturnRunIndex = defaultReturnRunIndex; | ||
this.runIndex = runIndex; | ||
@@ -64,3 +65,4 @@ this.itemIndex = itemIndex; | ||
} | ||
runIndex = runIndex === undefined ? that.runIndex : runIndex; | ||
runIndex = runIndex === undefined ? that.defaultReturnRunIndex : runIndex; | ||
runIndex = runIndex === -1 ? (that.runExecutionData.resultData.runData[nodeName].length - 1) : runIndex; | ||
if (that.runExecutionData.resultData.runData[nodeName].length < runIndex) { | ||
@@ -102,3 +104,3 @@ throw new Error(`No execution data found for run "${runIndex}" of node "${nodeName}"`); | ||
if (['binary', 'data', 'json'].includes(name)) { | ||
const executionData = that.getNodeExecutionData(nodeName, shortSyntax); | ||
const executionData = that.getNodeExecutionData(nodeName, shortSyntax, undefined); | ||
if (executionData.length <= that.itemIndex) { | ||
@@ -135,2 +137,8 @@ throw new Error(`No data found for item-index: "${that.itemIndex}"`); | ||
} | ||
else if (name === 'runIndex') { | ||
if (that.runExecutionData === null || !that.runExecutionData.resultData.runData[nodeName]) { | ||
return -1; | ||
} | ||
return that.runExecutionData.resultData.runData[nodeName].length - 1; | ||
} | ||
return Reflect.get(target, name, receiver); | ||
@@ -177,5 +185,9 @@ } | ||
$env: this.envGetter(), | ||
$evaluateExpression: (expression) => { }, | ||
$item: (itemIndex) => { | ||
const dataProxy = new WorkflowDataProxy(this.workflow, this.runExecutionData, this.runIndex, itemIndex, this.activeNodeName, this.connectionInputData); | ||
$evaluateExpression: (expression, itemIndex) => { | ||
itemIndex = itemIndex || that.itemIndex; | ||
return that.workflow.getParameterValue('=' + expression, that.runExecutionData, that.runIndex, itemIndex, that.activeNodeName, that.connectionInputData); | ||
}, | ||
$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); | ||
return dataProxy.getDataProxy(); | ||
@@ -190,2 +202,3 @@ }, | ||
outputIndex = outputIndex || 0; | ||
runIndex = runIndex === undefined ? -1 : runIndex; | ||
executionData = that.getNodeExecutionData(nodeName, false, outputIndex, runIndex); | ||
@@ -198,2 +211,3 @@ } | ||
$parameter: this.nodeParameterGetter(this.activeNodeName), | ||
$runIndex: this.runIndex, | ||
$workflow: this.workflowGetter(), | ||
@@ -200,0 +214,0 @@ }; |
@@ -896,2 +896,25 @@ "use strict"; | ||
}, | ||
{ | ||
description: 'return resolved value when referencing another property with expression on another node (long "$node["{NODE}"].parameter" syntax)', | ||
input: { | ||
Node1: { | ||
parameters: { | ||
value1: 'valueNode1', | ||
} | ||
}, | ||
Node2: { | ||
parameters: { | ||
value1: '={{$node["Node1"].parameter.value1}}a', | ||
}, | ||
}, | ||
Node3: { | ||
parameters: { | ||
value1: '={{$node["Node2"].parameter.value1}}b', | ||
}, | ||
} | ||
}, | ||
output: { | ||
value1: 'valueNode1ab', | ||
}, | ||
}, | ||
]; | ||
@@ -898,0 +921,0 @@ const nodeTypes = Helpers.NodeTypes(); |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.27.0", | ||
"version": "0.28.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
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
406147
6479