n8n-workflow
Advanced tools
Comparing version 0.49.0 to 0.50.0
@@ -6,6 +6,6 @@ import { INode, INodeExecutionData, INodeParameters, IRunExecutionData, NodeParameterValue, Workflow } from './'; | ||
convertObjectValueToString(value: object): string; | ||
resolveSimpleParameterValue(parameterValue: NodeParameterValue, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], returnObjectAsString?: boolean): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[]; | ||
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): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[] | undefined; | ||
getParameterValue(parameterValue: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[], runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], returnObjectAsString?: boolean): NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[]; | ||
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[]; | ||
} |
@@ -16,3 +16,3 @@ "use strict"; | ||
} | ||
resolveSimpleParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString = false) { | ||
resolveSimpleParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, 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); | ||
const dataProxy = new _1.WorkflowDataProxy(this.workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, -1, selfData); | ||
const data = dataProxy.getDataProxy(); | ||
@@ -55,3 +55,3 @@ try { | ||
} | ||
getComplexParameterValue(node, parameterValue, defaultValue = undefined) { | ||
getComplexParameterValue(node, parameterValue, defaultValue = undefined, selfData = {}) { | ||
if (parameterValue === undefined) { | ||
@@ -68,6 +68,6 @@ return defaultValue; | ||
}; | ||
const returnData = this.getParameterValue(parameterValue, runData, runIndex, itemIndex, node.name, connectionInputData); | ||
return this.getParameterValue(returnData, runData, runIndex, itemIndex, node.name, connectionInputData); | ||
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); | ||
} | ||
getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString = false) { | ||
getParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString = false, selfData = {}) { | ||
const isComplexParameter = (value) => { | ||
@@ -78,10 +78,10 @@ return typeof value === 'object'; | ||
if (isComplexParameter(value)) { | ||
return this.getParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString); | ||
return this.getParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString, selfData); | ||
} | ||
else { | ||
return this.resolveSimpleParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString); | ||
return this.resolveSimpleParameterValue(value, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString, selfData); | ||
} | ||
}; | ||
if (!isComplexParameter(parameterValue)) { | ||
return this.resolveSimpleParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString); | ||
return this.resolveSimpleParameterValue(parameterValue, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, returnObjectAsString, selfData); | ||
} | ||
@@ -88,0 +88,0 @@ if (Array.isArray(parameterValue)) { |
@@ -10,4 +10,6 @@ import { INodeExecutionData, IRunExecutionData, IWorkflowDataProxyData, Workflow } from './'; | ||
private connectionInputData; | ||
constructor(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], defaultReturnRunIndex?: number); | ||
private selfData; | ||
constructor(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, itemIndex: number, activeNodeName: string, connectionInputData: INodeExecutionData[], defaultReturnRunIndex?: number, selfData?: {}); | ||
private nodeContextGetter; | ||
private selfGetter; | ||
private nodeParameterGetter; | ||
@@ -14,0 +16,0 @@ private getNodeExecutionData; |
@@ -6,3 +6,3 @@ "use strict"; | ||
class WorkflowDataProxy { | ||
constructor(workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, defaultReturnRunIndex = -1) { | ||
constructor(workflow, runExecutionData, runIndex, itemIndex, activeNodeName, connectionInputData, defaultReturnRunIndex = -1, selfData = {}) { | ||
this.workflow = workflow; | ||
@@ -15,2 +15,3 @@ this.runExecutionData = runExecutionData; | ||
this.connectionInputData = connectionInputData; | ||
this.selfData = selfData; | ||
} | ||
@@ -37,2 +38,14 @@ nodeContextGetter(nodeName) { | ||
} | ||
selfGetter() { | ||
const that = this; | ||
return new Proxy({}, { | ||
ownKeys(target) { | ||
return Reflect.ownKeys(target); | ||
}, | ||
get(target, name, receiver) { | ||
name = name.toString(); | ||
return that.selfData[name]; | ||
}, | ||
}); | ||
} | ||
nodeParameterGetter(nodeName) { | ||
@@ -208,2 +221,3 @@ const that = this; | ||
$node: this.nodeGetter(), | ||
$self: this.selfGetter(), | ||
$parameter: this.nodeParameterGetter(this.activeNodeName), | ||
@@ -210,0 +224,0 @@ $runIndex: this.runIndex, |
{ | ||
"name": "n8n-workflow", | ||
"version": "0.49.0", | ||
"version": "0.50.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
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
423499
6728