mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-12 15:44:06 -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',
|
||||
|
||||
// TODO: Remove this
|
||||
'import/order': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': true }],
|
||||
},
|
||||
};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import type { AxiosResponseHeaders, ResponseType } from 'axios';
|
||||
|
||||
import type { BinaryData } from '../BinaryData/types';
|
||||
|
||||
export type RawListPage = {
|
||||
|
|
|
@ -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', () => {
|
||||
// ┌─────┐ ┌─────┐ ┌─────┐
|
||||
|
|
|
@ -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', () => {
|
||||
// ┌─────┐ ┌─────┐ ┌─────┐
|
||||
|
|
|
@ -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", () => {
|
||||
|
|
|
@ -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', () => {
|
||||
// ►►
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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', () => {
|
||||
// ►►
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toIConnections } from './helpers';
|
||||
|
||||
test('toIConnections', () => {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import { toITaskData } from './helpers';
|
||||
|
||||
test('toITaskData', function () {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import type { INode, IRunData } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './DirectedGraph';
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import type { INode, IPinData, IRunData } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './DirectedGraph';
|
||||
import { getIncomingData } from './getIncomingData';
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import type { INode } from 'n8n-workflow';
|
||||
|
||||
import type { GraphConnection } from './DirectedGraph';
|
||||
import { DirectedGraph } from './DirectedGraph';
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
import { CONFIG_MODES } from '../BinaryData/utils';
|
||||
|
||||
export class InvalidModeError extends ApplicationError {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Readable } from 'node:stream';
|
||||
import { createGunzip } from 'node:zlib';
|
||||
|
||||
import { binaryToBuffer } from '@/BinaryData/utils';
|
||||
|
||||
describe('BinaryData/utils', () => {
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import fs from 'fs';
|
||||
|
||||
import { InstanceSettings } from '@/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 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'));
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { Client } from 'ssh2';
|
||||
import type { SSHCredentials } from 'n8n-workflow';
|
||||
import { Client } from 'ssh2';
|
||||
|
||||
import { SSHClientsManager } from '@/SSHClientsManager';
|
||||
|
||||
describe('SSHClientsManager', () => {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import type { IDataObject, INode, INodeType } from 'n8n-workflow';
|
||||
|
||||
import { validateValueAgainstSchema } from '@/NodeExecuteFunctions';
|
||||
|
||||
describe('Validation', () => {
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
NodeExecutionOutput,
|
||||
Workflow,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { WorkflowExecute } from '@/WorkflowExecute';
|
||||
|
||||
import * as Helpers from './helpers';
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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) {}
|
||||
|
|
|
@ -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 = <T>(
|
||||
|
|
Loading…
Reference in a new issue