refactor(core): Move copyInputItems to node helpers (no-changelog) (#7299)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-10-06 16:25:58 +02:00
committed by GitHub
parent 34bda535e6
commit 597669aa62
9 changed files with 84 additions and 95 deletions

View File

@@ -7,7 +7,7 @@ import type {
NodeExecutionWithMetadata,
} from 'n8n-workflow';
import { NodeOperationError, deepCopy } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow';
import type {
Mysql2Pool,
@@ -20,22 +20,6 @@ import type {
import { BATCH_MODE } from './interfaces';
export function copyInputItems(items: INodeExecutionData[], properties: string[]): IDataObject[] {
// Prepare the data to insert and copy it to be returned
let newItem: IDataObject;
return items.map((item) => {
newItem = {};
for (const property of properties) {
if (item.json[property] === undefined) {
newItem[property] = null;
} else {
newItem[property] = deepCopy(item.json[property]);
}
}
return newItem;
});
}
export const prepareQueryAndReplacements = (rawQuery: string, replacements?: QueryValues) => {
if (replacements === undefined) {
return { query: rawQuery, values: [] };