mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Remove executeSingle from Edit Image node
This commit is contained in:
parent
4bf7ea3e26
commit
256711737c
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
BINARY_ENCODING,
|
||||
IExecuteSingleFunctions,
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
|
@ -948,14 +948,21 @@ export class EditImage implements INodeType {
|
|||
},
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> {
|
||||
const item = this.getInputData();
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length as unknown as number;
|
||||
let item: INodeExecutionData;
|
||||
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
const dataPropertyName = this.getNodeParameter('dataPropertyName') as string;
|
||||
for (let itemIndex = 0; itemIndex < length; itemIndex++) {
|
||||
item = items[itemIndex];
|
||||
|
||||
const options = this.getNodeParameter('options', {}) as IDataObject;
|
||||
|
||||
const operation = this.getNodeParameter('operation', itemIndex) as string;
|
||||
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex) as string;
|
||||
|
||||
const options = this.getNodeParameter('options', itemIndex,{}) as IDataObject;
|
||||
|
||||
const cleanupFunctions: Array<() => void> = [];
|
||||
|
||||
|
@ -1026,14 +1033,14 @@ export class EditImage implements INodeType {
|
|||
let operations: IDataObject[] = [];
|
||||
if (operation === 'multiStep') {
|
||||
// Operation parameters are already in the correct format
|
||||
const operationsData = this.getNodeParameter('operations', { operations: [] }) as IDataObject;
|
||||
const operationsData = this.getNodeParameter('operations', itemIndex ,{ operations: [] }) as IDataObject;
|
||||
operations = operationsData.operations as IDataObject[];
|
||||
} else {
|
||||
// Operation parameters have to first get collected
|
||||
const operationParameters: IDataObject = {};
|
||||
requiredOperationParameters[operation].forEach(parameterName => {
|
||||
try {
|
||||
operationParameters[parameterName] = this.getNodeParameter(parameterName);
|
||||
operationParameters[parameterName] = this.getNodeParameter(parameterName, itemIndex);
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
|
@ -1062,7 +1069,7 @@ export class EditImage implements INodeType {
|
|||
if (operation === 'information') {
|
||||
// Just return the information
|
||||
const imageData = await new Promise<IDataObject>((resolve, reject) => {
|
||||
gmInstance = gmInstance.identify((error, imageData) => {
|
||||
gmInstance = gmInstance.identify((error:any, imageData:any) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
|
@ -1072,7 +1079,7 @@ export class EditImage implements INodeType {
|
|||
});
|
||||
|
||||
item.json = imageData;
|
||||
return item;
|
||||
returnData.push(item);
|
||||
}
|
||||
|
||||
for (let i = 0; i < operations.length; i++) {
|
||||
|
@ -1220,7 +1227,7 @@ export class EditImage implements INodeType {
|
|||
newItem.binary![dataPropertyName as string].fileName = options.fileName as string;
|
||||
}
|
||||
|
||||
return new Promise<INodeExecutionData>((resolve, reject) => {
|
||||
returnData.push(await (new Promise<INodeExecutionData>((resolve, reject) => {
|
||||
gmInstance
|
||||
.toBuffer((error: Error | null, buffer: Buffer) => {
|
||||
cleanupFunctions.forEach(async cleanup => await cleanup());
|
||||
|
@ -1233,6 +1240,9 @@ export class EditImage implements INodeType {
|
|||
|
||||
return resolve(newItem);
|
||||
});
|
||||
});
|
||||
})));
|
||||
|
||||
}
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue