mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Impose import/order linting rule across nodes packages (no-changelog) (#12314)
This commit is contained in:
committed by
GitHub
parent
8c635993bd
commit
bafac73eb5
@@ -1,9 +1,9 @@
|
||||
import type { INodeTypes } from 'n8n-workflow';
|
||||
|
||||
import nock from 'nock';
|
||||
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
||||
|
||||
const queryMock = jest.fn(async function () {
|
||||
return [{ success: true }];
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import mysql2 from 'mysql2/promise';
|
||||
import type { IDataObject, INode } from 'n8n-workflow';
|
||||
|
||||
import mysql2 from 'mysql2/promise';
|
||||
import * as deleteTable from '../../v2/actions/database/deleteTable.operation';
|
||||
import { createMockExecuteFunction } from '@test/nodes/Helpers';
|
||||
|
||||
import * as deleteTable from '../../v2/actions/database/deleteTable.operation';
|
||||
import * as executeQuery from '../../v2/actions/database/executeQuery.operation';
|
||||
import * as insert from '../../v2/actions/database/insert.operation';
|
||||
import * as select from '../../v2/actions/database/select.operation';
|
||||
import * as update from '../../v2/actions/database/update.operation';
|
||||
import * as upsert from '../../v2/actions/database/upsert.operation';
|
||||
|
||||
import type { Mysql2Pool, QueryRunner } from '../../v2/helpers/interfaces';
|
||||
import { configureQueryRunner } from '../../v2/helpers/utils';
|
||||
import { createMockExecuteFunction } from '@test/nodes/Helpers';
|
||||
|
||||
const mySqlMockNode: INode = {
|
||||
id: '1',
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import type { IDataObject, INode } from 'n8n-workflow';
|
||||
import mysql2 from 'mysql2/promise';
|
||||
import { configureQueryRunner } from '../../v2/helpers/utils';
|
||||
import type { Mysql2Pool, QueryRunner } from '../../v2/helpers/interfaces';
|
||||
import { BATCH_MODE } from '../../v2/helpers/interfaces';
|
||||
import type { IDataObject, INode } from 'n8n-workflow';
|
||||
|
||||
import { createMockExecuteFunction } from '@test/nodes/Helpers';
|
||||
|
||||
import type { Mysql2Pool, QueryRunner } from '../../v2/helpers/interfaces';
|
||||
import { BATCH_MODE } from '../../v2/helpers/interfaces';
|
||||
import { configureQueryRunner } from '../../v2/helpers/utils';
|
||||
|
||||
const mySqlMockNode: INode = {
|
||||
id: '1',
|
||||
name: 'MySQL node',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { INode } from 'n8n-workflow';
|
||||
import type { SortRule, WhereClause } from '../../v2/helpers/interfaces';
|
||||
|
||||
import type { SortRule, WhereClause } from '../../v2/helpers/interfaces';
|
||||
import {
|
||||
prepareQueryAndReplacements,
|
||||
wrapData,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import mysql2 from 'mysql2/promise';
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeListSearchResult,
|
||||
} from 'n8n-workflow';
|
||||
import mysql2 from 'mysql2/promise';
|
||||
|
||||
export async function createConnection(
|
||||
credentials: ICredentialDataDecryptedObject,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type mysql2 from 'mysql2/promise';
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentialsDecrypted,
|
||||
@@ -12,13 +13,11 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type mysql2 from 'mysql2/promise';
|
||||
|
||||
import { createConnection, searchTables } from './GenericFunctions';
|
||||
|
||||
import { oldVersionNotice } from '@utils/descriptions';
|
||||
import { getResolvables } from '@utils/utilities';
|
||||
|
||||
import { createConnection, searchTables } from './GenericFunctions';
|
||||
|
||||
const versionDescription: INodeTypeDescription = {
|
||||
displayName: 'MySQL',
|
||||
name: 'mySql',
|
||||
|
||||
@@ -6,11 +6,9 @@ import type {
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { listSearch, credentialTest, loadOptions } from './methods';
|
||||
|
||||
import { versionDescription } from './actions/versionDescription';
|
||||
|
||||
import { router } from './actions/router';
|
||||
import { versionDescription } from './actions/versionDescription';
|
||||
import { listSearch, credentialTest, loadOptions } from './methods';
|
||||
|
||||
export class MySqlV2 implements INodeType {
|
||||
description: INodeTypeDescription;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { BATCH_MODE, SINGLE } from '../helpers/interfaces';
|
||||
|
||||
export const tableRLC: INodeProperties = {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import { tableRLC } from '../common.descriptions';
|
||||
import * as deleteTable from './deleteTable.operation';
|
||||
import * as executeQuery from './executeQuery.operation';
|
||||
import * as insert from './insert.operation';
|
||||
import * as select from './select.operation';
|
||||
import * as update from './update.operation';
|
||||
import * as upsert from './upsert.operation';
|
||||
import { tableRLC } from '../common.descriptions';
|
||||
|
||||
export { deleteTable, executeQuery, insert, select, update, upsert };
|
||||
|
||||
|
||||
@@ -6,21 +6,20 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import type {
|
||||
QueryRunner,
|
||||
QueryValues,
|
||||
QueryWithValues,
|
||||
WhereClause,
|
||||
} from '../../helpers/interfaces';
|
||||
|
||||
import { addWhereClauses, escapeSqlIdentifier } from '../../helpers/utils';
|
||||
|
||||
import {
|
||||
optionsCollection,
|
||||
selectRowsFixedCollection,
|
||||
combineConditionsCollection,
|
||||
} from '../common.descriptions';
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
|
||||
@@ -6,13 +6,12 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { QueryRunner, QueryWithValues } from '../../helpers/interfaces';
|
||||
|
||||
import { prepareQueryAndReplacements, replaceEmptyStringsByNulls } from '../../helpers/utils';
|
||||
|
||||
import { optionsCollection } from '../common.descriptions';
|
||||
import { getResolvables, updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import type { QueryRunner, QueryWithValues } from '../../helpers/interfaces';
|
||||
import { prepareQueryAndReplacements, replaceEmptyStringsByNulls } from '../../helpers/utils';
|
||||
import { optionsCollection } from '../common.descriptions';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Query',
|
||||
|
||||
@@ -5,19 +5,17 @@ import type {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import type {
|
||||
QueryMode,
|
||||
QueryRunner,
|
||||
QueryValues,
|
||||
QueryWithValues,
|
||||
} from '../../helpers/interfaces';
|
||||
|
||||
import { AUTO_MAP, BATCH_MODE, DATA_MODE } from '../../helpers/interfaces';
|
||||
|
||||
import { escapeSqlIdentifier, replaceEmptyStringsByNulls } from '../../helpers/utils';
|
||||
|
||||
import { optionsCollection } from '../common.descriptions';
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
|
||||
@@ -5,6 +5,8 @@ import type {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import type {
|
||||
QueryRunner,
|
||||
QueryValues,
|
||||
@@ -12,16 +14,13 @@ import type {
|
||||
SortRule,
|
||||
WhereClause,
|
||||
} from '../../helpers/interfaces';
|
||||
|
||||
import { addSortRules, addWhereClauses, escapeSqlIdentifier } from '../../helpers/utils';
|
||||
|
||||
import {
|
||||
optionsCollection,
|
||||
sortFixedCollection,
|
||||
selectRowsFixedCollection,
|
||||
combineConditionsCollection,
|
||||
} from '../common.descriptions';
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
|
||||
@@ -5,13 +5,12 @@ import type {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import type { QueryRunner, QueryValues, QueryWithValues } from '../../helpers/interfaces';
|
||||
import { AUTO_MAP, DATA_MODE } from '../../helpers/interfaces';
|
||||
|
||||
import { escapeSqlIdentifier, replaceEmptyStringsByNulls } from '../../helpers/utils';
|
||||
|
||||
import { optionsCollection } from '../common.descriptions';
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
|
||||
@@ -5,13 +5,12 @@ import type {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
import type { QueryRunner, QueryValues, QueryWithValues } from '../../helpers/interfaces';
|
||||
import { AUTO_MAP, DATA_MODE } from '../../helpers/interfaces';
|
||||
|
||||
import { escapeSqlIdentifier, replaceEmptyStringsByNulls } from '../../helpers/utils';
|
||||
|
||||
import { optionsCollection } from '../common.descriptions';
|
||||
import { updateDisplayOptions } from '@utils/utilities';
|
||||
|
||||
const properties: INodeProperties[] = [
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { createPool } from '../transport';
|
||||
import type { MysqlNodeCredentials, QueryRunner } from '../helpers/interfaces';
|
||||
import { configureQueryRunner } from '../helpers/utils';
|
||||
import * as database from './database/Database.resource';
|
||||
import type { MySqlType } from './node.type';
|
||||
import type { MysqlNodeCredentials, QueryRunner } from '../helpers/interfaces';
|
||||
import { configureQueryRunner } from '../helpers/utils';
|
||||
import { createPool } from '../transport';
|
||||
|
||||
export async function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
let returnData: INodeExecutionData[] = [];
|
||||
|
||||
@@ -6,10 +6,8 @@ import type {
|
||||
IPairedItemData,
|
||||
NodeExecutionWithMetadata,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { generatePairedItemData } from '../../../../utils/utilities';
|
||||
import type {
|
||||
Mysql2Pool,
|
||||
QueryMode,
|
||||
@@ -18,8 +16,8 @@ import type {
|
||||
SortRule,
|
||||
WhereClause,
|
||||
} from './interfaces';
|
||||
|
||||
import { BATCH_MODE } from './interfaces';
|
||||
import { generatePairedItemData } from '../../../../utils/utilities';
|
||||
|
||||
export function escapeSqlIdentifier(identifier: string): string {
|
||||
const parts = identifier.match(/(`[^`]*`|[^.`]+)/g) ?? [];
|
||||
|
||||
@@ -4,8 +4,8 @@ import type {
|
||||
INodeCredentialTestResult,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { createPool } from '../transport';
|
||||
import type { MysqlNodeCredentials } from '../helpers/interfaces';
|
||||
import { createPool } from '../transport';
|
||||
|
||||
export async function mysqlConnectionTest(
|
||||
this: ICredentialTestFunctions,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { IDataObject, ILoadOptionsFunctions, INodeListSearchResult } from 'n8n-workflow';
|
||||
import { createPool } from '../transport';
|
||||
|
||||
import type { MysqlNodeCredentials } from '../helpers/interfaces';
|
||||
import { createPool } from '../transport';
|
||||
|
||||
export async function searchTables(this: ILoadOptionsFunctions): Promise<INodeListSearchResult> {
|
||||
const credentials = await this.getCredentials<MysqlNodeCredentials>('mySql');
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { IDataObject, ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
||||
import { createPool } from '../transport';
|
||||
import { escapeSqlIdentifier } from '../helpers/utils';
|
||||
|
||||
import type { MysqlNodeCredentials } from '../helpers/interfaces';
|
||||
import { escapeSqlIdentifier } from '../helpers/utils';
|
||||
import { createPool } from '../transport';
|
||||
|
||||
export async function getColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const credentials = await this.getCredentials<MysqlNodeCredentials>('mySql');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { createServer, type AddressInfo } from 'node:net';
|
||||
import mysql2 from 'mysql2/promise';
|
||||
import type {
|
||||
ICredentialTestFunctions,
|
||||
@@ -6,10 +5,12 @@ import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-workflow';
|
||||
import { createServer, type AddressInfo } from 'node:net';
|
||||
|
||||
import { LOCALHOST } from '@utils/constants';
|
||||
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(
|
||||
this: IExecuteFunctions | ICredentialTestFunctions | ILoadOptionsFunctions,
|
||||
|
||||
Reference in New Issue
Block a user