mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
Remove executeSingle from FunctionItem node
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { IExecuteSingleFunctions } from 'n8n-core';
|
import { IExecuteFunctions } from 'n8n-core';
|
||||||
import {
|
import {
|
||||||
IBinaryKeyData,
|
IBinaryKeyData,
|
||||||
IDataObject,
|
IDataObject,
|
||||||
@@ -40,8 +40,16 @@ export class FunctionItem implements INodeType {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
let item = this.getInputData();
|
const items = this.getInputData();
|
||||||
|
|
||||||
|
const returnData: INodeExecutionData[] = [];
|
||||||
|
const length = items.length as unknown as number;
|
||||||
|
let item: INodeExecutionData;
|
||||||
|
|
||||||
|
for (let itemIndex = 0; itemIndex < length; itemIndex++) {
|
||||||
|
|
||||||
|
item = items[itemIndex];
|
||||||
|
|
||||||
// Copy the items as they may get changed in the functions
|
// Copy the items as they may get changed in the functions
|
||||||
item = JSON.parse(JSON.stringify(item));
|
item = JSON.parse(JSON.stringify(item));
|
||||||
@@ -61,7 +69,7 @@ export class FunctionItem implements INodeType {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Make it possible to access data via $node, $parameter, ...
|
// Make it possible to access data via $node, $parameter, ...
|
||||||
const dataProxy = this.getWorkflowDataProxy();
|
const dataProxy = this.getWorkflowDataProxy(itemIndex);
|
||||||
Object.assign(sandbox, dataProxy);
|
Object.assign(sandbox, dataProxy);
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
@@ -84,7 +92,7 @@ export class FunctionItem implements INodeType {
|
|||||||
const vm = new NodeVM(options);
|
const vm = new NodeVM(options);
|
||||||
|
|
||||||
// Get the code to execute
|
// Get the code to execute
|
||||||
const functionCode = this.getNodeParameter('functionCode') as string;
|
const functionCode = this.getNodeParameter('functionCode', itemIndex) as string;
|
||||||
|
|
||||||
|
|
||||||
let jsonData: IDataObject;
|
let jsonData: IDataObject;
|
||||||
@@ -108,6 +116,8 @@ export class FunctionItem implements INodeType {
|
|||||||
returnItem.binary = item.binary;
|
returnItem.binary = item.binary;
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnItem;
|
returnData.push(returnItem);
|
||||||
|
}
|
||||||
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user