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