mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
Feature/paired item support (#3869)
* Add paired item helper and implement it in some nodes
This commit is contained in:
@@ -447,7 +447,7 @@ export class Chargebee implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
let item: INodeExecutionData;
|
||||
|
||||
const credentials = await this.getCredentials('chargebeeApi');
|
||||
@@ -603,26 +603,38 @@ export class Chargebee implements INodeType {
|
||||
|
||||
if (resource === 'invoice' && operation === 'list') {
|
||||
responseData.list.forEach((data: IDataObject) => {
|
||||
returnData.push(data.invoice as IDataObject);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ ...(data.invoice as IDataObject) }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...responseData);
|
||||
});
|
||||
} else if (resource === 'invoice' && operation === 'pdfUrl') {
|
||||
const data: IDataObject = {};
|
||||
Object.assign(data, items[i].json);
|
||||
|
||||
data.pdfUrl = responseData.download.download_url;
|
||||
returnData.push(data);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ ...data }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...responseData);
|
||||
} else {
|
||||
returnData.push(responseData);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...responseData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {}, itemIndex: i });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user