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:
@@ -312,7 +312,7 @@ export class Magento2 implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const timezone = this.getTimezone();
|
||||
let responseData;
|
||||
@@ -378,7 +378,7 @@ export class Magento2 implements INodeType {
|
||||
body.password = password;
|
||||
}
|
||||
|
||||
Object.assign(body.customer, rest);
|
||||
Object.assign(body.customer!, rest);
|
||||
|
||||
responseData = await magentoApiRequest.call(this, 'POST', '/rest/V1/customers', body);
|
||||
}
|
||||
@@ -524,7 +524,7 @@ export class Magento2 implements INodeType {
|
||||
body.password = password;
|
||||
}
|
||||
|
||||
Object.assign(body.customer, rest);
|
||||
Object.assign(body.customer!, rest);
|
||||
|
||||
responseData = await magentoApiRequest.call(
|
||||
this,
|
||||
@@ -675,7 +675,7 @@ export class Magento2 implements INodeType {
|
||||
|
||||
body.product!.custom_attributes = customAttributes?.customAttribute || {};
|
||||
|
||||
Object.assign(body.product, rest);
|
||||
Object.assign(body.product!, rest);
|
||||
|
||||
responseData = await magentoApiRequest.call(
|
||||
this,
|
||||
@@ -790,7 +790,7 @@ export class Magento2 implements INodeType {
|
||||
|
||||
body.product!.custom_attributes = customAttributes?.customAttribute || {};
|
||||
|
||||
Object.assign(body.product, rest);
|
||||
Object.assign(body.product!, rest);
|
||||
|
||||
responseData = await magentoApiRequest.call(
|
||||
this,
|
||||
@@ -801,18 +801,25 @@ export class Magento2 implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user