diff --git a/packages/core/.eslintrc.js b/packages/core/.eslintrc.js index cd962bad5c..9bfae8a9eb 100644 --- a/packages/core/.eslintrc.js +++ b/packages/core/.eslintrc.js @@ -18,7 +18,6 @@ module.exports = { complexity: 'error', // TODO: Remove this - 'import/order': 'off', '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': true }], }, }; diff --git a/packages/core/src/ActiveWorkflows.ts b/packages/core/src/ActiveWorkflows.ts index bfc6319626..93e67488d5 100644 --- a/packages/core/src/ActiveWorkflows.ts +++ b/packages/core/src/ActiveWorkflows.ts @@ -1,5 +1,3 @@ -import { Service } from 'typedi'; - import type { IGetExecutePollFunctions, IGetExecuteTriggerFunctions, @@ -20,9 +18,10 @@ import { WorkflowActivationError, WorkflowDeactivationError, } from 'n8n-workflow'; +import { Service } from 'typedi'; -import { ScheduledTaskManager } from './ScheduledTaskManager'; import type { IWorkflowData } from './Interfaces'; +import { ScheduledTaskManager } from './ScheduledTaskManager'; @Service() export class ActiveWorkflows { diff --git a/packages/core/src/BinaryData/BinaryData.service.ts b/packages/core/src/BinaryData/BinaryData.service.ts index 20903aa71c..556a3176de 100644 --- a/packages/core/src/BinaryData/BinaryData.service.ts +++ b/packages/core/src/BinaryData/BinaryData.service.ts @@ -1,14 +1,14 @@ +import { BINARY_ENCODING } from 'n8n-workflow'; +import type { INodeExecutionData, IBinaryData } from 'n8n-workflow'; import { readFile, stat } from 'node:fs/promises'; import prettyBytes from 'pretty-bytes'; -import Container, { Service } from 'typedi'; -import { BINARY_ENCODING } from 'n8n-workflow'; -import { InvalidModeError } from '../errors/invalid-mode.error'; -import { areConfigModes, binaryToBuffer } from './utils'; - import type { Readable } from 'stream'; +import Container, { Service } from 'typedi'; + import type { BinaryData } from './types'; -import type { INodeExecutionData, IBinaryData } from 'n8n-workflow'; +import { areConfigModes, binaryToBuffer } from './utils'; import { InvalidManagerError } from '../errors/invalid-manager.error'; +import { InvalidModeError } from '../errors/invalid-mode.error'; @Service() export class BinaryDataService { diff --git a/packages/core/src/BinaryData/FileSystem.manager.ts b/packages/core/src/BinaryData/FileSystem.manager.ts index 5b7250d9eb..f49e6e5c02 100644 --- a/packages/core/src/BinaryData/FileSystem.manager.ts +++ b/packages/core/src/BinaryData/FileSystem.manager.ts @@ -1,13 +1,13 @@ +import { jsonParse } from 'n8n-workflow'; import { createReadStream } from 'node:fs'; import fs from 'node:fs/promises'; import path from 'node:path'; +import type { Readable } from 'stream'; import { v4 as uuid } from 'uuid'; -import { jsonParse } from 'n8n-workflow'; + +import type { BinaryData } from './types'; import { assertDir, doesNotExist } from './utils'; import { DisallowedFilepathError } from '../errors/disallowed-filepath.error'; - -import type { Readable } from 'stream'; -import type { BinaryData } from './types'; import { FileNotFoundError } from '../errors/file-not-found.error'; const EXECUTION_ID_EXTRACTOR = diff --git a/packages/core/src/BinaryData/ObjectStore.manager.ts b/packages/core/src/BinaryData/ObjectStore.manager.ts index 6f7bb3ef29..65827d4ef0 100644 --- a/packages/core/src/BinaryData/ObjectStore.manager.ts +++ b/packages/core/src/BinaryData/ObjectStore.manager.ts @@ -1,12 +1,12 @@ import fs from 'node:fs/promises'; +import type { Readable } from 'node:stream'; import { Service } from 'typedi'; import { v4 as uuid } from 'uuid'; + +import type { BinaryData } from './types'; import { binaryToBuffer } from './utils'; import { ObjectStoreService } from '../ObjectStore/ObjectStore.service.ee'; -import type { Readable } from 'node:stream'; -import type { BinaryData } from './types'; - @Service() export class ObjectStoreManager implements BinaryData.Manager { constructor(private readonly objectStoreService: ObjectStoreService) {} diff --git a/packages/core/src/BinaryData/utils.ts b/packages/core/src/BinaryData/utils.ts index c64cb4315b..bedda5be12 100644 --- a/packages/core/src/BinaryData/utils.ts +++ b/packages/core/src/BinaryData/utils.ts @@ -1,7 +1,8 @@ +import concatStream from 'concat-stream'; import fs from 'node:fs/promises'; import type { Readable } from 'node:stream'; + import type { BinaryData } from './types'; -import concatStream from 'concat-stream'; export const CONFIG_MODES = ['default', 'filesystem', 's3'] as const; diff --git a/packages/core/src/Cipher.ts b/packages/core/src/Cipher.ts index 4e1b649bed..d9ed93ddb6 100644 --- a/packages/core/src/Cipher.ts +++ b/packages/core/src/Cipher.ts @@ -1,5 +1,6 @@ -import { Service } from 'typedi'; import { createHash, createCipheriv, createDecipheriv, randomBytes } from 'crypto'; +import { Service } from 'typedi'; + import { InstanceSettings } from './InstanceSettings'; // Data encrypted by CryptoJS always starts with these bytes diff --git a/packages/core/src/Credentials.ts b/packages/core/src/Credentials.ts index 3210703a27..da6deb742c 100644 --- a/packages/core/src/Credentials.ts +++ b/packages/core/src/Credentials.ts @@ -1,6 +1,7 @@ -import { Container } from 'typedi'; import type { ICredentialDataDecryptedObject, ICredentialsEncrypted } from 'n8n-workflow'; import { ApplicationError, ICredentials, jsonParse } from 'n8n-workflow'; +import { Container } from 'typedi'; + import { Cipher } from './Cipher'; export class Credentials< diff --git a/packages/core/src/DirectoryLoader.ts b/packages/core/src/DirectoryLoader.ts index cef3db4068..a1401a8fb5 100644 --- a/packages/core/src/DirectoryLoader.ts +++ b/packages/core/src/DirectoryLoader.ts @@ -1,6 +1,4 @@ import glob from 'fast-glob'; -import { readFileSync } from 'node:fs'; -import { readFile } from 'node:fs/promises'; import type { CodexData, DocumentationLink, @@ -21,7 +19,10 @@ import { getVersionedNodeTypeAll, jsonParse, } from 'n8n-workflow'; +import { readFileSync } from 'node:fs'; +import { readFile } from 'node:fs/promises'; import * as path from 'path'; + import { loadClassInIsolation } from './ClassLoader'; import { CUSTOM_NODES_CATEGORY } from './Constants'; import type { n8n } from './Interfaces'; diff --git a/packages/core/src/ExecutionMetadata.ts b/packages/core/src/ExecutionMetadata.ts index cc2743a56f..8466933e05 100644 --- a/packages/core/src/ExecutionMetadata.ts +++ b/packages/core/src/ExecutionMetadata.ts @@ -1,5 +1,6 @@ import type { IRunExecutionData } from 'n8n-workflow'; import { LoggerProxy as Logger } from 'n8n-workflow'; + import { InvalidExecutionMetadataError } from './errors/invalid-execution-metadata.error'; export const KV_LIMIT = 10; diff --git a/packages/core/src/InstanceSettings.ts b/packages/core/src/InstanceSettings.ts index 44f4b0c336..17ccf15def 100644 --- a/packages/core/src/InstanceSettings.ts +++ b/packages/core/src/InstanceSettings.ts @@ -1,8 +1,8 @@ -import path from 'path'; -import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs'; import { createHash, randomBytes } from 'crypto'; -import { Service } from 'typedi'; +import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs'; import { ApplicationError, jsonParse } from 'n8n-workflow'; +import path from 'path'; +import { Service } from 'typedi'; interface ReadOnlySettings { encryptionKey: string; diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index 0d37dde2b3..af428026b7 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -32,6 +32,7 @@ import { IncomingMessage, type IncomingHttpHeaders } from 'http'; import { Agent, type AgentOptions } from 'https'; import get from 'lodash/get'; import isEmpty from 'lodash/isEmpty'; +import merge from 'lodash/merge'; import pick from 'lodash/pick'; import { DateTime } from 'luxon'; import { extension, lookup } from 'mime-types'; @@ -128,9 +129,12 @@ import clientOAuth1 from 'oauth-1.0a'; import path from 'path'; import { stringify } from 'qs'; import { Readable } from 'stream'; +import Container from 'typedi'; import url, { URL, URLSearchParams } from 'url'; import { BinaryDataService } from './BinaryData/BinaryData.service'; +import type { BinaryData } from './BinaryData/types'; +import { binaryToBuffer } from './BinaryData/utils'; import { BINARY_DATA_STORAGE_PATH, BLOCK_FILE_ACCESS_TO_N8N_FILES, @@ -143,23 +147,19 @@ import { UM_EMAIL_TEMPLATES_INVITE, UM_EMAIL_TEMPLATES_PWRESET, } from './Constants'; -import { extractValue } from './ExtractValue'; -import type { ExtendedValidationResult, IResponseError } from './Interfaces'; +import { getNodeAsTool } from './CreateNodeAsTool'; import { getAllWorkflowExecutionMetadata, getWorkflowExecutionMetadata, setAllWorkflowExecutionMetadata, setWorkflowExecutionMetadata, } from './ExecutionMetadata'; -import { getSecretsProxy } from './Secrets'; -import Container from 'typedi'; -import type { BinaryData } from './BinaryData/types'; -import merge from 'lodash/merge'; +import { extractValue } from './ExtractValue'; import { InstanceSettings } from './InstanceSettings'; +import type { ExtendedValidationResult, IResponseError } from './Interfaces'; import { ScheduledTaskManager } from './ScheduledTaskManager'; +import { getSecretsProxy } from './Secrets'; import { SSHClientsManager } from './SSHClientsManager'; -import { binaryToBuffer } from './BinaryData/utils'; -import { getNodeAsTool } from './CreateNodeAsTool'; axios.defaults.timeout = 300000; // Prevent axios from adding x-form-www-urlencoded headers by default diff --git a/packages/core/src/ObjectStore/ObjectStore.service.ee.ts b/packages/core/src/ObjectStore/ObjectStore.service.ee.ts index ddd21db799..0e4d8463df 100644 --- a/packages/core/src/ObjectStore/ObjectStore.service.ee.ts +++ b/packages/core/src/ObjectStore/ObjectStore.service.ee.ts @@ -1,12 +1,12 @@ -import { createHash } from 'node:crypto'; -import axios from 'axios'; -import { Service } from 'typedi'; import { sign } from 'aws4'; -import { isStream, parseXml, writeBlockedMessage } from './utils'; -import { ApplicationError, LoggerProxy as Logger } from 'n8n-workflow'; - -import type { AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig, Method } from 'axios'; import type { Request as Aws4Options, Credentials as Aws4Credentials } from 'aws4'; +import axios from 'axios'; +import type { AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig, Method } from 'axios'; +import { ApplicationError, LoggerProxy as Logger } from 'n8n-workflow'; +import { createHash } from 'node:crypto'; +import type { Readable } from 'stream'; +import { Service } from 'typedi'; + import type { Bucket, ConfigSchemaCredentials, @@ -15,7 +15,7 @@ import type { RawListPage, RequestOptions, } from './types'; -import type { Readable } from 'stream'; +import { isStream, parseXml, writeBlockedMessage } from './utils'; import type { BinaryData } from '../BinaryData/types'; @Service() diff --git a/packages/core/src/ObjectStore/types.ts b/packages/core/src/ObjectStore/types.ts index 639ae2e6a2..d0b7ab0713 100644 --- a/packages/core/src/ObjectStore/types.ts +++ b/packages/core/src/ObjectStore/types.ts @@ -1,4 +1,5 @@ import type { AxiosResponseHeaders, ResponseType } from 'axios'; + import type { BinaryData } from '../BinaryData/types'; export type RawListPage = { diff --git a/packages/core/src/PartialExecutionUtils/__tests__/DirectedGraph.test.ts b/packages/core/src/PartialExecutionUtils/__tests__/DirectedGraph.test.ts index 93df23de32..b383b5939a 100644 --- a/packages/core/src/PartialExecutionUtils/__tests__/DirectedGraph.test.ts +++ b/packages/core/src/PartialExecutionUtils/__tests__/DirectedGraph.test.ts @@ -9,8 +9,8 @@ // XX denotes that the node is disabled // PD denotes that the node has pinned data -import { DirectedGraph } from '../DirectedGraph'; import { createNodeData, defaultWorkflowParameter } from './helpers'; +import { DirectedGraph } from '../DirectedGraph'; describe('DirectedGraph', () => { // ┌─────┐ ┌─────┐ ┌─────┐ diff --git a/packages/core/src/PartialExecutionUtils/__tests__/cleanRunData.test.ts b/packages/core/src/PartialExecutionUtils/__tests__/cleanRunData.test.ts index fabfae0ee3..bf37ec7636 100644 --- a/packages/core/src/PartialExecutionUtils/__tests__/cleanRunData.test.ts +++ b/packages/core/src/PartialExecutionUtils/__tests__/cleanRunData.test.ts @@ -1,7 +1,8 @@ import type { IRunData } from 'n8n-workflow'; + +import { createNodeData, toITaskData } from './helpers'; import { cleanRunData } from '../cleanRunData'; import { DirectedGraph } from '../DirectedGraph'; -import { createNodeData, toITaskData } from './helpers'; describe('cleanRunData', () => { // ┌─────┐ ┌─────┐ ┌─────┐ diff --git a/packages/core/src/PartialExecutionUtils/__tests__/findStartNodes.test.ts b/packages/core/src/PartialExecutionUtils/__tests__/findStartNodes.test.ts index c830833d8d..0ea2e4f611 100644 --- a/packages/core/src/PartialExecutionUtils/__tests__/findStartNodes.test.ts +++ b/packages/core/src/PartialExecutionUtils/__tests__/findStartNodes.test.ts @@ -10,9 +10,10 @@ // PD denotes that the node has pinned data import { type IPinData, type IRunData } from 'n8n-workflow'; + import { createNodeData, toITaskData } from './helpers'; -import { findStartNodes, isDirty } from '../findStartNodes'; import { DirectedGraph } from '../DirectedGraph'; +import { findStartNodes, isDirty } from '../findStartNodes'; describe('isDirty', () => { test("if the node has pinned data it's not dirty", () => { diff --git a/packages/core/src/PartialExecutionUtils/__tests__/findSubgraph.test.ts b/packages/core/src/PartialExecutionUtils/__tests__/findSubgraph.test.ts index d82f73e9e3..40ff50df32 100644 --- a/packages/core/src/PartialExecutionUtils/__tests__/findSubgraph.test.ts +++ b/packages/core/src/PartialExecutionUtils/__tests__/findSubgraph.test.ts @@ -9,9 +9,9 @@ // XX denotes that the node is disabled // PD denotes that the node has pinned data +import { createNodeData } from './helpers'; import { DirectedGraph } from '../DirectedGraph'; import { findSubgraph } from '../findSubgraph'; -import { createNodeData } from './helpers'; describe('findSubgraph2', () => { // ►► diff --git a/packages/core/src/PartialExecutionUtils/__tests__/getSourceDataGroups.test.ts b/packages/core/src/PartialExecutionUtils/__tests__/getSourceDataGroups.test.ts index 737d0a2754..dffbe310d1 100644 --- a/packages/core/src/PartialExecutionUtils/__tests__/getSourceDataGroups.test.ts +++ b/packages/core/src/PartialExecutionUtils/__tests__/getSourceDataGroups.test.ts @@ -9,8 +9,9 @@ import type { IPinData } from 'n8n-workflow'; import { NodeConnectionType, type IRunData } from 'n8n-workflow'; -import { DirectedGraph } from '../DirectedGraph'; + import { createNodeData, toITaskData } from './helpers'; +import { DirectedGraph } from '../DirectedGraph'; import { getSourceDataGroups } from '../getSourceDataGroups'; describe('getSourceDataGroups', () => { diff --git a/packages/core/src/PartialExecutionUtils/__tests__/recreateNodeExecutionStack.test.ts b/packages/core/src/PartialExecutionUtils/__tests__/recreateNodeExecutionStack.test.ts index 42cbe1f5ff..d0cc934b13 100644 --- a/packages/core/src/PartialExecutionUtils/__tests__/recreateNodeExecutionStack.test.ts +++ b/packages/core/src/PartialExecutionUtils/__tests__/recreateNodeExecutionStack.test.ts @@ -9,12 +9,14 @@ // XX denotes that the node is disabled // PD denotes that the node has pinned data -import { recreateNodeExecutionStack } from '@/PartialExecutionUtils/recreateNodeExecutionStack'; -import { type IPinData, type IRunData } from 'n8n-workflow'; import { AssertionError } from 'assert'; +import { type IPinData, type IRunData } from 'n8n-workflow'; + +import { recreateNodeExecutionStack } from '@/PartialExecutionUtils/recreateNodeExecutionStack'; + +import { createNodeData, toITaskData } from './helpers'; import { DirectedGraph } from '../DirectedGraph'; import { findSubgraph } from '../findSubgraph'; -import { createNodeData, toITaskData } from './helpers'; describe('recreateNodeExecutionStack', () => { // ►► diff --git a/packages/core/src/PartialExecutionUtils/__tests__/toIConnections.test.ts b/packages/core/src/PartialExecutionUtils/__tests__/toIConnections.test.ts index a2524bf3ce..e5ea0e658a 100644 --- a/packages/core/src/PartialExecutionUtils/__tests__/toIConnections.test.ts +++ b/packages/core/src/PartialExecutionUtils/__tests__/toIConnections.test.ts @@ -1,4 +1,5 @@ import { NodeConnectionType } from 'n8n-workflow'; + import { createNodeData, toIConnections } from './helpers'; test('toIConnections', () => { diff --git a/packages/core/src/PartialExecutionUtils/__tests__/toITaskData.test.ts b/packages/core/src/PartialExecutionUtils/__tests__/toITaskData.test.ts index e255836339..fe9c3f132a 100644 --- a/packages/core/src/PartialExecutionUtils/__tests__/toITaskData.test.ts +++ b/packages/core/src/PartialExecutionUtils/__tests__/toITaskData.test.ts @@ -1,4 +1,5 @@ import { NodeConnectionType } from 'n8n-workflow'; + import { toITaskData } from './helpers'; test('toITaskData', function () { diff --git a/packages/core/src/PartialExecutionUtils/cleanRunData.ts b/packages/core/src/PartialExecutionUtils/cleanRunData.ts index 945dca1451..5d74a3575a 100644 --- a/packages/core/src/PartialExecutionUtils/cleanRunData.ts +++ b/packages/core/src/PartialExecutionUtils/cleanRunData.ts @@ -1,4 +1,5 @@ import type { INode, IRunData } from 'n8n-workflow'; + import type { DirectedGraph } from './DirectedGraph'; /** diff --git a/packages/core/src/PartialExecutionUtils/findStartNodes.ts b/packages/core/src/PartialExecutionUtils/findStartNodes.ts index 910045d709..12a9688c1c 100644 --- a/packages/core/src/PartialExecutionUtils/findStartNodes.ts +++ b/packages/core/src/PartialExecutionUtils/findStartNodes.ts @@ -1,4 +1,5 @@ import type { INode, IPinData, IRunData } from 'n8n-workflow'; + import type { DirectedGraph } from './DirectedGraph'; import { getIncomingData } from './getIncomingData'; diff --git a/packages/core/src/PartialExecutionUtils/findSubgraph.ts b/packages/core/src/PartialExecutionUtils/findSubgraph.ts index 2b1ceb2998..4564d15ed5 100644 --- a/packages/core/src/PartialExecutionUtils/findSubgraph.ts +++ b/packages/core/src/PartialExecutionUtils/findSubgraph.ts @@ -1,4 +1,5 @@ import type { INode } from 'n8n-workflow'; + import type { GraphConnection } from './DirectedGraph'; import { DirectedGraph } from './DirectedGraph'; diff --git a/packages/core/src/PartialExecutionUtils/findTriggerForPartialExecution.ts b/packages/core/src/PartialExecutionUtils/findTriggerForPartialExecution.ts index baae6e7304..977e99c107 100644 --- a/packages/core/src/PartialExecutionUtils/findTriggerForPartialExecution.ts +++ b/packages/core/src/PartialExecutionUtils/findTriggerForPartialExecution.ts @@ -1,5 +1,5 @@ -import type { INode, Workflow } from 'n8n-workflow'; import * as assert from 'assert/strict'; +import type { INode, Workflow } from 'n8n-workflow'; function findAllParentTriggers(workflow: Workflow, destinationNodeName: string) { const parentNodes = workflow diff --git a/packages/core/src/PartialExecutionUtils/recreateNodeExecutionStack.ts b/packages/core/src/PartialExecutionUtils/recreateNodeExecutionStack.ts index b1e3334440..897838d511 100644 --- a/packages/core/src/PartialExecutionUtils/recreateNodeExecutionStack.ts +++ b/packages/core/src/PartialExecutionUtils/recreateNodeExecutionStack.ts @@ -1,3 +1,4 @@ +import * as a from 'assert/strict'; import { NodeConnectionType, type IExecuteData, @@ -11,7 +12,6 @@ import { type IWaitingForExecutionSource, } from 'n8n-workflow'; -import * as a from 'assert/strict'; import type { DirectedGraph } from './DirectedGraph'; import { getIncomingData } from './getIncomingData'; import { getSourceDataGroups } from './getSourceDataGroups'; diff --git a/packages/core/src/SSHClientsManager.ts b/packages/core/src/SSHClientsManager.ts index 78126f96e8..17046a26eb 100644 --- a/packages/core/src/SSHClientsManager.ts +++ b/packages/core/src/SSHClientsManager.ts @@ -1,7 +1,7 @@ -import { Service } from 'typedi'; -import { Client, type ConnectConfig } from 'ssh2'; -import { createHash } from 'node:crypto'; import type { SSHCredentials } from 'n8n-workflow'; +import { createHash } from 'node:crypto'; +import { Client, type ConnectConfig } from 'ssh2'; +import { Service } from 'typedi'; @Service() export class SSHClientsManager { diff --git a/packages/core/src/ScheduledTaskManager.ts b/packages/core/src/ScheduledTaskManager.ts index eb519a60a7..fd2bb525a9 100644 --- a/packages/core/src/ScheduledTaskManager.ts +++ b/packages/core/src/ScheduledTaskManager.ts @@ -1,6 +1,7 @@ -import { Service } from 'typedi'; import { CronJob } from 'cron'; import type { CronExpression, Workflow } from 'n8n-workflow'; +import { Service } from 'typedi'; + import { InstanceSettings } from './InstanceSettings'; @Service() diff --git a/packages/core/src/WorkflowExecute.ts b/packages/core/src/WorkflowExecute.ts index a10d8c530c..46de2472fc 100644 --- a/packages/core/src/WorkflowExecute.ts +++ b/packages/core/src/WorkflowExecute.ts @@ -2,9 +2,9 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ +import * as assert from 'assert/strict'; import { setMaxListeners } from 'events'; -import PCancelable from 'p-cancelable'; - +import get from 'lodash/get'; import type { ExecutionBaseError, ExecutionStatus, @@ -46,11 +46,9 @@ import { sleep, ErrorReporterProxy, } from 'n8n-workflow'; -import get from 'lodash/get'; -import * as NodeExecuteFunctions from './NodeExecuteFunctions'; +import PCancelable from 'p-cancelable'; -import * as assert from 'assert/strict'; -import { recreateNodeExecutionStack } from './PartialExecutionUtils/recreateNodeExecutionStack'; +import * as NodeExecuteFunctions from './NodeExecuteFunctions'; import { DirectedGraph, findCycles, @@ -59,6 +57,7 @@ import { findTriggerForPartialExecution, } from './PartialExecutionUtils'; import { cleanRunData } from './PartialExecutionUtils/cleanRunData'; +import { recreateNodeExecutionStack } from './PartialExecutionUtils/recreateNodeExecutionStack'; export class WorkflowExecute { private status: ExecutionStatus = 'new'; diff --git a/packages/core/src/errors/invalid-mode.error.ts b/packages/core/src/errors/invalid-mode.error.ts index 348fbb410d..179582911a 100644 --- a/packages/core/src/errors/invalid-mode.error.ts +++ b/packages/core/src/errors/invalid-mode.error.ts @@ -1,4 +1,5 @@ import { ApplicationError } from 'n8n-workflow'; + import { CONFIG_MODES } from '../BinaryData/utils'; export class InvalidModeError extends ApplicationError { diff --git a/packages/core/test/BinaryData/utils.test.ts b/packages/core/test/BinaryData/utils.test.ts index 95a138c00d..50a7f165df 100644 --- a/packages/core/test/BinaryData/utils.test.ts +++ b/packages/core/test/BinaryData/utils.test.ts @@ -1,5 +1,6 @@ import { Readable } from 'node:stream'; import { createGunzip } from 'node:zlib'; + import { binaryToBuffer } from '@/BinaryData/utils'; describe('BinaryData/utils', () => { diff --git a/packages/core/test/Cipher.test.ts b/packages/core/test/Cipher.test.ts index 1b7c0de944..e3dfa609fa 100644 --- a/packages/core/test/Cipher.test.ts +++ b/packages/core/test/Cipher.test.ts @@ -1,6 +1,8 @@ import Container from 'typedi'; -import { InstanceSettings } from '@/InstanceSettings'; + import { Cipher } from '@/Cipher'; +import { InstanceSettings } from '@/InstanceSettings'; + import { mockInstance } from './utils'; describe('Cipher', () => { diff --git a/packages/core/test/CreateNodeAsTool.test.ts b/packages/core/test/CreateNodeAsTool.test.ts index c4509e08be..8081113b16 100644 --- a/packages/core/test/CreateNodeAsTool.test.ts +++ b/packages/core/test/CreateNodeAsTool.test.ts @@ -1,8 +1,9 @@ -import { createNodeAsTool } from '@/CreateNodeAsTool'; import type { IExecuteFunctions, INodeParameters, INodeType } from 'n8n-workflow'; import { NodeConnectionType } from 'n8n-workflow'; import { z } from 'zod'; +import { createNodeAsTool } from '@/CreateNodeAsTool'; + jest.mock('@langchain/core/tools', () => ({ DynamicStructuredTool: jest.fn().mockImplementation((config) => ({ name: config.name, diff --git a/packages/core/test/Credentials.test.ts b/packages/core/test/Credentials.test.ts index ada86a07b0..fa7be59267 100644 --- a/packages/core/test/Credentials.test.ts +++ b/packages/core/test/Credentials.test.ts @@ -1,6 +1,7 @@ -import { Container } from 'typedi'; import { mock } from 'jest-mock-extended'; import type { CredentialInformation } from 'n8n-workflow'; +import { Container } from 'typedi'; + import { Cipher } from '@/Cipher'; import { Credentials } from '@/Credentials'; import type { InstanceSettings } from '@/InstanceSettings'; diff --git a/packages/core/test/FileSystem.manager.test.ts b/packages/core/test/FileSystem.manager.test.ts index 7087242726..581974c0e9 100644 --- a/packages/core/test/FileSystem.manager.test.ts +++ b/packages/core/test/FileSystem.manager.test.ts @@ -1,9 +1,11 @@ -import path from 'node:path'; import fs from 'node:fs'; import fsp from 'node:fs/promises'; import { tmpdir } from 'node:os'; +import path from 'node:path'; + import { FileSystemManager } from '@/BinaryData/FileSystem.manager'; import { isStream } from '@/ObjectStore/utils'; + import { toFileId, toStream } from './utils'; jest.mock('fs'); diff --git a/packages/core/test/InstanceSettings.test.ts b/packages/core/test/InstanceSettings.test.ts index 414f875274..64b6840f2f 100644 --- a/packages/core/test/InstanceSettings.test.ts +++ b/packages/core/test/InstanceSettings.test.ts @@ -1,4 +1,5 @@ import fs from 'fs'; + import { InstanceSettings } from '@/InstanceSettings'; describe('InstanceSettings', () => { diff --git a/packages/core/test/NodeExecuteFunctions.test.ts b/packages/core/test/NodeExecuteFunctions.test.ts index 3af9c752f6..421b7cd247 100644 --- a/packages/core/test/NodeExecuteFunctions.test.ts +++ b/packages/core/test/NodeExecuteFunctions.test.ts @@ -1,20 +1,9 @@ -import type { SecureContextOptions } from 'tls'; -import { - cleanupParameterData, - copyInputItems, - ensureType, - getBinaryDataBuffer, - isFilePathBlocked, - parseIncomingMessage, - parseRequestObject, - proxyRequestToAxios, - removeEmptyBody, - setBinaryDataBuffer, -} from '@/NodeExecuteFunctions'; -import { DateTime } from 'luxon'; import { mkdtempSync, readFileSync } from 'fs'; import type { IncomingMessage } from 'http'; +import type { Agent } from 'https'; import { mock } from 'jest-mock-extended'; +import toPlainObject from 'lodash/toPlainObject'; +import { DateTime } from 'luxon'; import type { IBinaryData, IHttpRequestMethods, @@ -28,14 +17,26 @@ import type { WorkflowHooks, } from 'n8n-workflow'; import { ExpressionError } from 'n8n-workflow'; -import { BinaryDataService } from '@/BinaryData/BinaryData.service'; import nock from 'nock'; import { tmpdir } from 'os'; import { join } from 'path'; +import type { SecureContextOptions } from 'tls'; import Container from 'typedi'; -import type { Agent } from 'https'; -import toPlainObject from 'lodash/toPlainObject'; + +import { BinaryDataService } from '@/BinaryData/BinaryData.service'; import { InstanceSettings } from '@/InstanceSettings'; +import { + cleanupParameterData, + copyInputItems, + ensureType, + getBinaryDataBuffer, + isFilePathBlocked, + parseIncomingMessage, + parseRequestObject, + proxyRequestToAxios, + removeEmptyBody, + setBinaryDataBuffer, +} from '@/NodeExecuteFunctions'; const temporaryDir = mkdtempSync(join(tmpdir(), 'n8n')); diff --git a/packages/core/test/ObjectStore.manager.test.ts b/packages/core/test/ObjectStore.manager.test.ts index abc1f24c3a..f01e170213 100644 --- a/packages/core/test/ObjectStore.manager.test.ts +++ b/packages/core/test/ObjectStore.manager.test.ts @@ -1,9 +1,11 @@ -import fs from 'node:fs/promises'; import { mock } from 'jest-mock-extended'; +import fs from 'node:fs/promises'; + import { ObjectStoreManager } from '@/BinaryData/ObjectStore.manager'; import { ObjectStoreService } from '@/ObjectStore/ObjectStore.service.ee'; -import { isStream } from '@/ObjectStore/utils'; import type { MetadataResponseHeaders } from '@/ObjectStore/types'; +import { isStream } from '@/ObjectStore/utils'; + import { mockInstance, toFileId, toStream } from './utils'; jest.mock('fs/promises'); diff --git a/packages/core/test/ObjectStore.service.test.ts b/packages/core/test/ObjectStore.service.test.ts index d39f08e1e2..77936c20f0 100644 --- a/packages/core/test/ObjectStore.service.test.ts +++ b/packages/core/test/ObjectStore.service.test.ts @@ -1,6 +1,7 @@ import axios from 'axios'; -import { ObjectStoreService } from '@/ObjectStore/ObjectStore.service.ee'; import { Readable } from 'stream'; + +import { ObjectStoreService } from '@/ObjectStore/ObjectStore.service.ee'; import { writeBlockedMessage } from '@/ObjectStore/utils'; jest.mock('axios'); diff --git a/packages/core/test/SSHClientsManager.test.ts b/packages/core/test/SSHClientsManager.test.ts index a7ceabe9f9..132a54baef 100644 --- a/packages/core/test/SSHClientsManager.test.ts +++ b/packages/core/test/SSHClientsManager.test.ts @@ -1,5 +1,6 @@ -import { Client } from 'ssh2'; import type { SSHCredentials } from 'n8n-workflow'; +import { Client } from 'ssh2'; + import { SSHClientsManager } from '@/SSHClientsManager'; describe('SSHClientsManager', () => { diff --git a/packages/core/test/ScheduledTaskManager.test.ts b/packages/core/test/ScheduledTaskManager.test.ts index 15d5f7d487..3ff8837ca9 100644 --- a/packages/core/test/ScheduledTaskManager.test.ts +++ b/packages/core/test/ScheduledTaskManager.test.ts @@ -1,5 +1,5 @@ -import type { Workflow } from 'n8n-workflow'; import { mock } from 'jest-mock-extended'; +import type { Workflow } from 'n8n-workflow'; import type { InstanceSettings } from '@/InstanceSettings'; import { ScheduledTaskManager } from '@/ScheduledTaskManager'; diff --git a/packages/core/test/Validation.test.ts b/packages/core/test/Validation.test.ts index a19422a090..04ad3c134e 100644 --- a/packages/core/test/Validation.test.ts +++ b/packages/core/test/Validation.test.ts @@ -1,4 +1,5 @@ import type { IDataObject, INode, INodeType } from 'n8n-workflow'; + import { validateValueAgainstSchema } from '@/NodeExecuteFunctions'; describe('Validation', () => { diff --git a/packages/core/test/WorkflowExecute.test.ts b/packages/core/test/WorkflowExecute.test.ts index d14a4e3fd1..6d1927fb88 100644 --- a/packages/core/test/WorkflowExecute.test.ts +++ b/packages/core/test/WorkflowExecute.test.ts @@ -5,6 +5,7 @@ import { NodeExecutionOutput, Workflow, } from 'n8n-workflow'; + import { WorkflowExecute } from '@/WorkflowExecute'; import * as Helpers from './helpers'; diff --git a/packages/core/test/WorkflowExecutionMetadata.test.ts b/packages/core/test/WorkflowExecutionMetadata.test.ts index cdb50c9737..63d0892e6a 100644 --- a/packages/core/test/WorkflowExecutionMetadata.test.ts +++ b/packages/core/test/WorkflowExecutionMetadata.test.ts @@ -1,3 +1,6 @@ +import type { IRunExecutionData } from 'n8n-workflow'; + +import { InvalidExecutionMetadataError } from '@/errors/invalid-execution-metadata.error'; import { setWorkflowExecutionMetadata, setAllWorkflowExecutionMetadata, @@ -5,8 +8,6 @@ import { getWorkflowExecutionMetadata, getAllWorkflowExecutionMetadata, } from '@/ExecutionMetadata'; -import { InvalidExecutionMetadataError } from '@/errors/invalid-execution-metadata.error'; -import type { IRunExecutionData } from 'n8n-workflow'; describe('Execution Metadata functions', () => { test('setWorkflowExecutionMetadata will set a value', () => { diff --git a/packages/core/test/helpers/constants.ts b/packages/core/test/helpers/constants.ts index 70819478ad..f3de1c667c 100644 --- a/packages/core/test/helpers/constants.ts +++ b/packages/core/test/helpers/constants.ts @@ -5,6 +5,7 @@ import type { WorkflowTestData, } from 'n8n-workflow'; import { NodeConnectionType } from 'n8n-workflow'; + import { If } from '../../../nodes-base/dist/nodes/If/If.node'; import { Merge } from '../../../nodes-base/dist/nodes/Merge/Merge.node'; import { NoOp } from '../../../nodes-base/dist/nodes/NoOp/NoOp.node'; diff --git a/packages/core/test/helpers/index.ts b/packages/core/test/helpers/index.ts index 5f935ef850..5f0858ea41 100644 --- a/packages/core/test/helpers/index.ts +++ b/packages/core/test/helpers/index.ts @@ -1,8 +1,5 @@ -import path from 'path'; import { readdirSync, readFileSync } from 'fs'; - -const BASE_DIR = path.resolve(__dirname, '../../..'); - +import { mock } from 'jest-mock-extended'; import type { IDataObject, IDeferredPromise, @@ -17,11 +14,12 @@ import type { WorkflowTestData, INodeTypeData, } from 'n8n-workflow'; - import { ApplicationError, NodeHelpers, WorkflowHooks } from 'n8n-workflow'; +import path from 'path'; import { predefinedNodesTypes } from './constants'; -import { mock } from 'jest-mock-extended'; + +const BASE_DIR = path.resolve(__dirname, '../../..'); class NodeTypesClass implements INodeTypes { constructor(private nodeTypes: INodeTypeData = predefinedNodesTypes) {} diff --git a/packages/core/test/utils.ts b/packages/core/test/utils.ts index 8895875240..7f4862cabd 100644 --- a/packages/core/test/utils.ts +++ b/packages/core/test/utils.ts @@ -1,8 +1,8 @@ -import { Container } from 'typedi'; import { mock } from 'jest-mock-extended'; import { Duplex } from 'stream'; - import type { DeepPartial } from 'ts-essentials'; +import { Container } from 'typedi'; + import type { Class } from '@/Interfaces'; export const mockInstance = (