mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Move dependencies of Logger to standalone packages (#15338)
This commit is contained in:
@@ -1,2 +1,8 @@
|
|||||||
export * from './license-state';
|
export * from './license-state';
|
||||||
export * from './types';
|
export * from './types';
|
||||||
|
|
||||||
|
const { NODE_ENV } = process.env;
|
||||||
|
|
||||||
|
export const inTest = NODE_ENV === 'test';
|
||||||
|
export const inProduction = NODE_ENV === 'production';
|
||||||
|
export const inDevelopment = !NODE_ENV || NODE_ENV === 'development';
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
jest.mock('@/constants', () => ({
|
jest.mock('@n8n/backend-common', () => {
|
||||||
inProduction: true,
|
return {
|
||||||
}));
|
...jest.requireActual('@n8n/backend-common'),
|
||||||
|
inProduction: true,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
import type { GlobalConfig } from '@n8n/config';
|
import type { GlobalConfig } from '@n8n/config';
|
||||||
import { ControllerRegistryMetadata } from '@n8n/decorators';
|
import { ControllerRegistryMetadata } from '@n8n/decorators';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inTest, inDevelopment } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import { OnShutdown } from '@n8n/decorators';
|
import { OnShutdown } from '@n8n/decorators';
|
||||||
import { Container, Service } from '@n8n/di';
|
import { Container, Service } from '@n8n/di';
|
||||||
@@ -10,7 +11,7 @@ import isbot from 'isbot';
|
|||||||
import { Logger } from 'n8n-core';
|
import { Logger } from 'n8n-core';
|
||||||
|
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
import { N8N_VERSION, TEMPLATES_DIR, inDevelopment, inTest } from '@/constants';
|
import { N8N_VERSION, TEMPLATES_DIR } from '@/constants';
|
||||||
import { DbConnection } from '@/databases/db-connection';
|
import { DbConnection } from '@/databases/db-connection';
|
||||||
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
|
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
|
||||||
import { ExternalHooks } from '@/external-hooks';
|
import { ExternalHooks } from '@/external-hooks';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
import { LicenseState } from '@n8n/backend-common';
|
import { inDevelopment, inTest, LicenseState } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import { LICENSE_FEATURES } from '@n8n/constants';
|
import { LICENSE_FEATURES } from '@n8n/constants';
|
||||||
import { Container } from '@n8n/di';
|
import { Container } from '@n8n/di';
|
||||||
@@ -17,7 +17,7 @@ import { ensureError, sleep, UserError } from 'n8n-workflow';
|
|||||||
|
|
||||||
import type { AbstractServer } from '@/abstract-server';
|
import type { AbstractServer } from '@/abstract-server';
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
import { N8N_VERSION, N8N_RELEASE_DATE, inDevelopment, inTest } from '@/constants';
|
import { N8N_VERSION, N8N_RELEASE_DATE } from '@/constants';
|
||||||
import * as CrashJournal from '@/crash-journal';
|
import * as CrashJournal from '@/crash-journal';
|
||||||
import { DbConnection } from '@/databases/db-connection';
|
import { DbConnection } from '@/databases/db-connection';
|
||||||
import { getDataDeduplicationService } from '@/deduplication';
|
import { getDataDeduplicationService } from '@/deduplication';
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { Container } from '@n8n/di';
|
import { Container } from '@n8n/di';
|
||||||
import { Flags, type Config } from '@oclif/core';
|
import { Flags, type Config } from '@oclif/core';
|
||||||
|
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
import { N8N_VERSION, inTest } from '@/constants';
|
import { N8N_VERSION } from '@/constants';
|
||||||
import { EventMessageGeneric } from '@/eventbus/event-message-classes/event-message-generic';
|
import { EventMessageGeneric } from '@/eventbus/event-message-classes/event-message-generic';
|
||||||
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
|
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
|
||||||
import { LogStreamingEventRelay } from '@/events/relays/log-streaming.event-relay';
|
import { LogStreamingEventRelay } from '@/events/relays/log-streaming.event-relay';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import { Container } from '@n8n/di';
|
import { Container } from '@n8n/di';
|
||||||
import convict from 'convict';
|
import convict from 'convict';
|
||||||
@@ -8,7 +9,7 @@ import { Logger } from 'n8n-core';
|
|||||||
import { setGlobalState, UserError } from 'n8n-workflow';
|
import { setGlobalState, UserError } from 'n8n-workflow';
|
||||||
import assert from 'node:assert';
|
import assert from 'node:assert';
|
||||||
|
|
||||||
import { inTest, inE2ETests } from '@/constants';
|
import { inE2ETests } from '@/constants';
|
||||||
|
|
||||||
const globalConfig = Container.get(GlobalConfig);
|
const globalConfig = Container.get(GlobalConfig);
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ import type { ITaskDataConnections } from 'n8n-workflow';
|
|||||||
import { jsonParse, TRIMMED_TASK_DATA_CONNECTIONS_KEY } from 'n8n-workflow';
|
import { jsonParse, TRIMMED_TASK_DATA_CONNECTIONS_KEY } from 'n8n-workflow';
|
||||||
import { resolve, join, dirname } from 'path';
|
import { resolve, join, dirname } from 'path';
|
||||||
|
|
||||||
const { NODE_ENV, E2E_TESTS } = process.env;
|
const { E2E_TESTS } = process.env;
|
||||||
export const inProduction = NODE_ENV === 'production';
|
|
||||||
export const inDevelopment = !NODE_ENV || NODE_ENV === 'development';
|
|
||||||
export const inTest = NODE_ENV === 'test';
|
|
||||||
export const inE2ETests = E2E_TESTS === 'true';
|
export const inE2ETests = E2E_TESTS === 'true';
|
||||||
|
|
||||||
export const CUSTOM_API_CALL_NAME = 'Custom API Call';
|
export const CUSTOM_API_CALL_NAME = 'Custom API Call';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import { inProduction } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import type { BooleanLicenseFeature } from '@n8n/constants';
|
import { type BooleanLicenseFeature } from '@n8n/constants';
|
||||||
import { ControllerRegistryMetadata } from '@n8n/decorators';
|
import { ControllerRegistryMetadata } from '@n8n/decorators';
|
||||||
import type { AccessScope, Controller, RateLimit } from '@n8n/decorators';
|
import type { AccessScope, Controller, RateLimit } from '@n8n/decorators';
|
||||||
import { Container, Service } from '@n8n/di';
|
import { Container, Service } from '@n8n/di';
|
||||||
@@ -10,7 +11,7 @@ import { UnexpectedError } from 'n8n-workflow';
|
|||||||
import type { ZodClass } from 'zod-class';
|
import type { ZodClass } from 'zod-class';
|
||||||
|
|
||||||
import { AuthService } from '@/auth/auth.service';
|
import { AuthService } from '@/auth/auth.service';
|
||||||
import { inProduction, RESPONSE_ERROR_MESSAGES } from '@/constants';
|
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||||
import { UnauthenticatedError } from '@/errors/response-errors/unauthenticated.error';
|
import { UnauthenticatedError } from '@/errors/response-errors/unauthenticated.error';
|
||||||
import { License } from '@/license';
|
import { License } from '@/license';
|
||||||
import { userHasScopes } from '@/permissions.ee/check-access';
|
import { userHasScopes } from '@/permissions.ee/check-access';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inProduction } from '@n8n/backend-common';
|
||||||
import { Container } from '@n8n/di';
|
import { Container } from '@n8n/di';
|
||||||
import { existsSync } from 'fs';
|
import { existsSync } from 'fs';
|
||||||
import { mkdir, utimes, open, rm } from 'fs/promises';
|
import { mkdir, utimes, open, rm } from 'fs/promises';
|
||||||
@@ -5,8 +6,6 @@ import { InstanceSettings, Logger } from 'n8n-core';
|
|||||||
import { sleep } from 'n8n-workflow';
|
import { sleep } from 'n8n-workflow';
|
||||||
import { join, dirname } from 'path';
|
import { join, dirname } from 'path';
|
||||||
|
|
||||||
import { inProduction } from '@/constants';
|
|
||||||
|
|
||||||
export const touchFile = async (filePath: string): Promise<void> => {
|
export const touchFile = async (filePath: string): Promise<void> => {
|
||||||
await mkdir(dirname(filePath), { recursive: true });
|
await mkdir(dirname(filePath), { recursive: true });
|
||||||
const time = new Date();
|
const time = new Date();
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { Memoized } from '@n8n/decorators';
|
import { Memoized } from '@n8n/decorators';
|
||||||
import { Container, Service } from '@n8n/di';
|
import { Container, Service } from '@n8n/di';
|
||||||
import { DataSource } from '@n8n/typeorm';
|
import { DataSource } from '@n8n/typeorm';
|
||||||
import { ErrorReporter } from 'n8n-core';
|
import { ErrorReporter } from 'n8n-core';
|
||||||
import { DbConnectionTimeoutError, ensureError } from 'n8n-workflow';
|
import { DbConnectionTimeoutError, ensureError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { inTest } from '@/constants';
|
|
||||||
|
|
||||||
import { DbConnectionOptions } from './db-connection-options';
|
import { DbConnectionOptions } from './db-connection-options';
|
||||||
import type { Migration } from './types';
|
import type { Migration } from './types';
|
||||||
import { wrapMigration } from './utils/migration-helpers';
|
import { wrapMigration } from './utils/migration-helpers';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import { Container } from '@n8n/di';
|
import { Container } from '@n8n/di';
|
||||||
import type { ObjectLiteral } from '@n8n/typeorm';
|
import type { ObjectLiteral } from '@n8n/typeorm';
|
||||||
@@ -6,7 +7,6 @@ import { readFileSync, rmSync } from 'fs';
|
|||||||
import { InstanceSettings, Logger } from 'n8n-core';
|
import { InstanceSettings, Logger } from 'n8n-core';
|
||||||
import { jsonParse, UnexpectedError } from 'n8n-workflow';
|
import { jsonParse, UnexpectedError } from 'n8n-workflow';
|
||||||
|
|
||||||
import { inTest } from '@/constants';
|
|
||||||
import { createSchemaBuilder } from '@/databases/dsl';
|
import { createSchemaBuilder } from '@/databases/dsl';
|
||||||
import type { BaseMigration, Migration, MigrationContext, MigrationFn } from '@/databases/types';
|
import type { BaseMigration, Migration, MigrationContext, MigrationFn } from '@/databases/types';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||||
|
|
||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import { Container } from '@n8n/di';
|
import { Container } from '@n8n/di';
|
||||||
import { once as eventOnce } from 'events';
|
import { once as eventOnce } from 'events';
|
||||||
@@ -11,8 +12,6 @@ import path, { parse } from 'path';
|
|||||||
import readline from 'readline';
|
import readline from 'readline';
|
||||||
import { Worker } from 'worker_threads';
|
import { Worker } from 'worker_threads';
|
||||||
|
|
||||||
import { inTest } from '@/constants';
|
|
||||||
|
|
||||||
import type { EventMessageTypes } from '../event-message-classes';
|
import type { EventMessageTypes } from '../event-message-classes';
|
||||||
import { isEventMessageOptions } from '../event-message-classes/abstract-event-message';
|
import { isEventMessageOptions } from '../event-message-classes/abstract-event-message';
|
||||||
import type { AbstractEventMessageOptions } from '../event-message-classes/abstract-event-message-options';
|
import type { AbstractEventMessageOptions } from '../event-message-classes/abstract-event-message-options';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import { Container, Service } from '@n8n/di';
|
import { Container, Service } from '@n8n/di';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
@@ -29,13 +30,7 @@ import { deepCopy, NodeConnectionTypes, UnexpectedError, UserError } from 'n8n-w
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import picocolors from 'picocolors';
|
import picocolors from 'picocolors';
|
||||||
|
|
||||||
import {
|
import { CUSTOM_API_CALL_KEY, CUSTOM_API_CALL_NAME, CLI_DIR, inE2ETests } from '@/constants';
|
||||||
CUSTOM_API_CALL_KEY,
|
|
||||||
CUSTOM_API_CALL_NAME,
|
|
||||||
inTest,
|
|
||||||
CLI_DIR,
|
|
||||||
inE2ETests,
|
|
||||||
} from '@/constants';
|
|
||||||
import { isContainedWithin } from '@/utils/path-util';
|
import { isContainedWithin } from '@/utils/path-util';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
|
|||||||
@@ -18,9 +18,12 @@ jest.mock('ws', () => ({
|
|||||||
Server: jest.fn(),
|
Server: jest.fn(),
|
||||||
}));
|
}));
|
||||||
jest.unmock('@/push');
|
jest.unmock('@/push');
|
||||||
jest.mock('@/constants', () => ({
|
jest.mock('@n8n/backend-common', () => {
|
||||||
inProduction: true,
|
return {
|
||||||
}));
|
...jest.requireActual('@n8n/backend-common'),
|
||||||
|
inProduction: true,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
describe('Push', () => {
|
describe('Push', () => {
|
||||||
const pushRef = 'valid-push-ref';
|
const pushRef = 'valid-push-ref';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { PushMessage } from '@n8n/api-types';
|
import type { PushMessage } from '@n8n/api-types';
|
||||||
|
import { inProduction } from '@n8n/backend-common';
|
||||||
import type { User } from '@n8n/db';
|
import type { User } from '@n8n/db';
|
||||||
import { OnShutdown } from '@n8n/decorators';
|
import { OnShutdown } from '@n8n/decorators';
|
||||||
import { Container, Service } from '@n8n/di';
|
import { Container, Service } from '@n8n/di';
|
||||||
@@ -11,7 +12,7 @@ import { parse as parseUrl } from 'url';
|
|||||||
import { Server as WSServer } from 'ws';
|
import { Server as WSServer } from 'ws';
|
||||||
|
|
||||||
import { AuthService } from '@/auth/auth.service';
|
import { AuthService } from '@/auth/auth.service';
|
||||||
import { inProduction, TRIMMED_TASK_DATA_CONNECTIONS } from '@/constants';
|
import { TRIMMED_TASK_DATA_CONNECTIONS } from '@/constants';
|
||||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||||
import { Publisher } from '@/scaling/pubsub/publisher.service';
|
import { Publisher } from '@/scaling/pubsub/publisher.service';
|
||||||
import { TypedEmitter } from '@/typed-emitter';
|
import { TypedEmitter } from '@/typed-emitter';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
|
import { inDevelopment } from '@n8n/backend-common';
|
||||||
import { Container } from '@n8n/di';
|
import { Container } from '@n8n/di';
|
||||||
import type { Request, Response } from 'express';
|
import type { Request, Response } from 'express';
|
||||||
import { ErrorReporter, Logger } from 'n8n-core';
|
import { ErrorReporter, Logger } from 'n8n-core';
|
||||||
@@ -6,8 +7,6 @@ import { FORM_TRIGGER_PATH_IDENTIFIER, NodeApiError } from 'n8n-workflow';
|
|||||||
import { Readable } from 'node:stream';
|
import { Readable } from 'node:stream';
|
||||||
import picocolors from 'picocolors';
|
import picocolors from 'picocolors';
|
||||||
|
|
||||||
import { inDevelopment } from '@/constants';
|
|
||||||
|
|
||||||
import { ResponseError } from './errors/response-errors/abstract/response.error';
|
import { ResponseError } from './errors/response-errors/abstract/response.error';
|
||||||
|
|
||||||
export function sendSuccessResponse(
|
export function sendSuccessResponse(
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inDevelopment } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import { separate } from '@n8n/db';
|
import { separate } from '@n8n/db';
|
||||||
import { Service } from '@n8n/di';
|
import { Service } from '@n8n/di';
|
||||||
@@ -6,7 +7,7 @@ import { InstanceSettings, Logger } from 'n8n-core';
|
|||||||
import type { IWorkflowBase } from 'n8n-workflow';
|
import type { IWorkflowBase } from 'n8n-workflow';
|
||||||
|
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
import { inDevelopment, N8N_VERSION } from '@/constants';
|
import { N8N_VERSION } from '@/constants';
|
||||||
import { isApiEnabled } from '@/public-api';
|
import { isApiEnabled } from '@/public-api';
|
||||||
import {
|
import {
|
||||||
ENV_VARS_DOCS_URL,
|
ENV_VARS_DOCS_URL,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inDevelopment, inProduction } from '@n8n/backend-common';
|
||||||
import { SecurityConfig } from '@n8n/config';
|
import { SecurityConfig } from '@n8n/config';
|
||||||
import { Container, Service } from '@n8n/di';
|
import { Container, Service } from '@n8n/di';
|
||||||
import cookieParser from 'cookie-parser';
|
import cookieParser from 'cookie-parser';
|
||||||
@@ -11,15 +12,7 @@ import { resolve } from 'path';
|
|||||||
|
|
||||||
import { AbstractServer } from '@/abstract-server';
|
import { AbstractServer } from '@/abstract-server';
|
||||||
import config from '@/config';
|
import config from '@/config';
|
||||||
import {
|
import { CLI_DIR, EDITOR_UI_DIST_DIR, inE2ETests, N8N_VERSION, Time } from '@/constants';
|
||||||
CLI_DIR,
|
|
||||||
EDITOR_UI_DIST_DIR,
|
|
||||||
inDevelopment,
|
|
||||||
inE2ETests,
|
|
||||||
inProduction,
|
|
||||||
N8N_VERSION,
|
|
||||||
Time,
|
|
||||||
} from '@/constants';
|
|
||||||
import { ControllerRegistry } from '@/controller.registry';
|
import { ControllerRegistry } from '@/controller.registry';
|
||||||
import { CredentialsOverwrites } from '@/credentials-overwrites';
|
import { CredentialsOverwrites } from '@/credentials-overwrites';
|
||||||
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
|
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import { Service } from '@n8n/di';
|
import { Service } from '@n8n/di';
|
||||||
import compression from 'compression';
|
import compression from 'compression';
|
||||||
@@ -11,7 +12,6 @@ import type { AddressInfo, Socket } from 'node:net';
|
|||||||
import { parse as parseUrl } from 'node:url';
|
import { parse as parseUrl } from 'node:url';
|
||||||
import { Server as WSServer } from 'ws';
|
import { Server as WSServer } from 'ws';
|
||||||
|
|
||||||
import { inTest } from '@/constants';
|
|
||||||
import { bodyParser, rawBodyReader } from '@/middlewares';
|
import { bodyParser, rawBodyReader } from '@/middlewares';
|
||||||
import { send } from '@/response-helper';
|
import { send } from '@/response-helper';
|
||||||
import { TaskBrokerAuthController } from '@/task-runners/task-broker/auth/task-broker-auth.controller';
|
import { TaskBrokerAuthController } from '@/task-runners/task-broker/auth/task-broker-auth.controller';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { GlobalConfig } from '@n8n/config';
|
import { GlobalConfig } from '@n8n/config';
|
||||||
import type { User } from '@n8n/db';
|
import type { User } from '@n8n/db';
|
||||||
import { UserRepository } from '@n8n/db';
|
import { UserRepository } from '@n8n/db';
|
||||||
@@ -9,7 +10,6 @@ import { Logger } from 'n8n-core';
|
|||||||
import type { IWorkflowBase } from 'n8n-workflow';
|
import type { IWorkflowBase } from 'n8n-workflow';
|
||||||
import { join as pathJoin } from 'path';
|
import { join as pathJoin } from 'path';
|
||||||
|
|
||||||
import { inTest } from '@/constants';
|
|
||||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||||
import { EventService } from '@/events/event.service';
|
import { EventService } from '@/events/event.service';
|
||||||
import { UrlService } from '@/services/url.service';
|
import { UrlService } from '@/services/url.service';
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "3.808.0",
|
"@aws-sdk/client-s3": "3.808.0",
|
||||||
"@langchain/core": "catalog:",
|
"@langchain/core": "catalog:",
|
||||||
|
"@n8n/backend-common": "workspace:^",
|
||||||
"@n8n/client-oauth2": "workspace:*",
|
"@n8n/client-oauth2": "workspace:*",
|
||||||
"@n8n/config": "workspace:*",
|
"@n8n/config": "workspace:*",
|
||||||
"@n8n/decorators": "workspace:*",
|
"@n8n/decorators": "workspace:*",
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
const { NODE_ENV } = process.env;
|
|
||||||
export const inProduction = NODE_ENV === 'production';
|
|
||||||
export const inDevelopment = !NODE_ENV || NODE_ENV === 'development';
|
|
||||||
export const inTest = NODE_ENV === 'test';
|
|
||||||
|
|
||||||
export const CUSTOM_EXTENSION_ENV = 'N8N_CUSTOM_EXTENSIONS';
|
export const CUSTOM_EXTENSION_ENV = 'N8N_CUSTOM_EXTENSIONS';
|
||||||
export const PLACEHOLDER_EMPTY_EXECUTION_ID = '__UNKNOWN__';
|
export const PLACEHOLDER_EMPTY_EXECUTION_ID = '__UNKNOWN__';
|
||||||
export const PLACEHOLDER_EMPTY_WORKFLOW_ID = '__EMPTY__';
|
export const PLACEHOLDER_EMPTY_WORKFLOW_ID = '__EMPTY__';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { InstanceSettingsConfig } from '@n8n/config';
|
import { InstanceSettingsConfig } from '@n8n/config';
|
||||||
import { Memoized } from '@n8n/decorators';
|
import { Memoized } from '@n8n/decorators';
|
||||||
import { Service } from '@n8n/di';
|
import { Service } from '@n8n/di';
|
||||||
@@ -27,8 +28,6 @@ type InstanceRole = 'unset' | 'leader' | 'follower';
|
|||||||
|
|
||||||
export type InstanceType = 'main' | 'webhook' | 'worker';
|
export type InstanceType = 'main' | 'webhook' | 'worker';
|
||||||
|
|
||||||
const inTest = process.env.NODE_ENV === 'test';
|
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export class InstanceSettings {
|
export class InstanceSettings {
|
||||||
/** The path to the n8n folder in which all n8n related data gets saved */
|
/** The path to the n8n folder in which all n8n related data gets saved */
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { inDevelopment, inProduction } from '@n8n/backend-common';
|
||||||
import type { LogScope } from '@n8n/config';
|
import type { LogScope } from '@n8n/config';
|
||||||
import { GlobalConfig, InstanceSettingsConfig } from '@n8n/config';
|
import { GlobalConfig, InstanceSettingsConfig } from '@n8n/config';
|
||||||
import { Service } from '@n8n/di';
|
import { Service } from '@n8n/di';
|
||||||
@@ -14,7 +15,6 @@ import path, { basename } from 'node:path';
|
|||||||
import pc from 'picocolors';
|
import pc from 'picocolors';
|
||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
|
|
||||||
import { inDevelopment, inProduction } from '@/constants';
|
|
||||||
import { isObjectLiteral } from '@/utils/is-object-literal';
|
import { isObjectLiteral } from '@/utils/is-object-literal';
|
||||||
|
|
||||||
const noOp = () => {};
|
const noOp = () => {};
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ import vm from 'vm';
|
|||||||
|
|
||||||
import { loadClassInIsolation } from '../load-class-in-isolation';
|
import { loadClassInIsolation } from '../load-class-in-isolation';
|
||||||
|
|
||||||
jest.mock('@/constants', () => ({
|
jest.mock('@n8n/backend-common', () => {
|
||||||
inTest: false,
|
return {
|
||||||
}));
|
...jest.requireActual('@n8n/backend-common'),
|
||||||
|
inTest: false,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
describe('loadClassInIsolation', () => {
|
describe('loadClassInIsolation', () => {
|
||||||
const filePath = '/path/to/TestClass.js';
|
const filePath = '/path/to/TestClass.js';
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
import { inTest } from '@n8n/backend-common';
|
||||||
import { createContext, Script } from 'vm';
|
import { createContext, Script } from 'vm';
|
||||||
|
|
||||||
import { inTest } from '@/constants';
|
|
||||||
|
|
||||||
const context = createContext({ require });
|
const context = createContext({ require });
|
||||||
export const loadClassInIsolation = <T>(filePath: string, className: string) => {
|
export const loadClassInIsolation = <T>(filePath: string, className: string) => {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -1456,6 +1456,9 @@ importers:
|
|||||||
'@langchain/core':
|
'@langchain/core':
|
||||||
specifier: 'catalog:'
|
specifier: 'catalog:'
|
||||||
version: 0.3.30(openai@4.78.1(encoding@0.1.13)(zod@3.24.1))
|
version: 0.3.30(openai@4.78.1(encoding@0.1.13)(zod@3.24.1))
|
||||||
|
'@n8n/backend-common':
|
||||||
|
specifier: workspace:^
|
||||||
|
version: link:../@n8n/backend-common
|
||||||
'@n8n/client-oauth2':
|
'@n8n/client-oauth2':
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../@n8n/client-oauth2
|
version: link:../@n8n/client-oauth2
|
||||||
|
|||||||
Reference in New Issue
Block a user