diff --git a/packages/@n8n/config/src/configs/external-hooks.config.ts b/packages/@n8n/config/src/configs/external-hooks.config.ts index 2dc86b1429..20c8eb8654 100644 --- a/packages/@n8n/config/src/configs/external-hooks.config.ts +++ b/packages/@n8n/config/src/configs/external-hooks.config.ts @@ -1,6 +1,6 @@ import { Config, Env } from '../decorators'; -class ColonSeperatedStringArray extends Array { +class ColonSeparatedStringArray extends Array { constructor(str: string) { super(); const parsed = str.split(':') as this; @@ -13,5 +13,5 @@ class ColonSeperatedStringArray extends Array { export class ExternalHooksConfig { /** Files containing external hooks. Multiple files can be separated by colon (":") */ @Env('EXTERNAL_HOOK_FILES') - files: ColonSeperatedStringArray = []; + files: ColonSeparatedStringArray = []; } diff --git a/packages/cli/src/external-hooks.ts b/packages/cli/src/external-hooks.ts index 7602ece806..da8aa2d230 100644 --- a/packages/cli/src/external-hooks.ts +++ b/packages/cli/src/external-hooks.ts @@ -24,12 +24,12 @@ type Repositories = { Workflow: WorkflowRepository; }; -type Hooks = { +type ExternalHooksMap = { 'n8n.ready': [server: AbstractServer, config: Config]; - 'n8n.stop': []; - 'worker.ready': []; + 'n8n.stop': never; + 'worker.ready': never; - 'activeWorkflows.initialized': []; + 'activeWorkflows.initialized': never; 'credentials.create': [encryptedData: ICredentialsDb]; 'credentials.update': [newCredentialData: ICredentialsDb]; @@ -78,7 +78,7 @@ type Hooks = { executionId: string, ]; }; -type HookNames = keyof Hooks; +type HookNames = keyof ExternalHooksMap; // TODO: Derive this type from Hooks interface IExternalHooksFileData { @@ -90,7 +90,7 @@ interface IExternalHooksFileData { @Service() export class ExternalHooks { private readonly registered: { - [hookName in HookNames]?: Array<(...args: Hooks[hookName]) => Promise>; + [hookName in HookNames]?: Array<(...args: ExternalHooksMap[hookName]) => Promise>; } = {}; private readonly dbCollections: Repositories; @@ -146,7 +146,7 @@ export class ExternalHooks { async run( hookName: HookName, - hookParameters?: Hooks[HookName], + hookParameters?: ExternalHooksMap[HookName], ): Promise { const { registered, dbCollections } = this; const hookFunctions = registered[hookName];