refactor: Use NodeConnectionType consistently across the code base (no-changelog) (#10595)

This commit is contained in:
Ricardo Espinoza
2024-08-29 09:55:53 -04:00
committed by GitHub
parent 1491cbd228
commit c4eb3746d7
521 changed files with 2259 additions and 1999 deletions

View File

@@ -1,5 +1,5 @@
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
import type { INodeTypeDescription } from 'n8n-workflow';
import { NodeConnectionType, type INodeTypeDescription } from 'n8n-workflow';
import * as database from './database/Database.resource';
@@ -14,8 +14,8 @@ export const versionDescription: INodeTypeDescription = {
defaults: {
name: 'MySQL',
},
inputs: ['main'],
outputs: ['main'],
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
credentials: [
{
name: 'mySql',

View File

@@ -13,7 +13,7 @@ export async function searchTables(this: ILoadOptionsFunctions): Promise<INodeLi
const connection = await pool.getConnection();
const query = 'SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = ?';
const values = [credentials.database as string];
const values = [credentials.database];
const formatedQuery = connection.format(query, values);

View File

@@ -19,7 +19,7 @@ export async function getColumns(this: ILoadOptionsFunctions): Promise<INodeProp
const columns = (
await connection.query(
`SHOW COLUMNS FROM ${escapeSqlIdentifier(table)} FROM ${escapeSqlIdentifier(
credentials.database as string,
credentials.database,
)}`,
)
)[0] as IDataObject[];

View File

@@ -7,8 +7,8 @@ import type {
ILoadOptionsFunctions,
} from 'n8n-workflow';
import { formatPrivateKey } from '@utils/utilities';
import type { Mysql2Pool, MysqlNodeCredentials } from '../helpers/interfaces';
import { formatPrivateKey } from '@utils/utilities';
import { LOCALHOST } from '@utils/constants';
export async function createPool(
@@ -64,7 +64,7 @@ export async function createPool(
return mysql2.createPool(connectionOptions);
} else {
if (credentials.sshAuthenticateWith === 'privateKey' && credentials.privateKey) {
credentials.privateKey = formatPrivateKey(credentials.privateKey as string);
credentials.privateKey = formatPrivateKey(credentials.privateKey);
}
const sshClient = await this.helpers.getSSHClient(credentials);