mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 17:46:45 +00:00
Feature/paired item support (#3869)
* Add paired item helper and implement it in some nodes
This commit is contained in:
@@ -14,12 +14,14 @@ import {
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
IOAuth2Options,
|
||||
IPairedItemData,
|
||||
IPollFunctions as IPollFunctionsBase,
|
||||
IPollResponse,
|
||||
ITriggerFunctions as ITriggerFunctionsBase,
|
||||
ITriggerResponse,
|
||||
IWebhookFunctions as IWebhookFunctionsBase,
|
||||
IWorkflowSettings as IWorkflowSettingsWorkflow,
|
||||
NodeExecutionWithMetadata,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { OptionsWithUri, OptionsWithUrl } from 'request';
|
||||
@@ -68,6 +70,10 @@ export interface IExecuteFunctions extends IExecuteFunctionsBase {
|
||||
credentialsType: string,
|
||||
requestOptions: IHttpRequestOptions,
|
||||
): Promise<any>;
|
||||
constructExecutionMetaData(
|
||||
inputData: INodeExecutionData[],
|
||||
options: { itemData: IPairedItemData | IPairedItemData[] },
|
||||
): NodeExecutionWithMetadata[];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ import {
|
||||
LoggerProxy as Logger,
|
||||
IExecuteData,
|
||||
OAuth2GrantType,
|
||||
NodeExecutionWithMetadata,
|
||||
IPairedItemData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { Agent } from 'https';
|
||||
@@ -1307,13 +1309,31 @@ export function returnJsonArray(jsonData: IDataObject | IDataObject[]): INodeExe
|
||||
jsonData = [jsonData];
|
||||
}
|
||||
|
||||
jsonData.forEach((data) => {
|
||||
jsonData.forEach((data: IDataObject) => {
|
||||
returnData.push({ json: data });
|
||||
});
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes generic input data and brings it into the new json, pairedItem format n8n uses.
|
||||
* @export
|
||||
* @param {(IPairedItemData)} itemData
|
||||
* @param {(INodeExecutionData[])} inputData
|
||||
* @returns {(NodeExecutionWithMetadata[])}
|
||||
*/
|
||||
export function constructExecutionMetaData(
|
||||
inputData: INodeExecutionData[],
|
||||
options: { itemData: IPairedItemData | IPairedItemData[] },
|
||||
): NodeExecutionWithMetadata[] {
|
||||
const { itemData } = options;
|
||||
return inputData.map((data: INodeExecutionData) => {
|
||||
const { json, ...rest } = data;
|
||||
return { json, pairedItem: itemData, ...rest } as NodeExecutionWithMetadata;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically put the objects under a 'json' key and don't error,
|
||||
* if some objects contain json/binary keys and others don't, throws error 'Inconsistent item format'
|
||||
@@ -2417,6 +2437,7 @@ export function getExecuteFunctions(
|
||||
},
|
||||
returnJsonArray,
|
||||
normalizeItems,
|
||||
constructExecutionMetaData,
|
||||
},
|
||||
};
|
||||
})(workflow, runExecutionData, connectionInputData, inputData, node);
|
||||
|
||||
@@ -309,7 +309,7 @@ export class ActiveCampaign implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
let resource: string;
|
||||
let operation: string;
|
||||
@@ -1184,20 +1184,25 @@ export class ActiveCampaign implements INodeType {
|
||||
responseData = { success: true };
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export class Affinity implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
@@ -413,19 +413,26 @@ export class Affinity implements INodeType {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ export class Airtable implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
let responseData;
|
||||
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -483,14 +483,17 @@ export class Airtable implements INodeType {
|
||||
body['records'] = rows;
|
||||
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
returnData.push(...responseData.records);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.records),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
// empty rows
|
||||
rows.length = 0;
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json: { error: error.message }});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -524,13 +527,18 @@ export class Airtable implements INodeType {
|
||||
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
returnData.push(...responseData.records);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.records),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
// empty rows
|
||||
rows.length = 0;
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json:{ error: error.message }});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -578,9 +586,17 @@ export class Airtable implements INodeType {
|
||||
);
|
||||
return [data];
|
||||
}
|
||||
|
||||
// We can return from here
|
||||
return [
|
||||
this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(returnData),
|
||||
{ itemData: { item: 0 } },
|
||||
),
|
||||
];
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json:{ error: error.message }});
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
@@ -607,10 +623,15 @@ export class Airtable implements INodeType {
|
||||
try {
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json:{ error: error.message }});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -685,14 +706,19 @@ export class Airtable implements INodeType {
|
||||
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, data, qs);
|
||||
|
||||
returnData.push(...responseData.records);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.records),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
|
||||
// empty rows
|
||||
rows.length = 0;
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json:{ error: error.message }});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -702,6 +728,6 @@ export class Airtable implements INodeType {
|
||||
throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2409,11 +2409,12 @@ export class Asana implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData);
|
||||
}
|
||||
returnData.push(
|
||||
...this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
@@ -2423,6 +2424,6 @@ export class Asana implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return [returnData as INodeExecutionData[]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
NodeExecutionWithMetadata,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { automizyApiRequest, automizyApiRequestAllItems } from './GenericFunctions';
|
||||
@@ -120,7 +121,7 @@ export class Automizy implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -161,6 +162,11 @@ export class Automizy implements INodeType {
|
||||
`/smart-lists/${listId}/contacts`,
|
||||
body,
|
||||
);
|
||||
responseData = responseData.contacts;
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'delete') {
|
||||
@@ -169,12 +175,20 @@ export class Automizy implements INodeType {
|
||||
responseData = await automizyApiRequest.call(this, 'DELETE', `/contacts/${contactId}`);
|
||||
|
||||
responseData = { success: true };
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'get') {
|
||||
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||
|
||||
responseData = await automizyApiRequest.call(this, 'GET', `/contacts/${contactId}`);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
@@ -211,9 +225,12 @@ export class Automizy implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
|
||||
responseData = responseData.contacts;
|
||||
}
|
||||
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'update') {
|
||||
@@ -240,6 +257,10 @@ export class Automizy implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await automizyApiRequest.call(this, 'PATCH', `/contacts/${email}`, body);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,6 +273,10 @@ export class Automizy implements INodeType {
|
||||
};
|
||||
|
||||
responseData = await automizyApiRequest.call(this, 'POST', `/smart-lists`, body);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'delete') {
|
||||
@@ -260,12 +285,20 @@ export class Automizy implements INodeType {
|
||||
responseData = await automizyApiRequest.call(this, 'DELETE', `/smart-lists/${listId}`);
|
||||
|
||||
responseData = { success: true };
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'get') {
|
||||
const listId = this.getNodeParameter('listId', i) as string;
|
||||
|
||||
responseData = await automizyApiRequest.call(this, 'GET', `/smart-lists/${listId}`);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
@@ -297,6 +330,11 @@ export class Automizy implements INodeType {
|
||||
|
||||
responseData = responseData.smartLists;
|
||||
}
|
||||
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'update') {
|
||||
@@ -314,14 +352,17 @@ export class Automizy implements INodeType {
|
||||
`/smart-lists/${listId}`,
|
||||
body,
|
||||
);
|
||||
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
returnData.push(...(responseData as NodeExecutionWithMetadata[]));
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,20 +299,24 @@ export class Autopilot implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.toString() });
|
||||
const exectionErrorWithMetaData = this.helpers.constructExecutionMetaData(
|
||||
[{ json: { error: error.message } }],
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
responseData.push(...exectionErrorWithMetaData);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return [returnData as INodeExecutionData[]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
NodeApiError,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
@@ -472,11 +471,12 @@ export class AwsRekognition implements INodeType {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
@@ -485,6 +485,6 @@ export class AwsRekognition implements INodeType {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return [returnData as INodeExecutionData[]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ export class Baserow implements INodeType {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const mapper = new TableFieldMapper();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const operation = this.getNodeParameter('operation', 0) as Operation;
|
||||
|
||||
const tableId = this.getNodeParameter('tableId', 0) as string;
|
||||
@@ -219,8 +219,11 @@ export class Baserow implements INodeType {
|
||||
)) as Row[];
|
||||
|
||||
rows.forEach((row) => mapper.idsToNames(row));
|
||||
|
||||
returnData.push(...rows);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(rows),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// get
|
||||
@@ -233,8 +236,11 @@ export class Baserow implements INodeType {
|
||||
const row = await baserowApiRequest.call(this, 'GET', endpoint, {}, {}, jwtToken);
|
||||
|
||||
mapper.idsToNames(row);
|
||||
|
||||
returnData.push(row);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(row),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -276,8 +282,11 @@ export class Baserow implements INodeType {
|
||||
);
|
||||
|
||||
mapper.idsToNames(createdRow);
|
||||
|
||||
returnData.push(createdRow);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(createdRow),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -321,8 +330,11 @@ export class Baserow implements INodeType {
|
||||
);
|
||||
|
||||
mapper.idsToNames(updatedRow);
|
||||
|
||||
returnData.push(updatedRow);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(updatedRow),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -335,17 +347,21 @@ export class Baserow implements INodeType {
|
||||
const endpoint = `/api/database/rows/table/${tableId}/${rowId}/`;
|
||||
await baserowApiRequest.call(this, 'DELETE', endpoint, {}, {}, jwtToken);
|
||||
|
||||
returnData.push({ success: true });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
[{ json: { success: true } }],
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {}, itemIndex: i });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ export class Beeminder implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const timezone = this.getTimezone();
|
||||
|
||||
@@ -318,6 +318,11 @@ export class Beeminder implements INodeType {
|
||||
data.timestamp = moment.tz(data.timestamp, timezone).unix();
|
||||
}
|
||||
results = await createDatapoint.call(this, data);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(results),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
const options = this.getNodeParameter('options', i) as INodeParameters;
|
||||
@@ -331,6 +336,11 @@ export class Beeminder implements INodeType {
|
||||
}
|
||||
|
||||
results = await getAllDatapoints.call(this, data);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(results),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
const datapointId = this.getNodeParameter('datapointId', i) as string;
|
||||
const options = this.getNodeParameter('updateFields', i) as INodeParameters;
|
||||
@@ -343,6 +353,11 @@ export class Beeminder implements INodeType {
|
||||
data.timestamp = moment.tz(data.timestamp, timezone).unix();
|
||||
}
|
||||
results = await updateDatapoint.call(this, data);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(results),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
const datapointId = this.getNodeParameter('datapointId', i) as string;
|
||||
const data: IDataObject = {
|
||||
@@ -350,22 +365,22 @@ export class Beeminder implements INodeType {
|
||||
datapointId,
|
||||
};
|
||||
results = await deleteDatapoint.call(this, data);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(results),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {}, itemIndex: i });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
if (Array.isArray(results)) {
|
||||
returnData.push.apply(returnData, results as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(results as IDataObject);
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,9 +125,8 @@ export class Bitly implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -206,19 +205,20 @@ export class Bitly implements INodeType {
|
||||
responseData = await bitlyApiRequest.call(this, 'GET', `/bitlinks/${linkId}`);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {}, itemIndex: i });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ export class Bitwarden implements INodeType {
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
let responseData;
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const token = await getAccessToken.call(this);
|
||||
const bitwardenApiRequest = partialRight(tokenlessBitwardenApiRequest, token);
|
||||
@@ -136,7 +136,12 @@ export class Bitwarden implements INodeType {
|
||||
const id = this.getNodeParameter('collectionId', i);
|
||||
const endpoint = `/public/collections/${id}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'DELETE', endpoint, {}, {});
|
||||
responseData = { success: true };
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// collection: get
|
||||
@@ -145,6 +150,12 @@ export class Bitwarden implements INodeType {
|
||||
const id = this.getNodeParameter('collectionId', i);
|
||||
const endpoint = `/public/collections/${id}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// collection: getAll
|
||||
@@ -152,6 +163,12 @@ export class Bitwarden implements INodeType {
|
||||
|
||||
const endpoint = '/public/collections';
|
||||
responseData = await handleGetAll.call(this, i, 'GET', endpoint, {}, {});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// collection: update
|
||||
@@ -185,6 +202,12 @@ export class Bitwarden implements INodeType {
|
||||
const id = this.getNodeParameter('collectionId', i);
|
||||
const endpoint = `/public/collections/${id}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'PUT', endpoint, {}, body);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else if (resource === 'event') {
|
||||
// *********************************************************************
|
||||
@@ -200,6 +223,12 @@ export class Bitwarden implements INodeType {
|
||||
const qs = isEmpty(filters) ? {} : filters;
|
||||
const endpoint = '/public/events';
|
||||
responseData = await handleGetAll.call(this, i, 'GET', endpoint, qs, {});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else if (resource === 'group') {
|
||||
// *********************************************************************
|
||||
@@ -234,6 +263,12 @@ export class Bitwarden implements INodeType {
|
||||
|
||||
const endpoint = '/public/groups';
|
||||
responseData = await bitwardenApiRequest.call(this, 'POST', endpoint, {}, body);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// group: delete
|
||||
@@ -242,7 +277,12 @@ export class Bitwarden implements INodeType {
|
||||
const id = this.getNodeParameter('groupId', i);
|
||||
const endpoint = `/public/groups/${id}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'DELETE', endpoint, {}, {});
|
||||
responseData = { success: true };
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// group: get
|
||||
@@ -251,6 +291,12 @@ export class Bitwarden implements INodeType {
|
||||
const id = this.getNodeParameter('groupId', i);
|
||||
const endpoint = `/public/groups/${id}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// group: getAll
|
||||
@@ -258,6 +304,12 @@ export class Bitwarden implements INodeType {
|
||||
|
||||
const endpoint = '/public/groups';
|
||||
responseData = await handleGetAll.call(this, i, 'GET', endpoint, {}, {});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getMembers') {
|
||||
// ----------------------------------
|
||||
// group: getMembers
|
||||
@@ -267,6 +319,12 @@ export class Bitwarden implements INodeType {
|
||||
const endpoint = `/public/groups/${id}/member-ids`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
responseData = responseData.map((memberId: string) => ({ memberId }));
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// group: update
|
||||
@@ -323,6 +381,12 @@ export class Bitwarden implements INodeType {
|
||||
|
||||
const endpoint = `/public/groups/${groupId}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'PUT', endpoint, {}, body);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'updateMembers') {
|
||||
// ----------------------------------
|
||||
// group: updateMembers
|
||||
@@ -337,7 +401,12 @@ export class Bitwarden implements INodeType {
|
||||
const groupId = this.getNodeParameter('groupId', i);
|
||||
const endpoint = `/public/groups/${groupId}/member-ids`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'PUT', endpoint, {}, body);
|
||||
responseData = { success: true };
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else if (resource === 'member') {
|
||||
// *********************************************************************
|
||||
@@ -373,6 +442,12 @@ export class Bitwarden implements INodeType {
|
||||
|
||||
const endpoint = '/public/members/';
|
||||
responseData = await bitwardenApiRequest.call(this, 'POST', endpoint, {}, body);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// member: delete
|
||||
@@ -382,6 +457,12 @@ export class Bitwarden implements INodeType {
|
||||
const endpoint = `/public/members/${id}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'DELETE', endpoint, {}, {});
|
||||
responseData = { success: true };
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// member: get
|
||||
@@ -390,6 +471,12 @@ export class Bitwarden implements INodeType {
|
||||
const id = this.getNodeParameter('memberId', i);
|
||||
const endpoint = `/public/members/${id}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// member: getAll
|
||||
@@ -397,6 +484,12 @@ export class Bitwarden implements INodeType {
|
||||
|
||||
const endpoint = '/public/members';
|
||||
responseData = await handleGetAll.call(this, i, 'GET', endpoint, {}, {});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getGroups') {
|
||||
// ----------------------------------
|
||||
// member: getGroups
|
||||
@@ -406,6 +499,11 @@ export class Bitwarden implements INodeType {
|
||||
const endpoint = `/public/members/${id}/group-ids`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
|
||||
responseData = responseData.map((groupId: string) => ({ groupId }));
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// member: update
|
||||
@@ -447,6 +545,11 @@ export class Bitwarden implements INodeType {
|
||||
const id = this.getNodeParameter('memberId', i);
|
||||
const endpoint = `/public/members/${id}`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'PUT', endpoint, {}, body);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'updateGroups') {
|
||||
// ----------------------------------
|
||||
// member: updateGroups
|
||||
@@ -461,15 +564,15 @@ export class Bitwarden implements INodeType {
|
||||
const memberId = this.getNodeParameter('memberId', i);
|
||||
const endpoint = `/public/members/${memberId}/group-ids`;
|
||||
responseData = await bitwardenApiRequest.call(this, 'PUT', endpoint, {}, body);
|
||||
responseData = { success: true };
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export class Box implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -104,15 +104,12 @@ export class Box implements INodeType {
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
// https://developer.box.com/reference/delete-files-id
|
||||
if (operation === 'delete') {
|
||||
const fileId = this.getNodeParameter('fileId', i) as string;
|
||||
responseData = await boxApiRequest.call(this, 'DELETE', `/files/${fileId}`);
|
||||
responseData = { success: true };
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
// https://developer.box.com/reference/get-files-id-content
|
||||
if (operation === 'download') {
|
||||
@@ -150,7 +147,7 @@ export class Box implements INodeType {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
Object.assign(newItem.binary!, items[i].binary);
|
||||
}
|
||||
|
||||
items[i] = newItem;
|
||||
@@ -171,7 +168,6 @@ export class Box implements INodeType {
|
||||
qs.fields = additionalFields.fields as string;
|
||||
}
|
||||
responseData = await boxApiRequest.call(this, 'GET', `/files/${fileId}`, {}, qs);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
// https://developer.box.com/reference/get-search/
|
||||
if (operation === 'search') {
|
||||
@@ -223,7 +219,6 @@ export class Box implements INodeType {
|
||||
responseData = await boxApiRequest.call(this, 'GET', `/search`, {}, qs);
|
||||
responseData = responseData.entries;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
// https://developer.box.com/reference/post-collaborations/
|
||||
if (operation === 'share') {
|
||||
@@ -268,7 +263,6 @@ export class Box implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await boxApiRequest.call(this, 'POST', `/collaborations`, body, qs);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
// https://developer.box.com/reference/post-files-content
|
||||
if (operation === 'upload') {
|
||||
@@ -331,8 +325,7 @@ export class Box implements INodeType {
|
||||
'https://upload.box.com/api/2.0/files/content',
|
||||
{ formData: body },
|
||||
);
|
||||
|
||||
returnData.push.apply(returnData, responseData.entries as IDataObject[]);
|
||||
responseData = responseData.entries;
|
||||
} else {
|
||||
const content = this.getNodeParameter('fileContent', i) as string;
|
||||
|
||||
@@ -364,8 +357,7 @@ export class Box implements INodeType {
|
||||
'https://upload.box.com/api/2.0/files/content',
|
||||
{ formData: body },
|
||||
);
|
||||
|
||||
returnData.push.apply(returnData, responseData.entries as IDataObject[]);
|
||||
responseData = responseData.entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,13 +399,11 @@ export class Box implements INodeType {
|
||||
|
||||
responseData = await boxApiRequest.call(this, 'DELETE', `/folders/${folderId}`, qs);
|
||||
responseData = { success: true };
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
// https://developer.box.com/reference/get-folders-id/
|
||||
if (operation === 'get') {
|
||||
const folderId = this.getNodeParameter('folderId', i) as string;
|
||||
responseData = await boxApiRequest.call(this, 'GET', `/folders/${folderId}`, qs);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
// https://developer.box.com/reference/get-search/
|
||||
if (operation === 'search') {
|
||||
@@ -465,7 +455,6 @@ export class Box implements INodeType {
|
||||
responseData = await boxApiRequest.call(this, 'GET', `/search`, {}, qs);
|
||||
responseData = responseData.entries;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
// https://developer.box.com/reference/post-collaborations/
|
||||
if (operation === 'share') {
|
||||
@@ -510,7 +499,6 @@ export class Box implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await boxApiRequest.call(this, 'POST', `/collaborations`, body, qs);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
//https://developer.box.com/guides/folders/single/move/
|
||||
if (operation === 'update') {
|
||||
@@ -538,22 +526,31 @@ export class Box implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await boxApiRequest.call(this, 'PUT', `/folders/${folderId}`, body, qs);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
responseData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'file' && operation === 'download') {
|
||||
// For file downloads the files get attached to the existing items
|
||||
return this.prepareOutputData(items);
|
||||
} else {
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export class Brandfetch implements INodeType {
|
||||
const length = items.length;
|
||||
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
const responseData = [];
|
||||
const responseData: INodeExecutionData[] = [];
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
if (operation === 'logo') {
|
||||
@@ -173,7 +173,7 @@ export class Brandfetch implements INodeType {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
Object.assign(newItem.binary!, items[i].binary);
|
||||
}
|
||||
|
||||
newItem.json = response.response;
|
||||
@@ -205,7 +205,11 @@ export class Brandfetch implements INodeType {
|
||||
delete items[i].binary;
|
||||
}
|
||||
} else {
|
||||
responseData.push(response.response);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response.response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
responseData.push(...executionData);
|
||||
}
|
||||
}
|
||||
if (operation === 'color') {
|
||||
@@ -216,7 +220,11 @@ export class Brandfetch implements INodeType {
|
||||
};
|
||||
|
||||
const response = await brandfetchApiRequest.call(this, 'POST', `/color`, body);
|
||||
responseData.push(response.response);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
responseData.push(...executionData);
|
||||
}
|
||||
if (operation === 'font') {
|
||||
const domain = this.getNodeParameter('domain', i) as string;
|
||||
@@ -226,7 +234,11 @@ export class Brandfetch implements INodeType {
|
||||
};
|
||||
|
||||
const response = await brandfetchApiRequest.call(this, 'POST', `/font`, body);
|
||||
responseData.push(response.response);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
responseData.push(...executionData);
|
||||
}
|
||||
if (operation === 'company') {
|
||||
const domain = this.getNodeParameter('domain', i) as string;
|
||||
@@ -236,7 +248,11 @@ export class Brandfetch implements INodeType {
|
||||
};
|
||||
|
||||
const response = await brandfetchApiRequest.call(this, 'POST', `/company`, body);
|
||||
responseData.push(response.response);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
responseData.push(...executionData);
|
||||
}
|
||||
if (operation === 'industry') {
|
||||
const domain = this.getNodeParameter('domain', i) as string;
|
||||
@@ -246,11 +262,16 @@ export class Brandfetch implements INodeType {
|
||||
};
|
||||
|
||||
const response = await brandfetchApiRequest.call(this, 'POST', `/industry`, body);
|
||||
responseData.push.apply(responseData, response.response);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
responseData.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
responseData.push({ error: error.message });
|
||||
responseData.push({ error: error.message, json: {}, itemIndex: i });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -261,7 +282,7 @@ export class Brandfetch implements INodeType {
|
||||
// For file downloads the files get attached to the existing items
|
||||
return this.prepareOutputData(items);
|
||||
} else {
|
||||
return [this.helpers.returnJsonArray(responseData)];
|
||||
return [responseData];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INode,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
@@ -59,7 +60,7 @@ export class Bubble implements INodeType {
|
||||
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (resource === 'object') {
|
||||
@@ -169,15 +170,17 @@ export class Bubble implements INodeType {
|
||||
|
||||
property.forEach((data) => (body[data.key] = data.value));
|
||||
responseData = await bubbleApiRequest.call(this, 'PATCH', endpoint, body, {});
|
||||
responseData = { sucess: true };
|
||||
responseData = { success: true };
|
||||
}
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ export class Chargebee implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
let item: INodeExecutionData;
|
||||
|
||||
const credentials = await this.getCredentials('chargebeeApi');
|
||||
@@ -603,26 +603,38 @@ export class Chargebee implements INodeType {
|
||||
|
||||
if (resource === 'invoice' && operation === 'list') {
|
||||
responseData.list.forEach((data: IDataObject) => {
|
||||
returnData.push(data.invoice as IDataObject);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ ...(data.invoice as IDataObject) }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...responseData);
|
||||
});
|
||||
} else if (resource === 'invoice' && operation === 'pdfUrl') {
|
||||
const data: IDataObject = {};
|
||||
Object.assign(data, items[i].json);
|
||||
|
||||
data.pdfUrl = responseData.download.download_url;
|
||||
returnData.push(data);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ ...data }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...responseData);
|
||||
} else {
|
||||
returnData.push(responseData);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...responseData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {}, itemIndex: i });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export class CircleCi implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -68,6 +68,10 @@ export class CircleCi implements INodeType {
|
||||
const endpoint = `/project/${vcs}/${slug}/pipeline/${pipelineNumber}`;
|
||||
|
||||
responseData = await circleciApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
const vcs = this.getNodeParameter('vcs', i) as string;
|
||||
@@ -98,6 +102,10 @@ export class CircleCi implements INodeType {
|
||||
responseData = responseData.items;
|
||||
responseData = responseData.splice(0, qs.limit);
|
||||
}
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'trigger') {
|
||||
@@ -121,21 +129,22 @@ export class CircleCi implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await circleciApiRequest.call(this, 'POST', endpoint, body, qs);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
returnData.push(...responseData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {}, itemIndex: i });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export class CiscoWebex implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const timezone = this.getTimezone();
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -212,6 +212,10 @@ export class CiscoWebex implements INodeType {
|
||||
} else {
|
||||
responseData = await webexApiRequest.call(this, 'POST', '/messages', body);
|
||||
}
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------------
|
||||
// message: delete
|
||||
@@ -222,7 +226,10 @@ export class CiscoWebex implements INodeType {
|
||||
|
||||
const endpoint = `/messages/${messageId}`;
|
||||
responseData = await webexApiRequest.call(this, 'DELETE', endpoint);
|
||||
responseData = { success: true };
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// message: get
|
||||
@@ -233,6 +240,10 @@ export class CiscoWebex implements INodeType {
|
||||
|
||||
const endpoint = `/messages/${messageId}`;
|
||||
responseData = await webexApiRequest.call(this, 'GET', endpoint);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------------
|
||||
// message: getAll
|
||||
@@ -263,6 +274,10 @@ export class CiscoWebex implements INodeType {
|
||||
responseData = await webexApiRequest.call(this, 'GET', '/messages', {}, qs);
|
||||
responseData = responseData.items;
|
||||
}
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.items),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------------
|
||||
// message: update
|
||||
@@ -287,6 +302,10 @@ export class CiscoWebex implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await webexApiRequest.call(this, 'PUT', endpoint, body);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,6 +342,10 @@ export class CiscoWebex implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await webexApiRequest.call(this, 'POST', '/meetings', body);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'delete') {
|
||||
@@ -340,7 +363,10 @@ export class CiscoWebex implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
responseData = { success: true };
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'get') {
|
||||
@@ -367,6 +393,10 @@ export class CiscoWebex implements INodeType {
|
||||
undefined,
|
||||
{ headers },
|
||||
);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
@@ -398,12 +428,15 @@ export class CiscoWebex implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push(...responseData);
|
||||
} else {
|
||||
qs.max = this.getNodeParameter('limit', i) as number;
|
||||
responseData = await webexApiRequest.call(this, 'GET', '/meetings', {}, qs);
|
||||
responseData = responseData.items;
|
||||
}
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
if (operation === 'update') {
|
||||
@@ -458,17 +491,17 @@ export class CiscoWebex implements INodeType {
|
||||
}
|
||||
|
||||
responseData = await webexApiRequest.call(this, 'PUT', `/meetings/${meetingId}`, body);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
returnData.push(...responseData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.toString() });
|
||||
returnData.push({ error: error.toString(), json: {}, itemIndex: i });
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -536,6 +569,6 @@ export class CiscoWebex implements INodeType {
|
||||
// }
|
||||
// }
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ export class Clearbit implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -147,19 +147,19 @@ export class Clearbit implements INodeType {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {} });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ export class ClickUp implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -1627,19 +1627,20 @@ export class ClickUp implements INodeType {
|
||||
responseData = await clickupApiRequest.call(this, 'PUT', `/list/${listId}`, body);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {} });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ export class Clockify implements INodeType {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const length = items.length;
|
||||
|
||||
@@ -835,20 +835,20 @@ export class Clockify implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {} });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
NodeApiError,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import { codaApiRequest, codaApiRequestAllItems } from './GenericFunctions';
|
||||
import { tableFields, tableOperations } from './TableDescription';
|
||||
@@ -240,12 +239,12 @@ export class Coda implements INodeType {
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const items = this.getInputData();
|
||||
let responseData;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
let qs: IDataObject = {};
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
if (resource === 'table') {
|
||||
// https://coda.io/developers/apis/v1beta1#operation/upsertRows
|
||||
@@ -331,23 +330,32 @@ export class Coda implements INodeType {
|
||||
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
if (options.rawData === true) {
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
returnData.push({
|
||||
id: responseData.id,
|
||||
...responseData.values,
|
||||
});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ id: responseData.id, ...responseData.values }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
// https://coda.io/developers/apis/v1beta1#operation/listRows
|
||||
if (operation === 'getAllRows') {
|
||||
@@ -451,7 +459,11 @@ export class Coda implements INodeType {
|
||||
returnData.push(responseData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -468,10 +480,18 @@ export class Coda implements INodeType {
|
||||
const columnId = this.getNodeParameter('columnId', i) as string;
|
||||
const endpoint = `/docs/${docId}/tables/${tableId}/columns/${columnId}`;
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {});
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -494,16 +514,24 @@ export class Coda implements INodeType {
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
responseData = responseData.items;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
if (resource === 'formula') {
|
||||
@@ -515,16 +543,24 @@ export class Coda implements INodeType {
|
||||
const formulaId = this.getNodeParameter('formulaId', i) as string;
|
||||
const endpoint = `/docs/${docId}/formulas/${formulaId}`;
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {});
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
//https://coda.io/developers/apis/v1beta1#operation/listFormulas
|
||||
if (operation === 'getAll') {
|
||||
@@ -540,16 +576,24 @@ export class Coda implements INodeType {
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
responseData = responseData.items;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
if (resource === 'control') {
|
||||
@@ -561,16 +605,24 @@ export class Coda implements INodeType {
|
||||
const controlId = this.getNodeParameter('controlId', i) as string;
|
||||
const endpoint = `/docs/${docId}/controls/${controlId}`;
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {});
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
//https://coda.io/developers/apis/v1beta1#operation/listControls
|
||||
if (operation === 'getAll') {
|
||||
@@ -586,16 +638,24 @@ export class Coda implements INodeType {
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
responseData = responseData.items;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
if (resource === 'view') {
|
||||
@@ -606,9 +666,13 @@ export class Coda implements INodeType {
|
||||
const viewId = this.getNodeParameter('viewId', i) as string;
|
||||
const endpoint = `/docs/${docId}/tables/${viewId}`;
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {});
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
//https://coda.io/developers/apis/v1beta1#operation/listViews
|
||||
if (operation === 'getAll') {
|
||||
@@ -624,16 +688,24 @@ export class Coda implements INodeType {
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
responseData = responseData.items;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
responseData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...responseData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
if (operation === 'getAllViewRows') {
|
||||
const docId = this.getNodeParameter('docId', 0) as string;
|
||||
@@ -698,16 +770,24 @@ export class Coda implements INodeType {
|
||||
const rowId = this.getNodeParameter('rowId', i) as string;
|
||||
const endpoint = `/docs/${docId}/tables/${viewId}/rows/${rowId}`;
|
||||
responseData = await codaApiRequest.call(this, 'DELETE', endpoint);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
//https://coda.io/developers/apis/v1beta1#operation/pushViewButton
|
||||
if (operation === 'pushViewButton') {
|
||||
@@ -719,16 +799,24 @@ export class Coda implements INodeType {
|
||||
const columnId = this.getNodeParameter('columnId', i) as string;
|
||||
const endpoint = `/docs/${docId}/tables/${viewId}/rows/${rowId}/buttons/${columnId}`;
|
||||
responseData = await codaApiRequest.call(this, 'POST', endpoint);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
if (operation === 'getAllViewColumns') {
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
@@ -744,16 +832,24 @@ export class Coda implements INodeType {
|
||||
responseData = await codaApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
responseData = responseData.items;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.messsage }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
//https://coda.io/developers/apis/v1beta1#operation/updateViewRow
|
||||
if (operation === 'updateViewRow') {
|
||||
|
||||
@@ -139,7 +139,7 @@ export class CoinGecko implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -471,20 +471,20 @@ export class CoinGecko implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {} });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ export class Contentful implements INodeType {
|
||||
let responseData;
|
||||
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const qs: Record<string, string | number> = {};
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
@@ -353,19 +353,19 @@ export class Contentful implements INodeType {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {} });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ export class ConvertKit implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -478,20 +478,20 @@ export class ConvertKit implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ error: error.message, json: {} });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ export class Copper implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -615,18 +615,20 @@ export class Copper implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.toString() });
|
||||
returnData.push({ error: error.toString(), json: {} });
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
NodeExecutionWithMetadata,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { deepLApiRequest } from './GenericFunctions';
|
||||
@@ -108,14 +109,13 @@ export class DeepL implements INodeType {
|
||||
const items = this.getInputData();
|
||||
const length = items.length;
|
||||
|
||||
const responseData = [];
|
||||
const responseData: INodeExecutionData[] = [];
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
const resource = this.getNodeParameter('resource', i) as string;
|
||||
const operation = this.getNodeParameter('operation', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
if (resource === 'language') {
|
||||
if (operation === 'translate') {
|
||||
let body: IDataObject = {};
|
||||
@@ -129,19 +129,30 @@ export class DeepL implements INodeType {
|
||||
: additionalFields.sourceLang;
|
||||
}
|
||||
|
||||
const response = await deepLApiRequest.call(this, 'GET', '/translate', body);
|
||||
responseData.push(response.translations[0]);
|
||||
const { translations } = await deepLApiRequest.call(this, 'GET', '/translate', body);
|
||||
const [translation] = translations;
|
||||
const translationJsonArray = this.helpers.returnJsonArray(translation);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
translationJsonArray,
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
responseData.push(...executionData);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
responseData.push({ $error: error, $json: this.getInputData(i) });
|
||||
const executionErrorData = {
|
||||
json: {} as IDataObject,
|
||||
error: error.message,
|
||||
itemIndex: i,
|
||||
};
|
||||
responseData.push(executionErrorData as INodeExecutionData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(responseData)];
|
||||
return [responseData];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ export class Discord implements INodeType {
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const webhookUri = this.getNodeParameter('webhookUri', 0, '') as string;
|
||||
|
||||
@@ -269,9 +269,13 @@ export class Discord implements INodeType {
|
||||
});
|
||||
}
|
||||
|
||||
returnData.push({ success: true });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({success: true}),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialsDecrypted,
|
||||
ICredentialTestFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeCredentialTestResult,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
@@ -21,17 +18,9 @@ import { categoryFields, categoryOperations } from './CategoryDescription';
|
||||
|
||||
import { groupFields, groupOperations } from './GroupDescription';
|
||||
|
||||
// import {
|
||||
// searchFields,
|
||||
// searchOperations,
|
||||
// } from './SearchDescription';
|
||||
|
||||
import { userFields, userOperations } from './UserDescription';
|
||||
|
||||
import { userGroupFields, userGroupOperations } from './UserGroupDescription';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
//import moment from 'moment';
|
||||
|
||||
export class Discourse implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -122,7 +111,7 @@ export class Discourse implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -431,19 +420,24 @@ export class Discourse implements INodeType {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ export class Disqus implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -604,7 +604,11 @@ export class Disqus implements INodeType {
|
||||
|
||||
try {
|
||||
const responseData = await disqusApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData.response);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
@@ -640,7 +644,11 @@ export class Disqus implements INodeType {
|
||||
qs.limit = limit;
|
||||
responseData = await disqusApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
}
|
||||
returnData.push.apply(returnData, responseData.response as IDataObject[]);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.response as IDataObject),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
@@ -681,7 +689,11 @@ export class Disqus implements INodeType {
|
||||
endpoint,
|
||||
)) as IDataObject;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData.response as IDataObject[]);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.response as IDataObject),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
@@ -718,7 +730,11 @@ export class Disqus implements INodeType {
|
||||
qs.limit = limit;
|
||||
responseData = await disqusApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
}
|
||||
returnData.push.apply(returnData, responseData.response as IDataObject[]);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.response as IDataObject),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
@@ -736,13 +752,17 @@ export class Disqus implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,7 +693,7 @@ export class Dropbox implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -849,11 +849,11 @@ export class Dropbox implements INodeType {
|
||||
filters.file_extensions = (filters.file_extensions as string).split(',');
|
||||
}
|
||||
|
||||
Object.assign(body.options, filters);
|
||||
Object.assign(body.options!, filters);
|
||||
|
||||
if (returnAll === false) {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
Object.assign(body.options, { max_results: limit });
|
||||
Object.assign(body.options!, { max_results: limit });
|
||||
}
|
||||
|
||||
endpoint = 'https://api.dropboxapi.com/2/files/search_v2';
|
||||
@@ -932,20 +932,24 @@ export class Dropbox implements INodeType {
|
||||
}
|
||||
|
||||
if (resource === 'file' && operation === 'upload') {
|
||||
responseData = JSON.parse(responseData);
|
||||
}
|
||||
|
||||
if (resource === 'file' && operation === 'download') {
|
||||
const data = JSON.parse(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(data),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (resource === 'file' && operation === 'download') {
|
||||
const newItem: INodeExecutionData = {
|
||||
json: items[i].json,
|
||||
binary: {},
|
||||
pairedItem: {item: i},
|
||||
};
|
||||
|
||||
if (items[i].binary !== undefined) {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
Object.assign(newItem.binary!, items[i].binary);
|
||||
}
|
||||
|
||||
items[i] = newItem;
|
||||
@@ -987,29 +991,39 @@ export class Dropbox implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
returnData.push(newItem as IDataObject);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(newItem),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else if (resource === 'search' && operation === 'query') {
|
||||
let data = responseData;
|
||||
if (returnAll === true) {
|
||||
returnData.push.apply(
|
||||
returnData,
|
||||
simple === true ? simplify(responseData) : responseData,
|
||||
);
|
||||
data = (simple === true) ? simplify(responseData) : responseData;
|
||||
} else {
|
||||
returnData.push.apply(
|
||||
returnData,
|
||||
simple === true ? simplify(responseData[property]) : responseData[property],
|
||||
);
|
||||
data = (simple === true) ? simplify(responseData[property]) : responseData[property];
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(data),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
if (resource === 'file' && operation === 'download') {
|
||||
items[i].json = { error: error.message };
|
||||
} else {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json: { error: error.message }});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -1022,7 +1036,7 @@ export class Dropbox implements INodeType {
|
||||
return this.prepareOutputData(items);
|
||||
} else {
|
||||
// For all other ones does the output items get replaced
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ export class ERPNext implements INodeType {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
let responseData;
|
||||
|
||||
const body: IDataObject = {};
|
||||
@@ -282,10 +282,12 @@ export class ERPNext implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ export class Egoi implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
let responseData;
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const items = this.getInputData();
|
||||
const length = items.length;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -739,19 +739,21 @@ export class Egoi implements INodeType {
|
||||
throw error;
|
||||
} else {
|
||||
// Return the actual reason as error
|
||||
returnData.push({
|
||||
error: error.message,
|
||||
});
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ export class ElasticSecurity implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -573,18 +573,24 @@ export class ElasticSecurity implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ export class Elasticsearch implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as 'document' | 'index';
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -329,11 +329,13 @@ export class Elasticsearch implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ export class Emelia implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
@@ -134,7 +134,13 @@ export class Emelia implements INodeType {
|
||||
},
|
||||
});
|
||||
|
||||
returnData.push({ contactId: responseData.data.addContactToCampaignHook });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({
|
||||
contactId: responseData.data.addContactToCampaignHook,
|
||||
}),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// campaign: create
|
||||
@@ -159,7 +165,11 @@ export class Emelia implements INodeType {
|
||||
},
|
||||
});
|
||||
|
||||
returnData.push(responseData.data.createCampaign);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.data.createCampaign),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// campaign: get
|
||||
@@ -200,7 +210,11 @@ export class Emelia implements INodeType {
|
||||
},
|
||||
});
|
||||
|
||||
returnData.push(responseData.data.campaign);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData.data.campaign),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// campaign: getAll
|
||||
@@ -238,7 +252,11 @@ export class Emelia implements INodeType {
|
||||
campaigns = campaigns.slice(0, limit);
|
||||
}
|
||||
|
||||
returnData.push(...campaigns);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(campaigns),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'pause') {
|
||||
// ----------------------------------
|
||||
// campaign: pause
|
||||
@@ -255,7 +273,11 @@ export class Emelia implements INodeType {
|
||||
},
|
||||
});
|
||||
|
||||
returnData.push({ success: true });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'start') {
|
||||
// ----------------------------------
|
||||
// campaign: start
|
||||
@@ -272,7 +294,11 @@ export class Emelia implements INodeType {
|
||||
},
|
||||
});
|
||||
|
||||
returnData.push({ success: true });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'duplicate') {
|
||||
// ----------------------------------
|
||||
// campaign: duplicate
|
||||
@@ -313,7 +339,11 @@ export class Emelia implements INodeType {
|
||||
variables,
|
||||
});
|
||||
|
||||
returnData.push({ _id: duplicateCampaign });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ _id: duplicateCampaign }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else if (resource === 'contactList') {
|
||||
// **********************************
|
||||
@@ -360,7 +390,11 @@ export class Emelia implements INodeType {
|
||||
},
|
||||
});
|
||||
|
||||
returnData.push({ contactId: responseData.data.addContactsToListHook });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ contactId: responseData.data.addContactsToListHook }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// contactList: getAll
|
||||
@@ -389,18 +423,26 @@ export class Emelia implements INodeType {
|
||||
contactLists = contactLists.slice(0, limit);
|
||||
}
|
||||
|
||||
returnData.push(...contactLists);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(contactLists),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export class Flow implements INodeType {
|
||||
const credentials = await this.getCredentials('flowApi');
|
||||
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
@@ -258,16 +258,17 @@ export class Flow implements INodeType {
|
||||
responseData = responseData.tasks;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
throw new NodeApiError(this.getNode(), error, { itemIndex: i });
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1093,7 +1093,7 @@ export class Freshdesk implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
@@ -1407,25 +1407,29 @@ export class Freshdesk implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
if (responseData === undefined) {
|
||||
responseData = {
|
||||
success: true,
|
||||
};
|
||||
}
|
||||
|
||||
returnData.push(responseData as IDataObject);
|
||||
if (!Array.isArray(responseData) && responseData === undefined) {
|
||||
responseData = {
|
||||
success: true,
|
||||
};
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ export class Freshservice implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -1230,7 +1230,7 @@ export class Freshservice implements INodeType {
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
if (Object.keys(additionalFields).length) {
|
||||
Object.assign(body.application, additionalFields);
|
||||
Object.assign(body.application!, additionalFields);
|
||||
}
|
||||
|
||||
responseData = await freshserviceApiRequest.call(this, 'POST', '/applications', body);
|
||||
@@ -1266,7 +1266,7 @@ export class Freshservice implements INodeType {
|
||||
|
||||
validateUpdateFields.call(this, updateFields, resource);
|
||||
|
||||
Object.assign(body.application, updateFields);
|
||||
Object.assign(body.application!, updateFields);
|
||||
|
||||
const softwareId = this.getNodeParameter('softwareId', i);
|
||||
const endpoint = `/applications/${softwareId}`;
|
||||
@@ -1375,17 +1375,23 @@ export class Freshservice implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ export class FreshworksCrm implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -979,17 +979,23 @@ export class FreshworksCrm implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ json: { error: error.message } });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ export class GetResponse implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -292,19 +292,23 @@ export class GetResponse implements INodeType {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ export class Ghost implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const timezone = this.getTimezone();
|
||||
const qs: IDataObject = {};
|
||||
@@ -127,6 +127,7 @@ export class Ghost implements INodeType {
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
const source = this.getNodeParameter('source', 0) as string;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
if (source === 'contentApi') {
|
||||
@@ -147,9 +148,9 @@ export class Ghost implements INodeType {
|
||||
} else {
|
||||
endpoint = `/content/posts/${identifier}`;
|
||||
}
|
||||
responseData = await ghostApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
|
||||
returnData.push.apply(returnData, responseData.posts);
|
||||
responseData = await ghostApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
responseData = responseData.posts;
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
@@ -173,8 +174,6 @@ export class Ghost implements INodeType {
|
||||
responseData = await ghostApiRequest.call(this, 'GET', '/content/posts', {}, qs);
|
||||
responseData = responseData.posts;
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,16 +229,13 @@ export class Ghost implements INodeType {
|
||||
{ posts: [post] },
|
||||
qs,
|
||||
);
|
||||
|
||||
returnData.push.apply(returnData, responseData.posts);
|
||||
responseData = responseData.posts;
|
||||
}
|
||||
|
||||
if (operation === 'delete') {
|
||||
const postId = this.getNodeParameter('postId', i) as string;
|
||||
|
||||
responseData = await ghostApiRequest.call(this, 'DELETE', `/admin/posts/${postId}`);
|
||||
|
||||
returnData.push({ success: true });
|
||||
}
|
||||
|
||||
if (operation === 'get') {
|
||||
@@ -259,8 +255,7 @@ export class Ghost implements INodeType {
|
||||
endpoint = `/admin/posts/${identifier}`;
|
||||
}
|
||||
responseData = await ghostApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
|
||||
returnData.push.apply(returnData, responseData.posts);
|
||||
responseData = responseData.posts;
|
||||
}
|
||||
|
||||
if (operation === 'getAll') {
|
||||
@@ -284,8 +279,6 @@ export class Ghost implements INodeType {
|
||||
responseData = await ghostApiRequest.call(this, 'GET', '/admin/posts', {}, qs);
|
||||
responseData = responseData.posts;
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
|
||||
if (operation === 'update') {
|
||||
@@ -343,19 +336,30 @@ export class Ghost implements INodeType {
|
||||
{ posts: [post] },
|
||||
qs,
|
||||
);
|
||||
|
||||
returnData.push.apply(returnData, responseData.posts);
|
||||
responseData = responseData.posts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
responseData = this.helpers.returnJsonArray(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IPairedItemData,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
@@ -1609,7 +1610,7 @@ export class Github implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
let returnAll = false;
|
||||
|
||||
@@ -2102,6 +2103,7 @@ export class Github implements INodeType {
|
||||
});
|
||||
}
|
||||
|
||||
const asBinaryProperty = this.getNodeParameter('asBinaryProperty', i, false) as boolean;
|
||||
if (returnAll === true) {
|
||||
responseData = await githubApiRequestAllItems.call(
|
||||
this,
|
||||
@@ -2115,10 +2117,8 @@ export class Github implements INodeType {
|
||||
}
|
||||
|
||||
if (fullOperation === 'file:get') {
|
||||
const asBinaryProperty = this.getNodeParameter('asBinaryProperty', i);
|
||||
|
||||
if (asBinaryProperty === true) {
|
||||
if (Array.isArray(responseData)) {
|
||||
if (Array.isArray(responseData) && responseData.length > 1) {
|
||||
throw new NodeOperationError(this.getNode(), 'File Path is a folder, not a file.', {
|
||||
itemIndex: i,
|
||||
});
|
||||
@@ -2135,27 +2135,34 @@ export class Github implements INodeType {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
Object.assign(newItem.binary as object, items[i].binary!);
|
||||
}
|
||||
|
||||
const { content, path } = responseData[i].json;
|
||||
newItem.binary![binaryPropertyName] = await this.helpers.prepareBinaryData(
|
||||
Buffer.from(responseData.content, 'base64'),
|
||||
responseData.path,
|
||||
Buffer.from(content as string, 'base64'),
|
||||
path as string,
|
||||
);
|
||||
|
||||
items[i] = newItem;
|
||||
|
||||
return this.prepareOutputData(items);
|
||||
return [items];
|
||||
}
|
||||
}
|
||||
|
||||
if (fullOperation === 'release:delete') {
|
||||
responseData = { success: true };
|
||||
}
|
||||
|
||||
if (overwriteDataOperations.includes(fullOperation)) {
|
||||
returnData.push(responseData);
|
||||
} else if (overwriteDataOperationsArray.includes(fullOperation)) {
|
||||
returnData.push.apply(returnData, responseData);
|
||||
if (
|
||||
overwriteDataOperations.includes(fullOperation) ||
|
||||
overwriteDataOperationsArray.includes(fullOperation)
|
||||
) {
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
@@ -2163,7 +2170,17 @@ export class Github implements INodeType {
|
||||
overwriteDataOperations.includes(fullOperation) ||
|
||||
overwriteDataOperationsArray.includes(fullOperation)
|
||||
) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
[
|
||||
{
|
||||
json: {
|
||||
error: error.message,
|
||||
},
|
||||
},
|
||||
],
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
} else {
|
||||
items[i].json = { error: error.message };
|
||||
}
|
||||
@@ -2178,10 +2195,10 @@ export class Github implements INodeType {
|
||||
overwriteDataOperationsArray.includes(fullOperation)
|
||||
) {
|
||||
// Return data gets replaced
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
} else {
|
||||
// For all other ones simply return the unchanged items
|
||||
return this.prepareOutputData(items);
|
||||
return [items];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -976,7 +976,7 @@ export class Gitlab implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
let credentials;
|
||||
|
||||
@@ -1232,7 +1232,9 @@ export class Gitlab implements INodeType {
|
||||
endpoint = `/users/${owner}/projects`;
|
||||
}
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`);
|
||||
throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
|
||||
itemIndex: i,
|
||||
});
|
||||
}
|
||||
|
||||
if (returnAll === true) {
|
||||
@@ -1247,18 +1249,22 @@ export class Gitlab implements INodeType {
|
||||
responseData = await gitlabApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
}
|
||||
|
||||
if (overwriteDataOperations.includes(fullOperation)) {
|
||||
returnData.push(responseData);
|
||||
} else if (overwriteDataOperationsArray.includes(fullOperation)) {
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
if (
|
||||
overwriteDataOperations.includes(fullOperation) ||
|
||||
overwriteDataOperationsArray.includes(fullOperation)
|
||||
) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
} else {
|
||||
items[i].json = { error: error.message };
|
||||
}
|
||||
@@ -1273,7 +1279,7 @@ export class Gitlab implements INodeType {
|
||||
overwriteDataOperationsArray.includes(fullOperation)
|
||||
) {
|
||||
// Return data gets replaced
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
} else {
|
||||
// For all other ones simply return the unchanged items
|
||||
return this.prepareOutputData(items);
|
||||
|
||||
@@ -154,7 +154,7 @@ export class GoToWebinar implements INodeType {
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
let responseData;
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const { oauthTokenData } = (await this.getCredentials('goToWebinarOAuth2Api')) as {
|
||||
oauthTokenData: { account_key: string; organizer_key: string };
|
||||
@@ -636,18 +636,25 @@ export class GoToWebinar implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ export class GoogleAnalytics implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
@@ -276,19 +276,24 @@ export class GoogleAnalytics implements INodeType {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ export class GoogleBigQuery implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -192,7 +192,7 @@ export class GoogleBigQuery implements INodeType {
|
||||
returnData.push(responseData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ json: { error: error.message } });
|
||||
} else {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
@@ -226,13 +226,6 @@ export class GoogleBigQuery implements INodeType {
|
||||
const options = this.getNodeParameter('options', i) as IDataObject;
|
||||
Object.assign(qs, options);
|
||||
|
||||
// if (qs.useInt64Timestamp !== undefined) {
|
||||
// qs.formatOptions = {
|
||||
// useInt64Timestamp: qs.useInt64Timestamp,
|
||||
// };
|
||||
// delete qs.useInt64Timestamp;
|
||||
// }
|
||||
|
||||
if (qs.selectedFields) {
|
||||
fields = (qs.selectedFields as string).split(',');
|
||||
}
|
||||
@@ -246,10 +239,6 @@ export class GoogleBigQuery implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push.apply(
|
||||
returnData,
|
||||
simple ? simplify(responseData, fields) : responseData,
|
||||
);
|
||||
} else {
|
||||
qs.maxResults = this.getNodeParameter('limit', i) as number;
|
||||
responseData = await googleApiRequest.call(
|
||||
@@ -259,22 +248,30 @@ export class GoogleBigQuery implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push.apply(
|
||||
returnData,
|
||||
simple ? simplify(responseData.rows, fields) : responseData.rows,
|
||||
);
|
||||
}
|
||||
|
||||
responseData = simple ? simplify(responseData.rows, fields) : responseData.rows;
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
throw new NodeApiError(this.getNode(), error, { itemIndex: i });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ export class GoogleBooks implements INodeType {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const length = items.length;
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
const qs: IDataObject = {};
|
||||
@@ -499,19 +499,24 @@ export class GoogleBooks implements INodeType {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(responseData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ export class GoogleCalendar implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -188,7 +188,9 @@ export class GoogleCalendar implements INodeType {
|
||||
);
|
||||
|
||||
if (responseData.calendars[calendarId].errors) {
|
||||
throw new NodeApiError(this.getNode(), responseData.calendars[calendarId]);
|
||||
throw new NodeApiError(this.getNode(), responseData.calendars[calendarId], {
|
||||
itemIndex: i,
|
||||
});
|
||||
}
|
||||
|
||||
if (outputFormat === 'availability') {
|
||||
@@ -580,23 +582,24 @@ export class GoogleCalendar implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail() !== true) {
|
||||
throw error;
|
||||
} else {
|
||||
// Return the actual reason as error
|
||||
returnData.push({
|
||||
error: (error as JsonObject).message,
|
||||
});
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ export class GoogleChat implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -239,7 +239,7 @@ export class GoogleChat implements INodeType {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
Object.assign(newItem.binary!, items[i].binary);
|
||||
}
|
||||
|
||||
items[i] = newItem;
|
||||
@@ -535,18 +535,23 @@ export class GoogleChat implements INodeType {
|
||||
responseData = await googleApiRequest.call(this, 'POST', '', body, qs, uri, true);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
// Return the actual reason as error
|
||||
if (operation === 'download') {
|
||||
items[i].json = { error: error.message };
|
||||
} else {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -559,7 +564,7 @@ export class GoogleChat implements INodeType {
|
||||
return this.prepareOutputData(items);
|
||||
} else {
|
||||
// For all other ones does the output get replaced
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
import { contactFields, contactOperations } from './ContactDescription';
|
||||
|
||||
import moment from 'moment';
|
||||
import { IData } from '../Analytics/Interfaces';
|
||||
|
||||
export class GoogleContacts implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -88,7 +87,7 @@ export class GoogleContacts implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -504,19 +503,25 @@ export class GoogleContacts implements INodeType {
|
||||
responseData.contactId = responseData.resourceName.split('/')[1];
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ export class GoogleDocs implements INodeType {
|
||||
};
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
|
||||
let responseData;
|
||||
@@ -503,17 +503,23 @@ export class GoogleDocs implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1930,7 +1930,7 @@ export class GoogleDrive implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -1963,11 +1963,14 @@ export class GoogleDrive implements INodeType {
|
||||
|
||||
Object.assign(body, options);
|
||||
|
||||
const response = await googleApiRequest.call(this, 'POST', `/drive/v3/drives`, body, {
|
||||
requestId: uuid(),
|
||||
});
|
||||
const response = await googleApiRequest.call(this, 'POST', `/drive/v3/drives`, body, { requestId: uuid() });
|
||||
|
||||
returnData.push(response as IDataObject);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
@@ -1978,7 +1981,12 @@ export class GoogleDrive implements INodeType {
|
||||
|
||||
await googleApiRequest.call(this, 'DELETE', `/drive/v3/drives/${driveId}`);
|
||||
|
||||
returnData.push({ success: true });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
@@ -1991,15 +1999,14 @@ export class GoogleDrive implements INodeType {
|
||||
|
||||
Object.assign(qs, options);
|
||||
|
||||
const response = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/drive/v3/drives/${driveId}`,
|
||||
{},
|
||||
qs,
|
||||
const response = await googleApiRequest.call(this, 'GET', `/drive/v3/drives/${driveId}`, {}, qs);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(response as IDataObject);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (operation === 'list') {
|
||||
// ----------------------------------
|
||||
@@ -2028,7 +2035,12 @@ export class GoogleDrive implements INodeType {
|
||||
response = data.drives as IDataObject[];
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, response);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
@@ -2041,14 +2053,14 @@ export class GoogleDrive implements INodeType {
|
||||
|
||||
Object.assign(body, options);
|
||||
|
||||
const response = await googleApiRequest.call(
|
||||
this,
|
||||
'PATCH',
|
||||
`/drive/v3/drives/${driveId}`,
|
||||
body,
|
||||
const response = await googleApiRequest.call(this, 'PATCH', `/drive/v3/drives/${driveId}`, body);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(response as IDataObject);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
if (resource === 'file') {
|
||||
@@ -2074,15 +2086,14 @@ export class GoogleDrive implements INodeType {
|
||||
supportsAllDrives: true,
|
||||
};
|
||||
|
||||
const response = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/drive/v3/files/${fileId}/copy`,
|
||||
body,
|
||||
qs,
|
||||
const response = await googleApiRequest.call(this, 'POST', `/drive/v3/files/${fileId}/copy`, body, qs);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(response as IDataObject);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'download') {
|
||||
// ----------------------------------
|
||||
// download
|
||||
@@ -2281,11 +2292,16 @@ export class GoogleDrive implements INodeType {
|
||||
|
||||
const version = this.getNode().typeVersion;
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(files),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
if (version === 1) {
|
||||
return [this.helpers.returnJsonArray(files as IDataObject[])];
|
||||
} else {
|
||||
returnData.push(...files);
|
||||
return [executionData];
|
||||
}
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'upload') {
|
||||
// ----------------------------------
|
||||
// upload
|
||||
@@ -2416,7 +2432,11 @@ export class GoogleDrive implements INodeType {
|
||||
);
|
||||
}
|
||||
|
||||
returnData.push(response as IDataObject);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// file:update
|
||||
@@ -2454,7 +2474,12 @@ export class GoogleDrive implements INodeType {
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
returnData.push(responseData as IDataObject);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
if (resource === 'folder') {
|
||||
@@ -2478,7 +2503,11 @@ export class GoogleDrive implements INodeType {
|
||||
|
||||
const response = await googleApiRequest.call(this, 'POST', '/drive/v3/files', body, qs);
|
||||
|
||||
returnData.push(response as IDataObject);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
if (['file', 'folder'].includes(resource)) {
|
||||
@@ -2498,10 +2527,15 @@ export class GoogleDrive implements INodeType {
|
||||
);
|
||||
|
||||
// If we are still here it did succeed
|
||||
returnData.push({
|
||||
fileId,
|
||||
success: true,
|
||||
});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({
|
||||
fileId,
|
||||
success: true,
|
||||
}),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (operation === 'share') {
|
||||
const fileId = this.getNodeParameter('fileId', i) as string;
|
||||
@@ -2530,7 +2564,11 @@ export class GoogleDrive implements INodeType {
|
||||
qs,
|
||||
);
|
||||
|
||||
returnData.push(response as IDataObject);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(response),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -2538,7 +2576,7 @@ export class GoogleDrive implements INodeType {
|
||||
if (resource === 'file' && operation === 'download') {
|
||||
items[i].json = { error: error.message };
|
||||
} else {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({ json: {error: error.message} });
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -2550,7 +2588,7 @@ export class GoogleDrive implements INodeType {
|
||||
return this.prepareOutputData(items);
|
||||
} else {
|
||||
// For all other ones does the output items get replaced
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
let responseData;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -120,18 +120,20 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
return element;
|
||||
});
|
||||
|
||||
if (simple === false) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push.apply(
|
||||
returnData,
|
||||
responseData
|
||||
.map((element: IDataObject) => {
|
||||
return fullDocumentToJson(element.found as IDataObject);
|
||||
})
|
||||
.filter((el: IDataObject) => !!el),
|
||||
);
|
||||
if (simple) {
|
||||
responseData = responseData
|
||||
.map((element: IDataObject) => {
|
||||
return fullDocumentToJson(element.found as IDataObject);
|
||||
})
|
||||
.filter((el: IDataObject) => !!el);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
const projectId = this.getNodeParameter('projectId', 0) as string;
|
||||
const database = this.getNodeParameter('database', 0) as string;
|
||||
@@ -162,11 +164,16 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
|
||||
responseData.id = (responseData.name as string).split('/').pop();
|
||||
|
||||
if (simple === false) {
|
||||
returnData.push(responseData);
|
||||
} else {
|
||||
returnData.push(fullDocumentToJson(responseData as IDataObject));
|
||||
if (simple) {
|
||||
responseData = fullDocumentToJson(responseData);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}),
|
||||
);
|
||||
} else if (operation === 'getAll') {
|
||||
@@ -194,21 +201,25 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
)) as IDataObject;
|
||||
responseData = getAllResponse.documents;
|
||||
}
|
||||
|
||||
responseData = responseData.map((element: IDataObject) => {
|
||||
element.id = (element.name as string).split('/').pop();
|
||||
return element;
|
||||
});
|
||||
if (simple === false) {
|
||||
returnData.push.apply(returnData, responseData);
|
||||
} else {
|
||||
returnData.push.apply(
|
||||
returnData,
|
||||
responseData.map((element: IDataObject) => fullDocumentToJson(element as IDataObject)),
|
||||
|
||||
if (simple) {
|
||||
responseData = responseData.map((element: IDataObject) =>
|
||||
fullDocumentToJson(element as IDataObject),
|
||||
);
|
||||
}
|
||||
} else if (operation === 'delete') {
|
||||
const responseData: IDataObject[] = [];
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
await Promise.all(
|
||||
items.map(async (item: IDataObject, i: number) => {
|
||||
const projectId = this.getNodeParameter('projectId', i) as string;
|
||||
@@ -222,10 +233,14 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
`/${projectId}/databases/${database}/documents/${collection}/${documentId}`,
|
||||
);
|
||||
|
||||
responseData.push({ success: true });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}),
|
||||
);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
} else if (operation === 'upsert') {
|
||||
const projectId = this.getNodeParameter('projectId', 0) as string;
|
||||
const database = this.getNodeParameter('database', 0) as string;
|
||||
@@ -272,10 +287,14 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
for (let i = 0; i < writeResults.length; i++) {
|
||||
writeResults[i]['status'] = status[i];
|
||||
Object.assign(writeResults[i], items[i].json);
|
||||
responseData.push(writeResults[i]);
|
||||
}
|
||||
|
||||
returnData.push.apply(returnData, responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(writeResults[i]),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
// } else if (operation === 'update') {
|
||||
// const projectId = this.getNodeParameter('projectId', 0) as string;
|
||||
@@ -333,19 +352,20 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
},
|
||||
);
|
||||
|
||||
if (simple === false) {
|
||||
returnData.push.apply(returnData, responseData);
|
||||
} else {
|
||||
//@ts-ignore
|
||||
returnData.push.apply(
|
||||
returnData,
|
||||
responseData
|
||||
.map((element: IDataObject) => {
|
||||
return fullDocumentToJson(element.document as IDataObject);
|
||||
})
|
||||
.filter((element: IDataObject) => !!element),
|
||||
);
|
||||
if (simple) {
|
||||
responseData = responseData
|
||||
.map((element: IDataObject) => {
|
||||
return fullDocumentToJson(element.document as IDataObject);
|
||||
})
|
||||
.filter((element: IDataObject) => !!element);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -376,10 +396,16 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||
// @ts-ignore
|
||||
responseData = getAllResponse.collectionIds.map((o) => ({ name: o }));
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ export class GoogleFirebaseRealtimeDatabase implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -228,21 +228,29 @@ export class GoogleFirebaseRealtimeDatabase implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (typeof responseData === 'string' || typeof responseData === 'number') {
|
||||
returnData.push({
|
||||
|
||||
if (typeof responseData === 'string' || typeof responseData === 'number') {
|
||||
responseData = {
|
||||
[this.getNodeParameter('path', i) as string]: responseData,
|
||||
} as IDataObject);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
};
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ export class GSuiteAdmin implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -419,14 +419,15 @@ export class GSuiteAdmin implements INodeType {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ export class Gmail implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
@@ -817,23 +817,25 @@ export class Gmail implements INodeType {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
|
||||
let executionData = responseData as INodeExecutionData[];
|
||||
if (!['draft', 'message'].includes(resource) && !['get', 'getAll'].includes(operation)) {
|
||||
executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
}
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json:{ error: error.message }});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
if (['draft', 'message'].includes(resource) && ['get', 'getAll'].includes(operation)) {
|
||||
//@ts-ignore
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ export class GooglePerspective implements INodeType {
|
||||
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
let responseData;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
@@ -260,17 +260,24 @@ export class GooglePerspective implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(responseData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,7 +411,12 @@ export class GoogleSlides implements INodeType {
|
||||
'GET',
|
||||
`/presentations/${presentationId}/pages/${pageObjectId}`,
|
||||
);
|
||||
returnData.push({ json: responseData });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getThumbnail') {
|
||||
// ----------------------------------
|
||||
// page: getThumbnail
|
||||
@@ -438,14 +443,26 @@ export class GoogleSlides implements INodeType {
|
||||
|
||||
const fileName = pageObjectId + '.png';
|
||||
const binaryData = await this.helpers.prepareBinaryData(data, fileName || fileName);
|
||||
returnData.push({
|
||||
json: responseData,
|
||||
binary: {
|
||||
[binaryProperty]: binaryData,
|
||||
},
|
||||
});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
[
|
||||
{
|
||||
json: responseData,
|
||||
binary: {
|
||||
[binaryProperty]: binaryData,
|
||||
},
|
||||
},
|
||||
],
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
returnData.push({ json: responseData });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
} else if (resource === 'presentation') {
|
||||
@@ -463,7 +480,13 @@ export class GoogleSlides implements INodeType {
|
||||
};
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'POST', '/presentations', body);
|
||||
returnData.push({ json: responseData });
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// presentation: get
|
||||
@@ -475,7 +498,13 @@ export class GoogleSlides implements INodeType {
|
||||
'GET',
|
||||
`/presentations/${presentationId}`,
|
||||
);
|
||||
returnData.push({ json: responseData });
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getSlides') {
|
||||
// ----------------------------------
|
||||
// presentation: getSlides
|
||||
@@ -494,7 +523,13 @@ export class GoogleSlides implements INodeType {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
responseData = responseData.slice(0, limit);
|
||||
}
|
||||
returnData.push(...this.helpers.returnJsonArray(responseData));
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'replaceText') {
|
||||
// ----------------------------------
|
||||
// presentation: replaceText
|
||||
@@ -531,18 +566,28 @@ export class GoogleSlides implements INodeType {
|
||||
`/presentations/${presentationId}:batchUpdate`,
|
||||
{ requests },
|
||||
);
|
||||
returnData.push({ json: responseData });
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ json: { error: error.message } });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [returnData];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ export class GoogleTasks implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -251,19 +251,26 @@ export class GoogleTasks implements INodeType {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ export class GoogleTranslate implements INodeType {
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
const responseData = [];
|
||||
const responseData: INodeExecutionData[] = [];
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (resource === 'language') {
|
||||
if (operation === 'translate') {
|
||||
@@ -198,10 +198,19 @@ export class GoogleTranslate implements INodeType {
|
||||
q: text,
|
||||
target: translateTo,
|
||||
});
|
||||
responseData.push(response.data.translations[0]);
|
||||
|
||||
const [translation] = response.data.translations;
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(translation),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
responseData.push(...executionData);
|
||||
}
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(responseData)];
|
||||
|
||||
return this.prepareOutputData(responseData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ export class YouTube implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -1099,17 +1099,24 @@ export class YouTube implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ export class Gotify implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -207,19 +207,21 @@ export class Gotify implements INodeType {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json:{ error: error.message }});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,6 +324,7 @@ export class GraphQL implements INodeType {
|
||||
let requestOptions: OptionsWithUri & RequestPromiseOptions;
|
||||
|
||||
const returnItems: INodeExecutionData[] = [];
|
||||
const responseData: IDataObject | IDataObject[] = [];
|
||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||
try {
|
||||
const requestMethod = this.getNodeParameter('requestMethod', itemIndex, 'POST') as string;
|
||||
@@ -334,7 +335,6 @@ export class GraphQL implements INodeType {
|
||||
'graphql',
|
||||
) as string;
|
||||
const responseFormat = this.getNodeParameter('responseFormat', 0) as string;
|
||||
|
||||
const { parameter }: { parameter?: Array<{ name: string; value: string }> } =
|
||||
this.getNodeParameter('headerParametersUi', itemIndex, {}) as IDataObject;
|
||||
const headerParameters = (parameter || []).reduce(
|
||||
@@ -433,8 +433,7 @@ export class GraphQL implements INodeType {
|
||||
}
|
||||
if (responseFormat === 'string') {
|
||||
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0) as string;
|
||||
|
||||
returnItems.push({
|
||||
responseData.push({
|
||||
json: {
|
||||
[dataPropertyName]: response,
|
||||
},
|
||||
@@ -458,12 +457,23 @@ export class GraphQL implements INodeType {
|
||||
'Unexpected error';
|
||||
throw new NodeApiError(this.getNode(), response.errors, { message });
|
||||
}
|
||||
|
||||
returnItems.push({ json: response });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: itemIndex } },
|
||||
);
|
||||
returnItems.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnItems.push({ json: { error: (error as JsonObject).message } });
|
||||
const errorData = this.helpers.returnJsonArray({
|
||||
$error: error,
|
||||
json: this.getInputData(itemIndex),
|
||||
itemIndex,
|
||||
});
|
||||
const exectionErrorWithMetaData = this.helpers.constructExecutionMetaData(errorData, {
|
||||
itemData: { item: itemIndex },
|
||||
});
|
||||
returnItems.push(...exectionErrorWithMetaData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
|
||||
@@ -263,7 +263,7 @@ export class HackerNews implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -342,20 +342,25 @@ export class HackerNews implements INodeType {
|
||||
delete responseData.children;
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ export class HaloPSA implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
let responseData;
|
||||
|
||||
const tokens = await getAccessTokens.call(this);
|
||||
@@ -664,20 +664,25 @@ export class HaloPSA implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ export class Harvest implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -229,13 +229,23 @@ export class Harvest implements INodeType {
|
||||
endpoint = `time_entries/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'time_entries', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'createByStartEnd') {
|
||||
// ----------------------------------
|
||||
// createByStartEnd
|
||||
@@ -258,7 +268,12 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'createByDuration') {
|
||||
// ----------------------------------
|
||||
// createByDuration
|
||||
@@ -281,7 +296,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -292,7 +313,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `time_entries/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'deleteExternal') {
|
||||
// ----------------------------------
|
||||
// deleteExternal
|
||||
@@ -303,7 +330,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `time_entries/${id}/external_reference`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'restartTime') {
|
||||
// ----------------------------------
|
||||
// restartTime
|
||||
@@ -314,7 +347,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `time_entries/${id}/restart`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'stopTime') {
|
||||
// ----------------------------------
|
||||
// stopTime
|
||||
@@ -325,7 +364,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `time_entries/${id}/stop`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -345,7 +390,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -365,14 +416,26 @@ export class Harvest implements INodeType {
|
||||
endpoint = `clients/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'clients', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -393,7 +456,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -413,7 +482,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -424,7 +499,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `clients/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -444,14 +525,26 @@ export class Harvest implements INodeType {
|
||||
endpoint = `projects/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'projects', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -476,7 +569,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -496,7 +595,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -507,7 +612,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `projects/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -527,14 +638,26 @@ export class Harvest implements INodeType {
|
||||
endpoint = `users/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'users', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'me') {
|
||||
// ----------------------------------
|
||||
// me
|
||||
@@ -545,7 +668,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `users/me`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -568,7 +697,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -588,7 +723,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -599,7 +740,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `users/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -619,14 +766,26 @@ export class Harvest implements INodeType {
|
||||
endpoint = `contacts/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'contacts', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -648,7 +807,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -668,7 +833,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -679,7 +850,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `contacts/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -697,7 +874,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `company`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -717,14 +900,26 @@ export class Harvest implements INodeType {
|
||||
endpoint = `tasks/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'tasks', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -745,7 +940,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -765,7 +966,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -776,7 +983,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `tasks/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -796,14 +1009,26 @@ export class Harvest implements INodeType {
|
||||
endpoint = `invoices/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'invoices', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -824,7 +1049,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -844,7 +1075,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -855,7 +1092,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `invoices/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -875,14 +1118,26 @@ export class Harvest implements INodeType {
|
||||
endpoint = `expenses/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'expenses', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -905,7 +1160,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -925,7 +1186,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -936,7 +1203,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `expenses/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -956,14 +1229,26 @@ export class Harvest implements INodeType {
|
||||
endpoint = `estimates/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// getAll
|
||||
// ----------------------------------
|
||||
|
||||
const responseData: IDataObject[] = await getAllResource.call(this, 'estimates', i);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// create
|
||||
@@ -984,7 +1269,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -1004,7 +1295,13 @@ export class Harvest implements INodeType {
|
||||
endpoint,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -1015,7 +1312,13 @@ export class Harvest implements INodeType {
|
||||
endpoint = `estimates/${id}`;
|
||||
|
||||
const responseData = await harvestApiRequest.call(this, requestMethod, qs, endpoint);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -1030,13 +1333,18 @@ export class Harvest implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ export class HelpScout implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -559,17 +559,24 @@ export class HelpScout implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -929,7 +929,7 @@ export class Hubspot implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
@@ -979,7 +979,7 @@ export class Hubspot implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
returnData.push({ json: { error: (error as JsonObject).message } });
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
@@ -1367,6 +1367,10 @@ 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') {
|
||||
@@ -1402,6 +1406,10 @@ 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') {
|
||||
@@ -1462,6 +1470,10 @@ 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
|
||||
@@ -1956,6 +1968,10 @@ 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') {
|
||||
@@ -1984,6 +2000,10 @@ 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') {
|
||||
@@ -2010,6 +2030,10 @@ 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') {
|
||||
@@ -2194,6 +2218,10 @@ 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;
|
||||
@@ -2224,6 +2252,10 @@ 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;
|
||||
@@ -2283,6 +2315,10 @@ 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') {
|
||||
@@ -2369,6 +2405,10 @@ 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
|
||||
@@ -2723,20 +2763,20 @@ export class Hubspot implements INodeType {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
returnData.push({ json: { error: (error as JsonObject).message } });
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ export class Hunter implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -359,19 +359,26 @@ export class Hunter implements INodeType {
|
||||
responseData = await hunterApiRequest.call(this, 'GET', '/email-verifier', {}, qs);
|
||||
responseData = responseData.data;
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ export class Intercom implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let qs: IDataObject;
|
||||
let responseData;
|
||||
@@ -613,19 +613,26 @@ export class Intercom implements INodeType {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ export class InvoiceNinja implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
@@ -883,19 +883,26 @@ export class InvoiceNinja implements INodeType {
|
||||
responseData = responseData.data;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ export class Jira implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
@@ -547,7 +547,13 @@ export class Jira implements INodeType {
|
||||
}
|
||||
body.fields = fields;
|
||||
responseData = await jiraSoftwareCloudApiRequest.call(this, '/api/2/issue', 'POST', body);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-put
|
||||
@@ -655,7 +661,12 @@ export class Jira implements INodeType {
|
||||
'PUT',
|
||||
body,
|
||||
);
|
||||
returnData.push({ success: true });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-get
|
||||
@@ -704,9 +715,19 @@ export class Jira implements INodeType {
|
||||
(a, b) => (b === null ? a : b),
|
||||
);
|
||||
}
|
||||
returnData.push(simplifyIssueOutput(responseData));
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(simplifyIssueOutput(responseData)),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -748,7 +769,13 @@ export class Jira implements INodeType {
|
||||
);
|
||||
responseData = responseData.issues;
|
||||
}
|
||||
returnData.push(...responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-changelog-get
|
||||
@@ -774,7 +801,13 @@ export class Jira implements INodeType {
|
||||
);
|
||||
responseData = responseData.values;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-notify-post
|
||||
@@ -874,7 +907,13 @@ export class Jira implements INodeType {
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-transitions-get
|
||||
@@ -899,7 +938,13 @@ export class Jira implements INodeType {
|
||||
qs,
|
||||
);
|
||||
responseData = responseData.transitions;
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-delete
|
||||
@@ -915,7 +960,13 @@ export class Jira implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push({ success: true });
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -965,7 +1016,13 @@ export class Jira implements INodeType {
|
||||
},
|
||||
},
|
||||
);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-attachment-id-delete
|
||||
@@ -979,7 +1036,13 @@ export class Jira implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push({ success: true });
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-attachment-id-get
|
||||
@@ -994,7 +1057,13 @@ export class Jira implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push({ json: responseData });
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (download) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryProperty', 0) as string;
|
||||
@@ -1042,7 +1111,13 @@ export class Jira implements INodeType {
|
||||
responseData = responseData.slice(0, limit);
|
||||
}
|
||||
responseData = responseData.map((data: IDataObject) => ({ json: data }));
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (download) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryProperty', 0) as string;
|
||||
@@ -1130,7 +1205,13 @@ export class Jira implements INodeType {
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-issueIdOrKey-get
|
||||
@@ -1147,7 +1228,13 @@ export class Jira implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-get
|
||||
@@ -1179,7 +1266,13 @@ export class Jira implements INodeType {
|
||||
);
|
||||
responseData = responseData.comments;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-delete
|
||||
@@ -1194,7 +1287,13 @@ export class Jira implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push({ success: true });
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
//https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-put
|
||||
@@ -1251,7 +1350,13 @@ export class Jira implements INodeType {
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1279,7 +1384,13 @@ export class Jira implements INodeType {
|
||||
body,
|
||||
{},
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else if (operation === 'delete') {
|
||||
// https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-delete
|
||||
@@ -1292,7 +1403,13 @@ export class Jira implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push({ success: true });
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ success: true }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else if (operation === 'get') {
|
||||
// https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-get
|
||||
@@ -1312,15 +1429,17 @@ export class Jira implements INodeType {
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resource === 'issueAttachment' && (operation === 'getAll' || operation === 'get')) {
|
||||
return this.prepareOutputData(returnData as unknown as INodeExecutionData[]);
|
||||
} else {
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ export class Keap implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -858,12 +858,15 @@ export class Keap implements INodeType {
|
||||
responseData = await keapApiRequest.call(this, 'POST', '/files', body);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ export class Kitemaker implements INodeType {
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
let responseData;
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
// https://github.com/kitemakerhq/docs/blob/main/kitemaker.graphql
|
||||
|
||||
@@ -193,7 +193,7 @@ export class Kitemaker implements INodeType {
|
||||
query: getOrganization,
|
||||
});
|
||||
|
||||
returnData.push(responseData.data.organization);
|
||||
responseData = responseData.data.organization;
|
||||
}
|
||||
} else if (resource === 'space') {
|
||||
// *********************************************************************
|
||||
@@ -210,7 +210,7 @@ export class Kitemaker implements INodeType {
|
||||
variables: {},
|
||||
});
|
||||
|
||||
returnData.push(...allItems);
|
||||
responseData = allItems;
|
||||
}
|
||||
} else if (resource === 'user') {
|
||||
// *********************************************************************
|
||||
@@ -227,7 +227,7 @@ export class Kitemaker implements INodeType {
|
||||
variables: {},
|
||||
});
|
||||
|
||||
returnData.push(...allItems);
|
||||
responseData = allItems;
|
||||
}
|
||||
} else if (resource === 'workItem') {
|
||||
// *********************************************************************
|
||||
@@ -263,7 +263,7 @@ export class Kitemaker implements INodeType {
|
||||
variables: { input },
|
||||
});
|
||||
|
||||
returnData.push(responseData.data.createWorkItem.workItem);
|
||||
responseData = responseData.data.createWorkItem.workItem;
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// workItem: get
|
||||
@@ -276,7 +276,7 @@ export class Kitemaker implements INodeType {
|
||||
variables: { workItemId },
|
||||
});
|
||||
|
||||
returnData.push(responseData.data.workItem);
|
||||
responseData = responseData.data.workItem;
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// workItem: getAll
|
||||
@@ -289,7 +289,7 @@ export class Kitemaker implements INodeType {
|
||||
},
|
||||
});
|
||||
|
||||
returnData.push(...allItems);
|
||||
responseData = allItems;
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// workItem: update
|
||||
@@ -316,11 +316,18 @@ export class Kitemaker implements INodeType {
|
||||
variables: { input },
|
||||
});
|
||||
|
||||
returnData.push(responseData.data.editWorkItem.workItem);
|
||||
responseData = responseData.data.editWorkItem.workItem;
|
||||
}
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import { IDataObject, ILoadOptionsFunctions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
import {
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
activityFields,
|
||||
@@ -101,7 +107,7 @@ export class Lemlist implements INodeType {
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
let responseData;
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
try {
|
||||
@@ -282,18 +288,25 @@ export class Lemlist implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.toString() });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export class Line implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -143,19 +143,24 @@ export class Line implements INodeType {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ export class Linear implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
@@ -237,21 +237,25 @@ export class Linear implements INodeType {
|
||||
responseData = responseData?.data?.issueUpdate?.issue;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({
|
||||
error: (error as JsonObject).message,
|
||||
});
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ export class Magento2 implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const timezone = this.getTimezone();
|
||||
let responseData;
|
||||
@@ -378,7 +378,7 @@ export class Magento2 implements INodeType {
|
||||
body.password = password;
|
||||
}
|
||||
|
||||
Object.assign(body.customer, rest);
|
||||
Object.assign(body.customer!, rest);
|
||||
|
||||
responseData = await magentoApiRequest.call(this, 'POST', '/rest/V1/customers', body);
|
||||
}
|
||||
@@ -524,7 +524,7 @@ export class Magento2 implements INodeType {
|
||||
body.password = password;
|
||||
}
|
||||
|
||||
Object.assign(body.customer, rest);
|
||||
Object.assign(body.customer!, rest);
|
||||
|
||||
responseData = await magentoApiRequest.call(
|
||||
this,
|
||||
@@ -675,7 +675,7 @@ export class Magento2 implements INodeType {
|
||||
|
||||
body.product!.custom_attributes = customAttributes?.customAttribute || {};
|
||||
|
||||
Object.assign(body.product, rest);
|
||||
Object.assign(body.product!, rest);
|
||||
|
||||
responseData = await magentoApiRequest.call(
|
||||
this,
|
||||
@@ -790,7 +790,7 @@ export class Magento2 implements INodeType {
|
||||
|
||||
body.product!.custom_attributes = customAttributes?.customAttribute || {};
|
||||
|
||||
Object.assign(body.product, rest);
|
||||
Object.assign(body.product!, rest);
|
||||
|
||||
responseData = await magentoApiRequest.call(
|
||||
this,
|
||||
@@ -801,18 +801,25 @@ export class Magento2 implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1674,7 +1674,7 @@ export class Mailchimp implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
@@ -2185,19 +2185,19 @@ export class Mailchimp implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
returnData.push({json:{ error: error.message }});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ export class MailerLite implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -183,17 +183,24 @@ export class MailerLite implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,12 +184,19 @@ export class Mailgun implements INodeType {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
|
||||
returnData.push({
|
||||
json: responseData,
|
||||
});
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: itemIndex } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ json: { error: error.message } });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: itemIndex } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
|
||||
@@ -95,7 +95,7 @@ export class Mailjet implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
@@ -303,19 +303,26 @@ export class Mailjet implements INodeType {
|
||||
responseData = await mailjetApiRequest.call(this, 'POST', '/v4/sms-send', body);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,7 +711,7 @@ export class Mandrill implements INodeType {
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const items = this.getInputData();
|
||||
let responseData;
|
||||
let emailSentResponse;
|
||||
@@ -884,19 +884,25 @@ export class Mandrill implements INodeType {
|
||||
|
||||
responseData = await emailSentResponse;
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export class Marketstack implements INodeType {
|
||||
const operation = this.getNodeParameter('operation', 0) as Operation;
|
||||
|
||||
let responseData: any; // tslint:disable-line: no-any
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
try {
|
||||
@@ -163,17 +163,24 @@ export class Marketstack implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import { INodeExecutionData } from 'n8n-workflow';
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import * as channel from './channel';
|
||||
import * as message from './message';
|
||||
@@ -11,6 +14,7 @@ import { Mattermost } from './Interfaces';
|
||||
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const operationResult: INodeExecutionData[] = [];
|
||||
let responseData: IDataObject | IDataObject[] = [];
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const resource = this.getNodeParameter<Mattermost>('resource', i);
|
||||
@@ -28,14 +32,20 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
|
||||
|
||||
try {
|
||||
if (mattermost.resource === 'channel') {
|
||||
operationResult.push(...(await channel[mattermost.operation].execute.call(this, i)));
|
||||
responseData = await channel[mattermost.operation].execute.call(this, i);
|
||||
} else if (mattermost.resource === 'message') {
|
||||
operationResult.push(...(await message[mattermost.operation].execute.call(this, i)));
|
||||
responseData = await message[mattermost.operation].execute.call(this, i);
|
||||
} else if (mattermost.resource === 'reaction') {
|
||||
operationResult.push(...(await reaction[mattermost.operation].execute.call(this, i)));
|
||||
responseData = await reaction[mattermost.operation].execute.call(this, i);
|
||||
} else if (mattermost.resource === 'user') {
|
||||
operationResult.push(...(await user[mattermost.operation].execute.call(this, i)));
|
||||
responseData = await user[mattermost.operation].execute.call(this, i);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
operationResult.push(...executionData);
|
||||
} catch (err) {
|
||||
if (this.continueOnFail()) {
|
||||
operationResult.push({ json: this.getInputData(i)[0].json, error: err });
|
||||
|
||||
@@ -315,7 +315,7 @@ export class Mautic implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let qs: IDataObject;
|
||||
let responseData;
|
||||
@@ -1018,20 +1018,20 @@ export class Mautic implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
returnData.push({ json: { error: (error as JsonObject).message }});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export class MicrosoftDynamicsCrm implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -277,20 +277,25 @@ export class MicrosoftDynamicsCrm implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push(...responseData);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ export class MicrosoftExcel implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let qs: IDataObject = {};
|
||||
const result: IDataObject[] = [];
|
||||
@@ -235,14 +235,19 @@ export class MicrosoftExcel implements INodeType {
|
||||
{ 'workbook-session-id': id },
|
||||
);
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
@@ -291,14 +296,19 @@ export class MicrosoftExcel implements INodeType {
|
||||
responseData = { [dataProperty]: responseData };
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -361,15 +371,29 @@ export class MicrosoftExcel implements INodeType {
|
||||
for (let y = 0; y < columns.length; y++) {
|
||||
object[columns[y]] = responseData[i].values[0][y];
|
||||
}
|
||||
returnData.push({ ...object });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ ...object }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else {
|
||||
const dataProperty = this.getNodeParameter('dataProperty', i) as string;
|
||||
returnData.push({ [dataProperty]: responseData });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ [dataProperty]: responseData }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -427,16 +451,30 @@ export class MicrosoftExcel implements INodeType {
|
||||
responseData = result.filter((data: IDataObject) => {
|
||||
return data[lookupColumn]?.toString() === lookupValue;
|
||||
});
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} else {
|
||||
responseData = result.find((data: IDataObject) => {
|
||||
return data[lookupColumn]?.toString() === lookupValue;
|
||||
});
|
||||
returnData.push(responseData as IDataObject);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData as IDataObject),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -510,13 +548,27 @@ export class MicrosoftExcel implements INodeType {
|
||||
}
|
||||
|
||||
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(...executionData);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -591,16 +643,30 @@ export class MicrosoftExcel implements INodeType {
|
||||
for (let y = 0; y < keyValues.length; y++) {
|
||||
object[keyValues[y]] = responseData.values[i][y];
|
||||
}
|
||||
returnData.push({ ...object });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ ...object }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
} else {
|
||||
const dataProperty = this.getNodeParameter('dataProperty', i) as string;
|
||||
returnData.push({ [dataProperty]: responseData });
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ [dataProperty]: responseData }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
@@ -608,6 +674,6 @@ export class MicrosoftExcel implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -95,14 +95,12 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
{ json: true, resolveWithFullResponse: true },
|
||||
);
|
||||
responseData = { location: responseData.headers.location };
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_delete?view=odsp-graph-online
|
||||
if (operation === 'delete') {
|
||||
const fileId = this.getNodeParameter('fileId', i) as string;
|
||||
responseData = await microsoftApiRequest.call(this, 'DELETE', `/drive/items/${fileId}`);
|
||||
responseData = { success: true };
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children?view=odsp-graph-online
|
||||
if (operation === 'download') {
|
||||
@@ -150,7 +148,7 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
Object.assign(newItem.binary!, items[i].binary);
|
||||
}
|
||||
|
||||
items[i] = newItem;
|
||||
@@ -167,7 +165,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
if (operation === 'get') {
|
||||
const fileId = this.getNodeParameter('fileId', i) as string;
|
||||
responseData = await microsoftApiRequest.call(this, 'GET', `/drive/items/${fileId}`);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_search?view=odsp-graph-online
|
||||
if (operation === 'search') {
|
||||
@@ -179,7 +176,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
`/drive/root/search(q='${query}')`,
|
||||
);
|
||||
responseData = responseData.filter((item: IDataObject) => item.file);
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createlink?view=odsp-graph-online
|
||||
if (operation === 'share') {
|
||||
@@ -196,7 +192,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
`/drive/items/${fileId}/createLink`,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online#example-upload-a-new-file
|
||||
if (operation === 'upload') {
|
||||
@@ -244,7 +239,7 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
{},
|
||||
);
|
||||
|
||||
returnData.push(JSON.parse(responseData) as IDataObject);
|
||||
responseData = JSON.parse(responseData);
|
||||
} else {
|
||||
const body = this.getNodeParameter('fileContent', i) as string;
|
||||
if (fileName === '') {
|
||||
@@ -262,7 +257,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
undefined,
|
||||
{ 'Content-Type': 'text/plain' },
|
||||
);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,7 +283,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
}
|
||||
parentFolderId = responseData.id;
|
||||
}
|
||||
returnData.push(responseData);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_delete?view=odsp-graph-online
|
||||
if (operation === 'delete') {
|
||||
@@ -300,7 +293,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
`/drive/items/${folderId}`,
|
||||
);
|
||||
responseData = { success: true };
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_list_children?view=odsp-graph-online
|
||||
if (operation === 'getChildren') {
|
||||
@@ -311,7 +303,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
'GET',
|
||||
`/drive/items/${folderId}/children`,
|
||||
);
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_search?view=odsp-graph-online
|
||||
if (operation === 'search') {
|
||||
@@ -323,7 +314,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
`/drive/root/search(q='${query}')`,
|
||||
);
|
||||
responseData = responseData.filter((item: IDataObject) => item.folder);
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
}
|
||||
//https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createlink?view=odsp-graph-online
|
||||
if (operation === 'share') {
|
||||
@@ -340,7 +330,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
`/drive/items/${folderId}/createLink`,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData);
|
||||
}
|
||||
}
|
||||
if (resource === 'file' || resource === 'folder') {
|
||||
@@ -354,7 +343,6 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
`/drive/items/${itemId}`,
|
||||
body,
|
||||
);
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -362,18 +350,28 @@ export class MicrosoftOneDrive implements INodeType {
|
||||
if (resource === 'file' && operation === 'download') {
|
||||
items[i].json = { error: error.message };
|
||||
} else {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
if (resource === 'file' && operation === 'download') {
|
||||
// For file downloads the files get attached to the existing items
|
||||
return this.prepareOutputData(items);
|
||||
} else {
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ export class MicrosoftOutlook implements INodeType {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
Object.assign(newItem.binary!, items[i].binary);
|
||||
}
|
||||
|
||||
items[i] = newItem;
|
||||
@@ -783,7 +783,7 @@ export class MicrosoftOutlook implements INodeType {
|
||||
// Create a shallow copy of the binary data so that the old
|
||||
// data references which do not get changed still stay behind
|
||||
// but the incoming data does not get changed.
|
||||
Object.assign(newItem.binary, items[i].binary);
|
||||
Object.assign(newItem.binary!, items[i].binary);
|
||||
}
|
||||
|
||||
items[i] = newItem;
|
||||
|
||||
@@ -234,7 +234,8 @@ export class MicrosoftSql implements INodeType {
|
||||
const pool = new mssql.ConnectionPool(config);
|
||||
await pool.connect();
|
||||
|
||||
let returnItems = [];
|
||||
const returnItems: INodeExecutionData[] = [];
|
||||
let responseData: IDataObject | IDataObject[] = [];
|
||||
|
||||
const items = this.getInputData();
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -254,7 +255,7 @@ export class MicrosoftSql implements INodeType {
|
||||
? flatten(queryResult.recordsets)
|
||||
: queryResult.recordsets[0];
|
||||
|
||||
returnItems = this.helpers.returnJsonArray(result as IDataObject[]);
|
||||
responseData = result;
|
||||
} else if (operation === 'insert') {
|
||||
// ----------------------------------
|
||||
// insert
|
||||
@@ -281,7 +282,7 @@ export class MicrosoftSql implements INodeType {
|
||||
},
|
||||
);
|
||||
|
||||
returnItems = items;
|
||||
responseData = items;
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// update
|
||||
@@ -318,7 +319,7 @@ export class MicrosoftSql implements INodeType {
|
||||
},
|
||||
);
|
||||
|
||||
returnItems = items;
|
||||
responseData = items;
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// delete
|
||||
@@ -368,9 +369,7 @@ export class MicrosoftSql implements INodeType {
|
||||
0,
|
||||
);
|
||||
|
||||
returnItems = this.helpers.returnJsonArray({
|
||||
rowsDeleted,
|
||||
} as IDataObject);
|
||||
responseData = rowsDeleted;
|
||||
} else {
|
||||
await pool.close();
|
||||
throw new NodeOperationError(
|
||||
@@ -380,7 +379,7 @@ export class MicrosoftSql implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail() === true) {
|
||||
returnItems = items;
|
||||
responseData = items;
|
||||
} else {
|
||||
await pool.close();
|
||||
throw error;
|
||||
@@ -389,7 +388,12 @@ export class MicrosoftSql implements INodeType {
|
||||
|
||||
// Close the connection
|
||||
await pool.close();
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
returnItems.push(...executionData);
|
||||
return this.prepareOutputData(returnItems);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ export class MicrosoftTeams implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -626,19 +626,25 @@ export class MicrosoftTeams implements INodeType {
|
||||
responseData = { success: true };
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: (error as JsonObject).message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ export class MicrosoftToDo implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
@@ -399,15 +399,23 @@ export class MicrosoftToDo implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ export class Misp implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -729,17 +729,24 @@ export class Misp implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ export class MondayCom implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
let responseData;
|
||||
const qs: IDataObject = {};
|
||||
@@ -728,19 +728,25 @@ export class MondayCom implements INodeType {
|
||||
responseData = responseData.data.move_item_to_group;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ error: error.message });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ export class MongoDb implements INodeType {
|
||||
|
||||
const mdb = client.db(database as string);
|
||||
|
||||
let returnItems = [];
|
||||
const returnItems: INodeExecutionData[] = [];
|
||||
let responseData: IDataObject | IDataObject[] = [];
|
||||
|
||||
const items = this.getInputData();
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -57,12 +58,11 @@ export class MongoDb implements INodeType {
|
||||
.collection(this.getNodeParameter('collection', 0) as string)
|
||||
.aggregate(queryParameter);
|
||||
|
||||
const queryResult = await query.toArray();
|
||||
responseData = await query.toArray();
|
||||
|
||||
returnItems = this.helpers.returnJsonArray(queryResult as IDataObject[]);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnItems = this.helpers.returnJsonArray({ error: (error as JsonObject).message });
|
||||
responseData = [ { error: (error as JsonObject).message } ];
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
@@ -77,10 +77,10 @@ export class MongoDb implements INodeType {
|
||||
.collection(this.getNodeParameter('collection', 0) as string)
|
||||
.deleteMany(JSON.parse(this.getNodeParameter('query', 0) as string));
|
||||
|
||||
returnItems = this.helpers.returnJsonArray([{ deletedCount }]);
|
||||
responseData = [{ deletedCount }];
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnItems = this.helpers.returnJsonArray({ error: (error as JsonObject).message });
|
||||
responseData = [{ error: (error as JsonObject).message }];
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
@@ -116,10 +116,10 @@ export class MongoDb implements INodeType {
|
||||
}
|
||||
const queryResult = await query.toArray();
|
||||
|
||||
returnItems = this.helpers.returnJsonArray(queryResult as IDataObject[]);
|
||||
responseData = queryResult;
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnItems = this.helpers.returnJsonArray({ error: (error as JsonObject).message });
|
||||
responseData = [{ error: (error as JsonObject).message }];
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
@@ -150,16 +150,14 @@ export class MongoDb implements INodeType {
|
||||
|
||||
// Add the id to the data
|
||||
for (const i of Object.keys(insertedIds)) {
|
||||
returnItems.push({
|
||||
json: {
|
||||
...insertItems[parseInt(i, 10)],
|
||||
id: insertedIds[parseInt(i, 10)] as string,
|
||||
},
|
||||
responseData.push({
|
||||
...insertItems[parseInt(i, 10)],
|
||||
id: insertedIds[parseInt(i, 10)] as string,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnItems = this.helpers.returnJsonArray({ error: (error as JsonObject).message });
|
||||
responseData = [{ error: (error as JsonObject).message }];
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
@@ -219,21 +217,25 @@ export class MongoDb implements INodeType {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
returnItems = this.helpers.returnJsonArray(updateItems as IDataObject[]);
|
||||
|
||||
responseData = updateItems;
|
||||
} else {
|
||||
if (this.continueOnFail()) {
|
||||
returnItems = this.helpers.returnJsonArray({
|
||||
json: { error: `The operation "${operation}" is not supported!` },
|
||||
});
|
||||
responseData = [{ error: `The operation "${operation}" is not supported!` }];
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`The operation "${operation}" is not supported!`,
|
||||
);
|
||||
throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`, {itemIndex: 0});
|
||||
}
|
||||
}
|
||||
|
||||
client.close();
|
||||
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: 0 } },
|
||||
);
|
||||
|
||||
returnItems.push(...executionData);
|
||||
|
||||
return this.prepareOutputData(returnItems);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ export class MonicaCrm implements INodeType {
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
@@ -1150,7 +1150,11 @@ export class MonicaCrm implements INodeType {
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({ json: { error: error.message } });
|
||||
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray({ error: error.message }),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
returnData.push(...executionErrorData);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1161,11 +1165,14 @@ export class MonicaCrm implements INodeType {
|
||||
responseData = responseData.data;
|
||||
}
|
||||
|
||||
Array.isArray(responseData)
|
||||
? returnData.push(...responseData)
|
||||
: returnData.push(responseData);
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(responseData),
|
||||
{ itemData: { item: i } },
|
||||
);
|
||||
|
||||
returnData.push(...executionData);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ export class MySql implements INodeType {
|
||||
const connection = await mysql2.createConnection(baseCredentials);
|
||||
const items = this.getInputData();
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
let returnItems = [];
|
||||
let returnItems: INodeExecutionData[] = [];
|
||||
|
||||
if (operation === 'executeQuery') {
|
||||
// ----------------------------------
|
||||
@@ -242,22 +242,19 @@ export class MySql implements INodeType {
|
||||
return connection.query(rawQuery);
|
||||
});
|
||||
|
||||
const queryResult = ((await Promise.all(queryQueue)) as mysql2.OkPacket[][]).reduce(
|
||||
(collection, result) => {
|
||||
const [rows, fields] = result;
|
||||
returnItems = (await Promise.all(queryQueue) as mysql2.OkPacket[][]).reduce((collection, result, index) => {
|
||||
const [rows] = result;
|
||||
|
||||
if (Array.isArray(rows)) {
|
||||
return collection.concat(rows);
|
||||
}
|
||||
const executionData = this.helpers.constructExecutionMetaData(
|
||||
this.helpers.returnJsonArray(rows as unknown as IDataObject[]),
|
||||
{ itemData: { item: index } },
|
||||
);
|
||||
|
||||
collection.push(rows);
|
||||
collection.push(...executionData);
|
||||
|
||||
return collection;
|
||||
},
|
||||
[],
|
||||
);
|
||||
return collection;
|
||||
}, [] as INodeExecutionData[]);
|
||||
|
||||
returnItems = this.helpers.returnJsonArray(queryResult as unknown as IDataObject[]);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnItems = this.helpers.returnJsonArray({ error: error.message });
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user