mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Implement a new OnPubSubEvent decorator (#15688)
This commit is contained in:
committed by
GitHub
parent
b772462cea
commit
4b11268a6e
@@ -41,6 +41,7 @@
|
||||
"@n8n/backend-common": "workspace:^",
|
||||
"@n8n/client-oauth2": "workspace:*",
|
||||
"@n8n/config": "workspace:*",
|
||||
"@n8n/constants": "workspace:*",
|
||||
"@n8n/decorators": "workspace:*",
|
||||
"@n8n/di": "workspace:*",
|
||||
"@sentry/node": "catalog:",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import type { InstanceType } from '@n8n/constants';
|
||||
import { Service } from '@n8n/di';
|
||||
import type { NodeOptions } from '@sentry/node';
|
||||
import type { ErrorEvent, EventHint } from '@sentry/types';
|
||||
@@ -7,8 +8,6 @@ import type { ReportingOptions } from 'n8n-workflow';
|
||||
import { ApplicationError, ExecutionCancelledError, BaseError } from 'n8n-workflow';
|
||||
import { createHash } from 'node:crypto';
|
||||
|
||||
import type { InstanceType } from '@/instance-settings';
|
||||
|
||||
type ErrorReporterInitOptions = {
|
||||
serverType: InstanceType | 'task_runner';
|
||||
dsn: string;
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { InstanceSettings, InstanceType } from './instance-settings';
|
||||
export { InstanceSettings } from './instance-settings';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { inTest, Logger } from '@n8n/backend-common';
|
||||
import { InstanceSettingsConfig } from '@n8n/config';
|
||||
import type { InstanceRole, InstanceType } from '@n8n/constants';
|
||||
import { Memoized } from '@n8n/decorators';
|
||||
import { Service } from '@n8n/di';
|
||||
import { createHash, randomBytes } from 'crypto';
|
||||
@@ -22,10 +23,6 @@ interface WritableSettings {
|
||||
|
||||
type Settings = ReadOnlySettings & WritableSettings;
|
||||
|
||||
type InstanceRole = 'unset' | 'leader' | 'follower';
|
||||
|
||||
export type InstanceType = 'main' | 'webhook' | 'worker';
|
||||
|
||||
@Service()
|
||||
export class InstanceSettings {
|
||||
/** The path to the n8n folder in which all n8n related data gets saved */
|
||||
@@ -60,10 +57,8 @@ export class InstanceSettings {
|
||||
private readonly config: InstanceSettingsConfig,
|
||||
private readonly logger: Logger,
|
||||
) {
|
||||
const command = process.argv[2];
|
||||
this.instanceType = ['webhook', 'worker'].includes(command)
|
||||
? (command as InstanceType)
|
||||
: 'main';
|
||||
const command = process.argv[2] as InstanceType;
|
||||
this.instanceType = ['webhook', 'worker'].includes(command) ? command : 'main';
|
||||
|
||||
this.hostId = `${this.instanceType}-${nanoid()}`;
|
||||
this.settings = this.loadOrCreate();
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
{ "path": "../@n8n/decorators/tsconfig.build.json" },
|
||||
{ "path": "../@n8n/backend-common/tsconfig.build.json" },
|
||||
{ "path": "../@n8n/config/tsconfig.build.json" },
|
||||
{ "path": "../@n8n/constants/tsconfig.build.json" },
|
||||
{ "path": "../@n8n/di/tsconfig.build.json" },
|
||||
{ "path": "../@n8n/client-oauth2/tsconfig.build.json" }
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user