mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
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:
parent
d87ff130a4
commit
409a9ea357
|
@ -91,7 +91,7 @@ export class AwsDynamoDB implements INodeType {
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
|
||||||
let responseData;
|
let responseData;
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
try {
|
try {
|
||||||
|
@ -391,14 +391,19 @@ export class AwsDynamoDB implements INodeType {
|
||||||
responseData = responseData.map(simplify);
|
responseData = responseData.map(simplify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
Array.isArray(responseData)
|
this.helpers.returnJsonArray(responseData),
|
||||||
? returnData.push(...responseData)
|
{ itemData: { item: i } },
|
||||||
: returnData.push(responseData);
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,6 +411,6 @@ export class AwsDynamoDB implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import type {
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
JsonObject,
|
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
|
@ -84,7 +83,7 @@ export class AwsS3 implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const qs: IDataObject = {};
|
const qs: IDataObject = {};
|
||||||
let responseData;
|
let responseData;
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
|
@ -150,8 +149,11 @@ export class AwsS3 implements INodeType {
|
||||||
qs,
|
qs,
|
||||||
headers,
|
headers,
|
||||||
);
|
);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push({ success: true });
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html
|
// https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html
|
||||||
|
@ -167,7 +169,11 @@ export class AwsS3 implements INodeType {
|
||||||
{},
|
{},
|
||||||
headers,
|
headers,
|
||||||
);
|
);
|
||||||
returnData.push({ success: true });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html
|
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBuckets.html
|
||||||
|
@ -194,7 +200,11 @@ export class AwsS3 implements INodeType {
|
||||||
);
|
);
|
||||||
responseData = responseData.slice(0, qs.limit);
|
responseData = responseData.slice(0, qs.limit);
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
|
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
|
||||||
|
@ -263,11 +273,11 @@ export class AwsS3 implements INodeType {
|
||||||
);
|
);
|
||||||
responseData = responseData.ListBucketResult.Contents;
|
responseData = responseData.ListBucketResult.Contents;
|
||||||
}
|
}
|
||||||
if (Array.isArray(responseData)) {
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push.apply(returnData, responseData);
|
this.helpers.returnJsonArray(responseData),
|
||||||
} else {
|
{ itemData: { item: i } },
|
||||||
returnData.push(responseData);
|
);
|
||||||
}
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resource === 'folder') {
|
if (resource === 'folder') {
|
||||||
|
@ -306,7 +316,11 @@ export class AwsS3 implements INodeType {
|
||||||
{},
|
{},
|
||||||
region,
|
region,
|
||||||
);
|
);
|
||||||
returnData.push({ success: true });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html
|
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html
|
||||||
if (operation === 'delete') {
|
if (operation === 'delete') {
|
||||||
|
@ -386,7 +400,11 @@ export class AwsS3 implements INodeType {
|
||||||
|
|
||||||
responseData = { deleted: responseData.DeleteResult.Deleted };
|
responseData = { deleted: responseData.DeleteResult.Deleted };
|
||||||
}
|
}
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
|
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
|
@ -446,7 +464,11 @@ export class AwsS3 implements INodeType {
|
||||||
if (qs.limit) {
|
if (qs.limit) {
|
||||||
responseData = responseData.splice(0, qs.limit as number);
|
responseData = responseData.splice(0, qs.limit as number);
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -554,7 +576,11 @@ export class AwsS3 implements INodeType {
|
||||||
{},
|
{},
|
||||||
region,
|
region,
|
||||||
);
|
);
|
||||||
returnData.push(responseData.CopyObjectResult);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData.CopyObjectResult),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
|
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
|
||||||
if (operation === 'download') {
|
if (operation === 'download') {
|
||||||
|
@ -647,8 +673,11 @@ export class AwsS3 implements INodeType {
|
||||||
{},
|
{},
|
||||||
region,
|
region,
|
||||||
);
|
);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push({ success: true });
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
|
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
|
||||||
if (operation === 'getAll') {
|
if (operation === 'getAll') {
|
||||||
|
@ -710,7 +739,11 @@ export class AwsS3 implements INodeType {
|
||||||
if (qs.limit) {
|
if (qs.limit) {
|
||||||
responseData = responseData.splice(0, qs.limit as number);
|
responseData = responseData.splice(0, qs.limit as number);
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html
|
//https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html
|
||||||
|
@ -863,12 +896,20 @@ export class AwsS3 implements INodeType {
|
||||||
region,
|
region,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
returnData.push({ success: true });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: (error as JsonObject).message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -878,7 +919,7 @@ export class AwsS3 implements INodeType {
|
||||||
// For file downloads the files get attached to the existing items
|
// For file downloads the files get attached to the existing items
|
||||||
return this.prepareOutputData(items);
|
return this.prepareOutputData(items);
|
||||||
} else {
|
} else {
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -817,7 +817,7 @@ export class AwsSes implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
let responseData;
|
let responseData;
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
@ -1281,23 +1281,24 @@ export class AwsSes implements INodeType {
|
||||||
responseData = responseData.UpdateTemplateResponse;
|
responseData = responseData.UpdateTemplateResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
if (Array.isArray(responseData)) {
|
this.helpers.returnJsonArray(responseData),
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
{ itemData: { item: i } },
|
||||||
} else {
|
);
|
||||||
if (responseData !== undefined) {
|
returnData.push(...executionData);
|
||||||
returnData.push(responseData as IDataObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeApiError } from 'n8n-workflow';
|
import { NodeApiError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { dropcontactApiRequest } from './GenericFunction';
|
import { dropcontactApiRequest, mapPairedItemsFrom } from './GenericFunction';
|
||||||
|
|
||||||
export class Dropcontact implements INodeType {
|
export class Dropcontact implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
@ -246,7 +246,7 @@ export class Dropcontact implements INodeType {
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
|
||||||
let responseData: any;
|
let responseData: any;
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
|
|
||||||
if (resource === 'contact') {
|
if (resource === 'contact') {
|
||||||
if (operation === 'enrich') {
|
if (operation === 'enrich') {
|
||||||
|
@ -278,7 +278,13 @@ export class Dropcontact implements INodeType {
|
||||||
|
|
||||||
if (!responseData.success) {
|
if (!responseData.success) {
|
||||||
if (this.continueOnFail()) {
|
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 {
|
} else {
|
||||||
throw new NodeApiError(this.getNode(), {
|
throw new NodeApiError(this.getNode(), {
|
||||||
error: responseData.reason || 'invalid request',
|
error: responseData.reason || 'invalid request',
|
||||||
|
@ -300,7 +306,13 @@ export class Dropcontact implements INodeType {
|
||||||
);
|
);
|
||||||
if (!responseData.success) {
|
if (!responseData.success) {
|
||||||
if (this.continueOnFail()) {
|
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 {
|
} else {
|
||||||
throw new NodeApiError(this.getNode(), {
|
throw new NodeApiError(this.getNode(), {
|
||||||
error: responseData.reason,
|
error: responseData.reason,
|
||||||
|
@ -308,10 +320,22 @@ export class Dropcontact implements INodeType {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} 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 {
|
} 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 };
|
)) as { request_id: string; error: string; success: boolean };
|
||||||
if (!responseData.success) {
|
if (!responseData.success) {
|
||||||
if (this.continueOnFail()) {
|
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 {
|
} else {
|
||||||
throw new NodeApiError(this.getNode(), {
|
throw new NodeApiError(this.getNode(), {
|
||||||
error: responseData.reason || 'invalid request',
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { IExecuteFunctions, IHookFunctions } from 'n8n-core';
|
import type { IExecuteFunctions, IHookFunctions } from 'n8n-core';
|
||||||
|
|
||||||
import type { IDataObject, ILoadOptionsFunctions } from 'n8n-workflow';
|
import type { IDataObject, ILoadOptionsFunctions, IPairedItemData } from 'n8n-workflow';
|
||||||
|
|
||||||
import type { OptionsWithUri } from 'request';
|
import type { OptionsWithUri } from 'request';
|
||||||
|
|
||||||
|
@ -32,3 +32,11 @@ export async function dropcontactApiRequest(
|
||||||
|
|
||||||
return this.helpers.requestWithAuthentication.call(this, 'dropcontactApi', options);
|
return this.helpers.requestWithAuthentication.call(this, 'dropcontactApi', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function mapPairedItemsFrom<T>(iterable: Iterable<T> | ArrayLike<T>): IPairedItemData[] {
|
||||||
|
return Array.from(iterable, (_, i) => i).map((index) => {
|
||||||
|
return {
|
||||||
|
item: index,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -543,17 +543,19 @@ export class Ftp implements INodeType {
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
responseData = await callRecursiveList(path, sftp!, normalizeSFtpItem);
|
responseData = await callRecursiveList(path, sftp!, normalizeSFtpItem);
|
||||||
returnItems.push.apply(
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnItems,
|
|
||||||
this.helpers.returnJsonArray(responseData as unknown as IDataObject[]),
|
this.helpers.returnJsonArray(responseData as unknown as IDataObject[]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
);
|
);
|
||||||
|
returnItems.push.apply(returnItems, executionData);
|
||||||
} else {
|
} else {
|
||||||
responseData = await sftp!.list(path);
|
responseData = await sftp!.list(path);
|
||||||
responseData.forEach((item) => normalizeSFtpItem(item, path));
|
responseData.forEach((item) => normalizeSFtpItem(item, path));
|
||||||
returnItems.push.apply(
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnItems,
|
|
||||||
this.helpers.returnJsonArray(responseData as unknown as IDataObject[]),
|
this.helpers.returnJsonArray(responseData as unknown as IDataObject[]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
);
|
);
|
||||||
|
returnItems.push.apply(returnItems, executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,8 +568,11 @@ export class Ftp implements INodeType {
|
||||||
} else {
|
} else {
|
||||||
responseData = await sftp!.delete(path);
|
responseData = await sftp!.delete(path);
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnItems.push({ json: { success: true } });
|
[{ json: { success: true } }],
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnItems.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'rename') {
|
if (operation === 'rename') {
|
||||||
|
@ -582,8 +587,11 @@ export class Ftp implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData = await sftp!.rename(oldPath, newPath);
|
responseData = await sftp!.rename(oldPath, newPath);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnItems.push({ json: { success: true } });
|
[{ json: { success: true } }],
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnItems.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'download') {
|
if (operation === 'download') {
|
||||||
|
@ -600,7 +608,11 @@ export class Ftp implements INodeType {
|
||||||
filePathDownload,
|
filePathDownload,
|
||||||
);
|
);
|
||||||
|
|
||||||
returnItems.push(items[i]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(items[i]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnItems.push(...executionData);
|
||||||
} finally {
|
} finally {
|
||||||
await binaryFile.cleanup();
|
await binaryFile.cleanup();
|
||||||
}
|
}
|
||||||
|
@ -643,7 +655,11 @@ export class Ftp implements INodeType {
|
||||||
await sftp!.put(buffer, remotePath);
|
await sftp!.put(buffer, remotePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
returnItems.push(items[i]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(items[i]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnItems.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,19 +671,21 @@ export class Ftp implements INodeType {
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
responseData = await callRecursiveList(path, ftp!, normalizeFtpItem);
|
responseData = await callRecursiveList(path, ftp!, normalizeFtpItem);
|
||||||
returnItems.push.apply(
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnItems,
|
|
||||||
this.helpers.returnJsonArray(responseData as unknown as IDataObject[]),
|
this.helpers.returnJsonArray(responseData as unknown as IDataObject[]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
);
|
);
|
||||||
|
returnItems.push.apply(returnItems, executionData);
|
||||||
} else {
|
} else {
|
||||||
responseData = await ftp!.list(path);
|
responseData = await ftp!.list(path);
|
||||||
responseData.forEach((item) =>
|
responseData.forEach((item) =>
|
||||||
normalizeFtpItem(item as ftpClient.ListingElement, path),
|
normalizeFtpItem(item as ftpClient.ListingElement, path),
|
||||||
);
|
);
|
||||||
returnItems.push.apply(
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnItems,
|
|
||||||
this.helpers.returnJsonArray(responseData as unknown as IDataObject[]),
|
this.helpers.returnJsonArray(responseData as unknown as IDataObject[]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
);
|
);
|
||||||
|
returnItems.push.apply(returnItems, executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,8 +698,11 @@ export class Ftp implements INodeType {
|
||||||
} else {
|
} else {
|
||||||
responseData = await ftp!.delete(path);
|
responseData = await ftp!.delete(path);
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnItems.push({ json: { success: true } });
|
[{ json: { success: true } }],
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnItems.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'download') {
|
if (operation === 'download') {
|
||||||
|
@ -699,7 +720,11 @@ export class Ftp implements INodeType {
|
||||||
filePathDownload,
|
filePathDownload,
|
||||||
);
|
);
|
||||||
|
|
||||||
returnItems.push(items[i]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(items[i]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnItems.push(...executionData);
|
||||||
} finally {
|
} finally {
|
||||||
await binaryFile.cleanup();
|
await binaryFile.cleanup();
|
||||||
}
|
}
|
||||||
|
@ -711,8 +736,11 @@ export class Ftp implements INodeType {
|
||||||
const newPath = this.getNodeParameter('newPath', i) as string;
|
const newPath = this.getNodeParameter('newPath', i) as string;
|
||||||
|
|
||||||
responseData = await ftp!.rename(oldPath, newPath);
|
responseData = await ftp!.rename(oldPath, newPath);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnItems.push({ json: { success: true } });
|
[{ json: { success: true } }],
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnItems.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'upload') {
|
if (operation === 'upload') {
|
||||||
|
@ -773,7 +801,11 @@ export class Ftp implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
returnItems.push(items[i]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(items[i]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnItems.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ export class Grist implements INodeType {
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
let responseData;
|
let responseData;
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
|
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
|
||||||
|
@ -247,17 +247,23 @@ export class Grist implements INodeType {
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
Array.isArray(responseData)
|
this.helpers.returnJsonArray(responseData),
|
||||||
? returnData.push(...responseData)
|
{ itemData: { item: i } },
|
||||||
: returnData.push(responseData);
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ export class HomeAssistant implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
@ -442,22 +442,27 @@ export class HomeAssistant implements INodeType {
|
||||||
if (resource === 'cameraProxy' && operation === 'get') {
|
if (resource === 'cameraProxy' && operation === 'get') {
|
||||||
items[i].json = { error: error.message };
|
items[i].json = { error: error.message };
|
||||||
} else {
|
} else {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
Array.isArray(responseData)
|
this.helpers.returnJsonArray(responseData),
|
||||||
? returnData.push(...responseData)
|
{ itemData: { item: i } },
|
||||||
: returnData.push(responseData);
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resource === 'cameraProxy' && operation === 'getScreenshot') {
|
if (resource === 'cameraProxy' && operation === 'getScreenshot') {
|
||||||
return this.prepareOutputData(items);
|
return this.prepareOutputData(items);
|
||||||
} else {
|
} else {
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import type { IExecuteFunctions } from 'n8n-core';
|
import type { IExecuteFunctions } from 'n8n-core';
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
|
||||||
ILoadOptionsFunctions,
|
ILoadOptionsFunctions,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodePropertyOptions,
|
INodePropertyOptions,
|
||||||
|
@ -70,7 +69,7 @@ export class LinkedIn implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
let responseData;
|
let responseData;
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
@ -256,21 +255,24 @@ export class LinkedIn implements INodeType {
|
||||||
responseData = await linkedInApiRequest.call(this, 'POST', endpoint, body);
|
responseData = await linkedInApiRequest.call(this, 'POST', endpoint, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
if (Array.isArray(responseData)) {
|
this.helpers.returnJsonArray(responseData),
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
{ itemData: { item: i } },
|
||||||
} else {
|
);
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push(...executionData);
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,27 +138,30 @@ export class Matrix implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData() as IDataObject[];
|
const items = this.getInputData() as IDataObject[];
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
try {
|
try {
|
||||||
const responseData = await handleMatrixCall.call(this, items[i], i, resource, operation);
|
const responseData = await handleMatrixCall.call(this, items[i], i, resource, operation);
|
||||||
if (Array.isArray(responseData)) {
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
this.helpers.returnJsonArray(responseData),
|
||||||
} else {
|
{ itemData: { item: i } },
|
||||||
returnData.push(responseData as IDataObject);
|
);
|
||||||
}
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return this.prepareOutputData(returnData);
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
const qs: IDataObject = {};
|
const qs: IDataObject = {};
|
||||||
let responseData;
|
let responseData;
|
||||||
|
@ -145,11 +145,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
try {
|
try {
|
||||||
const messageId = this.getNodeParameter('messageId', i) as string;
|
const messageId = this.getNodeParameter('messageId', i) as string;
|
||||||
responseData = await microsoftApiRequest.call(this, 'DELETE', `/messages/${messageId}`);
|
responseData = await microsoftApiRequest.call(this, 'DELETE', `/messages/${messageId}`);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push({ success: true });
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -182,17 +189,29 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
if (additionalFields.dataPropertyAttachmentsPrefixName) {
|
if (additionalFields.dataPropertyAttachmentsPrefixName) {
|
||||||
const prefix = additionalFields.dataPropertyAttachmentsPrefixName as string;
|
const prefix = additionalFields.dataPropertyAttachmentsPrefixName as string;
|
||||||
const data = await downloadAttachments.call(this, responseData, prefix);
|
const data = await downloadAttachments.call(this, responseData, prefix);
|
||||||
returnData.push.apply(returnData, data as unknown as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(data),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} else {
|
} else {
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalFields.dataPropertyAttachmentsPrefixName) {
|
if (additionalFields.dataPropertyAttachmentsPrefixName) {
|
||||||
return [returnData as INodeExecutionData[]];
|
return [returnData];
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -217,10 +236,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
body,
|
body,
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -256,10 +283,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
|
|
||||||
responseData = await microsoftApiRequest.call(this, 'POST', '/messages', body, {});
|
responseData = await microsoftApiRequest.call(this, 'POST', '/messages', body, {});
|
||||||
|
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -289,11 +324,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
'POST',
|
'POST',
|
||||||
`/messages/${messageId}/send`,
|
`/messages/${messageId}/send`,
|
||||||
);
|
);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push({ success: true });
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -354,10 +396,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
await microsoftApiRequest.call(this, 'POST', `/messages/${responseData.id}/send`);
|
await microsoftApiRequest.call(this, 'POST', `/messages/${responseData.id}/send`);
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -452,13 +502,25 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
if (additionalFields.dataPropertyAttachmentsPrefixName) {
|
if (additionalFields.dataPropertyAttachmentsPrefixName) {
|
||||||
const prefix = additionalFields.dataPropertyAttachmentsPrefixName as string;
|
const prefix = additionalFields.dataPropertyAttachmentsPrefixName as string;
|
||||||
const data = await downloadAttachments.call(this, responseData, prefix);
|
const data = await downloadAttachments.call(this, responseData, prefix);
|
||||||
returnData.push.apply(returnData, data as unknown as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(data),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} else {
|
} else {
|
||||||
returnData.push.apply(returnData, responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -466,7 +528,7 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalFields.dataPropertyAttachmentsPrefixName) {
|
if (additionalFields.dataPropertyAttachmentsPrefixName) {
|
||||||
return [returnData as INodeExecutionData[]];
|
return [returnData];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,10 +547,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
`/messages/${messageId}/move`,
|
`/messages/${messageId}/move`,
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
returnData.push({ success: true });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -536,10 +606,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
};
|
};
|
||||||
|
|
||||||
responseData = await microsoftApiRequest.call(this, 'POST', '/sendMail', body, {});
|
responseData = await microsoftApiRequest.call(this, 'POST', '/sendMail', body, {});
|
||||||
returnData.push({ success: true });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -647,10 +725,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
returnData.push({ success: true });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -740,10 +826,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
undefined,
|
undefined,
|
||||||
qs,
|
qs,
|
||||||
);
|
);
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -783,10 +877,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
responseData = await microsoftApiRequest.call(this, 'GET', endpoint, undefined, qs);
|
responseData = await microsoftApiRequest.call(this, 'GET', endpoint, undefined, qs);
|
||||||
responseData = responseData.value;
|
responseData = responseData.value;
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -821,10 +923,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData = await microsoftApiRequest.call(this, 'POST', endpoint, body);
|
responseData = await microsoftApiRequest.call(this, 'POST', endpoint, body);
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -841,10 +951,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
'DELETE',
|
'DELETE',
|
||||||
`/mailFolders/${folderId}`,
|
`/mailFolders/${folderId}`,
|
||||||
);
|
);
|
||||||
returnData.push({ success: true });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ success: true }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -872,10 +990,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
{},
|
{},
|
||||||
qs,
|
qs,
|
||||||
);
|
);
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -911,10 +1037,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
responseData = await microsoftApiRequest.call(this, 'GET', '/mailFolders', {}, qs);
|
responseData = await microsoftApiRequest.call(this, 'GET', '/mailFolders', {}, qs);
|
||||||
responseData = responseData.value;
|
responseData = responseData.value;
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -956,10 +1090,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
);
|
);
|
||||||
responseData = responseData.value;
|
responseData = responseData.value;
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -983,10 +1125,18 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
`/mailFolders/${folderId}`,
|
`/mailFolders/${folderId}`,
|
||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
returnData.push(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -1025,11 +1175,19 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
responseData = await microsoftApiRequest.call(this, 'GET', endpoint, undefined, qs);
|
responseData = await microsoftApiRequest.call(this, 'GET', endpoint, undefined, qs);
|
||||||
responseData = responseData.value;
|
responseData = responseData.value;
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -1043,7 +1201,7 @@ export class MicrosoftOutlook implements INodeType {
|
||||||
) {
|
) {
|
||||||
return this.prepareOutputData(items);
|
return this.prepareOutputData(items);
|
||||||
} else {
|
} else {
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import type { IExecuteFunctions } from 'n8n-core';
|
import type { IExecuteFunctions } from 'n8n-core';
|
||||||
|
|
||||||
import type {
|
import type { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||||
IDataObject,
|
|
||||||
INodeExecutionData,
|
|
||||||
INodeType,
|
|
||||||
INodeTypeDescription,
|
|
||||||
} from 'n8n-workflow';
|
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
|
@ -116,7 +111,7 @@ export class N8nTrainingCustomerDatastore implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
let responseData;
|
let responseData;
|
||||||
|
@ -138,11 +133,15 @@ export class N8nTrainingCustomerDatastore implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(responseData)) {
|
if (Array.isArray(responseData)) {
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push.apply(returnData, executionData);
|
||||||
} else if (responseData !== undefined) {
|
} else if (responseData !== undefined) {
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push({ json: responseData });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import type { IExecuteFunctions } from 'n8n-core';
|
import type { IExecuteFunctions } from 'n8n-core';
|
||||||
|
|
||||||
import type {
|
import type { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||||
IDataObject,
|
|
||||||
INodeExecutionData,
|
|
||||||
INodeType,
|
|
||||||
INodeTypeDescription,
|
|
||||||
} from 'n8n-workflow';
|
|
||||||
|
|
||||||
export class N8nTrainingCustomerMessenger implements INodeType {
|
export class N8nTrainingCustomerMessenger implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
|
@ -43,7 +38,7 @@ export class N8nTrainingCustomerMessenger implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
let responseData;
|
let responseData;
|
||||||
|
|
||||||
|
@ -53,9 +48,13 @@ export class N8nTrainingCustomerMessenger implements INodeType {
|
||||||
const message = this.getNodeParameter('message', i) as string;
|
const message = this.getNodeParameter('message', i) as string;
|
||||||
|
|
||||||
responseData = { output: `Sent message to customer ${customerId}: ${message}` };
|
responseData = { output: `Sent message to customer ${customerId}: ${message}` };
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
|
||||||
returnData.push(responseData);
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import type {
|
||||||
INodePropertyOptions,
|
INodePropertyOptions,
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
JsonObject,
|
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { deepCopy } from 'n8n-workflow';
|
import { deepCopy } from 'n8n-workflow';
|
||||||
|
|
||||||
|
@ -298,7 +297,7 @@ export class Odoo implements INodeType {
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
let items = this.getInputData();
|
let items = this.getInputData();
|
||||||
items = deepCopy(items);
|
items = deepCopy(items);
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
let responseData;
|
let responseData;
|
||||||
|
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
|
@ -745,21 +744,27 @@ export class Odoo implements INodeType {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (responseData !== undefined) {
|
||||||
if (Array.isArray(responseData)) {
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push.apply(returnData, responseData);
|
this.helpers.returnJsonArray(responseData),
|
||||||
} else if (responseData !== undefined) {
|
{ itemData: { item: i } },
|
||||||
returnData.push(responseData);
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: (error as JsonObject).message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ export class Phantombuster implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
const qs: IDataObject = {};
|
const qs: IDataObject = {};
|
||||||
let responseData;
|
let responseData;
|
||||||
|
@ -247,20 +247,23 @@ export class Phantombuster implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
if (Array.isArray(responseData)) {
|
this.helpers.returnJsonArray(responseData),
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
{ itemData: { item: i } },
|
||||||
} else if (responseData !== undefined) {
|
);
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push(...executionData);
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import type { IExecuteFunctions } from 'n8n-core';
|
import type { IExecuteFunctions } from 'n8n-core';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
|
||||||
ILoadOptionsFunctions,
|
ILoadOptionsFunctions,
|
||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodePropertyOptions,
|
INodePropertyOptions,
|
||||||
|
@ -88,7 +87,7 @@ export class PhilipsHue implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
let responseData;
|
let responseData;
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
|
@ -176,12 +175,12 @@ export class PhilipsHue implements INodeType {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
if (Array.isArray(responseData)) {
|
return this.prepareOutputData(returnData);
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
|
||||||
} else if (responseData !== undefined) {
|
|
||||||
returnData.push(responseData as IDataObject);
|
|
||||||
}
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,7 @@ export class Pushover implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
let responseData;
|
let responseData;
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
|
@ -372,21 +372,25 @@ export class Pushover implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
responseData = await pushoverApiRequest.call(this, 'POST', '/messages.json', body);
|
responseData = await pushoverApiRequest.call(this, 'POST', '/messages.json', body);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Array.isArray(responseData)) {
|
return this.prepareOutputData(returnData);
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
|
||||||
} else if (responseData !== undefined) {
|
|
||||||
returnData.push(responseData as IDataObject);
|
|
||||||
}
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,7 @@ export class Rocketchat implements INodeType {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
let responseData;
|
let responseData;
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
|
@ -478,20 +478,24 @@ export class Rocketchat implements INodeType {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Array.isArray(responseData)) {
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
this.helpers.returnJsonArray(responseData),
|
||||||
} else if (responseData !== undefined) {
|
{ itemData: { item: i } },
|
||||||
returnData.push(responseData as IDataObject);
|
);
|
||||||
}
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ export class Snowflake implements INodeType {
|
||||||
const credentials = (await this.getCredentials(
|
const credentials = (await this.getCredentials(
|
||||||
'snowflake',
|
'snowflake',
|
||||||
)) as unknown as snowflake.ConnectionOptions;
|
)) as unknown as snowflake.ConnectionOptions;
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
let responseData;
|
let responseData;
|
||||||
|
|
||||||
const connection = snowflake.createConnection(credentials);
|
const connection = snowflake.createConnection(credentials);
|
||||||
|
@ -178,7 +178,11 @@ export class Snowflake implements INodeType {
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
const query = this.getNodeParameter('query', i) as string;
|
const query = this.getNodeParameter('query', i) as string;
|
||||||
responseData = await execute(connection, query, []);
|
responseData = await execute(connection, query, []);
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +200,13 @@ export class Snowflake implements INodeType {
|
||||||
const data = copyInputItems(items, columns);
|
const data = copyInputItems(items, columns);
|
||||||
const binds = data.map((element) => Object.values(element));
|
const binds = data.map((element) => Object.values(element));
|
||||||
await execute(connection, query, binds as unknown as snowflake.InsertBinds);
|
await execute(connection, query, binds as unknown as snowflake.InsertBinds);
|
||||||
returnData.push.apply(returnData, data);
|
data.forEach((d, i) => {
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(d),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'update') {
|
if (operation === 'update') {
|
||||||
|
@ -221,11 +231,16 @@ export class Snowflake implements INodeType {
|
||||||
for (let i = 0; i < binds.length; i++) {
|
for (let i = 0; i < binds.length; i++) {
|
||||||
await execute(connection, query, binds[i] as unknown as snowflake.InsertBinds);
|
await execute(connection, query, binds[i] as unknown as snowflake.InsertBinds);
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, data);
|
data.forEach((d, i) => {
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(d),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await destroy(connection);
|
await destroy(connection);
|
||||||
|
return this.prepareOutputData(returnData);
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import type {
|
||||||
ICredentialTestFunctions,
|
ICredentialTestFunctions,
|
||||||
IDataObject,
|
IDataObject,
|
||||||
INodeProperties,
|
INodeProperties,
|
||||||
|
IPairedItemData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeApiError } from 'n8n-workflow';
|
import { NodeApiError } from 'n8n-workflow';
|
||||||
|
|
||||||
|
@ -322,3 +323,11 @@ export async function validateCredentials(
|
||||||
|
|
||||||
return this.helpers.request(options);
|
return this.helpers.request(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function mapPairedItemsFrom<T>(iterable: Iterable<T> | ArrayLike<T>): IPairedItemData[] {
|
||||||
|
return Array.from(iterable, (_, i) => i).map((index) => {
|
||||||
|
return {
|
||||||
|
item: index,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import {
|
||||||
buildGetQuery,
|
buildGetQuery,
|
||||||
buildOrQuery,
|
buildOrQuery,
|
||||||
buildQuery,
|
buildQuery,
|
||||||
|
mapPairedItemsFrom,
|
||||||
supabaseApiRequest,
|
supabaseApiRequest,
|
||||||
validateCredentials,
|
validateCredentials,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
@ -121,7 +122,7 @@ export class Supabase implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
const qs: IDataObject = {};
|
const qs: IDataObject = {};
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
|
@ -155,14 +156,28 @@ export class Supabase implements INodeType {
|
||||||
records.push(record);
|
records.push(record);
|
||||||
}
|
}
|
||||||
const endpoint = `/${tableId}`;
|
const endpoint = `/${tableId}`;
|
||||||
let createdRow;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
createdRow = await supabaseApiRequest.call(this, 'POST', endpoint, records);
|
const createdRows: IDataObject[] = await supabaseApiRequest.call(
|
||||||
returnData.push(...createdRow);
|
this,
|
||||||
|
'POST',
|
||||||
|
endpoint,
|
||||||
|
records,
|
||||||
|
);
|
||||||
|
createdRows.forEach((row, i) => {
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(row),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.description });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.description }),
|
||||||
|
{ itemData: mapPairedItemsFrom(records) },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
@ -207,11 +222,21 @@ export class Supabase implements INodeType {
|
||||||
rows = await supabaseApiRequest.call(this, 'DELETE', endpoint, {}, qs);
|
rows = await supabaseApiRequest.call(this, 'DELETE', endpoint, {}, qs);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.description });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.description }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
returnData.push(...rows);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(rows),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,11 +262,21 @@ export class Supabase implements INodeType {
|
||||||
rows = await supabaseApiRequest.call(this, 'GET', endpoint, {}, qs);
|
rows = await supabaseApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.description });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
returnData.push(...rows);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(rows),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,13 +315,23 @@ export class Supabase implements INodeType {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rows = await supabaseApiRequest.call(this, 'GET', endpoint, {}, qs);
|
rows = await supabaseApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(rows),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.description });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.description }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
returnData.push(...rows);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,16 +391,25 @@ export class Supabase implements INodeType {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
updatedRow = await supabaseApiRequest.call(this, 'PATCH', endpoint, record, qs);
|
updatedRow = await supabaseApiRequest.call(this, 'PATCH', endpoint, record, qs);
|
||||||
returnData.push(...updatedRow);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(updatedRow),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.description });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.description }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,7 +313,7 @@ export class TheHive implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
const qs: IDataObject = {};
|
const qs: IDataObject = {};
|
||||||
let responseData;
|
let responseData;
|
||||||
|
@ -1954,19 +1954,23 @@ export class TheHive implements INodeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(responseData)) {
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
this.helpers.returnJsonArray(responseData),
|
||||||
} else if (responseData !== undefined) {
|
{ itemData: { item: i } },
|
||||||
returnData.push(responseData as IDataObject);
|
);
|
||||||
}
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -697,7 +697,7 @@ export class TodoistV2 implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
const service = new TodoistService();
|
const service = new TodoistService();
|
||||||
let responseData;
|
let responseData;
|
||||||
|
@ -712,23 +712,40 @@ export class TodoistV2 implements INodeType {
|
||||||
i,
|
i,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (Array.isArray(responseData?.data)) {
|
|
||||||
returnData.push.apply(returnData, responseData?.data as IDataObject[]);
|
if (responseData !== undefined && Array.isArray(responseData?.data)) {
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData.data as IDataObject[]),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} else {
|
} else {
|
||||||
if (responseData?.hasOwnProperty('success')) {
|
if (responseData?.hasOwnProperty('success')) {
|
||||||
returnData.push({ success: responseData.success });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ success: responseData.success }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
} else {
|
} else {
|
||||||
returnData.push(responseData?.data as IDataObject);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData?.data as IDataObject),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ export class Zulip implements INodeType {
|
||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
const returnData: IDataObject[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
let responseData;
|
let responseData;
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
|
@ -464,20 +464,23 @@ export class Zulip implements INodeType {
|
||||||
responseData = await zulipApiRequest.call(this, 'DELETE', `/users/${userId}`, body);
|
responseData = await zulipApiRequest.call(this, 'DELETE', `/users/${userId}`, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
if (Array.isArray(responseData)) {
|
this.helpers.returnJsonArray(responseData),
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
{ itemData: { item: i } },
|
||||||
} else {
|
);
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push(...executionData);
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ error: error.message });
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData: { item: i } },
|
||||||
|
);
|
||||||
|
returnData.push(...executionData);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return this.prepareOutputData(returnData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue