diff --git a/packages/cli/src/ExternalSecrets/__tests__/ExternalSecretsManager.ee.test.ts b/packages/cli/src/ExternalSecrets/__tests__/ExternalSecretsManager.ee.test.ts index 92475c93115e9..7df8d6d323558 100644 --- a/packages/cli/src/ExternalSecrets/__tests__/ExternalSecretsManager.ee.test.ts +++ b/packages/cli/src/ExternalSecrets/__tests__/ExternalSecretsManager.ee.test.ts @@ -5,7 +5,6 @@ import type { ExternalSecretsSettings } from '@/Interfaces'; import { License } from '@/License'; import { ExternalSecretsManager } from '@/ExternalSecrets/ExternalSecretsManager.ee'; import { ExternalSecretsProviders } from '@/ExternalSecrets/ExternalSecretsProviders.ee'; -import { InternalHooks } from '@/InternalHooks'; import { mockInstance } from '@test/mocking'; import { DummyProvider, @@ -22,7 +21,6 @@ describe('External Secrets Manager', () => { const mockProvidersInstance = new MockProviders(); const license = mockInstance(License); const settingsRepo = mockInstance(SettingsRepository); - mockInstance(InternalHooks); const cipher = Container.get(Cipher); let providersMock: ExternalSecretsProviders; diff --git a/packages/cli/src/InternalHooks.ts b/packages/cli/src/InternalHooks.ts index 26954a0472c0f..b3d45b67c0acd 100644 --- a/packages/cli/src/InternalHooks.ts +++ b/packages/cli/src/InternalHooks.ts @@ -1,10 +1,10 @@ import { Service } from 'typedi'; -import type { User } from '@db/entities/User'; import { Telemetry } from '@/telemetry'; import { MessageEventBus } from './eventbus/MessageEventBus/MessageEventBus'; /** - * @deprecated Do not add to this class. To add log streaming or telemetry events, use + * @deprecated Do not add to this class. It will be removed once we remove + * further dep cycles. To add log streaming or telemetry events, use * `EventService` to emit the event and then use the `LogStreamingEventRelay` or * `TelemetryEventRelay` to forward them to the event bus or telemetry. */ @@ -21,35 +21,4 @@ export class InternalHooks { async init() { await this.telemetry.init(); } - - onUserInviteEmailClick(userInviteClickData: { inviter: User; invitee: User }) { - this.telemetry.track('User clicked invite link from email', { - user_id: userInviteClickData.invitee.id, - }); - } - - onUserPasswordResetEmailClick(userPasswordResetData: { user: User }) { - this.telemetry.track('User clicked password reset link from email', { - user_id: userPasswordResetData.user.id, - }); - } - - onUserTransactionalEmail(userTransactionalEmailData: { - user_id: string; - message_type: - | 'Reset password' - | 'New user invite' - | 'Resend invite' - | 'Workflow shared' - | 'Credentials shared'; - public_api: boolean; - }) { - this.telemetry.track('Instance sent transactional email to user', userTransactionalEmailData); - } - - onUserPasswordResetRequestClick(userPasswordResetData: { user: User }) { - this.telemetry.track('User requested password reset while logged out', { - user_id: userPasswordResetData.user.id, - }); - } } diff --git a/packages/cli/src/UserManagement/email/UserManagementMailer.ts b/packages/cli/src/UserManagement/email/UserManagementMailer.ts index 459d8ec1c2668..7d5e8d254865e 100644 --- a/packages/cli/src/UserManagement/email/UserManagementMailer.ts +++ b/packages/cli/src/UserManagement/email/UserManagementMailer.ts @@ -8,7 +8,6 @@ import { GlobalConfig } from '@n8n/config'; import type { User } from '@db/entities/User'; import type { WorkflowEntity } from '@db/entities/WorkflowEntity'; import { UserRepository } from '@db/repositories/user.repository'; -import { InternalHooks } from '@/InternalHooks'; import { Logger } from '@/Logger'; import { UrlService } from '@/services/url.service'; import { InternalServerError } from '@/errors/response-errors/internal-server.error'; @@ -112,10 +111,10 @@ export class UserManagementMailer { this.logger.info('Sent workflow shared email successfully', { sharerId: sharer.id }); - Container.get(InternalHooks).onUserTransactionalEmail({ - user_id: sharer.id, - message_type: 'Workflow shared', - public_api: false, + Container.get(EventService).emit('user-transactional-email-sent', { + userId: sharer.id, + messageType: 'Workflow shared', + publicApi: false, }); return result; @@ -167,10 +166,10 @@ export class UserManagementMailer { this.logger.info('Sent credentials shared email successfully', { sharerId: sharer.id }); - Container.get(InternalHooks).onUserTransactionalEmail({ - user_id: sharer.id, - message_type: 'Credentials shared', - public_api: false, + Container.get(EventService).emit('user-transactional-email-sent', { + userId: sharer.id, + messageType: 'Credentials shared', + publicApi: false, }); return result; diff --git a/packages/cli/src/commands/BaseCommand.ts b/packages/cli/src/commands/BaseCommand.ts index 62ff002e43298..d0c34dac0a86d 100644 --- a/packages/cli/src/commands/BaseCommand.ts +++ b/packages/cli/src/commands/BaseCommand.ts @@ -15,8 +15,8 @@ import { ExternalHooks } from '@/ExternalHooks'; import { NodeTypes } from '@/NodeTypes'; import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; import type { N8nInstanceType } from '@/Interfaces'; -import { InternalHooks } from '@/InternalHooks'; import { PostHogClient } from '@/posthog'; +import { InternalHooks } from '@/InternalHooks'; import { License } from '@/License'; import { ExternalSecretsManager } from '@/ExternalSecrets/ExternalSecretsManager.ee'; import { initExpressionEvaluator } from '@/ExpressionEvaluator'; diff --git a/packages/cli/src/controllers/__tests__/me.controller.test.ts b/packages/cli/src/controllers/__tests__/me.controller.test.ts index 4a313552af497..d4b877e50d52d 100644 --- a/packages/cli/src/controllers/__tests__/me.controller.test.ts +++ b/packages/cli/src/controllers/__tests__/me.controller.test.ts @@ -9,7 +9,6 @@ import { AUTH_COOKIE_NAME } from '@/constants'; import type { AuthenticatedRequest, MeRequest } from '@/requests'; import { UserService } from '@/services/user.service'; import { ExternalHooks } from '@/ExternalHooks'; -import { InternalHooks } from '@/InternalHooks'; import { License } from '@/License'; import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { UserRepository } from '@/databases/repositories/user.repository'; @@ -21,7 +20,6 @@ const browserId = 'test-browser-id'; describe('MeController', () => { const externalHooks = mockInstance(ExternalHooks); - mockInstance(InternalHooks); const eventService = mockInstance(EventService); const userService = mockInstance(UserService); const userRepository = mockInstance(UserRepository); diff --git a/packages/cli/src/controllers/auth.controller.ts b/packages/cli/src/controllers/auth.controller.ts index e2a481fae9fe0..99b5c523207a1 100644 --- a/packages/cli/src/controllers/auth.controller.ts +++ b/packages/cli/src/controllers/auth.controller.ts @@ -14,7 +14,6 @@ import { isLdapCurrentAuthenticationMethod, isSamlCurrentAuthenticationMethod, } from '@/sso/ssoHelpers'; -import { InternalHooks } from '../InternalHooks'; import { License } from '@/License'; import { UserService } from '@/services/user.service'; import { MfaService } from '@/Mfa/mfa.service'; @@ -30,7 +29,6 @@ import { EventService } from '@/events/event.service'; export class AuthController { constructor( private readonly logger: Logger, - private readonly internalHooks: InternalHooks, private readonly authService: AuthService, private readonly mfaService: MfaService, private readonly userService: UserService, @@ -179,7 +177,6 @@ export class AuthController { throw new BadRequestError('Invalid request'); } - this.internalHooks.onUserInviteEmailClick({ inviter, invitee }); this.eventService.emit('user-invite-email-click', { inviter, invitee }); const { firstName, lastName } = inviter; diff --git a/packages/cli/src/controllers/passwordReset.controller.ts b/packages/cli/src/controllers/passwordReset.controller.ts index 458593d228a33..0cfe7cac19e12 100644 --- a/packages/cli/src/controllers/passwordReset.controller.ts +++ b/packages/cli/src/controllers/passwordReset.controller.ts @@ -13,7 +13,6 @@ import { RESPONSE_ERROR_MESSAGES } from '@/constants'; import { MfaService } from '@/Mfa/mfa.service'; import { Logger } from '@/Logger'; import { ExternalHooks } from '@/ExternalHooks'; -import { InternalHooks } from '@/InternalHooks'; import { UrlService } from '@/services/url.service'; import { InternalServerError } from '@/errors/response-errors/internal-server.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error'; @@ -28,7 +27,6 @@ export class PasswordResetController { constructor( private readonly logger: Logger, private readonly externalHooks: ExternalHooks, - private readonly internalHooks: InternalHooks, private readonly mailer: UserManagementMailer, private readonly authService: AuthService, private readonly userService: UserService, @@ -131,13 +129,12 @@ export class PasswordResetController { } this.logger.info('Sent password reset email successfully', { userId: user.id, email }); - this.internalHooks.onUserTransactionalEmail({ - user_id: id, - message_type: 'Reset password', - public_api: false, + this.eventService.emit('user-transactional-email-sent', { + userId: id, + messageType: 'Reset password', + publicApi: false, }); - this.internalHooks.onUserPasswordResetRequestClick({ user }); this.eventService.emit('user-password-reset-request-click', { user }); } @@ -170,7 +167,6 @@ export class PasswordResetController { } this.logger.info('Reset-password token resolved successfully', { userId: user.id }); - this.internalHooks.onUserPasswordResetEmailClick({ user }); this.eventService.emit('user-password-reset-email-click', { user }); } diff --git a/packages/cli/src/events/relay-event-map.ts b/packages/cli/src/events/relay-event-map.ts index 8d6463defbe29..8f0efc2fedf8c 100644 --- a/packages/cli/src/events/relay-event-map.ts +++ b/packages/cli/src/events/relay-event-map.ts @@ -207,6 +207,17 @@ export type RelayEventMap = { user: UserLike; }; + 'user-transactional-email-sent': { + userId: string; + messageType: + | 'Reset password' + | 'New user invite' + | 'Resend invite' + | 'Workflow shared' + | 'Credentials shared'; + publicApi: boolean; + }; + // #endregion // #region Public API diff --git a/packages/cli/src/events/telemetry-event-relay.ts b/packages/cli/src/events/telemetry-event-relay.ts index a7eaf5ef2c27c..6b0ae37a44307 100644 --- a/packages/cli/src/events/telemetry-event-relay.ts +++ b/packages/cli/src/events/telemetry-event-relay.ts @@ -95,6 +95,10 @@ export class TelemetryEventRelay extends EventRelay { 'user-submitted-personalization-survey': (event) => this.userSubmittedPersonalizationSurvey(event), 'email-failed': (event) => this.emailFailed(event), + 'user-transactional-email-sent': (event) => this.userTransactionalEmailSent(event), + 'user-invite-email-click': (event) => this.userInviteEmailClick(event), + 'user-password-reset-email-click': (event) => this.userPasswordResetEmailClick(event), + 'user-password-reset-request-click': (event) => this.userPasswordResetRequestClick(event), }); } @@ -955,5 +959,41 @@ export class TelemetryEventRelay extends EventRelay { }); } + private userTransactionalEmailSent({ + userId, + messageType, + publicApi, + }: RelayEventMap['user-transactional-email-sent']) { + this.telemetry.track('User sent transactional email', { + user_id: userId, + message_type: messageType, + public_api: publicApi, + }); + } + + // #endregion + + // #region Click + + private userInviteEmailClick({ invitee }: RelayEventMap['user-invite-email-click']) { + this.telemetry.track('User clicked invite link from email', { + user_id: invitee.id, + }); + } + + private userPasswordResetEmailClick({ user }: RelayEventMap['user-password-reset-email-click']) { + this.telemetry.track('User clicked password reset link from email', { + user_id: user.id, + }); + } + + private userPasswordResetRequestClick({ + user, + }: RelayEventMap['user-password-reset-request-click']) { + this.telemetry.track('User requested password reset while logged out', { + user_id: user.id, + }); + } + // #endregion } diff --git a/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts b/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts index 39a84d27a78c1..965e7da6fecda 100644 --- a/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts +++ b/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts @@ -13,7 +13,6 @@ import { OrchestrationService } from '@/services/orchestration.service'; import config from '@/config'; import { ExecutionRecoveryService } from '@/executions/execution-recovery.service'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; -import { InternalHooks } from '@/InternalHooks'; import { Push } from '@/push'; import { ARTIFICIAL_TASK_DATA } from '@/constants'; import { NodeCrashedError } from '@/errors/node-crashed.error'; @@ -26,7 +25,6 @@ import type { EventMessageTypes as EventMessage } from '@/eventbus/EventMessageC describe('ExecutionRecoveryService', () => { const push = mockInstance(Push); - mockInstance(InternalHooks); const instanceSettings = new InstanceSettings(); let executionRecoveryService: ExecutionRecoveryService; diff --git a/packages/cli/src/services/user.service.ts b/packages/cli/src/services/user.service.ts index 6b17530b7cf57..19b49fdb1927e 100644 --- a/packages/cli/src/services/user.service.ts +++ b/packages/cli/src/services/user.service.ts @@ -1,4 +1,4 @@ -import { Container, Service } from 'typedi'; +import { Service } from 'typedi'; import type { IUserSettings } from 'n8n-workflow'; import { ApplicationError, ErrorReporterProxy as ErrorReporter } from 'n8n-workflow'; @@ -8,7 +8,6 @@ import type { Invitation, PublicUser } from '@/Interfaces'; import type { PostHogClient } from '@/posthog'; import { Logger } from '@/Logger'; import { UserManagementMailer } from '@/UserManagement/email'; -import { InternalHooks } from '@/InternalHooks'; import { UrlService } from '@/services/url.service'; import type { UserRequest } from '@/requests'; import { InternalServerError } from '@/errors/response-errors/internal-server.error'; @@ -144,10 +143,11 @@ export class UserService { if (result.emailSent) { invitedUser.user.emailSent = true; delete invitedUser.user?.inviteAcceptUrl; - Container.get(InternalHooks).onUserTransactionalEmail({ - user_id: id, - message_type: 'New user invite', - public_api: false, + + this.eventService.emit('user-transactional-email-sent', { + userId: id, + messageType: 'New user invite', + publicApi: false, }); } diff --git a/packages/cli/test/integration/commands/credentials.cmd.test.ts b/packages/cli/test/integration/commands/credentials.cmd.test.ts index 386f3a41b20de..bcb6f0173b262 100644 --- a/packages/cli/test/integration/commands/credentials.cmd.test.ts +++ b/packages/cli/test/integration/commands/credentials.cmd.test.ts @@ -1,6 +1,5 @@ import { nanoid } from 'nanoid'; -import { InternalHooks } from '@/InternalHooks'; import { ImportCredentialsCommand } from '@/commands/import/credentials'; import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; @@ -11,7 +10,6 @@ import { getAllCredentials, getAllSharedCredentials } from '../shared/db/credent import { createMember, createOwner } from '../shared/db/users'; import { getPersonalProject } from '../shared/db/projects'; -mockInstance(InternalHooks); mockInstance(LoadNodesAndCredentials); const command = setupTestCommand(ImportCredentialsCommand); diff --git a/packages/cli/test/integration/commands/import.cmd.test.ts b/packages/cli/test/integration/commands/import.cmd.test.ts index 3295f0de27b1c..ba72d64d775fe 100644 --- a/packages/cli/test/integration/commands/import.cmd.test.ts +++ b/packages/cli/test/integration/commands/import.cmd.test.ts @@ -1,6 +1,5 @@ import { nanoid } from 'nanoid'; -import { InternalHooks } from '@/InternalHooks'; import { ImportWorkflowsCommand } from '@/commands/import/workflow'; import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; @@ -11,7 +10,6 @@ import { getAllSharedWorkflows, getAllWorkflows } from '../shared/db/workflows'; import { createMember, createOwner } from '../shared/db/users'; import { getPersonalProject } from '../shared/db/projects'; -mockInstance(InternalHooks); mockInstance(LoadNodesAndCredentials); const command = setupTestCommand(ImportWorkflowsCommand); diff --git a/packages/cli/test/integration/commands/ldap/reset.test.ts b/packages/cli/test/integration/commands/ldap/reset.test.ts index 12833b633f018..720c98c401063 100644 --- a/packages/cli/test/integration/commands/ldap/reset.test.ts +++ b/packages/cli/test/integration/commands/ldap/reset.test.ts @@ -4,7 +4,6 @@ import { EntityNotFoundError } from '@n8n/typeorm'; import { Reset } from '@/commands/ldap/reset'; import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; -import { InternalHooks } from '@/InternalHooks'; import { WorkflowRepository } from '@db/repositories/workflow.repository'; import { CredentialsRepository } from '@db/repositories/credentials.repository'; import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository'; @@ -26,7 +25,6 @@ import { createTeamProject, findProject, getPersonalProject } from '../../shared mockInstance(Telemetry); mockInstance(Push); -mockInstance(InternalHooks); mockInstance(LoadNodesAndCredentials); const command = setupTestCommand(Reset); diff --git a/packages/cli/test/integration/commands/license.cmd.test.ts b/packages/cli/test/integration/commands/license.cmd.test.ts index 8637d2d02017d..1717e1a5ff185 100644 --- a/packages/cli/test/integration/commands/license.cmd.test.ts +++ b/packages/cli/test/integration/commands/license.cmd.test.ts @@ -1,4 +1,3 @@ -import { InternalHooks } from '@/InternalHooks'; import { License } from '@/License'; import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; import { ClearLicenseCommand } from '@/commands/license/clear'; @@ -6,7 +5,6 @@ import { ClearLicenseCommand } from '@/commands/license/clear'; import { setupTestCommand } from '@test-integration/utils/testCommand'; import { mockInstance } from '../../shared/mocking'; -mockInstance(InternalHooks); mockInstance(LoadNodesAndCredentials); const license = mockInstance(License); const command = setupTestCommand(ClearLicenseCommand); diff --git a/packages/cli/test/integration/commands/reset.cmd.test.ts b/packages/cli/test/integration/commands/reset.cmd.test.ts index f38ea789d71b7..573e85043ea3c 100644 --- a/packages/cli/test/integration/commands/reset.cmd.test.ts +++ b/packages/cli/test/integration/commands/reset.cmd.test.ts @@ -1,7 +1,6 @@ import { Container } from 'typedi'; import { Reset } from '@/commands/user-management/reset'; -import { InternalHooks } from '@/InternalHooks'; import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; import { NodeTypes } from '@/NodeTypes'; import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository'; @@ -20,7 +19,6 @@ import { getPersonalProject } from '../shared/db/projects'; import { encryptCredentialData, saveCredential } from '../shared/db/credentials'; import { randomCredentialPayload } from '../shared/random'; -mockInstance(InternalHooks); mockInstance(LoadNodesAndCredentials); mockInstance(NodeTypes); const command = setupTestCommand(Reset); diff --git a/packages/cli/test/integration/commands/update/workflow.test.ts b/packages/cli/test/integration/commands/update/workflow.test.ts index 315e64c5263af..95a25bc4f647e 100644 --- a/packages/cli/test/integration/commands/update/workflow.test.ts +++ b/packages/cli/test/integration/commands/update/workflow.test.ts @@ -1,4 +1,3 @@ -import { InternalHooks } from '@/InternalHooks'; import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; import { UpdateWorkflowCommand } from '@/commands/update/workflow'; @@ -7,7 +6,6 @@ import * as testDb from '../../shared/testDb'; import { createWorkflowWithTrigger, getAllWorkflows } from '../../shared/db/workflows'; import { mockInstance } from '../../../shared/mocking'; -mockInstance(InternalHooks); mockInstance(LoadNodesAndCredentials); const command = setupTestCommand(UpdateWorkflowCommand); diff --git a/packages/cli/test/integration/commands/worker.cmd.test.ts b/packages/cli/test/integration/commands/worker.cmd.test.ts index 205a60307c643..e7f783bf94126 100644 --- a/packages/cli/test/integration/commands/worker.cmd.test.ts +++ b/packages/cli/test/integration/commands/worker.cmd.test.ts @@ -5,7 +5,6 @@ import config from '@/config'; import { ExternalSecretsManager } from '@/ExternalSecrets/ExternalSecretsManager.ee'; import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; -import { InternalHooks } from '@/InternalHooks'; import { OrchestrationHandlerWorkerService } from '@/services/orchestration/worker/orchestration.handler.worker.service'; import { OrchestrationWorkerService } from '@/services/orchestration/worker/orchestration.worker.service'; import { License } from '@/License'; @@ -18,7 +17,6 @@ import { LogStreamingEventRelay } from '@/events/log-streaming-event-relay'; config.set('executions.mode', 'queue'); config.set('binaryDataManager.availableModes', 'filesystem'); -mockInstance(InternalHooks); mockInstance(LoadNodesAndCredentials); const binaryDataService = mockInstance(BinaryDataService); const externalHooks = mockInstance(ExternalHooks); diff --git a/packages/cli/test/integration/controllers/invitation/invitation.controller.integration.test.ts b/packages/cli/test/integration/controllers/invitation/invitation.controller.integration.test.ts index 00e480f86f6f6..8b1048267da20 100644 --- a/packages/cli/test/integration/controllers/invitation/invitation.controller.integration.test.ts +++ b/packages/cli/test/integration/controllers/invitation/invitation.controller.integration.test.ts @@ -1,8 +1,6 @@ -import { mocked } from 'jest-mock'; import Container from 'typedi'; import { Not } from '@n8n/typeorm'; - -import { InternalHooks } from '@/InternalHooks'; +import { EventService } from '@/events/event.service'; import { ExternalHooks } from '@/ExternalHooks'; import { UserManagementMailer } from '@/UserManagement/email'; import { UserRepository } from '@/databases/repositories/user.repository'; @@ -31,7 +29,7 @@ import { ProjectRelationRepository } from '@/databases/repositories/projectRelat describe('InvitationController', () => { const mailer = mockInstance(UserManagementMailer); const externalHooks = mockInstance(ExternalHooks); - const internalHooks = mockInstance(InternalHooks); + const eventService = mockInstance(EventService); const testServer = utils.setupTestServer({ endpointGroups: ['invitations'] }); @@ -413,14 +411,24 @@ describe('InvitationController', () => { expect(externalHookName).toBe('user.invited'); expect(externalHookArg?.[0]).toStrictEqual([newUserEmail]); - // internal hooks - - const calls = mocked(internalHooks).onUserTransactionalEmail.mock.calls; - - for (const [onUserTransactionalEmailArg] of calls) { - expect(onUserTransactionalEmailArg.user_id).toBeDefined(); - expect(onUserTransactionalEmailArg.message_type).toBe('New user invite'); - expect(onUserTransactionalEmailArg.public_api).toBe(false); + for (const [eventName, payload] of eventService.emit.mock.calls) { + if (eventName === 'user-invited') { + expect(payload).toEqual({ + user: expect.objectContaining({ id: expect.any(String) }), + targetUserId: expect.arrayContaining([expect.any(String), expect.any(String)]), + publicApi: false, + emailSent: true, + inviteeRole: 'global:member', + }); + } else if (eventName === 'user-transactional-email-sent') { + expect(payload).toEqual({ + userId: expect.any(String), + messageType: 'New user invite', + publicApi: false, + }); + } else { + fail(`Unexpected event name: ${eventName}`); + } } }); diff --git a/packages/cli/test/integration/shared/utils/testCommand.ts b/packages/cli/test/integration/shared/utils/testCommand.ts index 2d25d837cc928..9592b806c3c75 100644 --- a/packages/cli/test/integration/shared/utils/testCommand.ts +++ b/packages/cli/test/integration/shared/utils/testCommand.ts @@ -6,6 +6,9 @@ import type { BaseCommand } from '@/commands/BaseCommand'; import * as testDb from '../testDb'; import { TelemetryEventRelay } from '@/events/telemetry-event-relay'; import { mockInstance } from '@test/mocking'; +import { InternalHooks } from '@/InternalHooks'; + +mockInstance(InternalHooks); export const setupTestCommand = (Command: Class) => { const config = mock(); diff --git a/packages/cli/test/integration/shared/utils/testServer.ts b/packages/cli/test/integration/shared/utils/testServer.ts index 7776b7e669415..319c4e2b588db 100644 --- a/packages/cli/test/integration/shared/utils/testServer.ts +++ b/packages/cli/test/integration/shared/utils/testServer.ts @@ -14,7 +14,6 @@ import { PostHogClient } from '@/posthog'; import { Push } from '@/push'; import { License } from '@/License'; import { Logger } from '@/Logger'; -import { InternalHooks } from '@/InternalHooks'; import { AuthService } from '@/auth/auth.service'; import type { APIRequest } from '@/requests'; @@ -82,7 +81,6 @@ export const setupTestServer = ({ // Mock all telemetry and logging mockInstance(Logger); - mockInstance(InternalHooks); mockInstance(PostHogClient); mockInstance(Push); diff --git a/packages/cli/test/integration/webhooks.api.test.ts b/packages/cli/test/integration/webhooks.api.test.ts index 64cb760c8ec69..5b61dd98611ac 100644 --- a/packages/cli/test/integration/webhooks.api.test.ts +++ b/packages/cli/test/integration/webhooks.api.test.ts @@ -4,7 +4,6 @@ import type { INodeType, INodeTypeDescription, IWebhookFunctions } from 'n8n-wor import { AbstractServer } from '@/AbstractServer'; import { ExternalHooks } from '@/ExternalHooks'; -import { InternalHooks } from '@/InternalHooks'; import { NodeTypes } from '@/NodeTypes'; import { Push } from '@/push'; import type { WorkflowEntity } from '@db/entities/WorkflowEntity'; @@ -21,7 +20,6 @@ mockInstance(Telemetry); describe('Webhook API', () => { mockInstance(ExternalHooks); - mockInstance(InternalHooks); mockInstance(Push); let agent: SuperAgentTest; diff --git a/packages/cli/test/integration/webhooks.test.ts b/packages/cli/test/integration/webhooks.test.ts index 280edb370d286..44bc32c1b5a62 100644 --- a/packages/cli/test/integration/webhooks.test.ts +++ b/packages/cli/test/integration/webhooks.test.ts @@ -5,7 +5,6 @@ import { mock } from 'jest-mock-extended'; import { AbstractServer } from '@/AbstractServer'; import { ActiveWebhooks } from '@/webhooks/ActiveWebhooks'; import { ExternalHooks } from '@/ExternalHooks'; -import { InternalHooks } from '@/InternalHooks'; import { TestWebhooks } from '@/webhooks/TestWebhooks'; import { WaitingWebhooks } from '@/webhooks/WaitingWebhooks'; import { WaitingForms } from '@/WaitingForms'; @@ -19,7 +18,6 @@ let agent: SuperAgentTest; describe('WebhookServer', () => { mockInstance(ExternalHooks); - mockInstance(InternalHooks); describe('CORS', () => { const corsOrigin = 'https://example.com';