mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
refactor(core): Reorganize n8n-core and enforce file-name casing (no-changelog) (#12667)
This commit is contained in:
parent
e7f00bcb7f
commit
05858c2153
|
@ -16,6 +16,7 @@ module.exports = {
|
|||
|
||||
rules: {
|
||||
complexity: 'error',
|
||||
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
||||
|
||||
// TODO: Remove this
|
||||
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': true }],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const { LoggerProxy } = require('n8n-workflow');
|
||||
const { PackageDirectoryLoader } = require('../dist/DirectoryLoader');
|
||||
const { PackageDirectoryLoader } = require('../dist/nodes-loader/package-directory-loader');
|
||||
const { packageDir, writeJSON } = require('./common');
|
||||
|
||||
LoggerProxy.init(console);
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
export { DirectedGraph } from './DirectedGraph';
|
||||
export { findTriggerForPartialExecution } from './findTriggerForPartialExecution';
|
||||
export { findStartNodes } from './findStartNodes';
|
||||
export { findSubgraph } from './findSubgraph';
|
||||
export { recreateNodeExecutionStack } from './recreateNodeExecutionStack';
|
||||
export { cleanRunData } from './cleanRunData';
|
||||
export { handleCycles } from './handleCycles';
|
||||
export { filterDisabledNodes } from './filterDisabledNodes';
|
|
@ -2,9 +2,10 @@ import { Container } from '@n8n/di';
|
|||
import { mock } from 'jest-mock-extended';
|
||||
import type { CredentialInformation } from 'n8n-workflow';
|
||||
|
||||
import { Cipher } from '@/Cipher';
|
||||
import { Credentials } from '@/Credentials';
|
||||
import type { InstanceSettings } from '@/InstanceSettings';
|
||||
import { Cipher } from '@/encryption/cipher';
|
||||
import type { InstanceSettings } from '@/instance-settings';
|
||||
|
||||
import { Credentials } from '../credentials';
|
||||
|
||||
describe('Credentials', () => {
|
||||
const cipher = new Cipher(mock<InstanceSettings>({ encryptionKey: 'password' }));
|
|
@ -21,8 +21,8 @@ import { join } from 'path';
|
|||
import { Readable } from 'stream';
|
||||
import type { SecureContextOptions } from 'tls';
|
||||
|
||||
import { BinaryDataService } from '@/BinaryData/BinaryData.service';
|
||||
import { InstanceSettings } from '@/InstanceSettings';
|
||||
import { BinaryDataService } from '@/binary-data/binary-data.service';
|
||||
import { InstanceSettings } from '@/instance-settings';
|
||||
import {
|
||||
binaryToString,
|
||||
copyInputItems,
|
||||
|
@ -36,7 +36,7 @@ import {
|
|||
proxyRequestToAxios,
|
||||
removeEmptyBody,
|
||||
setBinaryDataBuffer,
|
||||
} from '@/NodeExecuteFunctions';
|
||||
} from '@/node-execute-functions';
|
||||
|
||||
const temporaryDir = mkdtempSync(join(tmpdir(), 'n8n'));
|
||||
|
|
@ -3,10 +3,9 @@ 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';
|
||||
import { FileSystemManager } from '@/binary-data/file-system.manager';
|
||||
import { isStream } from '@/binary-data/object-store/utils';
|
||||
import { toFileId, toStream } from '@test/utils';
|
||||
|
||||
jest.mock('fs');
|
||||
jest.mock('fs/promises');
|
|
@ -1,12 +1,11 @@
|
|||
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 type { MetadataResponseHeaders } from '@/ObjectStore/types';
|
||||
import { isStream } from '@/ObjectStore/utils';
|
||||
|
||||
import { mockInstance, toFileId, toStream } from './utils';
|
||||
import { ObjectStoreService } from '@/binary-data/object-store/object-store.service.ee';
|
||||
import type { MetadataResponseHeaders } from '@/binary-data/object-store/types';
|
||||
import { isStream } from '@/binary-data/object-store/utils';
|
||||
import { ObjectStoreManager } from '@/binary-data/object-store.manager';
|
||||
import { mockInstance, toFileId, toStream } from '@test/utils';
|
||||
|
||||
jest.mock('fs/promises');
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { Readable } from 'node:stream';
|
||||
import { createGunzip } from 'node:zlib';
|
||||
|
||||
import { binaryToBuffer } from '@/BinaryData/utils';
|
||||
import { binaryToBuffer } from '@/binary-data/utils';
|
||||
|
||||
describe('BinaryData/utils', () => {
|
||||
describe('binaryToBuffer', () => {
|
|
@ -22,7 +22,7 @@ export class BinaryDataService {
|
|||
this.mode = config.mode === 'filesystem' ? 'filesystem-v2' : config.mode;
|
||||
|
||||
if (config.availableModes.includes('filesystem')) {
|
||||
const { FileSystemManager } = await import('./FileSystem.manager');
|
||||
const { FileSystemManager } = await import('./file-system.manager');
|
||||
|
||||
this.managers.filesystem = new FileSystemManager(config.localStoragePath);
|
||||
this.managers['filesystem-v2'] = this.managers.filesystem;
|
||||
|
@ -31,8 +31,8 @@ export class BinaryDataService {
|
|||
}
|
||||
|
||||
if (config.availableModes.includes('s3')) {
|
||||
const { ObjectStoreManager } = await import('./ObjectStore.manager');
|
||||
const { ObjectStoreService } = await import('../ObjectStore/ObjectStore.service.ee');
|
||||
const { ObjectStoreManager } = await import('./object-store.manager');
|
||||
const { ObjectStoreService } = await import('./object-store/object-store.service.ee');
|
||||
|
||||
this.managers.s3 = new ObjectStoreManager(Container.get(ObjectStoreService));
|
||||
|
4
packages/core/src/binary-data/index.ts
Normal file
4
packages/core/src/binary-data/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
export * from './binary-data.service';
|
||||
export * from './types';
|
||||
export { ObjectStoreService } from './object-store/object-store.service.ee';
|
||||
export { isStoredMode as isValidNonDefaultMode } from './utils';
|
|
@ -3,9 +3,9 @@ import fs from 'node:fs/promises';
|
|||
import type { Readable } from 'node:stream';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
import { ObjectStoreService } from './object-store/object-store.service.ee';
|
||||
import type { BinaryData } from './types';
|
||||
import { binaryToBuffer } from './utils';
|
||||
import { ObjectStoreService } from '../ObjectStore/ObjectStore.service.ee';
|
||||
|
||||
@Service()
|
||||
export class ObjectStoreManager implements BinaryData.Manager {
|
|
@ -2,8 +2,8 @@ import axios from 'axios';
|
|||
import { mock } from 'jest-mock-extended';
|
||||
import { Readable } from 'stream';
|
||||
|
||||
import { ObjectStoreService } from '@/ObjectStore/ObjectStore.service.ee';
|
||||
import { writeBlockedMessage } from '@/ObjectStore/utils';
|
||||
import { ObjectStoreService } from '@/binary-data/object-store/object-store.service.ee';
|
||||
import { writeBlockedMessage } from '@/binary-data/object-store/utils';
|
||||
|
||||
jest.mock('axios');
|
||||
|
|
@ -18,7 +18,7 @@ import type {
|
|||
RequestOptions,
|
||||
} from './types';
|
||||
import { isStream, parseXml, writeBlockedMessage } from './utils';
|
||||
import type { BinaryData } from '../BinaryData/types';
|
||||
import type { BinaryData } from '../types';
|
||||
|
||||
@Service()
|
||||
export class ObjectStoreService {
|
|
@ -1,6 +1,6 @@
|
|||
import type { AxiosResponseHeaders, ResponseType } from 'axios';
|
||||
|
||||
import type { BinaryData } from '../BinaryData/types';
|
||||
import type { BinaryData } from '../types';
|
||||
|
||||
export type RawListPage = {
|
||||
listBucketResult: {
|
|
@ -1,6 +1,3 @@
|
|||
import type { INodeProperties } from 'n8n-workflow';
|
||||
import { cronNodeOptions } from 'n8n-workflow';
|
||||
|
||||
const { NODE_ENV } = process.env;
|
||||
export const inProduction = NODE_ENV === 'production';
|
||||
export const inDevelopment = !NODE_ENV || NODE_ENV === 'development';
|
||||
|
@ -11,38 +8,9 @@ export const PLACEHOLDER_EMPTY_WORKFLOW_ID = '__EMPTY__';
|
|||
export const HTTP_REQUEST_NODE_TYPE = 'n8n-nodes-base.httpRequest';
|
||||
export const HTTP_REQUEST_TOOL_NODE_TYPE = '@n8n/n8n-nodes-langchain.toolHttpRequest';
|
||||
|
||||
export const CUSTOM_NODES_CATEGORY = 'Custom Nodes';
|
||||
|
||||
export const RESTRICT_FILE_ACCESS_TO = 'N8N_RESTRICT_FILE_ACCESS_TO';
|
||||
export const BLOCK_FILE_ACCESS_TO_N8N_FILES = 'N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES';
|
||||
export const CONFIG_FILES = 'N8N_CONFIG_FILES';
|
||||
export const BINARY_DATA_STORAGE_PATH = 'N8N_BINARY_DATA_STORAGE_PATH';
|
||||
export const UM_EMAIL_TEMPLATES_INVITE = 'N8N_UM_EMAIL_TEMPLATES_INVITE';
|
||||
export const UM_EMAIL_TEMPLATES_PWRESET = 'N8N_UM_EMAIL_TEMPLATES_PWRESET';
|
||||
|
||||
export const commonPollingParameters: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Poll Times',
|
||||
name: 'pollTimes',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add Poll Time',
|
||||
},
|
||||
default: { item: [{ mode: 'everyMinute' }] },
|
||||
description: 'Time at which polling should occur',
|
||||
placeholder: 'Add Poll Time',
|
||||
options: cronNodeOptions,
|
||||
},
|
||||
];
|
||||
|
||||
export const commonCORSParameters: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Allowed Origins (CORS)',
|
||||
name: 'allowedOrigins',
|
||||
type: 'string',
|
||||
default: '*',
|
||||
description:
|
||||
'Comma-separated list of URLs allowed for cross-origin non-preflight requests. Use * (default) to allow all origins.',
|
||||
},
|
||||
];
|
|
@ -2,7 +2,7 @@ import { Container } from '@n8n/di';
|
|||
import type { ICredentialDataDecryptedObject, ICredentialsEncrypted } from 'n8n-workflow';
|
||||
import { ApplicationError, ICredentials, jsonParse } from 'n8n-workflow';
|
||||
|
||||
import { Cipher } from './Cipher';
|
||||
import { Cipher } from '@/encryption/cipher';
|
||||
|
||||
export class Credentials<
|
||||
T extends object = ICredentialDataDecryptedObject,
|
|
@ -1,9 +1,9 @@
|
|||
import { Container } from '@n8n/di';
|
||||
|
||||
import { Cipher } from '@/Cipher';
|
||||
import { InstanceSettings } from '@/InstanceSettings';
|
||||
import { InstanceSettings } from '@/instance-settings';
|
||||
import { mockInstance } from '@test/utils';
|
||||
|
||||
import { mockInstance } from './utils';
|
||||
import { Cipher } from '../cipher';
|
||||
|
||||
describe('Cipher', () => {
|
||||
mockInstance(InstanceSettings, { encryptionKey: 'test_key' });
|
|
@ -1,7 +1,7 @@
|
|||
import { Service } from '@n8n/di';
|
||||
import { createHash, createCipheriv, createDecipheriv, randomBytes } from 'crypto';
|
||||
|
||||
import { InstanceSettings } from './InstanceSettings';
|
||||
import { InstanceSettings } from '@/instance-settings';
|
||||
|
||||
// Data encrypted by CryptoJS always starts with these bytes
|
||||
const RANDOM_BYTES = Buffer.from('53616c7465645f5f', 'hex');
|
1
packages/core/src/encryption/index.ts
Normal file
1
packages/core/src/encryption/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export { Cipher } from './cipher';
|
|
@ -4,9 +4,10 @@ import { AxiosError } from 'axios';
|
|||
import { mock } from 'jest-mock-extended';
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
import { ErrorReporter } from '@/error-reporter';
|
||||
import type { Logger } from '@/logging/logger';
|
||||
|
||||
import { ErrorReporter } from '../error-reporter';
|
||||
|
||||
jest.mock('@sentry/node', () => ({
|
||||
init: jest.fn(),
|
||||
setTag: jest.fn(),
|
|
@ -6,8 +6,8 @@ import { AxiosError } from 'axios';
|
|||
import { ApplicationError, ExecutionCancelledError, type ReportingOptions } from 'n8n-workflow';
|
||||
import { createHash } from 'node:crypto';
|
||||
|
||||
import type { InstanceType } from './InstanceSettings';
|
||||
import { Logger } from './logging/logger';
|
||||
import type { InstanceType } from '@/instance-settings';
|
||||
import { Logger } from '@/logging/logger';
|
||||
|
||||
type ErrorReporterInitOptions = {
|
||||
serverType: InstanceType | 'task_runner';
|
|
@ -5,3 +5,5 @@ export { InvalidManagerError } from './invalid-manager.error';
|
|||
export { InvalidExecutionMetadataError } from './invalid-execution-metadata.error';
|
||||
export { UnrecognizedCredentialTypeError } from './unrecognized-credential-type.error';
|
||||
export { UnrecognizedNodeTypeError } from './unrecognized-node-type.error';
|
||||
|
||||
export { ErrorReporter } from './error-reporter';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
import { CONFIG_MODES } from '../BinaryData/utils';
|
||||
import { CONFIG_MODES } from '../binary-data/utils';
|
||||
|
||||
export class InvalidModeError extends ApplicationError {
|
||||
constructor() {
|
||||
|
|
|
@ -12,11 +12,12 @@ import type {
|
|||
} from 'n8n-workflow';
|
||||
import { LoggerProxy, TriggerCloseError, WorkflowActivationError } from 'n8n-workflow';
|
||||
|
||||
import { ActiveWorkflows } from '@/ActiveWorkflows';
|
||||
import type { ErrorReporter } from '@/error-reporter';
|
||||
import type { PollContext } from '@/node-execution-context';
|
||||
import type { ScheduledTaskManager } from '@/ScheduledTaskManager';
|
||||
import type { TriggersAndPollers } from '@/TriggersAndPollers';
|
||||
import type { ErrorReporter } from '@/errors/error-reporter';
|
||||
|
||||
import { ActiveWorkflows } from '../active-workflows';
|
||||
import type { PollContext } from '../node-execution-context';
|
||||
import type { ScheduledTaskManager } from '../scheduled-task-manager';
|
||||
import type { TriggersAndPollers } from '../triggers-and-pollers';
|
||||
|
||||
describe('ActiveWorkflows', () => {
|
||||
const workflowId = 'test-workflow-id';
|
|
@ -21,10 +21,10 @@ import type {
|
|||
} from 'n8n-workflow';
|
||||
import { NodeHelpers, Workflow } from 'n8n-workflow';
|
||||
|
||||
import * as executionContexts from '@/node-execution-context';
|
||||
import { RoutingNode } from '@/RoutingNode';
|
||||
import * as executionContexts from '@/execution-engine/node-execution-context';
|
||||
import { NodeTypes } from '@test/helpers';
|
||||
|
||||
import { NodeTypes } from './helpers';
|
||||
import { RoutingNode } from '../routing-node';
|
||||
|
||||
const postReceiveFunction1 = async function (
|
||||
this: IExecuteSingleFunctions,
|
|
@ -1,8 +1,9 @@
|
|||
import { mock } from 'jest-mock-extended';
|
||||
import type { Workflow } from 'n8n-workflow';
|
||||
|
||||
import type { InstanceSettings } from '@/InstanceSettings';
|
||||
import { ScheduledTaskManager } from '@/ScheduledTaskManager';
|
||||
import type { InstanceSettings } from '@/instance-settings';
|
||||
|
||||
import { ScheduledTaskManager } from '../scheduled-task-manager';
|
||||
|
||||
describe('ScheduledTaskManager', () => {
|
||||
const instanceSettings = mock<InstanceSettings>({ isLeader: true });
|
|
@ -1,7 +1,7 @@
|
|||
import type { SSHCredentials } from 'n8n-workflow';
|
||||
import { Client } from 'ssh2';
|
||||
|
||||
import { SSHClientsManager } from '@/SSHClientsManager';
|
||||
import { SSHClientsManager } from '../ssh-clients-manager';
|
||||
|
||||
describe('SSHClientsManager', () => {
|
||||
const credentials: SSHCredentials = {
|
|
@ -13,7 +13,7 @@ import type {
|
|||
IRun,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { TriggersAndPollers } from '@/TriggersAndPollers';
|
||||
import { TriggersAndPollers } from '../triggers-and-pollers';
|
||||
|
||||
describe('TriggersAndPollers', () => {
|
||||
const node = mock<INode>();
|
|
@ -37,13 +37,13 @@ import {
|
|||
Workflow,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { DirectedGraph } from '@/PartialExecutionUtils';
|
||||
import * as partialExecutionUtils from '@/PartialExecutionUtils';
|
||||
import { createNodeData, toITaskData } from '@/PartialExecutionUtils/__tests__/helpers';
|
||||
import { WorkflowExecute } from '@/WorkflowExecute';
|
||||
import * as Helpers from '@test/helpers';
|
||||
import { legacyWorkflowExecuteTests, v1WorkflowExecuteTests } from '@test/helpers/constants';
|
||||
|
||||
import * as Helpers from './helpers';
|
||||
import { legacyWorkflowExecuteTests, v1WorkflowExecuteTests } from './helpers/constants';
|
||||
import { DirectedGraph } from '../partial-execution-utils';
|
||||
import * as partialExecutionUtils from '../partial-execution-utils';
|
||||
import { createNodeData, toITaskData } from '../partial-execution-utils/__tests__/helpers';
|
||||
import { WorkflowExecute } from '../workflow-execute';
|
||||
|
||||
const nodeTypes = Helpers.NodeTypes();
|
||||
|
|
@ -18,11 +18,12 @@ import {
|
|||
WorkflowDeactivationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { ErrorReporter } from './error-reporter';
|
||||
import type { IWorkflowData } from './Interfaces';
|
||||
import { Logger } from './logging/logger';
|
||||
import { ScheduledTaskManager } from './ScheduledTaskManager';
|
||||
import { TriggersAndPollers } from './TriggersAndPollers';
|
||||
import { ErrorReporter } from '@/errors/error-reporter';
|
||||
import type { IWorkflowData } from '@/interfaces';
|
||||
import { Logger } from '@/logging/logger';
|
||||
|
||||
import { ScheduledTaskManager } from './scheduled-task-manager';
|
||||
import { TriggersAndPollers } from './triggers-and-pollers';
|
||||
|
||||
@Service()
|
||||
export class ActiveWorkflows {
|
6
packages/core/src/execution-engine/index.ts
Normal file
6
packages/core/src/execution-engine/index.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export * from './active-workflows';
|
||||
export * from './routing-node';
|
||||
export * from './node-execution-context';
|
||||
export * from './partial-execution-utils';
|
||||
export * from './node-execution-context/utils/execution-metadata';
|
||||
export * from './workflow-execute';
|
|
@ -12,7 +12,7 @@ import type {
|
|||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import { InstanceSettings } from '@/InstanceSettings';
|
||||
import { InstanceSettings } from '@/instance-settings';
|
||||
|
||||
import { NodeExecutionContext } from '../node-execution-context';
|
||||
|
|
@ -17,7 +17,7 @@ import type {
|
|||
} from 'n8n-workflow';
|
||||
import { ApplicationError, NodeHelpers, WAIT_INDEFINITELY } from 'n8n-workflow';
|
||||
|
||||
import { BinaryDataService } from '@/BinaryData/BinaryData.service';
|
||||
import { BinaryDataService } from '@/binary-data/binary-data.service';
|
||||
|
||||
import type { BaseExecuteContext } from '../base-execute-context';
|
||||
|
|
@ -29,7 +29,7 @@ import {
|
|||
WorkflowDataProxy,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { BinaryDataService } from '@/BinaryData/BinaryData.service';
|
||||
import { BinaryDataService } from '@/binary-data/binary-data.service';
|
||||
|
||||
import { NodeExecutionContext } from './node-execution-context';
|
||||
|
|
@ -37,10 +37,10 @@ import {
|
|||
getFileSystemHelperFunctions,
|
||||
getCheckProcessedHelperFunctions,
|
||||
detectBinaryEncoding,
|
||||
} from '@/NodeExecuteFunctions';
|
||||
} from '@/node-execute-functions';
|
||||
|
||||
import { BaseExecuteContext } from './base-execute-context';
|
||||
import { getInputConnectionData } from './utils/getInputConnectionData';
|
||||
import { getInputConnectionData } from './utils/get-input-connection-data';
|
||||
|
||||
export class ExecuteContext extends BaseExecuteContext implements IExecuteFunctions {
|
||||
readonly helpers: IExecuteFunctions['helpers'];
|
|
@ -21,7 +21,7 @@ import {
|
|||
getBinaryHelperFunctions,
|
||||
getRequestHelperFunctions,
|
||||
returnJsonArray,
|
||||
} from '@/NodeExecuteFunctions';
|
||||
} from '@/node-execute-functions';
|
||||
|
||||
import { BaseExecuteContext } from './base-execute-context';
|
||||
|
|
@ -16,7 +16,7 @@ import {
|
|||
getNodeWebhookUrl,
|
||||
getRequestHelperFunctions,
|
||||
getWebhookDescription,
|
||||
} from '@/NodeExecuteFunctions';
|
||||
} from '@/node-execute-functions';
|
||||
|
||||
import { NodeExecutionContext } from './node-execution-context';
|
||||
|
|
@ -10,4 +10,4 @@ export { SupplyDataContext } from './supply-data-context';
|
|||
export { TriggerContext } from './trigger-context';
|
||||
export { WebhookContext } from './webhook-context';
|
||||
|
||||
export { getAdditionalKeys } from './utils/getAdditionalKeys';
|
||||
export { getAdditionalKeys } from './utils/get-additional-keys';
|
|
@ -9,11 +9,11 @@ import type {
|
|||
Workflow,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { extractValue } from '@/ExtractValue';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { getRequestHelperFunctions, getSSHTunnelFunctions } from '@/NodeExecuteFunctions';
|
||||
import { getRequestHelperFunctions, getSSHTunnelFunctions } from '@/node-execute-functions';
|
||||
|
||||
import { NodeExecutionContext } from './node-execution-context';
|
||||
import { extractValue } from './utils/extract-value';
|
||||
|
||||
export class LoadOptionsContext extends NodeExecutionContext implements ILoadOptionsFunctions {
|
||||
readonly helpers: ILoadOptionsFunctions['helpers'];
|
|
@ -28,16 +28,16 @@ import {
|
|||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { HTTP_REQUEST_NODE_TYPE, HTTP_REQUEST_TOOL_NODE_TYPE } from '@/Constants';
|
||||
import { HTTP_REQUEST_NODE_TYPE, HTTP_REQUEST_TOOL_NODE_TYPE } from '@/constants';
|
||||
import { Memoized } from '@/decorators';
|
||||
import { extractValue } from '@/ExtractValue';
|
||||
import { InstanceSettings } from '@/InstanceSettings';
|
||||
import { InstanceSettings } from '@/instance-settings';
|
||||
import { Logger } from '@/logging/logger';
|
||||
|
||||
import { cleanupParameterData } from './utils/cleanupParameterData';
|
||||
import { ensureType } from './utils/ensureType';
|
||||
import { getAdditionalKeys } from './utils/getAdditionalKeys';
|
||||
import { validateValueAgainstSchema } from './utils/validateValueAgainstSchema';
|
||||
import { cleanupParameterData } from './utils/cleanup-parameter-data';
|
||||
import { ensureType } from './utils/ensure-type';
|
||||
import { extractValue } from './utils/extract-value';
|
||||
import { getAdditionalKeys } from './utils/get-additional-keys';
|
||||
import { validateValueAgainstSchema } from './utils/validate-value-against-schema';
|
||||
|
||||
export abstract class NodeExecutionContext implements Omit<FunctionsBase, 'getCredentials'> {
|
||||
protected readonly instanceSettings = Container.get(InstanceSettings);
|
|
@ -15,7 +15,7 @@ import {
|
|||
getRequestHelperFunctions,
|
||||
getSchedulingFunctions,
|
||||
returnJsonArray,
|
||||
} from '@/NodeExecuteFunctions';
|
||||
} from '@/node-execute-functions';
|
||||
|
||||
import { NodeExecutionContext } from './node-execution-context';
|
||||
|
|
@ -33,10 +33,10 @@ import {
|
|||
getSSHTunnelFunctions,
|
||||
normalizeItems,
|
||||
returnJsonArray,
|
||||
} from '@/NodeExecuteFunctions';
|
||||
} from '@/node-execute-functions';
|
||||
|
||||
import { BaseExecuteContext } from './base-execute-context';
|
||||
import { getInputConnectionData } from './utils/getInputConnectionData';
|
||||
import { getInputConnectionData } from './utils/get-input-connection-data';
|
||||
|
||||
export class SupplyDataContext extends BaseExecuteContext implements ISupplyDataFunctions {
|
||||
readonly helpers: ISupplyDataFunctions['helpers'];
|
|
@ -16,7 +16,7 @@ import {
|
|||
getSchedulingFunctions,
|
||||
getSSHTunnelFunctions,
|
||||
returnJsonArray,
|
||||
} from '@/NodeExecuteFunctions';
|
||||
} from '@/node-execute-functions';
|
||||
|
||||
import { NodeExecutionContext } from './node-execution-context';
|
||||
|
|
@ -2,7 +2,7 @@ import toPlainObject from 'lodash/toPlainObject';
|
|||
import { DateTime } from 'luxon';
|
||||
import type { NodeParameterValue } from 'n8n-workflow';
|
||||
|
||||
import { cleanupParameterData } from '../cleanupParameterData';
|
||||
import { cleanupParameterData } from '../cleanup-parameter-data';
|
||||
|
||||
describe('cleanupParameterData', () => {
|
||||
it('should stringify Luxon dates in-place', () => {
|
|
@ -2,7 +2,7 @@ import { mock } from 'jest-mock-extended';
|
|||
import type { INodeType, ISupplyDataFunctions, INode } from 'n8n-workflow';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { createNodeAsTool } from '@/CreateNodeAsTool';
|
||||
import { createNodeAsTool } from '../create-node-as-tool';
|
||||
|
||||
jest.mock('@langchain/core/tools', () => ({
|
||||
DynamicStructuredTool: jest.fn().mockImplementation((config) => ({
|
|
@ -1,6 +1,6 @@
|
|||
import { ExpressionError } from 'n8n-workflow';
|
||||
|
||||
import { ensureType } from '../ensureType';
|
||||
import { ensureType } from '../ensure-type';
|
||||
|
||||
describe('ensureType', () => {
|
||||
it('throws error for null value', () => {
|
|
@ -1,13 +1,14 @@
|
|||
import type { IRunExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { InvalidExecutionMetadataError } from '@/errors/invalid-execution-metadata.error';
|
||||
|
||||
import {
|
||||
setWorkflowExecutionMetadata,
|
||||
setAllWorkflowExecutionMetadata,
|
||||
KV_LIMIT,
|
||||
getWorkflowExecutionMetadata,
|
||||
getAllWorkflowExecutionMetadata,
|
||||
} from '@/ExecutionMetadata';
|
||||
} from '../execution-metadata';
|
||||
|
||||
describe('Execution Metadata functions', () => {
|
||||
test('setWorkflowExecutionMetadata will set a value', () => {
|
|
@ -7,9 +7,9 @@ import type {
|
|||
SecretsHelpersBase,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { PLACEHOLDER_EMPTY_EXECUTION_ID } from '@/Constants';
|
||||
import { PLACEHOLDER_EMPTY_EXECUTION_ID } from '@/constants';
|
||||
|
||||
import { getAdditionalKeys } from '../getAdditionalKeys';
|
||||
import { getAdditionalKeys } from '../get-additional-keys';
|
||||
|
||||
describe('getAdditionalKeys', () => {
|
||||
const secretsHelpers = mock<SecretsHelpersBase>();
|
|
@ -1,6 +1,6 @@
|
|||
import type { IDataObject, INode, INodeType } from 'n8n-workflow';
|
||||
|
||||
import { validateValueAgainstSchema } from '../validateValueAgainstSchema';
|
||||
import { validateValueAgainstSchema } from '../validate-value-against-schema';
|
||||
|
||||
describe('validateValueAgainstSchema', () => {
|
||||
test('should validate fixedCollection values parameter', () => {
|
|
@ -1,7 +1,7 @@
|
|||
import type { IRunExecutionData } 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;
|
||||
|
|
@ -6,14 +6,15 @@ import type {
|
|||
} from 'n8n-workflow';
|
||||
import { LoggerProxy } from 'n8n-workflow';
|
||||
|
||||
import { PLACEHOLDER_EMPTY_EXECUTION_ID } from '@/Constants';
|
||||
import { PLACEHOLDER_EMPTY_EXECUTION_ID } from '@/constants';
|
||||
|
||||
import {
|
||||
setWorkflowExecutionMetadata,
|
||||
setAllWorkflowExecutionMetadata,
|
||||
getWorkflowExecutionMetadata,
|
||||
getAllWorkflowExecutionMetadata,
|
||||
} from '@/ExecutionMetadata';
|
||||
import { getSecretsProxy } from '@/Secrets';
|
||||
} from './execution-metadata';
|
||||
import { getSecretsProxy } from './get-secrets-proxy';
|
||||
|
||||
/** Returns the additional keys for Expressions and Function-Nodes */
|
||||
export function getAdditionalKeys(
|
|
@ -19,10 +19,10 @@ import {
|
|||
ApplicationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { createNodeAsTool } from '@/CreateNodeAsTool';
|
||||
import { createNodeAsTool } from './create-node-as-tool';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { SupplyDataContext } from '@/node-execution-context';
|
||||
import type { ExecuteContext, WebhookContext } from '@/node-execution-context';
|
||||
import { SupplyDataContext } from '../../node-execution-context';
|
||||
import type { ExecuteContext, WebhookContext } from '../../node-execution-context';
|
||||
|
||||
export async function getInputConnectionData(
|
||||
this: ExecuteContext | WebhookContext | SupplyDataContext,
|
|
@ -14,7 +14,7 @@ import {
|
|||
validateFieldType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type { ExtendedValidationResult } from '@/Interfaces';
|
||||
import type { ExtendedValidationResult } from '@/interfaces';
|
||||
|
||||
const validateResourceMapperValue = (
|
||||
parameterName: string,
|
|
@ -25,10 +25,10 @@ import {
|
|||
getNodeWebhookUrl,
|
||||
getRequestHelperFunctions,
|
||||
returnJsonArray,
|
||||
} from '@/NodeExecuteFunctions';
|
||||
} from '@/node-execute-functions';
|
||||
|
||||
import { NodeExecutionContext } from './node-execution-context';
|
||||
import { getInputConnectionData } from './utils/getInputConnectionData';
|
||||
import { getInputConnectionData } from './utils/get-input-connection-data';
|
||||
|
||||
export class WebhookContext extends NodeExecutionContext implements IWebhookFunctions {
|
||||
readonly helpers: IWebhookFunctions['helpers'];
|
|
@ -1,8 +1,8 @@
|
|||
import type { IRunData } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toITaskData } from './helpers';
|
||||
import { cleanRunData } from '../cleanRunData';
|
||||
import { DirectedGraph } from '../DirectedGraph';
|
||||
import { cleanRunData } from '../clean-run-data';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
|
||||
describe('cleanRunData', () => {
|
||||
// ┌─────┐ ┌─────┐ ┌─────┐
|
|
@ -13,7 +13,7 @@ import type { INode } from 'n8n-workflow';
|
|||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, defaultWorkflowParameter } from './helpers';
|
||||
import { DirectedGraph } from '../DirectedGraph';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
|
||||
describe('DirectedGraph', () => {
|
||||
// ┌─────┐ ┌─────┐ ┌─────┐
|
|
@ -12,8 +12,8 @@
|
|||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData } from './helpers';
|
||||
import { DirectedGraph } from '../DirectedGraph';
|
||||
import { filterDisabledNodes } from '../filterDisabledNodes';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
import { filterDisabledNodes } from '../filter-disabled-nodes';
|
||||
|
||||
describe('filterDisabledNodes', () => {
|
||||
// XX
|
|
@ -12,8 +12,8 @@
|
|||
import { type IPinData, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toITaskData } from './helpers';
|
||||
import { DirectedGraph } from '../DirectedGraph';
|
||||
import { findStartNodes, isDirty } from '../findStartNodes';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
import { findStartNodes, isDirty } from '../find-start-nodes';
|
||||
|
||||
describe('isDirty', () => {
|
||||
test("if the node has pinned data it's not dirty", () => {
|
|
@ -12,8 +12,8 @@
|
|||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData } from './helpers';
|
||||
import { DirectedGraph } from '../DirectedGraph';
|
||||
import { findSubgraph } from '../findSubgraph';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
import { findSubgraph } from '../find-subgraph';
|
||||
|
||||
describe('findSubgraph', () => {
|
||||
// ►►
|
|
@ -11,8 +11,8 @@ import type { IPinData } from 'n8n-workflow';
|
|||
import { NodeConnectionType, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toITaskData } from './helpers';
|
||||
import { DirectedGraph } from '../DirectedGraph';
|
||||
import { getSourceDataGroups } from '../getSourceDataGroups';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
import { getSourceDataGroups } from '../get-source-data-groups';
|
||||
|
||||
describe('getSourceDataGroups', () => {
|
||||
//┌───────┐1
|
|
@ -10,8 +10,8 @@
|
|||
// PD denotes that the node has pinned data
|
||||
|
||||
import { createNodeData } from './helpers';
|
||||
import { DirectedGraph } from '../DirectedGraph';
|
||||
import { handleCycles } from '../handleCycles';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
import { handleCycles } from '../handle-cycles';
|
||||
|
||||
describe('handleCycles', () => {
|
||||
// ┌────┐ ┌─────────┐
|
|
@ -18,15 +18,14 @@ import type {
|
|||
} from 'n8n-workflow';
|
||||
import { NodeConnectionType, type IPinData, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import { createNodeData, toITaskData } from './helpers';
|
||||
import { DirectedGraph } from '../directed-graph';
|
||||
import { findSubgraph } from '../find-subgraph';
|
||||
import {
|
||||
addWaitingExecution,
|
||||
addWaitingExecutionSource,
|
||||
recreateNodeExecutionStack,
|
||||
} from '@/PartialExecutionUtils/recreateNodeExecutionStack';
|
||||
|
||||
import { createNodeData, toITaskData } from './helpers';
|
||||
import { DirectedGraph } from '../DirectedGraph';
|
||||
import { findSubgraph } from '../findSubgraph';
|
||||
} from '../recreate-node-execution-stack';
|
||||
|
||||
describe('recreateNodeExecutionStack', () => {
|
||||
// ►►
|
|
@ -1,6 +1,6 @@
|
|||
import type { INode, IRunData } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './DirectedGraph';
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
|
||||
/**
|
||||
* Returns new run data that does not contain data for any node that is a child
|
|
@ -1,6 +1,6 @@
|
|||
import { NodeConnectionType } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './DirectedGraph';
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
|
||||
export function filterDisabledNodes(graph: DirectedGraph): DirectedGraph {
|
||||
const filteredGraph = graph.clone();
|
|
@ -1,7 +1,7 @@
|
|||
import { NodeConnectionType, type INode, type IPinData, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './DirectedGraph';
|
||||
import { getIncomingData, getIncomingDataFromAnyRun } from './getIncomingData';
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
import { getIncomingData, getIncomingDataFromAnyRun } from './get-incoming-data';
|
||||
|
||||
/**
|
||||
* A node is dirty if either of the following is true:
|
|
@ -1,7 +1,7 @@
|
|||
import { NodeConnectionType, type INode } from 'n8n-workflow';
|
||||
|
||||
import type { GraphConnection } from './DirectedGraph';
|
||||
import { DirectedGraph } from './DirectedGraph';
|
||||
import type { GraphConnection } from './directed-graph';
|
||||
import { DirectedGraph } from './directed-graph';
|
||||
|
||||
function findSubgraphRecursive(
|
||||
graph: DirectedGraph,
|
|
@ -1,6 +1,6 @@
|
|||
import { type INode, type IPinData, type IRunData } from 'n8n-workflow';
|
||||
|
||||
import type { GraphConnection, DirectedGraph } from './DirectedGraph';
|
||||
import type { GraphConnection, DirectedGraph } from './directed-graph';
|
||||
|
||||
function sortByInputIndexThenByName(
|
||||
connection1: GraphConnection,
|
|
@ -1,7 +1,7 @@
|
|||
import type { INode } from 'n8n-workflow';
|
||||
import * as a from 'node:assert/strict';
|
||||
|
||||
import type { DirectedGraph } from './DirectedGraph';
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
|
||||
/**
|
||||
* Returns a new set of start nodes.
|
|
@ -0,0 +1,8 @@
|
|||
export { DirectedGraph } from './directed-graph';
|
||||
export { findTriggerForPartialExecution } from './find-trigger-for-partial-execution';
|
||||
export { findStartNodes } from './find-start-nodes';
|
||||
export { findSubgraph } from './find-subgraph';
|
||||
export { recreateNodeExecutionStack } from './recreate-node-execution-stack';
|
||||
export { cleanRunData } from './clean-run-data';
|
||||
export { handleCycles } from './handle-cycles';
|
||||
export { filterDisabledNodes } from './filter-disabled-nodes';
|
|
@ -12,9 +12,9 @@ import {
|
|||
type IWaitingForExecutionSource,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type { DirectedGraph } from './DirectedGraph';
|
||||
import { getIncomingDataFromAnyRun } from './getIncomingData';
|
||||
import { getSourceDataGroups } from './getSourceDataGroups';
|
||||
import type { DirectedGraph } from './directed-graph';
|
||||
import { getIncomingDataFromAnyRun } from './get-incoming-data';
|
||||
import { getSourceDataGroups } from './get-source-data-groups';
|
||||
|
||||
export function addWaitingExecution(
|
||||
waitingExecution: IWaitingForExecution,
|
|
@ -2,7 +2,7 @@ import { Service } from '@n8n/di';
|
|||
import { CronJob } from 'cron';
|
||||
import type { CronExpression, Workflow } from 'n8n-workflow';
|
||||
|
||||
import { InstanceSettings } from './InstanceSettings';
|
||||
import { InstanceSettings } from '@/instance-settings';
|
||||
|
||||
@Service()
|
||||
export class ScheduledTaskManager {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue