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

@@ -6,7 +6,7 @@ import type {
INodeTypeDescription,
} from 'n8n-workflow';
import { connect, copyInputItems, destroy, execute } from './GenericFunctions';
import { connect, destroy, execute } from './GenericFunctions';
import snowflake from 'snowflake-sdk';
import { getResolvables } from '@utils/utilities';
@@ -207,7 +207,7 @@ export class Snowflake implements INodeType {
const query = `INSERT INTO ${table}(${columns.join(',')}) VALUES (${columns
.map((_column) => '?')
.join(',')})`;
const data = copyInputItems(items, columns);
const data = this.helpers.copyInputItems(items, columns);
const binds = data.map((element) => Object.values(element));
await execute(connection, query, binds as unknown as snowflake.InsertBinds);
data.forEach((d, i) => {
@@ -236,7 +236,7 @@ export class Snowflake implements INodeType {
const query = `UPDATE ${table} SET ${columns
.map((column) => `${column} = ?`)
.join(',')} WHERE ${updateKey} = ?;`;
const data = copyInputItems(items, columns);
const data = this.helpers.copyInputItems(items, columns);
const binds = data.map((element) => Object.values(element).concat(element[updateKey]));
for (let i = 0; i < binds.length; i++) {
await execute(connection, query, binds[i] as unknown as snowflake.InsertBinds);