mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
refactor: Enable import/order rule for n8n-core (#11016)
This commit is contained in:
parent
e54a396088
commit
d2238b9eac
|
@ -18,7 +18,6 @@ module.exports = {
|
||||||
complexity: 'error',
|
complexity: 'error',
|
||||||
|
|
||||||
// TODO: Remove this
|
// TODO: Remove this
|
||||||
'import/order': 'off',
|
|
||||||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': true }],
|
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': true }],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import { Service } from 'typedi';
|
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
IGetExecutePollFunctions,
|
IGetExecutePollFunctions,
|
||||||
IGetExecuteTriggerFunctions,
|
IGetExecuteTriggerFunctions,
|
||||||
|
@ -20,9 +18,10 @@ import {
|
||||||
WorkflowActivationError,
|
WorkflowActivationError,
|
||||||
WorkflowDeactivationError,
|
WorkflowDeactivationError,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
import { Service } from 'typedi';
|
||||||
|
|
||||||
import { ScheduledTaskManager } from './ScheduledTaskManager';
|
|
||||||
import type { IWorkflowData } from './Interfaces';
|
import type { IWorkflowData } from './Interfaces';
|
||||||
|
import { ScheduledTaskManager } from './ScheduledTaskManager';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class ActiveWorkflows {
|
export class ActiveWorkflows {
|
||||||
|
|
|
@ -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 { readFile, stat } from 'node:fs/promises';
|
||||||
import prettyBytes from 'pretty-bytes';
|
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 type { Readable } from 'stream';
|
||||||
|
import Container, { Service } from 'typedi';
|
||||||
|
|
||||||
import type { BinaryData } from './types';
|
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 { InvalidManagerError } from '../errors/invalid-manager.error';
|
||||||
|
import { InvalidModeError } from '../errors/invalid-mode.error';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class BinaryDataService {
|
export class BinaryDataService {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
import { jsonParse } from 'n8n-workflow';
|
||||||
import { createReadStream } from 'node:fs';
|
import { createReadStream } from 'node:fs';
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
import type { Readable } from 'stream';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
import { jsonParse } from 'n8n-workflow';
|
|
||||||
|
import type { BinaryData } from './types';
|
||||||
import { assertDir, doesNotExist } from './utils';
|
import { assertDir, doesNotExist } from './utils';
|
||||||
import { DisallowedFilepathError } from '../errors/disallowed-filepath.error';
|
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';
|
import { FileNotFoundError } from '../errors/file-not-found.error';
|
||||||
|
|
||||||
const EXECUTION_ID_EXTRACTOR =
|
const EXECUTION_ID_EXTRACTOR =
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
|
import type { Readable } from 'node:stream';
|
||||||
import { Service } from 'typedi';
|
import { Service } from 'typedi';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
|
||||||
|
import type { BinaryData } from './types';
|
||||||
import { binaryToBuffer } from './utils';
|
import { binaryToBuffer } from './utils';
|
||||||
import { ObjectStoreService } from '../ObjectStore/ObjectStore.service.ee';
|
import { ObjectStoreService } from '../ObjectStore/ObjectStore.service.ee';
|
||||||
|
|
||||||
import type { Readable } from 'node:stream';
|
|
||||||
import type { BinaryData } from './types';
|
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class ObjectStoreManager implements BinaryData.Manager {
|
export class ObjectStoreManager implements BinaryData.Manager {
|
||||||
constructor(private readonly objectStoreService: ObjectStoreService) {}
|
constructor(private readonly objectStoreService: ObjectStoreService) {}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
import concatStream from 'concat-stream';
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import type { Readable } from 'node:stream';
|
import type { Readable } from 'node:stream';
|
||||||
|
|
||||||
import type { BinaryData } from './types';
|
import type { BinaryData } from './types';
|
||||||
import concatStream from 'concat-stream';
|
|
||||||
|
|
||||||
export const CONFIG_MODES = ['default', 'filesystem', 's3'] as const;
|
export const CONFIG_MODES = ['default', 'filesystem', 's3'] as const;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Service } from 'typedi';
|
|
||||||
import { createHash, createCipheriv, createDecipheriv, randomBytes } from 'crypto';
|
import { createHash, createCipheriv, createDecipheriv, randomBytes } from 'crypto';
|
||||||
|
import { Service } from 'typedi';
|
||||||
|
|
||||||
import { InstanceSettings } from './InstanceSettings';
|
import { InstanceSettings } from './InstanceSettings';
|
||||||
|
|
||||||
// Data encrypted by CryptoJS always starts with these bytes
|
// Data encrypted by CryptoJS always starts with these bytes
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Container } from 'typedi';
|
|
||||||
import type { ICredentialDataDecryptedObject, ICredentialsEncrypted } from 'n8n-workflow';
|
import type { ICredentialDataDecryptedObject, ICredentialsEncrypted } from 'n8n-workflow';
|
||||||
import { ApplicationError, ICredentials, jsonParse } from 'n8n-workflow';
|
import { ApplicationError, ICredentials, jsonParse } from 'n8n-workflow';
|
||||||
|
import { Container } from 'typedi';
|
||||||
|
|
||||||
import { Cipher } from './Cipher';
|
import { Cipher } from './Cipher';
|
||||||
|
|
||||||
export class Credentials<
|
export class Credentials<
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import { readFileSync } from 'node:fs';
|
|
||||||
import { readFile } from 'node:fs/promises';
|
|
||||||
import type {
|
import type {
|
||||||
CodexData,
|
CodexData,
|
||||||
DocumentationLink,
|
DocumentationLink,
|
||||||
|
@ -21,7 +19,10 @@ import {
|
||||||
getVersionedNodeTypeAll,
|
getVersionedNodeTypeAll,
|
||||||
jsonParse,
|
jsonParse,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
import { readFile } from 'node:fs/promises';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { loadClassInIsolation } from './ClassLoader';
|
import { loadClassInIsolation } from './ClassLoader';
|
||||||
import { CUSTOM_NODES_CATEGORY } from './Constants';
|
import { CUSTOM_NODES_CATEGORY } from './Constants';
|
||||||
import type { n8n } from './Interfaces';
|
import type { n8n } from './Interfaces';
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { IRunExecutionData } from 'n8n-workflow';
|
import type { IRunExecutionData } from 'n8n-workflow';
|
||||||
import { LoggerProxy as Logger } from 'n8n-workflow';
|
import { LoggerProxy as Logger } from 'n8n-workflow';
|
||||||
|
|
||||||
import { InvalidExecutionMetadataError } from './errors/invalid-execution-metadata.error';
|
import { InvalidExecutionMetadataError } from './errors/invalid-execution-metadata.error';
|
||||||
|
|
||||||
export const KV_LIMIT = 10;
|
export const KV_LIMIT = 10;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import path from 'path';
|
|
||||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
||||||
import { createHash, randomBytes } from 'crypto';
|
import { createHash, randomBytes } from 'crypto';
|
||||||
import { Service } from 'typedi';
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
||||||
import { ApplicationError, jsonParse } from 'n8n-workflow';
|
import { ApplicationError, jsonParse } from 'n8n-workflow';
|
||||||
|
import path from 'path';
|
||||||
|
import { Service } from 'typedi';
|
||||||
|
|
||||||
interface ReadOnlySettings {
|
interface ReadOnlySettings {
|
||||||
encryptionKey: string;
|
encryptionKey: string;
|
||||||
|
|
|
@ -32,6 +32,7 @@ import { IncomingMessage, type IncomingHttpHeaders } from 'http';
|
||||||
import { Agent, type AgentOptions } from 'https';
|
import { Agent, type AgentOptions } from 'https';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import isEmpty from 'lodash/isEmpty';
|
import isEmpty from 'lodash/isEmpty';
|
||||||
|
import merge from 'lodash/merge';
|
||||||
import pick from 'lodash/pick';
|
import pick from 'lodash/pick';
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import { extension, lookup } from 'mime-types';
|
import { extension, lookup } from 'mime-types';
|
||||||
|
@ -128,9 +129,12 @@ import clientOAuth1 from 'oauth-1.0a';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { stringify } from 'qs';
|
import { stringify } from 'qs';
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
|
import Container from 'typedi';
|
||||||
import url, { URL, URLSearchParams } from 'url';
|
import url, { URL, URLSearchParams } from 'url';
|
||||||
|
|
||||||
import { BinaryDataService } from './BinaryData/BinaryData.service';
|
import { BinaryDataService } from './BinaryData/BinaryData.service';
|
||||||
|
import type { BinaryData } from './BinaryData/types';
|
||||||
|
import { binaryToBuffer } from './BinaryData/utils';
|
||||||
import {
|
import {
|
||||||
BINARY_DATA_STORAGE_PATH,
|
BINARY_DATA_STORAGE_PATH,
|
||||||
BLOCK_FILE_ACCESS_TO_N8N_FILES,
|
BLOCK_FILE_ACCESS_TO_N8N_FILES,
|
||||||
|
@ -143,23 +147,19 @@ import {
|
||||||
UM_EMAIL_TEMPLATES_INVITE,
|
UM_EMAIL_TEMPLATES_INVITE,
|
||||||
UM_EMAIL_TEMPLATES_PWRESET,
|
UM_EMAIL_TEMPLATES_PWRESET,
|
||||||
} from './Constants';
|
} from './Constants';
|
||||||
import { extractValue } from './ExtractValue';
|
import { getNodeAsTool } from './CreateNodeAsTool';
|
||||||
import type { ExtendedValidationResult, IResponseError } from './Interfaces';
|
|
||||||
import {
|
import {
|
||||||
getAllWorkflowExecutionMetadata,
|
getAllWorkflowExecutionMetadata,
|
||||||
getWorkflowExecutionMetadata,
|
getWorkflowExecutionMetadata,
|
||||||
setAllWorkflowExecutionMetadata,
|
setAllWorkflowExecutionMetadata,
|
||||||
setWorkflowExecutionMetadata,
|
setWorkflowExecutionMetadata,
|
||||||
} from './ExecutionMetadata';
|
} from './ExecutionMetadata';
|
||||||
import { getSecretsProxy } from './Secrets';
|
import { extractValue } from './ExtractValue';
|
||||||
import Container from 'typedi';
|
|
||||||
import type { BinaryData } from './BinaryData/types';
|
|
||||||
import merge from 'lodash/merge';
|
|
||||||
import { InstanceSettings } from './InstanceSettings';
|
import { InstanceSettings } from './InstanceSettings';
|
||||||
|
import type { ExtendedValidationResult, IResponseError } from './Interfaces';
|
||||||
import { ScheduledTaskManager } from './ScheduledTaskManager';
|
import { ScheduledTaskManager } from './ScheduledTaskManager';
|
||||||
|
import { getSecretsProxy } from './Secrets';
|
||||||
import { SSHClientsManager } from './SSHClientsManager';
|
import { SSHClientsManager } from './SSHClientsManager';
|
||||||
import { binaryToBuffer } from './BinaryData/utils';
|
|
||||||
import { getNodeAsTool } from './CreateNodeAsTool';
|
|
||||||
|
|
||||||
axios.defaults.timeout = 300000;
|
axios.defaults.timeout = 300000;
|
||||||
// Prevent axios from adding x-form-www-urlencoded headers by default
|
// Prevent axios from adding x-form-www-urlencoded headers by default
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { createHash } from 'node:crypto';
|
|
||||||
import axios from 'axios';
|
|
||||||
import { Service } from 'typedi';
|
|
||||||
import { sign } from 'aws4';
|
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 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 {
|
import type {
|
||||||
Bucket,
|
Bucket,
|
||||||
ConfigSchemaCredentials,
|
ConfigSchemaCredentials,
|
||||||
|
@ -15,7 +15,7 @@ import type {
|
||||||
RawListPage,
|
RawListPage,
|
||||||
RequestOptions,
|
RequestOptions,
|
||||||
} from './types';
|
} from './types';
|
||||||
import type { Readable } from 'stream';
|
import { isStream, parseXml, writeBlockedMessage } from './utils';
|
||||||
import type { BinaryData } from '../BinaryData/types';
|
import type { BinaryData } from '../BinaryData/types';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { AxiosResponseHeaders, ResponseType } from 'axios';
|
import type { AxiosResponseHeaders, ResponseType } from 'axios';
|
||||||
|
|
||||||
import type { BinaryData } from '../BinaryData/types';
|
import type { BinaryData } from '../BinaryData/types';
|
||||||
|
|
||||||
export type RawListPage = {
|
export type RawListPage = {
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
// XX denotes that the node is disabled
|
// XX denotes that the node is disabled
|
||||||
// PD denotes that the node has pinned data
|
// PD denotes that the node has pinned data
|
||||||
|
|
||||||
import { DirectedGraph } from '../DirectedGraph';
|
|
||||||
import { createNodeData, defaultWorkflowParameter } from './helpers';
|
import { createNodeData, defaultWorkflowParameter } from './helpers';
|
||||||
|
import { DirectedGraph } from '../DirectedGraph';
|
||||||
|
|
||||||
describe('DirectedGraph', () => {
|
describe('DirectedGraph', () => {
|
||||||
// ┌─────┐ ┌─────┐ ┌─────┐
|
// ┌─────┐ ┌─────┐ ┌─────┐
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import type { IRunData } from 'n8n-workflow';
|
import type { IRunData } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { createNodeData, toITaskData } from './helpers';
|
||||||
import { cleanRunData } from '../cleanRunData';
|
import { cleanRunData } from '../cleanRunData';
|
||||||
import { DirectedGraph } from '../DirectedGraph';
|
import { DirectedGraph } from '../DirectedGraph';
|
||||||
import { createNodeData, toITaskData } from './helpers';
|
|
||||||
|
|
||||||
describe('cleanRunData', () => {
|
describe('cleanRunData', () => {
|
||||||
// ┌─────┐ ┌─────┐ ┌─────┐
|
// ┌─────┐ ┌─────┐ ┌─────┐
|
||||||
|
|
|
@ -10,9 +10,10 @@
|
||||||
// PD denotes that the node has pinned data
|
// PD denotes that the node has pinned data
|
||||||
|
|
||||||
import { type IPinData, type IRunData } from 'n8n-workflow';
|
import { type IPinData, type IRunData } from 'n8n-workflow';
|
||||||
|
|
||||||
import { createNodeData, toITaskData } from './helpers';
|
import { createNodeData, toITaskData } from './helpers';
|
||||||
import { findStartNodes, isDirty } from '../findStartNodes';
|
|
||||||
import { DirectedGraph } from '../DirectedGraph';
|
import { DirectedGraph } from '../DirectedGraph';
|
||||||
|
import { findStartNodes, isDirty } from '../findStartNodes';
|
||||||
|
|
||||||
describe('isDirty', () => {
|
describe('isDirty', () => {
|
||||||
test("if the node has pinned data it's not dirty", () => {
|
test("if the node has pinned data it's not dirty", () => {
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
// XX denotes that the node is disabled
|
// XX denotes that the node is disabled
|
||||||
// PD denotes that the node has pinned data
|
// PD denotes that the node has pinned data
|
||||||
|
|
||||||
|
import { createNodeData } from './helpers';
|
||||||
import { DirectedGraph } from '../DirectedGraph';
|
import { DirectedGraph } from '../DirectedGraph';
|
||||||
import { findSubgraph } from '../findSubgraph';
|
import { findSubgraph } from '../findSubgraph';
|
||||||
import { createNodeData } from './helpers';
|
|
||||||
|
|
||||||
describe('findSubgraph2', () => {
|
describe('findSubgraph2', () => {
|
||||||
// ►►
|
// ►►
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
|
|
||||||
import type { IPinData } from 'n8n-workflow';
|
import type { IPinData } from 'n8n-workflow';
|
||||||
import { NodeConnectionType, type IRunData } from 'n8n-workflow';
|
import { NodeConnectionType, type IRunData } from 'n8n-workflow';
|
||||||
import { DirectedGraph } from '../DirectedGraph';
|
|
||||||
import { createNodeData, toITaskData } from './helpers';
|
import { createNodeData, toITaskData } from './helpers';
|
||||||
|
import { DirectedGraph } from '../DirectedGraph';
|
||||||
import { getSourceDataGroups } from '../getSourceDataGroups';
|
import { getSourceDataGroups } from '../getSourceDataGroups';
|
||||||
|
|
||||||
describe('getSourceDataGroups', () => {
|
describe('getSourceDataGroups', () => {
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
// XX denotes that the node is disabled
|
// XX denotes that the node is disabled
|
||||||
// PD denotes that the node has pinned data
|
// 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 { 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 { DirectedGraph } from '../DirectedGraph';
|
||||||
import { findSubgraph } from '../findSubgraph';
|
import { findSubgraph } from '../findSubgraph';
|
||||||
import { createNodeData, toITaskData } from './helpers';
|
|
||||||
|
|
||||||
describe('recreateNodeExecutionStack', () => {
|
describe('recreateNodeExecutionStack', () => {
|
||||||
// ►►
|
// ►►
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { NodeConnectionType } from 'n8n-workflow';
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
|
|
||||||
import { createNodeData, toIConnections } from './helpers';
|
import { createNodeData, toIConnections } from './helpers';
|
||||||
|
|
||||||
test('toIConnections', () => {
|
test('toIConnections', () => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { NodeConnectionType } from 'n8n-workflow';
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
|
|
||||||
import { toITaskData } from './helpers';
|
import { toITaskData } from './helpers';
|
||||||
|
|
||||||
test('toITaskData', function () {
|
test('toITaskData', function () {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INode, IRunData } from 'n8n-workflow';
|
import type { INode, IRunData } from 'n8n-workflow';
|
||||||
|
|
||||||
import type { DirectedGraph } from './DirectedGraph';
|
import type { DirectedGraph } from './DirectedGraph';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INode, IPinData, IRunData } from 'n8n-workflow';
|
import type { INode, IPinData, IRunData } from 'n8n-workflow';
|
||||||
|
|
||||||
import type { DirectedGraph } from './DirectedGraph';
|
import type { DirectedGraph } from './DirectedGraph';
|
||||||
import { getIncomingData } from './getIncomingData';
|
import { getIncomingData } from './getIncomingData';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { INode } from 'n8n-workflow';
|
import type { INode } from 'n8n-workflow';
|
||||||
|
|
||||||
import type { GraphConnection } from './DirectedGraph';
|
import type { GraphConnection } from './DirectedGraph';
|
||||||
import { DirectedGraph } from './DirectedGraph';
|
import { DirectedGraph } from './DirectedGraph';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { INode, Workflow } from 'n8n-workflow';
|
|
||||||
import * as assert from 'assert/strict';
|
import * as assert from 'assert/strict';
|
||||||
|
import type { INode, Workflow } from 'n8n-workflow';
|
||||||
|
|
||||||
function findAllParentTriggers(workflow: Workflow, destinationNodeName: string) {
|
function findAllParentTriggers(workflow: Workflow, destinationNodeName: string) {
|
||||||
const parentNodes = workflow
|
const parentNodes = workflow
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import * as a from 'assert/strict';
|
||||||
import {
|
import {
|
||||||
NodeConnectionType,
|
NodeConnectionType,
|
||||||
type IExecuteData,
|
type IExecuteData,
|
||||||
|
@ -11,7 +12,6 @@ import {
|
||||||
type IWaitingForExecutionSource,
|
type IWaitingForExecutionSource,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import * as a from 'assert/strict';
|
|
||||||
import type { DirectedGraph } from './DirectedGraph';
|
import type { DirectedGraph } from './DirectedGraph';
|
||||||
import { getIncomingData } from './getIncomingData';
|
import { getIncomingData } from './getIncomingData';
|
||||||
import { getSourceDataGroups } from './getSourceDataGroups';
|
import { getSourceDataGroups } from './getSourceDataGroups';
|
||||||
|
|
|
@ -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 type { SSHCredentials } from 'n8n-workflow';
|
||||||
|
import { createHash } from 'node:crypto';
|
||||||
|
import { Client, type ConnectConfig } from 'ssh2';
|
||||||
|
import { Service } from 'typedi';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class SSHClientsManager {
|
export class SSHClientsManager {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Service } from 'typedi';
|
|
||||||
import { CronJob } from 'cron';
|
import { CronJob } from 'cron';
|
||||||
import type { CronExpression, Workflow } from 'n8n-workflow';
|
import type { CronExpression, Workflow } from 'n8n-workflow';
|
||||||
|
import { Service } from 'typedi';
|
||||||
|
|
||||||
import { InstanceSettings } from './InstanceSettings';
|
import { InstanceSettings } from './InstanceSettings';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||||
|
import * as assert from 'assert/strict';
|
||||||
import { setMaxListeners } from 'events';
|
import { setMaxListeners } from 'events';
|
||||||
import PCancelable from 'p-cancelable';
|
import get from 'lodash/get';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ExecutionBaseError,
|
ExecutionBaseError,
|
||||||
ExecutionStatus,
|
ExecutionStatus,
|
||||||
|
@ -46,11 +46,9 @@ import {
|
||||||
sleep,
|
sleep,
|
||||||
ErrorReporterProxy,
|
ErrorReporterProxy,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import get from 'lodash/get';
|
import PCancelable from 'p-cancelable';
|
||||||
import * as NodeExecuteFunctions from './NodeExecuteFunctions';
|
|
||||||
|
|
||||||
import * as assert from 'assert/strict';
|
import * as NodeExecuteFunctions from './NodeExecuteFunctions';
|
||||||
import { recreateNodeExecutionStack } from './PartialExecutionUtils/recreateNodeExecutionStack';
|
|
||||||
import {
|
import {
|
||||||
DirectedGraph,
|
DirectedGraph,
|
||||||
findCycles,
|
findCycles,
|
||||||
|
@ -59,6 +57,7 @@ import {
|
||||||
findTriggerForPartialExecution,
|
findTriggerForPartialExecution,
|
||||||
} from './PartialExecutionUtils';
|
} from './PartialExecutionUtils';
|
||||||
import { cleanRunData } from './PartialExecutionUtils/cleanRunData';
|
import { cleanRunData } from './PartialExecutionUtils/cleanRunData';
|
||||||
|
import { recreateNodeExecutionStack } from './PartialExecutionUtils/recreateNodeExecutionStack';
|
||||||
|
|
||||||
export class WorkflowExecute {
|
export class WorkflowExecute {
|
||||||
private status: ExecutionStatus = 'new';
|
private status: ExecutionStatus = 'new';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { ApplicationError } from 'n8n-workflow';
|
import { ApplicationError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { CONFIG_MODES } from '../BinaryData/utils';
|
import { CONFIG_MODES } from '../BinaryData/utils';
|
||||||
|
|
||||||
export class InvalidModeError extends ApplicationError {
|
export class InvalidModeError extends ApplicationError {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Readable } from 'node:stream';
|
import { Readable } from 'node:stream';
|
||||||
import { createGunzip } from 'node:zlib';
|
import { createGunzip } from 'node:zlib';
|
||||||
|
|
||||||
import { binaryToBuffer } from '@/BinaryData/utils';
|
import { binaryToBuffer } from '@/BinaryData/utils';
|
||||||
|
|
||||||
describe('BinaryData/utils', () => {
|
describe('BinaryData/utils', () => {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import Container from 'typedi';
|
import Container from 'typedi';
|
||||||
import { InstanceSettings } from '@/InstanceSettings';
|
|
||||||
import { Cipher } from '@/Cipher';
|
import { Cipher } from '@/Cipher';
|
||||||
|
import { InstanceSettings } from '@/InstanceSettings';
|
||||||
|
|
||||||
import { mockInstance } from './utils';
|
import { mockInstance } from './utils';
|
||||||
|
|
||||||
describe('Cipher', () => {
|
describe('Cipher', () => {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { createNodeAsTool } from '@/CreateNodeAsTool';
|
|
||||||
import type { IExecuteFunctions, INodeParameters, INodeType } from 'n8n-workflow';
|
import type { IExecuteFunctions, INodeParameters, INodeType } from 'n8n-workflow';
|
||||||
import { NodeConnectionType } from 'n8n-workflow';
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
import { createNodeAsTool } from '@/CreateNodeAsTool';
|
||||||
|
|
||||||
jest.mock('@langchain/core/tools', () => ({
|
jest.mock('@langchain/core/tools', () => ({
|
||||||
DynamicStructuredTool: jest.fn().mockImplementation((config) => ({
|
DynamicStructuredTool: jest.fn().mockImplementation((config) => ({
|
||||||
name: config.name,
|
name: config.name,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Container } from 'typedi';
|
|
||||||
import { mock } from 'jest-mock-extended';
|
import { mock } from 'jest-mock-extended';
|
||||||
import type { CredentialInformation } from 'n8n-workflow';
|
import type { CredentialInformation } from 'n8n-workflow';
|
||||||
|
import { Container } from 'typedi';
|
||||||
|
|
||||||
import { Cipher } from '@/Cipher';
|
import { Cipher } from '@/Cipher';
|
||||||
import { Credentials } from '@/Credentials';
|
import { Credentials } from '@/Credentials';
|
||||||
import type { InstanceSettings } from '@/InstanceSettings';
|
import type { InstanceSettings } from '@/InstanceSettings';
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import path from 'node:path';
|
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import fsp from 'node:fs/promises';
|
import fsp from 'node:fs/promises';
|
||||||
import { tmpdir } from 'node:os';
|
import { tmpdir } from 'node:os';
|
||||||
|
import path from 'node:path';
|
||||||
|
|
||||||
import { FileSystemManager } from '@/BinaryData/FileSystem.manager';
|
import { FileSystemManager } from '@/BinaryData/FileSystem.manager';
|
||||||
import { isStream } from '@/ObjectStore/utils';
|
import { isStream } from '@/ObjectStore/utils';
|
||||||
|
|
||||||
import { toFileId, toStream } from './utils';
|
import { toFileId, toStream } from './utils';
|
||||||
|
|
||||||
jest.mock('fs');
|
jest.mock('fs');
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
import { InstanceSettings } from '@/InstanceSettings';
|
import { InstanceSettings } from '@/InstanceSettings';
|
||||||
|
|
||||||
describe('InstanceSettings', () => {
|
describe('InstanceSettings', () => {
|
||||||
|
|
|
@ -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 { mkdtempSync, readFileSync } from 'fs';
|
||||||
import type { IncomingMessage } from 'http';
|
import type { IncomingMessage } from 'http';
|
||||||
|
import type { Agent } from 'https';
|
||||||
import { mock } from 'jest-mock-extended';
|
import { mock } from 'jest-mock-extended';
|
||||||
|
import toPlainObject from 'lodash/toPlainObject';
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
import type {
|
import type {
|
||||||
IBinaryData,
|
IBinaryData,
|
||||||
IHttpRequestMethods,
|
IHttpRequestMethods,
|
||||||
|
@ -28,14 +17,26 @@ import type {
|
||||||
WorkflowHooks,
|
WorkflowHooks,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { ExpressionError } from 'n8n-workflow';
|
import { ExpressionError } from 'n8n-workflow';
|
||||||
import { BinaryDataService } from '@/BinaryData/BinaryData.service';
|
|
||||||
import nock from 'nock';
|
import nock from 'nock';
|
||||||
import { tmpdir } from 'os';
|
import { tmpdir } from 'os';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
import type { SecureContextOptions } from 'tls';
|
||||||
import Container from 'typedi';
|
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 { InstanceSettings } from '@/InstanceSettings';
|
||||||
|
import {
|
||||||
|
cleanupParameterData,
|
||||||
|
copyInputItems,
|
||||||
|
ensureType,
|
||||||
|
getBinaryDataBuffer,
|
||||||
|
isFilePathBlocked,
|
||||||
|
parseIncomingMessage,
|
||||||
|
parseRequestObject,
|
||||||
|
proxyRequestToAxios,
|
||||||
|
removeEmptyBody,
|
||||||
|
setBinaryDataBuffer,
|
||||||
|
} from '@/NodeExecuteFunctions';
|
||||||
|
|
||||||
const temporaryDir = mkdtempSync(join(tmpdir(), 'n8n'));
|
const temporaryDir = mkdtempSync(join(tmpdir(), 'n8n'));
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import fs from 'node:fs/promises';
|
|
||||||
import { mock } from 'jest-mock-extended';
|
import { mock } from 'jest-mock-extended';
|
||||||
|
import fs from 'node:fs/promises';
|
||||||
|
|
||||||
import { ObjectStoreManager } from '@/BinaryData/ObjectStore.manager';
|
import { ObjectStoreManager } from '@/BinaryData/ObjectStore.manager';
|
||||||
import { ObjectStoreService } from '@/ObjectStore/ObjectStore.service.ee';
|
import { ObjectStoreService } from '@/ObjectStore/ObjectStore.service.ee';
|
||||||
import { isStream } from '@/ObjectStore/utils';
|
|
||||||
import type { MetadataResponseHeaders } from '@/ObjectStore/types';
|
import type { MetadataResponseHeaders } from '@/ObjectStore/types';
|
||||||
|
import { isStream } from '@/ObjectStore/utils';
|
||||||
|
|
||||||
import { mockInstance, toFileId, toStream } from './utils';
|
import { mockInstance, toFileId, toStream } from './utils';
|
||||||
|
|
||||||
jest.mock('fs/promises');
|
jest.mock('fs/promises');
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { ObjectStoreService } from '@/ObjectStore/ObjectStore.service.ee';
|
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
|
|
||||||
|
import { ObjectStoreService } from '@/ObjectStore/ObjectStore.service.ee';
|
||||||
import { writeBlockedMessage } from '@/ObjectStore/utils';
|
import { writeBlockedMessage } from '@/ObjectStore/utils';
|
||||||
|
|
||||||
jest.mock('axios');
|
jest.mock('axios');
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Client } from 'ssh2';
|
|
||||||
import type { SSHCredentials } from 'n8n-workflow';
|
import type { SSHCredentials } from 'n8n-workflow';
|
||||||
|
import { Client } from 'ssh2';
|
||||||
|
|
||||||
import { SSHClientsManager } from '@/SSHClientsManager';
|
import { SSHClientsManager } from '@/SSHClientsManager';
|
||||||
|
|
||||||
describe('SSHClientsManager', () => {
|
describe('SSHClientsManager', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Workflow } from 'n8n-workflow';
|
|
||||||
import { mock } from 'jest-mock-extended';
|
import { mock } from 'jest-mock-extended';
|
||||||
|
import type { Workflow } from 'n8n-workflow';
|
||||||
|
|
||||||
import type { InstanceSettings } from '@/InstanceSettings';
|
import type { InstanceSettings } from '@/InstanceSettings';
|
||||||
import { ScheduledTaskManager } from '@/ScheduledTaskManager';
|
import { ScheduledTaskManager } from '@/ScheduledTaskManager';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { IDataObject, INode, INodeType } from 'n8n-workflow';
|
import type { IDataObject, INode, INodeType } from 'n8n-workflow';
|
||||||
|
|
||||||
import { validateValueAgainstSchema } from '@/NodeExecuteFunctions';
|
import { validateValueAgainstSchema } from '@/NodeExecuteFunctions';
|
||||||
|
|
||||||
describe('Validation', () => {
|
describe('Validation', () => {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
NodeExecutionOutput,
|
NodeExecutionOutput,
|
||||||
Workflow,
|
Workflow,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { WorkflowExecute } from '@/WorkflowExecute';
|
import { WorkflowExecute } from '@/WorkflowExecute';
|
||||||
|
|
||||||
import * as Helpers from './helpers';
|
import * as Helpers from './helpers';
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import type { IRunExecutionData } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { InvalidExecutionMetadataError } from '@/errors/invalid-execution-metadata.error';
|
||||||
import {
|
import {
|
||||||
setWorkflowExecutionMetadata,
|
setWorkflowExecutionMetadata,
|
||||||
setAllWorkflowExecutionMetadata,
|
setAllWorkflowExecutionMetadata,
|
||||||
|
@ -5,8 +8,6 @@ import {
|
||||||
getWorkflowExecutionMetadata,
|
getWorkflowExecutionMetadata,
|
||||||
getAllWorkflowExecutionMetadata,
|
getAllWorkflowExecutionMetadata,
|
||||||
} from '@/ExecutionMetadata';
|
} from '@/ExecutionMetadata';
|
||||||
import { InvalidExecutionMetadataError } from '@/errors/invalid-execution-metadata.error';
|
|
||||||
import type { IRunExecutionData } from 'n8n-workflow';
|
|
||||||
|
|
||||||
describe('Execution Metadata functions', () => {
|
describe('Execution Metadata functions', () => {
|
||||||
test('setWorkflowExecutionMetadata will set a value', () => {
|
test('setWorkflowExecutionMetadata will set a value', () => {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import type {
|
||||||
WorkflowTestData,
|
WorkflowTestData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeConnectionType } from 'n8n-workflow';
|
import { NodeConnectionType } from 'n8n-workflow';
|
||||||
|
|
||||||
import { If } from '../../../nodes-base/dist/nodes/If/If.node';
|
import { If } from '../../../nodes-base/dist/nodes/If/If.node';
|
||||||
import { Merge } from '../../../nodes-base/dist/nodes/Merge/Merge.node';
|
import { Merge } from '../../../nodes-base/dist/nodes/Merge/Merge.node';
|
||||||
import { NoOp } from '../../../nodes-base/dist/nodes/NoOp/NoOp.node';
|
import { NoOp } from '../../../nodes-base/dist/nodes/NoOp/NoOp.node';
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import path from 'path';
|
|
||||||
import { readdirSync, readFileSync } from 'fs';
|
import { readdirSync, readFileSync } from 'fs';
|
||||||
|
import { mock } from 'jest-mock-extended';
|
||||||
const BASE_DIR = path.resolve(__dirname, '../../..');
|
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
IDeferredPromise,
|
IDeferredPromise,
|
||||||
|
@ -17,11 +14,12 @@ import type {
|
||||||
WorkflowTestData,
|
WorkflowTestData,
|
||||||
INodeTypeData,
|
INodeTypeData,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { ApplicationError, NodeHelpers, WorkflowHooks } from 'n8n-workflow';
|
import { ApplicationError, NodeHelpers, WorkflowHooks } from 'n8n-workflow';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
import { predefinedNodesTypes } from './constants';
|
import { predefinedNodesTypes } from './constants';
|
||||||
import { mock } from 'jest-mock-extended';
|
|
||||||
|
const BASE_DIR = path.resolve(__dirname, '../../..');
|
||||||
|
|
||||||
class NodeTypesClass implements INodeTypes {
|
class NodeTypesClass implements INodeTypes {
|
||||||
constructor(private nodeTypes: INodeTypeData = predefinedNodesTypes) {}
|
constructor(private nodeTypes: INodeTypeData = predefinedNodesTypes) {}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Container } from 'typedi';
|
|
||||||
import { mock } from 'jest-mock-extended';
|
import { mock } from 'jest-mock-extended';
|
||||||
import { Duplex } from 'stream';
|
import { Duplex } from 'stream';
|
||||||
|
|
||||||
import type { DeepPartial } from 'ts-essentials';
|
import type { DeepPartial } from 'ts-essentials';
|
||||||
|
import { Container } from 'typedi';
|
||||||
|
|
||||||
import type { Class } from '@/Interfaces';
|
import type { Class } from '@/Interfaces';
|
||||||
|
|
||||||
export const mockInstance = <T>(
|
export const mockInstance = <T>(
|
||||||
|
|
Loading…
Reference in a new issue