From b2d8a1cb100f4d65e3d062b61abb1d80d601cc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 12 May 2025 17:30:59 +0200 Subject: [PATCH] refactor(core): Move webhook repository to `@n8n/db` (#15318) --- packages/@n8n/db/src/repositories/index.ts | 1 + .../db/src}/repositories/webhook.repository.ts | 3 ++- packages/cli/src/webhooks/__tests__/webhook.service.test.ts | 2 +- packages/cli/src/webhooks/webhook.service.ts | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) rename packages/{cli/src/databases => @n8n/db/src}/repositories/webhook.repository.ts (84%) diff --git a/packages/@n8n/db/src/repositories/index.ts b/packages/@n8n/db/src/repositories/index.ts index 4e7b4aa1c6..1be5191651 100644 --- a/packages/@n8n/db/src/repositories/index.ts +++ b/packages/@n8n/db/src/repositories/index.ts @@ -31,3 +31,4 @@ export { WorkflowStatisticsRepository } from './workflow-statistics.repository'; export { WorkflowTagMappingRepository } from './workflow-tag-mapping.repository'; export { SharedWorkflowRepository } from './shared-workflow.repository'; export { SharedCredentialsRepository } from './shared-credentials.repository'; +export { WebhookRepository } from './webhook.repository'; diff --git a/packages/cli/src/databases/repositories/webhook.repository.ts b/packages/@n8n/db/src/repositories/webhook.repository.ts similarity index 84% rename from packages/cli/src/databases/repositories/webhook.repository.ts rename to packages/@n8n/db/src/repositories/webhook.repository.ts index 3bde2469a9..91372a28b2 100644 --- a/packages/cli/src/databases/repositories/webhook.repository.ts +++ b/packages/@n8n/db/src/repositories/webhook.repository.ts @@ -1,7 +1,8 @@ -import { WebhookEntity } from '@n8n/db'; import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; +import { WebhookEntity } from '../entities'; + @Service() export class WebhookRepository extends Repository { constructor(dataSource: DataSource) { diff --git a/packages/cli/src/webhooks/__tests__/webhook.service.test.ts b/packages/cli/src/webhooks/__tests__/webhook.service.test.ts index ff623cc6df..90518ee510 100644 --- a/packages/cli/src/webhooks/__tests__/webhook.service.test.ts +++ b/packages/cli/src/webhooks/__tests__/webhook.service.test.ts @@ -1,11 +1,11 @@ import { WebhookEntity } from '@n8n/db'; +import type { WebhookRepository } from '@n8n/db'; import { mock } from 'jest-mock-extended'; import type { INode, INodeType, IWebhookData, IWorkflowExecuteAdditionalData } from 'n8n-workflow'; import { Workflow } from 'n8n-workflow'; import { v4 as uuid } from 'uuid'; import config from '@/config'; -import type { WebhookRepository } from '@/databases/repositories/webhook.repository'; import type { NodeTypes } from '@/node-types'; import type { CacheService } from '@/services/cache/cache.service'; import { WebhookService } from '@/webhooks/webhook.service'; diff --git a/packages/cli/src/webhooks/webhook.service.ts b/packages/cli/src/webhooks/webhook.service.ts index d306d897bc..79d0db910d 100644 --- a/packages/cli/src/webhooks/webhook.service.ts +++ b/packages/cli/src/webhooks/webhook.service.ts @@ -1,4 +1,5 @@ import type { WebhookEntity } from '@n8n/db'; +import { WebhookRepository } from '@n8n/db'; import { Service } from '@n8n/di'; import { HookContext, WebhookContext, Logger } from 'n8n-core'; import { Node, NodeHelpers, UnexpectedError } from 'n8n-workflow'; @@ -15,7 +16,6 @@ import type { WorkflowExecuteMode, } from 'n8n-workflow'; -import { WebhookRepository } from '@/databases/repositories/webhook.repository'; import { NodeTypes } from '@/node-types'; import { CacheService } from '@/services/cache/cache.service';