mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix: Manually reverted PR 11716 Do not assign all paired items (no-changelog) (#13429)
This commit is contained in:
@@ -49,6 +49,11 @@ describe('Test AirtableV2, base => getMany', () => {
|
|||||||
name: 'base 1',
|
name: 'base 1',
|
||||||
permissionLevel: 'create',
|
permissionLevel: 'create',
|
||||||
},
|
},
|
||||||
|
pairedItem: [
|
||||||
|
{
|
||||||
|
item: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
json: {
|
json: {
|
||||||
@@ -56,6 +61,11 @@ describe('Test AirtableV2, base => getMany', () => {
|
|||||||
name: 'base 2',
|
name: 'base 2',
|
||||||
permissionLevel: 'edit',
|
permissionLevel: 'edit',
|
||||||
},
|
},
|
||||||
|
pairedItem: [
|
||||||
|
{
|
||||||
|
item: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
json: {
|
json: {
|
||||||
@@ -63,6 +73,11 @@ describe('Test AirtableV2, base => getMany', () => {
|
|||||||
name: 'base 3',
|
name: 'base 3',
|
||||||
permissionLevel: 'create',
|
permissionLevel: 'create',
|
||||||
},
|
},
|
||||||
|
pairedItem: [
|
||||||
|
{
|
||||||
|
item: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
@@ -86,6 +101,11 @@ describe('Test AirtableV2, base => getMany', () => {
|
|||||||
name: 'base 2',
|
name: 'base 2',
|
||||||
permissionLevel: 'edit',
|
permissionLevel: 'edit',
|
||||||
},
|
},
|
||||||
|
pairedItem: [
|
||||||
|
{
|
||||||
|
item: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -98,7 +98,11 @@ describe('Test AirtableV2, search operation', () => {
|
|||||||
expect(result).toHaveLength(2);
|
expect(result).toHaveLength(2);
|
||||||
expect(result[0]).toEqual({
|
expect(result[0]).toEqual({
|
||||||
json: { id: 'recYYY', foo: 'foo 2', bar: 'bar 2' },
|
json: { id: 'recYYY', foo: 'foo 2', bar: 'bar 2' },
|
||||||
pairedItem: [],
|
pairedItem: [
|
||||||
|
{
|
||||||
|
item: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -138,7 +142,11 @@ describe('Test AirtableV2, search operation', () => {
|
|||||||
expect(result).toHaveLength(1);
|
expect(result).toHaveLength(1);
|
||||||
expect(result[0]).toEqual({
|
expect(result[0]).toEqual({
|
||||||
json: { id: 'recYYY', foo: 'foo 2', bar: 'bar 2' },
|
json: { id: 'recYYY', foo: 'foo 2', bar: 'bar 2' },
|
||||||
pairedItem: [],
|
pairedItem: [
|
||||||
|
{
|
||||||
|
item: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
|||||||
import type { IRecord } from './GenericFunctions';
|
import type { IRecord } from './GenericFunctions';
|
||||||
import { apiRequest, apiRequestAllItems, downloadRecordAttachments } from './GenericFunctions';
|
import { apiRequest, apiRequestAllItems, downloadRecordAttachments } from './GenericFunctions';
|
||||||
import { oldVersionNotice } from '../../../utils/descriptions';
|
import { oldVersionNotice } from '../../../utils/descriptions';
|
||||||
|
import { generatePairedItemData } from '../../../utils/utilities';
|
||||||
|
|
||||||
const versionDescription: INodeTypeDescription = {
|
const versionDescription: INodeTypeDescription = {
|
||||||
displayName: 'Airtable',
|
displayName: 'Airtable',
|
||||||
@@ -736,16 +737,24 @@ export class AirtableV1 implements INodeType {
|
|||||||
const downloadFieldNames = (
|
const downloadFieldNames = (
|
||||||
this.getNodeParameter('downloadFieldNames', 0) as string
|
this.getNodeParameter('downloadFieldNames', 0) as string
|
||||||
).split(',');
|
).split(',');
|
||||||
|
const pairedItem = generatePairedItemData(items.length);
|
||||||
const data = await downloadRecordAttachments.call(
|
const data = await downloadRecordAttachments.call(
|
||||||
this,
|
this,
|
||||||
responseData.records as IRecord[],
|
responseData.records as IRecord[],
|
||||||
downloadFieldNames,
|
downloadFieldNames,
|
||||||
|
pairedItem,
|
||||||
);
|
);
|
||||||
return [data];
|
return [data];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
// We can return from here
|
||||||
|
const itemData = generatePairedItemData(items.length);
|
||||||
|
|
||||||
|
return [
|
||||||
|
this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(returnData), {
|
||||||
|
itemData,
|
||||||
|
}),
|
||||||
|
];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
returnData.push({ json: { error: error.message } });
|
returnData.push({ json: { error: error.message } });
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ import type {
|
|||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { updateDisplayOptions, wrapData } from '../../../../../utils/utilities';
|
import {
|
||||||
|
generatePairedItemData,
|
||||||
|
updateDisplayOptions,
|
||||||
|
wrapData,
|
||||||
|
} from '../../../../../utils/utilities';
|
||||||
import { apiRequest } from '../../transport';
|
import { apiRequest } from '../../transport';
|
||||||
|
|
||||||
const properties: INodeProperties[] = [
|
const properties: INodeProperties[] = [
|
||||||
@@ -108,7 +112,11 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
|||||||
bases = bases.filter((base) => permissionLevel.includes(base.permissionLevel as string));
|
bases = bases.filter((base) => permissionLevel.includes(base.permissionLevel as string));
|
||||||
}
|
}
|
||||||
|
|
||||||
const returnData = wrapData(bases);
|
const itemData = generatePairedItemData(this.getInputData().length);
|
||||||
|
|
||||||
|
const returnData = this.helpers.constructExecutionMetaData(wrapData(bases), {
|
||||||
|
itemData,
|
||||||
|
});
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type {
|
|||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { updateDisplayOptions } from '../../../../../utils/utilities';
|
import { generatePairedItemData, updateDisplayOptions } from '../../../../../utils/utilities';
|
||||||
import type { IRecord } from '../../helpers/interfaces';
|
import type { IRecord } from '../../helpers/interfaces';
|
||||||
import { flattenOutput } from '../../helpers/utils';
|
import { flattenOutput } from '../../helpers/utils';
|
||||||
import { apiRequest, apiRequestAllItems, downloadRecordAttachments } from '../../transport';
|
import { apiRequest, apiRequestAllItems, downloadRecordAttachments } from '../../transport';
|
||||||
@@ -156,9 +156,12 @@ export async function execute(
|
|||||||
const endpoint = `${base}/${table}`;
|
const endpoint = `${base}/${table}`;
|
||||||
|
|
||||||
let itemsLength = items.length ? 1 : 0;
|
let itemsLength = items.length ? 1 : 0;
|
||||||
|
let fallbackPairedItems;
|
||||||
|
|
||||||
if (nodeVersion >= 2.1) {
|
if (nodeVersion >= 2.1) {
|
||||||
itemsLength = items.length;
|
itemsLength = items.length;
|
||||||
|
} else {
|
||||||
|
fallbackPairedItems = generatePairedItemData(items.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < itemsLength; i++) {
|
for (let i = 0; i < itemsLength; i++) {
|
||||||
@@ -205,7 +208,7 @@ export async function execute(
|
|||||||
this,
|
this,
|
||||||
responseData.records as IRecord[],
|
responseData.records as IRecord[],
|
||||||
options.downloadFields as string[],
|
options.downloadFields as string[],
|
||||||
nodeVersion >= 2.1 ? [{ item: i }] : undefined,
|
fallbackPairedItems || [{ item: i }],
|
||||||
);
|
);
|
||||||
returnData.push(...itemWithAttachments);
|
returnData.push(...itemWithAttachments);
|
||||||
continue;
|
continue;
|
||||||
@@ -217,7 +220,7 @@ export async function execute(
|
|||||||
json: flattenOutput(record),
|
json: flattenOutput(record),
|
||||||
})) as INodeExecutionData[];
|
})) as INodeExecutionData[];
|
||||||
|
|
||||||
const itemData = nodeVersion >= 2.1 ? [{ item: i }] : [];
|
const itemData = fallbackPairedItems || [{ item: i }];
|
||||||
|
|
||||||
const executionData = this.helpers.constructExecutionMetaData(records, {
|
const executionData = this.helpers.constructExecutionMetaData(records, {
|
||||||
itemData,
|
itemData,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type {
|
|||||||
|
|
||||||
import { getWorkflowInfo } from './GenericFunctions';
|
import { getWorkflowInfo } from './GenericFunctions';
|
||||||
import { localResourceMapping } from './methods';
|
import { localResourceMapping } from './methods';
|
||||||
|
import { generatePairedItemData } from '../../../utils/utilities';
|
||||||
import { getCurrentWorkflowInputData } from '../../../utils/workflowInputsResourceMapping/GenericFunctions';
|
import { getCurrentWorkflowInputData } from '../../../utils/workflowInputsResourceMapping/GenericFunctions';
|
||||||
export class ExecuteWorkflow implements INodeType {
|
export class ExecuteWorkflow implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
@@ -426,6 +427,8 @@ export class ExecuteWorkflow implements INodeType {
|
|||||||
|
|
||||||
const workflowResult = executionResult.data as INodeExecutionData[][];
|
const workflowResult = executionResult.data as INodeExecutionData[][];
|
||||||
|
|
||||||
|
const fallbackPairedItemData = generatePairedItemData(items.length);
|
||||||
|
|
||||||
for (const output of workflowResult) {
|
for (const output of workflowResult) {
|
||||||
const sameLength = output.length === items.length;
|
const sameLength = output.length === items.length;
|
||||||
|
|
||||||
@@ -434,12 +437,15 @@ export class ExecuteWorkflow implements INodeType {
|
|||||||
|
|
||||||
if (sameLength) {
|
if (sameLength) {
|
||||||
item.pairedItem = { item: itemIndex };
|
item.pairedItem = { item: itemIndex };
|
||||||
|
} else {
|
||||||
|
item.pairedItem = fallbackPairedItemData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return workflowResult;
|
return workflowResult;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const pairedItem = generatePairedItemData(items.length);
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
const metadata = parseErrorMetadata(error);
|
const metadata = parseErrorMetadata(error);
|
||||||
return [
|
return [
|
||||||
@@ -447,6 +453,7 @@ export class ExecuteWorkflow implements INodeType {
|
|||||||
{
|
{
|
||||||
json: { error: error.message },
|
json: { error: error.message },
|
||||||
metadata,
|
metadata,
|
||||||
|
pairedItem,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
|
|
||||||
import type { JsonToSpreadsheetBinaryOptions, JsonToSpreadsheetBinaryFormat } from '@utils/binary';
|
import type { JsonToSpreadsheetBinaryOptions, JsonToSpreadsheetBinaryFormat } from '@utils/binary';
|
||||||
import { convertJsonToSpreadsheetBinary } from '@utils/binary';
|
import { convertJsonToSpreadsheetBinary } from '@utils/binary';
|
||||||
import { updateDisplayOptions } from '@utils/utilities';
|
import { generatePairedItemData, updateDisplayOptions } from '@utils/utilities';
|
||||||
|
|
||||||
export const operations = ['csv', 'html', 'rtf', 'ods', 'xls', 'xlsx'];
|
export const operations = ['csv', 'html', 'rtf', 'ods', 'xls', 'xlsx'];
|
||||||
|
|
||||||
@@ -98,6 +98,7 @@ export async function execute(
|
|||||||
) {
|
) {
|
||||||
let returnData: INodeExecutionData[] = [];
|
let returnData: INodeExecutionData[] = [];
|
||||||
|
|
||||||
|
const pairedItem = generatePairedItemData(items.length);
|
||||||
try {
|
try {
|
||||||
const options = this.getNodeParameter('options', 0, {}) as JsonToSpreadsheetBinaryOptions;
|
const options = this.getNodeParameter('options', 0, {}) as JsonToSpreadsheetBinaryOptions;
|
||||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0, 'data');
|
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0, 'data');
|
||||||
@@ -115,6 +116,7 @@ export async function execute(
|
|||||||
binary: {
|
binary: {
|
||||||
[binaryPropertyName]: binaryData,
|
[binaryPropertyName]: binaryData,
|
||||||
},
|
},
|
||||||
|
pairedItem,
|
||||||
};
|
};
|
||||||
|
|
||||||
returnData = [newItem];
|
returnData = [newItem];
|
||||||
@@ -124,6 +126,7 @@ export async function execute(
|
|||||||
json: {
|
json: {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
},
|
},
|
||||||
|
pairedItem,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new NodeOperationError(this.getNode(), error);
|
throw new NodeOperationError(this.getNode(), error);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { NodeOperationError } from 'n8n-workflow';
|
|||||||
|
|
||||||
import { createBinaryFromJson } from '@utils/binary';
|
import { createBinaryFromJson } from '@utils/binary';
|
||||||
import { encodeDecodeOptions } from '@utils/descriptions';
|
import { encodeDecodeOptions } from '@utils/descriptions';
|
||||||
import { updateDisplayOptions } from '@utils/utilities';
|
import { generatePairedItemData, updateDisplayOptions } from '@utils/utilities';
|
||||||
|
|
||||||
export const properties: INodeProperties[] = [
|
export const properties: INodeProperties[] = [
|
||||||
{
|
{
|
||||||
@@ -92,6 +92,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
|
|||||||
|
|
||||||
const mode = this.getNodeParameter('mode', 0, 'once') as string;
|
const mode = this.getNodeParameter('mode', 0, 'once') as string;
|
||||||
if (mode === 'once') {
|
if (mode === 'once') {
|
||||||
|
const pairedItem = generatePairedItemData(items.length);
|
||||||
try {
|
try {
|
||||||
const options = this.getNodeParameter('options', 0, {});
|
const options = this.getNodeParameter('options', 0, {});
|
||||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0, 'data');
|
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0, 'data');
|
||||||
@@ -113,6 +114,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
|
|||||||
binary: {
|
binary: {
|
||||||
[binaryPropertyName]: binaryData,
|
[binaryPropertyName]: binaryData,
|
||||||
},
|
},
|
||||||
|
pairedItem,
|
||||||
};
|
};
|
||||||
|
|
||||||
returnData = [newItem];
|
returnData = [newItem];
|
||||||
@@ -122,6 +124,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
|
|||||||
json: {
|
json: {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
},
|
},
|
||||||
|
pairedItem,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
throw new NodeOperationError(this.getNode(), error);
|
throw new NodeOperationError(this.getNode(), error);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import type { Readable } from 'stream';
|
|||||||
import { pipeline } from 'stream/promises';
|
import { pipeline } from 'stream/promises';
|
||||||
import { file as tmpFile } from 'tmp-promise';
|
import { file as tmpFile } from 'tmp-promise';
|
||||||
|
|
||||||
import { formatPrivateKey } from '@utils/utilities';
|
import { formatPrivateKey, generatePairedItemData } from '@utils/utilities';
|
||||||
|
|
||||||
interface ReturnFtpItem {
|
interface ReturnFtpItem {
|
||||||
type: string;
|
type: string;
|
||||||
@@ -550,7 +550,9 @@ export class Ftp implements INodeType {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
return [[{ json: { error: error.message } }]];
|
const pairedItem = generatePairedItemData(items.length);
|
||||||
|
|
||||||
|
return [[{ json: { error: error.message }, pairedItem }]];
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { oldVersionNotice } from '@utils/descriptions';
|
|||||||
|
|
||||||
import { googleApiRequest, googleApiRequestAllItems, simplify } from './GenericFunctions';
|
import { googleApiRequest, googleApiRequestAllItems, simplify } from './GenericFunctions';
|
||||||
import { recordFields, recordOperations } from './RecordDescription';
|
import { recordFields, recordOperations } from './RecordDescription';
|
||||||
|
import { generatePairedItemData } from '../../../../utils/utilities';
|
||||||
|
|
||||||
const versionDescription: INodeTypeDescription = {
|
const versionDescription: INodeTypeDescription = {
|
||||||
displayName: 'Google BigQuery',
|
displayName: 'Google BigQuery',
|
||||||
@@ -194,6 +195,8 @@ export class GoogleBigQueryV1 implements INodeType {
|
|||||||
|
|
||||||
body.rows = rows;
|
body.rows = rows;
|
||||||
|
|
||||||
|
const itemData = generatePairedItemData(items.length);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
responseData = await googleApiRequest.call(
|
responseData = await googleApiRequest.call(
|
||||||
this,
|
this,
|
||||||
@@ -202,11 +205,17 @@ export class GoogleBigQueryV1 implements INodeType {
|
|||||||
body,
|
body,
|
||||||
);
|
);
|
||||||
|
|
||||||
const executionData = this.helpers.returnJsonArray(responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
const executionErrorData = this.helpers.returnJsonArray({ error: error.message });
|
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
returnData.push(...executionErrorData);
|
returnData.push(...executionErrorData);
|
||||||
}
|
}
|
||||||
throw new NodeApiError(this.getNode(), error as JsonObject, { itemIndex: 0 });
|
throw new NodeApiError(this.getNode(), error as JsonObject, { itemIndex: 0 });
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type {
|
|||||||
import { NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
|
||||||
import { updateDisplayOptions } from '@utils/utilities';
|
import { generatePairedItemData, updateDisplayOptions } from '@utils/utilities';
|
||||||
|
|
||||||
import type { TableSchema } from '../../helpers/interfaces';
|
import type { TableSchema } from '../../helpers/interfaces';
|
||||||
import { checkSchema, wrapData } from '../../helpers/utils';
|
import { checkSchema, wrapData } from '../../helpers/utils';
|
||||||
@@ -227,6 +227,7 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const itemData = generatePairedItemData(items.length);
|
||||||
for (let i = 0; i < rows.length; i += batchSize) {
|
for (let i = 0; i < rows.length; i += batchSize) {
|
||||||
const batch = rows.slice(i, i + batchSize);
|
const batch = rows.slice(i, i + batchSize);
|
||||||
body.rows = batch;
|
body.rows = batch;
|
||||||
@@ -280,7 +281,10 @@ export async function execute(this: IExecuteFunctions): Promise<INodeExecutionDa
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const executionData = wrapData(responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
wrapData(responseData as IDataObject[]),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
|
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
googleApiRequestAllItems,
|
googleApiRequestAllItems,
|
||||||
jsonToDocument,
|
jsonToDocument,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
import { generatePairedItemData } from '../../../../utils/utilities';
|
||||||
|
|
||||||
export class GoogleFirebaseCloudFirestore implements INodeType {
|
export class GoogleFirebaseCloudFirestore implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
@@ -120,7 +121,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 itemData = generatePairedItemData(items.length);
|
||||||
const returnData: INodeExecutionData[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
let responseData;
|
let responseData;
|
||||||
|
|
||||||
@@ -135,7 +136,7 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
|||||||
if (nodeVersion >= 1.1) {
|
if (nodeVersion >= 1.1) {
|
||||||
itemsLength = items.length;
|
itemsLength = items.length;
|
||||||
} else {
|
} else {
|
||||||
fallbackPairedItems = [];
|
fallbackPairedItems = generatePairedItemData(items.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resource === 'document') {
|
if (resource === 'document') {
|
||||||
@@ -171,7 +172,10 @@ export class GoogleFirebaseCloudFirestore implements INodeType {
|
|||||||
.filter((el: IDataObject) => !!el);
|
.filter((el: IDataObject) => !!el);
|
||||||
}
|
}
|
||||||
|
|
||||||
const executionData = this.helpers.returnJsonArray(responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
|
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
} else if (operation === 'create') {
|
} else if (operation === 'create') {
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ describe('Google Sheet - Delete', () => {
|
|||||||
mockExecuteFunctions = {
|
mockExecuteFunctions = {
|
||||||
getInputData: jest.fn().mockReturnValue([{ json: {} }]),
|
getInputData: jest.fn().mockReturnValue([{ json: {} }]),
|
||||||
getNodeParameter: jest.fn(),
|
getNodeParameter: jest.fn(),
|
||||||
} as Partial<IExecuteFunctions>;
|
helpers: {
|
||||||
|
constructExecutionMetaData: jest.fn((data) => ({ json: data })),
|
||||||
|
},
|
||||||
|
} as unknown as Partial<IExecuteFunctions>;
|
||||||
|
|
||||||
mockSheet = {
|
mockSheet = {
|
||||||
spreadsheetBatchUpdate: jest.fn(),
|
spreadsheetBatchUpdate: jest.fn(),
|
||||||
@@ -137,6 +140,9 @@ describe('Google Sheet - Delete', () => {
|
|||||||
if (param === 'numberToDelete') return 1;
|
if (param === 'numberToDelete') return 1;
|
||||||
return null;
|
return null;
|
||||||
}) as unknown as IExecuteFunctions['getNodeParameter'];
|
}) as unknown as IExecuteFunctions['getNodeParameter'];
|
||||||
|
mockExecuteFunctions.helpers = {
|
||||||
|
constructExecutionMetaData: jest.fn((data) => data),
|
||||||
|
} as unknown as IExecuteFunctions['helpers'];
|
||||||
|
|
||||||
const result = await execute.call(
|
const result = await execute.call(
|
||||||
mockExecuteFunctions as IExecuteFunctions,
|
mockExecuteFunctions as IExecuteFunctions,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import type {
|
|||||||
} from './GoogleSheet';
|
} from './GoogleSheet';
|
||||||
import { GoogleSheet } from './GoogleSheet';
|
import { GoogleSheet } from './GoogleSheet';
|
||||||
import { versionDescription } from './versionDescription';
|
import { versionDescription } from './versionDescription';
|
||||||
|
import { generatePairedItemData } from '../../../../utils/utilities';
|
||||||
import { getGoogleAccessToken } from '../../GenericFunctions';
|
import { getGoogleAccessToken } from '../../GenericFunctions';
|
||||||
|
|
||||||
export class GoogleSheetsV1 implements INodeType {
|
export class GoogleSheetsV1 implements INodeType {
|
||||||
@@ -293,9 +294,12 @@ export class GoogleSheetsV1 implements INodeType {
|
|||||||
returnData = [];
|
returnData = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pairedItem = generatePairedItemData(items.length);
|
||||||
|
|
||||||
const lookupOutput = returnData.map((item) => {
|
const lookupOutput = returnData.map((item) => {
|
||||||
return {
|
return {
|
||||||
json: item,
|
json: item,
|
||||||
|
pairedItem,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||||
|
|
||||||
import { wrapData } from '../../../../../../utils/utilities';
|
import { generatePairedItemData, wrapData } from '../../../../../../utils/utilities';
|
||||||
import type { GoogleSheet } from '../../helpers/GoogleSheet';
|
import type { GoogleSheet } from '../../helpers/GoogleSheet';
|
||||||
import type { SheetProperties } from '../../helpers/GoogleSheets.types';
|
import type { SheetProperties } from '../../helpers/GoogleSheets.types';
|
||||||
import { getColumnNumber, untilSheetSelected } from '../../helpers/GoogleSheets.utils';
|
import { getColumnNumber, untilSheetSelected } from '../../helpers/GoogleSheets.utils';
|
||||||
@@ -166,7 +166,10 @@ export async function execute(
|
|||||||
await sheet.spreadsheetBatchUpdate(requests);
|
await sheet.spreadsheetBatchUpdate(requests);
|
||||||
}
|
}
|
||||||
|
|
||||||
const returnData = wrapData({ success: true });
|
const itemData = generatePairedItemData(this.getInputData().length);
|
||||||
|
const returnData = this.helpers.constructExecutionMetaData(wrapData({ success: true }), {
|
||||||
|
itemData,
|
||||||
|
});
|
||||||
|
|
||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import {
|
|||||||
validateCredentials,
|
validateCredentials,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
import { ticketFields, ticketOperations } from './TicketDescription';
|
import { ticketFields, ticketOperations } from './TicketDescription';
|
||||||
|
import { generatePairedItemData } from '../../../utils/utilities';
|
||||||
|
|
||||||
export class HubspotV2 implements INodeType {
|
export class HubspotV2 implements INodeType {
|
||||||
description: INodeTypeDescription;
|
description: INodeTypeDescription;
|
||||||
@@ -1184,7 +1185,12 @@ export class HubspotV2 implements INodeType {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const executionData = this.helpers.returnJsonArray(responseData as IDataObject[]);
|
const itemData = generatePairedItemData(items.length);
|
||||||
|
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import type {
|
|||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { ApplicationError, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
import { ApplicationError, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { generatePairedItemData } from '../../utils/utilities';
|
||||||
|
|
||||||
export class Kafka implements INodeType {
|
export class Kafka implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: 'Kafka',
|
displayName: 'Kafka',
|
||||||
@@ -258,6 +260,7 @@ export class Kafka implements INodeType {
|
|||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
|
const itemData = generatePairedItemData(items.length);
|
||||||
|
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
|
|
||||||
@@ -397,12 +400,15 @@ export class Kafka implements INodeType {
|
|||||||
|
|
||||||
await producer.disconnect();
|
await producer.disconnect();
|
||||||
|
|
||||||
const executionData = this.helpers.returnJsonArray(responseData);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
|
|
||||||
return [executionData];
|
return [executionData];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
return [[{ json: { error: error.message } }]];
|
return [[{ json: { error: error.message }, pairedItem: itemData }]];
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
import { tableFields, tableOperations } from './TableDescription';
|
import { tableFields, tableOperations } from './TableDescription';
|
||||||
import { workbookFields, workbookOperations } from './WorkbookDescription';
|
import { workbookFields, workbookOperations } from './WorkbookDescription';
|
||||||
import { worksheetFields, worksheetOperations } from './WorksheetDescription';
|
import { worksheetFields, worksheetOperations } from './WorksheetDescription';
|
||||||
|
import { generatePairedItemData } from '../../../../utils/utilities';
|
||||||
|
|
||||||
const versionDescription: INodeTypeDescription = {
|
const versionDescription: INodeTypeDescription = {
|
||||||
displayName: 'Microsoft Excel',
|
displayName: 'Microsoft Excel',
|
||||||
@@ -172,6 +173,7 @@ export class MicrosoftExcelV1 implements INodeType {
|
|||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
|
const itemData = generatePairedItemData(items.length);
|
||||||
const returnData: INodeExecutionData[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
let qs: IDataObject = {};
|
let qs: IDataObject = {};
|
||||||
@@ -243,12 +245,18 @@ export class MicrosoftExcelV1 implements INodeType {
|
|||||||
{ 'workbook-session-id': id },
|
{ 'workbook-session-id': id },
|
||||||
);
|
);
|
||||||
|
|
||||||
const executionData = this.helpers.returnJsonArray(responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
|
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
const executionErrorData = this.helpers.returnJsonArray({ error: error.message });
|
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
returnData.push(...executionErrorData);
|
returnData.push(...executionErrorData);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import type {
|
|||||||
INodeProperties,
|
INodeProperties,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { processJsonInput, updateDisplayOptions } from '@utils/utilities';
|
import { generatePairedItemData, processJsonInput, updateDisplayOptions } from '@utils/utilities';
|
||||||
|
|
||||||
import type { ExcelResponse } from '../../helpers/interfaces';
|
import type { ExcelResponse } from '../../helpers/interfaces';
|
||||||
import { prepareOutput } from '../../helpers/utils';
|
import { prepareOutput } from '../../helpers/utils';
|
||||||
@@ -274,7 +274,11 @@ export async function execute(
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
const executionErrorData = this.helpers.returnJsonArray({ error: error.message });
|
const itemData = generatePairedItemData(this.getInputData().length);
|
||||||
|
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
returnData.push(...executionErrorData);
|
returnData.push(...executionErrorData);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type {
|
|||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { processJsonInput, updateDisplayOptions } from '@utils/utilities';
|
import { generatePairedItemData, processJsonInput, updateDisplayOptions } from '@utils/utilities';
|
||||||
|
|
||||||
import type { ExcelResponse, UpdateSummary } from '../../helpers/interfaces';
|
import type { ExcelResponse, UpdateSummary } from '../../helpers/interfaces';
|
||||||
import {
|
import {
|
||||||
@@ -375,7 +375,11 @@ export async function execute(
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
const executionErrorData = this.helpers.returnJsonArray({ error: error.message });
|
const itemData = generatePairedItemData(this.getInputData().length);
|
||||||
|
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
returnData.push(...executionErrorData);
|
returnData.push(...executionErrorData);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type {
|
|||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { processJsonInput, updateDisplayOptions } from '@utils/utilities';
|
import { generatePairedItemData, processJsonInput, updateDisplayOptions } from '@utils/utilities';
|
||||||
|
|
||||||
import type { ExcelResponse, UpdateSummary } from '../../helpers/interfaces';
|
import type { ExcelResponse, UpdateSummary } from '../../helpers/interfaces';
|
||||||
import {
|
import {
|
||||||
@@ -382,7 +382,11 @@ export async function execute(
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
const executionErrorData = this.helpers.returnJsonArray({ error: error.message });
|
const itemData = generatePairedItemData(this.getInputData().length);
|
||||||
|
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
returnData.push(...executionErrorData);
|
returnData.push(...executionErrorData);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { IDataObject, IExecuteFunctions, INode, INodeExecutionData } from 'n8n-workflow';
|
import type { IDataObject, IExecuteFunctions, INode, INodeExecutionData } from 'n8n-workflow';
|
||||||
import { NodeOperationError } from 'n8n-workflow';
|
import { NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { wrapData } from '@utils/utilities';
|
import { generatePairedItemData, wrapData } from '@utils/utilities';
|
||||||
|
|
||||||
import type { ExcelResponse, SheetData, UpdateSummary } from './interfaces';
|
import type { ExcelResponse, SheetData, UpdateSummary } from './interfaces';
|
||||||
|
|
||||||
@@ -62,7 +62,11 @@ export function prepareOutput(
|
|||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const executionData = wrapData({ [config.dataProperty || 'data']: responseData });
|
const itemData = generatePairedItemData(this.getInputData().length);
|
||||||
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
wrapData({ [config.dataProperty || 'data']: responseData }),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
|
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { flatten, getResolvables } from '@utils/utilities';
|
import { flatten, generatePairedItemData, getResolvables } from '@utils/utilities';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
configurePool,
|
configurePool,
|
||||||
@@ -343,7 +343,12 @@ export class MicrosoftSql implements INodeType {
|
|||||||
responseData = await deleteOperation(tables, pool);
|
responseData = await deleteOperation(tables, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData = this.helpers.returnJsonArray(responseData);
|
const itemData = generatePairedItemData(items.length);
|
||||||
|
|
||||||
|
returnData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
responseData = items;
|
responseData = items;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import {
|
|||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
import type { IMongoParametricCredentials } from './mongoDb.types';
|
import type { IMongoParametricCredentials } from './mongoDb.types';
|
||||||
import { nodeProperties } from './MongoDbProperties';
|
import { nodeProperties } from './MongoDbProperties';
|
||||||
|
import { generatePairedItemData } from '../../utils/utilities';
|
||||||
|
|
||||||
export class MongoDb implements INodeType {
|
export class MongoDb implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
@@ -117,7 +118,7 @@ export class MongoDb implements INodeType {
|
|||||||
if (nodeVersion >= 1.1) {
|
if (nodeVersion >= 1.1) {
|
||||||
itemsLength = items.length;
|
itemsLength = items.length;
|
||||||
} else {
|
} else {
|
||||||
fallbackPairedItems = [];
|
fallbackPairedItems = generatePairedItemData(items.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'aggregate') {
|
if (operation === 'aggregate') {
|
||||||
@@ -234,6 +235,7 @@ export class MongoDb implements INodeType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'findOneAndReplace') {
|
if (operation === 'findOneAndReplace') {
|
||||||
|
fallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);
|
||||||
const fields = prepareFields(this.getNodeParameter('fields', 0) as string);
|
const fields = prepareFields(this.getNodeParameter('fields', 0) as string);
|
||||||
const useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;
|
const useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;
|
||||||
const dateFields = prepareFields(
|
const dateFields = prepareFields(
|
||||||
@@ -268,10 +270,14 @@ export class MongoDb implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData = this.helpers.returnJsonArray(updateItems);
|
returnData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(updateItems),
|
||||||
|
{ itemData: fallbackPairedItems },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'findOneAndUpdate') {
|
if (operation === 'findOneAndUpdate') {
|
||||||
|
fallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);
|
||||||
const fields = prepareFields(this.getNodeParameter('fields', 0) as string);
|
const fields = prepareFields(this.getNodeParameter('fields', 0) as string);
|
||||||
const useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;
|
const useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;
|
||||||
const dateFields = prepareFields(
|
const dateFields = prepareFields(
|
||||||
@@ -306,10 +312,14 @@ export class MongoDb implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData = this.helpers.returnJsonArray(updateItems);
|
returnData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(updateItems),
|
||||||
|
{ itemData: fallbackPairedItems },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'insert') {
|
if (operation === 'insert') {
|
||||||
|
fallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);
|
||||||
let responseData: IDataObject[] = [];
|
let responseData: IDataObject[] = [];
|
||||||
try {
|
try {
|
||||||
// Prepare the data to insert and copy it to be returned
|
// Prepare the data to insert and copy it to be returned
|
||||||
@@ -340,10 +350,14 @@ export class MongoDb implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData = this.helpers.returnJsonArray(responseData);
|
returnData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData),
|
||||||
|
{ itemData: fallbackPairedItems },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'update') {
|
if (operation === 'update') {
|
||||||
|
fallbackPairedItems = fallbackPairedItems ?? generatePairedItemData(items.length);
|
||||||
const fields = prepareFields(this.getNodeParameter('fields', 0) as string);
|
const fields = prepareFields(this.getNodeParameter('fields', 0) as string);
|
||||||
const useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;
|
const useDotNotation = this.getNodeParameter('options.useDotNotation', 0, false) as boolean;
|
||||||
const dateFields = prepareFields(
|
const dateFields = prepareFields(
|
||||||
@@ -378,7 +392,10 @@ export class MongoDb implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
returnData = this.helpers.returnJsonArray(updateItems);
|
returnData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(updateItems),
|
||||||
|
{ itemData: fallbackPairedItems },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await client.close();
|
await client.close();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ describe('Test PostgresV2, runQueries', () => {
|
|||||||
|
|
||||||
expect(result).toBeDefined();
|
expect(result).toBeDefined();
|
||||||
expect(result).toHaveLength(1);
|
expect(result).toHaveLength(1);
|
||||||
expect(result).toEqual([{ json: { success: true }, pairedItem: undefined }]);
|
expect(result).toEqual([{ json: { success: true }, pairedItem: [{ item: 0 }] }]);
|
||||||
expect(dbMultiSpy).toHaveBeenCalledWith('SELECT * FROM table');
|
expect(dbMultiSpy).toHaveBeenCalledWith('SELECT * FROM table');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import type {
|
|||||||
SortRule,
|
SortRule,
|
||||||
WhereClause,
|
WhereClause,
|
||||||
} from './interfaces';
|
} from './interfaces';
|
||||||
|
import { generatePairedItemData } from '../../../../utils/utilities';
|
||||||
|
|
||||||
export function isJSON(str: string) {
|
export function isJSON(str: string) {
|
||||||
try {
|
try {
|
||||||
@@ -251,15 +252,17 @@ export function configureQueryRunner(
|
|||||||
.flat();
|
.flat();
|
||||||
|
|
||||||
if (!returnData.length) {
|
if (!returnData.length) {
|
||||||
|
const pairedItem = generatePairedItemData(queries.length);
|
||||||
|
|
||||||
if ((options?.nodeVersion as number) < 2.3) {
|
if ((options?.nodeVersion as number) < 2.3) {
|
||||||
if (emptyReturnData.length) {
|
if (emptyReturnData.length) {
|
||||||
emptyReturnData[0].pairedItem = undefined;
|
emptyReturnData[0].pairedItem = pairedItem;
|
||||||
}
|
}
|
||||||
returnData = emptyReturnData;
|
returnData = emptyReturnData;
|
||||||
} else {
|
} else {
|
||||||
returnData = queries.every((query) => isSelectQuery(query.query))
|
returnData = queries.every((query) => isSelectQuery(query.query))
|
||||||
? []
|
? []
|
||||||
: [{ json: { success: true } }];
|
: [{ json: { success: true }, pairedItem }];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
import { recordFields, recordOperations } from './RecordDescription';
|
import { recordFields, recordOperations } from './RecordDescription';
|
||||||
import { reportFields, reportOperations } from './ReportDescription';
|
import { reportFields, reportOperations } from './ReportDescription';
|
||||||
|
import { generatePairedItemData } from '../../utils/utilities';
|
||||||
|
|
||||||
export class QuickBase implements INodeType {
|
export class QuickBase implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
@@ -113,6 +114,7 @@ export class QuickBase implements INodeType {
|
|||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
|
const itemData = generatePairedItemData(items.length);
|
||||||
const returnData: INodeExecutionData[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
const length = items.length;
|
const length = items.length;
|
||||||
const qs: IDataObject = {};
|
const qs: IDataObject = {};
|
||||||
@@ -290,7 +292,10 @@ export class QuickBase implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const executionData = this.helpers.returnJsonArray(responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
|
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
@@ -457,7 +462,10 @@ export class QuickBase implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const executionData = this.helpers.returnJsonArray(responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
|
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
@@ -537,7 +545,10 @@ export class QuickBase implements INodeType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const executionData = this.helpers.returnJsonArray(responseData as IDataObject[]);
|
const executionData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray(responseData as IDataObject[]),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
|
|
||||||
returnData.push(...executionData);
|
returnData.push(...executionData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import {
|
|||||||
type INodeTypeDescription,
|
type INodeTypeDescription,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { generatePairedItemData } from '../../utils/utilities';
|
||||||
|
|
||||||
export class ReadBinaryFiles implements INodeType {
|
export class ReadBinaryFiles implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
hidden: true,
|
hidden: true,
|
||||||
@@ -46,6 +48,7 @@ export class ReadBinaryFiles implements INodeType {
|
|||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const fileSelector = this.getNodeParameter('fileSelector', 0) as string;
|
const fileSelector = this.getNodeParameter('fileSelector', 0) as string;
|
||||||
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
|
const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
|
||||||
|
const pairedItem = generatePairedItemData(this.getInputData().length);
|
||||||
|
|
||||||
const files = await glob(fileSelector);
|
const files = await glob(fileSelector);
|
||||||
|
|
||||||
@@ -57,6 +60,7 @@ export class ReadBinaryFiles implements INodeType {
|
|||||||
[dataPropertyName]: await this.helpers.prepareBinaryData(stream, filePath),
|
[dataPropertyName]: await this.helpers.prepareBinaryData(stream, filePath),
|
||||||
},
|
},
|
||||||
json: {},
|
json: {},
|
||||||
|
pairedItem,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import {
|
|||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import type { Readable } from 'stream';
|
import type { Readable } from 'stream';
|
||||||
|
|
||||||
import { formatPrivateKey } from '../../utils/utilities';
|
import { formatPrivateKey, generatePairedItemData } from '../../utils/utilities';
|
||||||
|
|
||||||
export class RespondToWebhook implements INodeType {
|
export class RespondToWebhook implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
@@ -443,7 +443,11 @@ export class RespondToWebhook implements INodeType {
|
|||||||
this.sendResponse(response);
|
this.sendResponse(response);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
const returnData = [{ json: { error: error.message } }];
|
const itemData = generatePairedItemData(items.length);
|
||||||
|
const returnData = this.helpers.constructExecutionMetaData(
|
||||||
|
[{ json: { error: error.message } }],
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
return [returnData];
|
return [returnData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ describe('RespondToWebhook Node', () => {
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
json: { error: 'The Response Data option "notSupportedRespondWith" is not supported!' },
|
json: { error: 'The Response Data option "notSupportedRespondWith" is not supported!' },
|
||||||
|
pairedItem: [{ item: 0 }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ import type {
|
|||||||
INodeExecutionData,
|
INodeExecutionData,
|
||||||
INodeType,
|
INodeType,
|
||||||
INodeTypeDescription,
|
INodeTypeDescription,
|
||||||
IPairedItemData,
|
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||||
import Parser from 'rss-parser';
|
import Parser from 'rss-parser';
|
||||||
import { URL } from 'url';
|
import { URL } from 'url';
|
||||||
|
|
||||||
|
import { generatePairedItemData } from '../../utils/utilities';
|
||||||
|
|
||||||
// Utility function
|
// Utility function
|
||||||
|
|
||||||
function validateURL(url: string) {
|
function validateURL(url: string) {
|
||||||
@@ -76,7 +77,7 @@ export class RssFeedRead implements INodeType {
|
|||||||
if (nodeVersion >= 1.1) {
|
if (nodeVersion >= 1.1) {
|
||||||
itemsLength = items.length;
|
itemsLength = items.length;
|
||||||
} else {
|
} else {
|
||||||
fallbackPairedItems = [] as IPairedItemData[];
|
fallbackPairedItems = generatePairedItemData(items.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < itemsLength; i++) {
|
for (let i = 0; i < itemsLength; i++) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
} from 'xlsx';
|
} from 'xlsx';
|
||||||
|
|
||||||
import { oldVersionNotice } from '@utils/descriptions';
|
import { oldVersionNotice } from '@utils/descriptions';
|
||||||
import { flattenObject } from '@utils/utilities';
|
import { flattenObject, generatePairedItemData } from '@utils/utilities';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
operationProperty,
|
operationProperty,
|
||||||
@@ -58,6 +58,7 @@ export class SpreadsheetFileV1 implements INodeType {
|
|||||||
|
|
||||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
|
const pairedItem = generatePairedItemData(items.length);
|
||||||
|
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
|
||||||
@@ -229,6 +230,7 @@ export class SpreadsheetFileV1 implements INodeType {
|
|||||||
const newItem: INodeExecutionData = {
|
const newItem: INodeExecutionData = {
|
||||||
json: {},
|
json: {},
|
||||||
binary: {},
|
binary: {},
|
||||||
|
pairedItem,
|
||||||
};
|
};
|
||||||
|
|
||||||
let fileName = `spreadsheet.${fileFormat}`;
|
let fileName = `spreadsheet.${fileFormat}`;
|
||||||
@@ -245,6 +247,7 @@ export class SpreadsheetFileV1 implements INodeType {
|
|||||||
json: {
|
json: {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
},
|
},
|
||||||
|
pairedItem,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n
|
|||||||
|
|
||||||
import type { JsonToSpreadsheetBinaryFormat, JsonToSpreadsheetBinaryOptions } from '@utils/binary';
|
import type { JsonToSpreadsheetBinaryFormat, JsonToSpreadsheetBinaryOptions } from '@utils/binary';
|
||||||
import { convertJsonToSpreadsheetBinary } from '@utils/binary';
|
import { convertJsonToSpreadsheetBinary } from '@utils/binary';
|
||||||
|
import { generatePairedItemData } from '@utils/utilities';
|
||||||
|
|
||||||
import { toFileOptions, toFileProperties } from '../description';
|
import { toFileOptions, toFileProperties } from '../description';
|
||||||
|
|
||||||
@@ -10,6 +11,8 @@ export const description: INodeProperties[] = [...toFileProperties, toFileOption
|
|||||||
export async function execute(this: IExecuteFunctions, items: INodeExecutionData[]) {
|
export async function execute(this: IExecuteFunctions, items: INodeExecutionData[]) {
|
||||||
const returnData: INodeExecutionData[] = [];
|
const returnData: INodeExecutionData[] = [];
|
||||||
|
|
||||||
|
const pairedItem = generatePairedItemData(items.length);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
|
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
|
||||||
const fileFormat = this.getNodeParameter('fileFormat', 0) as JsonToSpreadsheetBinaryFormat;
|
const fileFormat = this.getNodeParameter('fileFormat', 0) as JsonToSpreadsheetBinaryFormat;
|
||||||
@@ -22,6 +25,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
|
|||||||
binary: {
|
binary: {
|
||||||
[binaryPropertyName]: binaryData,
|
[binaryPropertyName]: binaryData,
|
||||||
},
|
},
|
||||||
|
pairedItem,
|
||||||
};
|
};
|
||||||
|
|
||||||
returnData.push(newItem);
|
returnData.push(newItem);
|
||||||
@@ -31,6 +35,7 @@ export async function execute(this: IExecuteFunctions, items: INodeExecutionData
|
|||||||
json: {
|
json: {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
},
|
},
|
||||||
|
pairedItem,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
|||||||
|
|
||||||
import type { IRecord } from './GenericFunction';
|
import type { IRecord } from './GenericFunction';
|
||||||
import { apiRequest, apiRequestAllItems } from './GenericFunction';
|
import { apiRequest, apiRequestAllItems } from './GenericFunction';
|
||||||
|
import { generatePairedItemData } from '../../utils/utilities';
|
||||||
|
|
||||||
export class Stackby implements INodeType {
|
export class Stackby implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
@@ -283,7 +284,11 @@ export class Stackby implements INodeType {
|
|||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.continueOnFail()) {
|
if (this.continueOnFail()) {
|
||||||
const executionErrorData = this.helpers.returnJsonArray({ error: error.message });
|
const itemData = generatePairedItemData(items.length);
|
||||||
|
const executionErrorData = this.helpers.constructExecutionMetaData(
|
||||||
|
this.helpers.returnJsonArray({ error: error.message }),
|
||||||
|
{ itemData },
|
||||||
|
);
|
||||||
returnData.push(...executionErrorData);
|
returnData.push(...executionErrorData);
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in New Issue
Block a user