1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-10 12:35:46 +03:00

fix: remove duplicate wrap of paired item data (#4001)

* fix: remove duplicate wrap of paired item data and adding where missing for other nodes
This commit is contained in:
Omar Ajoue 2022-09-01 17:48:22 +02:00 committed by GitHub
parent c8743ff6ca
commit 54efe20ee4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 17 additions and 148 deletions

View File

@ -1367,10 +1367,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'GET', endpoint, {}, qs);
responseData = responseData.contacts;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developers.hubspot.com/docs/methods/contacts/get_recently_created_contacts
if (operation === 'getRecentlyCreatedUpdated') {
@ -1406,10 +1402,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'GET', endpoint, {}, qs);
responseData = responseData.contacts;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developers.hubspot.com/docs/methods/contacts/delete_contact
if (operation === 'delete') {
@ -1470,10 +1462,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'POST', endpoint, body, qs);
responseData = responseData.results;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
}
//https://developers.hubspot.com/docs/methods/companies/companies-overview
@ -1968,10 +1956,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'GET', endpoint, {}, qs);
responseData = responseData.companies;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developers.hubspot.com/docs/methods/companies/get_companies_modified
if (operation === 'getRecentlyCreated' || operation === 'getRecentlyModified') {
@ -2000,10 +1984,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'GET', endpoint, {}, qs);
responseData = responseData.results;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developers.hubspot.com/docs/methods/companies/search_companies_by_domain
if (operation === 'searchByDomain') {
@ -2030,10 +2010,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'POST', endpoint, body);
responseData = responseData.results;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developers.hubspot.com/docs/methods/companies/delete_company
if (operation === 'delete') {
@ -2218,10 +2194,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'GET', endpoint, {}, qs);
responseData = responseData.deals;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
if (operation === 'getRecentlyCreated' || operation === 'getRecentlyModified') {
let endpoint;
@ -2252,10 +2224,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'GET', endpoint, {}, qs);
responseData = responseData.results;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
if (operation === 'delete') {
const dealId = this.getNodeParameter('dealId', i) as string;
@ -2315,10 +2283,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'POST', endpoint, body, qs);
responseData = responseData.results;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
}
if (resource === 'engagement') {
@ -2405,10 +2369,6 @@ export class Hubspot implements INodeType {
responseData = await hubspotApiRequest.call(this, 'GET', endpoint, {}, qs);
responseData = responseData.results;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
}
//https://developers.hubspot.com/docs/methods/forms/forms_overview

View File

@ -492,10 +492,12 @@ export class NotionV2 implements INodeType {
if (simple === true) {
responseData = simplifyObjects(responseData, download);
}
returnData.push.apply(
returnData,
Array.isArray(responseData) ? responseData : [responseData],
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
returnData.push(...executionData);
}
}
@ -567,7 +569,12 @@ export class NotionV2 implements INodeType {
if (simple === true) {
responseData = simplifyObjects(responseData, download);
}
returnData.push.apply(returnData, responseData);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
returnData.push(...executionData);
}
}
@ -591,10 +598,12 @@ export class NotionV2 implements INodeType {
if (simple === true) {
responseData = simplifyObjects(responseData, false);
}
returnData.push.apply(
returnData,
Array.isArray(responseData) ? responseData : [responseData],
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
returnData.push(...executionData);
}
}
}

View File

@ -186,7 +186,7 @@ export async function pgQueryV2(
const mode = overrideMode ? overrideMode : ((additionalFields.mode ?? 'multiple') as string);
if (mode === 'multiple') {
(await db.multi(pgp.helpers.concat(allQueries)))
return (await db.multi(pgp.helpers.concat(allQueries)))
.map((result, i) => {
return this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([...result]), {
itemData: { item: i },

View File

@ -239,10 +239,6 @@ export class Webflow implements INodeType {
);
responseData = responseData.items;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------
// item: update

View File

@ -208,10 +208,6 @@ export class WooCommerce implements INodeType {
qs.per_page = this.getNodeParameter('limit', i) as number;
responseData = await woocommerceApiRequest.call(this, 'GET', '/customers', {}, qs);
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// customer: update
@ -373,10 +369,6 @@ export class WooCommerce implements INodeType {
qs.per_page = this.getNodeParameter('limit', i) as number;
responseData = await woocommerceApiRequest.call(this, 'GET', '/products', {}, qs);
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-product
if (operation === 'delete') {
@ -576,10 +568,6 @@ export class WooCommerce implements INodeType {
qs.per_page = this.getNodeParameter('limit', i) as number;
responseData = await woocommerceApiRequest.call(this, 'GET', '/orders', {}, qs);
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-an-order
if (operation === 'delete') {

View File

@ -288,10 +288,6 @@ export class Wordpress implements INodeType {
qs.per_page = this.getNodeParameter('limit', i) as number;
responseData = await wordpressApiRequest.call(this, 'GET', '/posts', {}, qs);
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developer.wordpress.org/rest-api/reference/posts/#delete-a-post
if (operation === 'delete') {
@ -414,10 +410,6 @@ export class Wordpress implements INodeType {
qs.per_page = this.getNodeParameter('limit', i) as number;
responseData = await wordpressApiRequest.call(this, 'GET', '/users', {}, qs);
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developer.wordpress.org/rest-api/reference/users/#delete-a-user
if (operation === 'delete') {

View File

@ -456,10 +456,6 @@ export class Xero implements INodeType {
responseData = responseData.Invoices;
responseData = responseData.splice(0, limit);
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
}
if (resource === 'contact') {
@ -613,10 +609,6 @@ export class Xero implements INodeType {
responseData = responseData.Contacts;
responseData = responseData.splice(0, limit);
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
if (operation === 'update') {
const organizationId = this.getNodeParameter('organizationId', i) as string;

View File

@ -651,10 +651,6 @@ export class Zammad implements INodeType {
{},
limit,
);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
} else if (resource === 'ticket') {
// **********************************************************************

View File

@ -455,10 +455,6 @@ export class Zendesk implements INodeType {
responseData = await zendeskApiRequest.call(this, 'GET', endpoint, {}, qs);
responseData = responseData.results || responseData.suspended_tickets;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developer.zendesk.com/rest_api/docs/support/tickets#delete-ticket
//https://developer.zendesk.com/api-reference/ticketing/tickets/suspended_tickets/#delete-suspended-ticket
@ -524,10 +520,6 @@ export class Zendesk implements INodeType {
);
responseData = responseData.slice(0, limit);
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
}
//https://developer.zendesk.com/api-reference/ticketing/users/users/
@ -613,10 +605,6 @@ export class Zendesk implements INodeType {
responseData = await zendeskApiRequest.call(this, 'GET', `/users`, {}, qs);
responseData = responseData.users;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#list-organizations
if (operation === 'getOrganizations') {
@ -651,10 +639,6 @@ export class Zendesk implements INodeType {
responseData = await zendeskApiRequest.call(this, 'GET', `/users/search`, {}, qs);
responseData = responseData.users;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developer.zendesk.com/api-reference/ticketing/users/users/#delete-user
if (operation === 'delete') {
@ -754,10 +738,6 @@ export class Zendesk implements INodeType {
responseData = await zendeskApiRequest.call(this, 'GET', `/organizations`, {}, qs);
responseData = responseData.organizations;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
//https://developer.zendesk.com/api-reference/ticketing/organizations/organizations/#show-organizations-related-information
if (operation === 'getRelatedData') {

View File

@ -404,10 +404,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/accounts', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// account: update
@ -501,10 +497,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/contacts', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// contact: update
@ -597,10 +589,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/deals', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// deal: update
@ -699,10 +687,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/invoices', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// invoice: update
@ -798,10 +782,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/leads', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'getFields') {
// ----------------------------------------
// lead: getFields
@ -908,10 +888,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/products', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// product: update
@ -1011,10 +987,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/purchase_orders', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// purchaseOrder: update
@ -1115,10 +1087,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/quotes', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// quote: update
@ -1218,10 +1186,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/sales_orders', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// salesOrder: update
@ -1319,10 +1283,6 @@ export class ZohoCrm implements INodeType {
addGetAllFilterOptions(qs, options);
responseData = await handleListing.call(this, 'GET', '/vendors', {}, qs);
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
} else if (operation === 'update') {
// ----------------------------------------
// vendor: update

View File

@ -202,10 +202,6 @@ export class Zoom implements INodeType {
responseData = await zoomApiRequest.call(this, 'GET', '/users/me/meetings', {}, qs);
responseData = responseData.meetings;
}
responseData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
{ itemData: { item: i } },
);
}
if (operation === 'delete') {
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingdelete