fix: Add paired item to the most used nodes (#5220)
* PairedItem for N8n training * Add paired item to ftp node * Add paired item to rocketChat * Add pairedItem to pushOver * Add paired item to Matrix * Add pairedItem to theHive * Add paired item to Snowflake * Add paired item to PhilipsHue * Add pairedItem to supabase * Add paired item to Odoo * fix odoo & add paired item to grist * add pairedItem to Linkedin * add pairedItem Zulip * add pairedItem PhatomBuster * add pairedItem to TodoistV2 * Add pairedItem HomeAssistant * Add pairedItem to DropContact * Add pairedItem to Aws SES * Add pairedItem to microsoftOutlook * Add pairedItem to AwsS3 * Add pairedItem to Aws DynamoDB * 🐛 fix Dropcontact enrich operation paired item support * 🐛 fix Dropcontact insert/update operation paired items * 🐛 fix Supabase paired item support * 🐛 fix Supabase paired item support * 🐛 fix N8nTrainingCustomerDatastore paired item support * 🎨 remove unused imports * 🐛 fix MicrosoftOutlook paired item support * 🐛 fix AwsS3 paired item support --------- Co-authored-by: Marcus <marcus@n8n.io>
This commit is contained in:
@@ -8,7 +8,7 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import { dropcontactApiRequest } from './GenericFunction';
|
||||
import { dropcontactApiRequest, mapPairedItemsFrom } from './GenericFunction';
|
||||
|
||||
export class Dropcontact implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -246,7 +246,7 @@ export class Dropcontact implements INodeType {
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
let responseData: any;
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
if (resource === 'contact') {
|
||||
if (operation === 'enrich') {
|
||||
@@ -278,7 +278,13 @@ export class Dropcontact implements INodeType {
|
||||
|
||||
if (!responseData.success) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: responseData.reason || 'invalid request' });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: responseData.reason || 'invalid request' }),
|
||||
{
|
||||
itemData: mapPairedItemsFrom(entryData),
|
||||
},
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeApiError(this.getNode(), {
|
||||
error: responseData.reason || 'invalid request',
|
||||
@@ -300,7 +306,13 @@ export class Dropcontact implements INodeType {
|
||||
);
|
||||
if (!responseData.success) {
|
||||
if (this.continueOnFail()) {
|
||||
responseData.push({ error: responseData.reason });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: responseData.reason }),
|
||||
{
|
||||
itemData: mapPairedItemsFrom(entryData),
|
||||
},
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeApiError(this.getNode(), {
|
||||
error: responseData.reason,
|
||||
@@ -308,10 +320,22 @@ export class Dropcontact implements INodeType {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
returnData.push(...responseData.data);
|
||||
responseData.data.forEach((d: IDataObject, index: number) => {
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(d),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{
|
||||
itemData: mapPairedItemsFrom(entryData),
|
||||
},
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,18 +351,26 @@ export class Dropcontact implements INodeType {
|
||||
)) as { request_id: string; error: string; success: boolean };
|
||||
if (!responseData.success) {
|
||||
if (this.continueOnFail()) {
|
||||
responseData.push({ error: responseData.reason || 'invalid request' });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: responseData.reason || 'invalid request' }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeApiError(this.getNode(), {
|
||||
error: responseData.reason || 'invalid request',
|
||||
});
|
||||
}
|
||||
}
|
||||
returnData.push(...responseData.data);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.data),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user