fix(core): Missing pairing info (#7326)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Michael Kret
2023-10-10 18:36:20 +03:00
committed by GitHub
parent 6479eb180f
commit e2c3c7aceb
52 changed files with 363 additions and 157 deletions

View File

@@ -19,6 +19,7 @@ import type {
} from './interfaces';
import { BATCH_MODE } from './interfaces';
import { generatePairedItemData } from '../../../../utils/utilities';
export const prepareQueryAndReplacements = (rawQuery: string, replacements?: QueryValues) => {
if (replacements === undefined) {
@@ -122,6 +123,7 @@ export function prepareOutput(
itemData: IPairedItemData | IPairedItemData[];
},
) => NodeExecutionWithMetadata[],
itemData: IPairedItemData | IPairedItemData[],
) {
const returnData: INodeExecutionData[] = [];
@@ -133,7 +135,7 @@ export function prepareOutput(
};
const executionData = constructExecutionHelper(wrapData(item), {
itemData: { item: index },
itemData,
});
returnData.push(...executionData);
@@ -141,9 +143,9 @@ export function prepareOutput(
} else {
response
.filter((entry) => Array.isArray(entry))
.forEach((entry, index) => {
.forEach((entry) => {
const executionData = constructExecutionHelper(wrapData(entry), {
itemData: { item: index },
itemData,
});
returnData.push(...executionData);
@@ -152,7 +154,7 @@ export function prepareOutput(
if (!returnData.length) {
if ((options?.nodeVersion as number) < 2.2) {
returnData.push({ json: { success: true } });
returnData.push({ json: { success: true }, pairedItem: itemData });
} else {
const isSelectQuery = statements
.filter((statement) => !statement.startsWith('--'))
@@ -165,7 +167,7 @@ export function prepareOutput(
);
if (!isSelectQuery) {
returnData.push({ json: { success: true } });
returnData.push({ json: { success: true }, pairedItem: itemData });
}
}
}
@@ -218,8 +220,17 @@ export function configureQueryRunner(
response = [response];
}
//because single query is used in this mode mapping itemIndex not posible, setting all items as paired
const pairedItem = generatePairedItemData(queries.length);
returnData.push(
...prepareOutput(response, options, statements, this.helpers.constructExecutionMetaData),
...prepareOutput(
response,
options,
statements,
this.helpers.constructExecutionMetaData,
pairedItem,
),
);
} catch (err) {
const error = parseMySqlError.call(this, err, 0, formatedQueries);
@@ -250,6 +261,7 @@ export function configureQueryRunner(
options,
statements,
this.helpers.constructExecutionMetaData,
{ item: index },
),
);
} catch (err) {
@@ -288,6 +300,7 @@ export function configureQueryRunner(
options,
statements,
this.helpers.constructExecutionMetaData,
{ item: index },
),
);
} catch (err) {