From 87ca4e8bf752a0f46c9ebda4bb4edff6b8aa7452 Mon Sep 17 00:00:00 2001 From: Charlie Kolb Date: Fri, 2 Oct 2026 11:46:11 +0000 Subject: [PATCH] refactor(core): Move billable execution helper to backend services (no-changelog) (#40146) --- .../src/executions}/__tests__/is-billable-execution.test.ts | 0 .../backend-services/src/executions}/is-billable-execution.ts | 0 packages/@n8n/backend-services/src/index.ts | 1 + .../cli/src/modules/insights/insights-collection.service.ts | 2 +- packages/cli/src/services/workflow-statistics.service.ts | 3 +-- 5 files changed, 3 insertions(+), 3 deletions(-) rename packages/{cli/src/utils => @n8n/backend-services/src/executions}/__tests__/is-billable-execution.test.ts (100%) rename packages/{cli/src/utils => @n8n/backend-services/src/executions}/is-billable-execution.ts (100%) diff --git a/packages/cli/src/utils/__tests__/is-billable-execution.test.ts b/packages/@n8n/backend-services/src/executions/__tests__/is-billable-execution.test.ts similarity index 100% rename from packages/cli/src/utils/__tests__/is-billable-execution.test.ts rename to packages/@n8n/backend-services/src/executions/__tests__/is-billable-execution.test.ts diff --git a/packages/cli/src/utils/is-billable-execution.ts b/packages/@n8n/backend-services/src/executions/is-billable-execution.ts similarity index 100% rename from packages/cli/src/utils/is-billable-execution.ts rename to packages/@n8n/backend-services/src/executions/is-billable-execution.ts diff --git a/packages/@n8n/backend-services/src/index.ts b/packages/@n8n/backend-services/src/index.ts index 64b59e55385..f60a2877e2d 100644 --- a/packages/@n8n/backend-services/src/index.ts +++ b/packages/@n8n/backend-services/src/index.ts @@ -1,4 +1,5 @@ export { EventService, type EventMap } from './events/event.service'; +export { isBillableExecution } from './executions/is-billable-execution'; export { CredentialsFinderService, CREDENTIAL_USABILITY_SCOPES, diff --git a/packages/cli/src/modules/insights/insights-collection.service.ts b/packages/cli/src/modules/insights/insights-collection.service.ts index 7e0d9fc6f79..6a8428fd904 100644 --- a/packages/cli/src/modules/insights/insights-collection.service.ts +++ b/packages/cli/src/modules/insights/insights-collection.service.ts @@ -1,4 +1,5 @@ import { Logger } from '@n8n/backend-common'; +import { isBillableExecution } from '@n8n/backend-services'; import { SharedWorkflowRepository } from '@n8n/db'; import { OnLifecycleEvent, type WorkflowExecuteAfterContext } from '@n8n/decorators'; import { Service } from '@n8n/di'; @@ -8,7 +9,6 @@ import { IRun, type ExecutionStatus, type WorkflowExecuteMode } from 'n8n-workfl import { InsightsMetadata } from '@/modules/insights/database/entities/insights-metadata'; import { InsightsRaw } from '@/modules/insights/database/entities/insights-raw'; -import { isBillableExecution } from '@/utils/is-billable-execution'; import { InsightsMetadataRepository } from './database/repositories/insights-metadata.repository'; import { InsightsRawRepository } from './database/repositories/insights-raw.repository'; diff --git a/packages/cli/src/services/workflow-statistics.service.ts b/packages/cli/src/services/workflow-statistics.service.ts index 9d156bf4196..9665e0581bf 100644 --- a/packages/cli/src/services/workflow-statistics.service.ts +++ b/packages/cli/src/services/workflow-statistics.service.ts @@ -1,5 +1,5 @@ import { Logger, TypedEmitter } from '@n8n/backend-common'; -import { EventService } from '@n8n/backend-services'; +import { EventService, isBillableExecution } from '@n8n/backend-services'; import { DatabaseConfig } from '@n8n/config'; import type { CrashedExecution } from '@n8n/db'; import { @@ -21,7 +21,6 @@ import { } from 'n8n-workflow'; import { UserService } from '@/services/user.service'; -import { isBillableExecution } from '@/utils/is-billable-execution'; import { INSTANCE_ACTIVATED_SETTINGS_KEY } from './instance-activation.service'; import { OwnershipService } from './ownership.service';