Make special variables like $node, $parameter, ... accessible

in Function Nodes
This commit is contained in:
Jan Oberhauser
2019-09-04 14:53:39 +02:00
parent c1e753e9d1
commit 48ccb36536
5 changed files with 37 additions and 6 deletions

View File

@@ -48,8 +48,14 @@ export class Function implements INodeType {
getNodeParameter: this.getNodeParameter,
helpers: this.helpers,
items,
// To be able to access data of other items
$item: (index: number) => this.getWorkflowDataProxy(index),
};
// Make it possible to access data via $node, $parameter, ...
// By default use data from first item
Object.assign(sandbox, sandbox.$item(0));
const vm = new NodeVM({
console: 'inherit',
sandbox,