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