From 39d5e0ff873c4c65a3e52a9a0c93584133ded10f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Mon, 6 Jan 2025 10:21:24 +0100 Subject: [PATCH] refactor(core): Replace typedi with our custom DI system (no-changelog) (#12389) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Iván Ovejero --- package.json | 1 - packages/@n8n/config/package.json | 4 +- packages/@n8n/config/src/decorators.ts | 4 +- packages/@n8n/config/test/config.test.ts | 2 +- packages/@n8n/config/test/decorators.test.ts | 2 +- packages/@n8n/config/tsconfig.json | 3 +- packages/@n8n/di/.eslintrc.js | 7 + packages/@n8n/di/README.md | 52 ++++ packages/@n8n/di/jest.config.js | 2 + packages/@n8n/di/package.json | 26 ++ packages/@n8n/di/src/__tests__/di.test.ts | 287 ++++++++++++++++++ packages/@n8n/di/src/di.ts | 142 +++++++++ packages/@n8n/di/tsconfig.build.json | 11 + packages/@n8n/di/tsconfig.json | 12 + packages/@n8n/task-runner/package.json | 2 +- packages/@n8n/task-runner/src/start.ts | 2 +- packages/cli/package.json | 4 +- .../workflow-execute-additional-data.test.ts | 2 +- .../cli/src/__tests__/workflow-runner.test.ts | 2 +- packages/cli/src/abstract-server.ts | 2 +- packages/cli/src/activation-errors.service.ts | 2 +- packages/cli/src/active-executions.ts | 2 +- packages/cli/src/active-workflow-manager.ts | 2 +- packages/cli/src/auth/auth.service.ts | 2 +- packages/cli/src/auth/jwt.ts | 2 +- packages/cli/src/auth/methods/email.ts | 2 +- packages/cli/src/auth/methods/ldap.ts | 2 +- .../collaboration/collaboration.service.ts | 2 +- .../src/collaboration/collaboration.state.ts | 2 +- packages/cli/src/commands/audit.ts | 2 +- packages/cli/src/commands/base-command.ts | 2 +- packages/cli/src/commands/db/revert.ts | 2 +- packages/cli/src/commands/execute-batch.ts | 2 +- packages/cli/src/commands/execute.ts | 2 +- .../cli/src/commands/export/credentials.ts | 2 +- packages/cli/src/commands/export/workflow.ts | 2 +- .../cli/src/commands/import/credentials.ts | 2 +- packages/cli/src/commands/import/workflow.ts | 2 +- packages/cli/src/commands/ldap/reset.ts | 2 +- packages/cli/src/commands/license/clear.ts | 2 +- packages/cli/src/commands/license/info.ts | 2 +- packages/cli/src/commands/list/workflow.ts | 2 +- packages/cli/src/commands/mfa/disable.ts | 2 +- packages/cli/src/commands/start.ts | 2 +- packages/cli/src/commands/update/workflow.ts | 2 +- .../cli/src/commands/user-management/reset.ts | 2 +- packages/cli/src/commands/webhook.ts | 2 +- packages/cli/src/commands/worker.ts | 2 +- .../concurrency-control.service.ts | 2 +- .../cli/src/concurrency/concurrency-queue.ts | 2 +- packages/cli/src/config/index.ts | 2 +- packages/cli/src/config/schema.ts | 2 +- .../__tests__/api-keys.controller.test.ts | 2 +- .../__tests__/me.controller.test.ts | 2 +- .../cli/src/controllers/e2e.controller.ts | 2 +- .../oauth1-credential.controller.test.ts | 2 +- .../oauth2-credential.controller.test.ts | 2 +- .../oauth/abstract-oauth.controller.ts | 2 +- packages/cli/src/crash-journal.ts | 2 +- packages/cli/src/credential-types.ts | 2 +- packages/cli/src/credentials-helper.ts | 2 +- packages/cli/src/credentials-overwrites.ts | 2 +- .../src/credentials/credentials.service.ee.ts | 2 +- .../src/credentials/credentials.service.ts | 2 +- packages/cli/src/databases/config.ts | 2 +- .../src/databases/entities/abstract-entity.ts | 2 +- .../1711390882123-MoveSshKeysToDatabase.ts | 2 +- ...690000000002-MigrateIntegerKeysToString.ts | 2 +- .../__tests__/credentials.repository.test.ts | 2 +- .../__tests__/execution.repository.test.ts | 2 +- .../shared-credentials.repository.test.ts | 2 +- .../__tests__/workflow-statistics.test.ts | 2 +- .../annotation-tag-mapping.repository.ee.ts | 2 +- .../annotation-tag.repository.ee.ts | 2 +- .../repositories/api-key.repository.ts | 2 +- .../repositories/auth-identity.repository.ts | 2 +- .../auth-provider-sync-history.repository.ts | 2 +- .../repositories/auth-user.repository.ts | 2 +- .../repositories/credentials.repository.ts | 2 +- .../event-destinations.repository.ts | 2 +- .../execution-annotation.repository.ts | 2 +- .../repositories/execution-data.repository.ts | 2 +- .../execution-metadata.repository.ts | 2 +- .../repositories/execution.repository.ts | 2 +- .../installed-nodes.repository.ts | 2 +- .../installed-packages.repository.ts | 2 +- .../invalid-auth-token.repository.ts | 2 +- .../license-metrics.repository.ts | 2 +- .../repositories/processed-data.repository.ts | 2 +- .../project-relation.repository.ts | 2 +- .../repositories/project.repository.ts | 2 +- .../repositories/settings.repository.ts | 2 +- .../shared-credentials.repository.ts | 2 +- .../shared-workflow.repository.ts | 2 +- .../databases/repositories/tag.repository.ts | 2 +- .../test-definition.repository.ee.ts | 2 +- .../repositories/test-metric.repository.ee.ts | 2 +- .../repositories/test-run.repository.ee.ts | 2 +- .../databases/repositories/user.repository.ts | 2 +- .../repositories/variables.repository.ts | 2 +- .../repositories/webhook.repository.ts | 2 +- .../workflow-history.repository.ts | 2 +- .../workflow-statistics.repository.ts | 2 +- .../workflow-tag-mapping.repository.ts | 2 +- .../repositories/workflow.repository.ts | 2 +- .../databases/subscribers/user-subscriber.ts | 2 +- .../src/databases/utils/migration-helpers.ts | 2 +- .../cli/src/databases/utils/transformers.ts | 2 +- packages/cli/src/db.ts | 2 +- .../decorators/__tests__/on-shutdown.test.ts | 2 +- .../cli/src/decorators/controller.registry.ts | 4 +- packages/cli/src/decorators/on-shutdown.ts | 2 +- .../cli/src/decorators/rest-controller.ts | 2 +- packages/cli/src/decorators/types.ts | 4 +- .../src/deduplication/deduplication-helper.ts | 2 +- .../src/deprecation/deprecation.service.ts | 2 +- .../source-control-export.service.test.ts | 2 +- .../source-control-helper.ee.test.ts | 2 +- .../__tests__/source-control.service.test.ts | 2 +- .../source-control-enabled-middleware.ee.ts | 2 +- .../source-control-export.service.ee.ts | 2 +- .../source-control-git.service.ee.ts | 2 +- .../source-control-helper.ee.ts | 2 +- .../source-control-import.service.ee.ts | 2 +- .../source-control-preferences.service.ee.ts | 2 +- .../source-control.service.ee.ts | 2 +- .../variables/environment-helpers.ts | 2 +- .../variables/variables.service.ee.ts | 2 +- .../test-definition.service.ee.ts | 2 +- .../test-runner/test-runner.service.ee.ts | 2 +- .../message-event-bus-destination-from-db.ts | 2 +- ...message-event-bus-destination-syslog.ee.ts | 2 +- ...essage-event-bus-destination-webhook.ee.ts | 2 +- .../message-event-bus-destination.ee.ts | 2 +- .../message-event-bus-log-writer.ts | 2 +- .../message-event-bus/message-event-bus.ts | 2 +- packages/cli/src/events/event.service.ts | 2 +- packages/cli/src/events/relays/event-relay.ts | 2 +- .../relays/log-streaming.event-relay.ts | 2 +- .../events/relays/telemetry.event-relay.ts | 2 +- .../restore-binary-data-id.ts | 2 +- .../save-execution-progress.ts | 2 +- .../shared/shared-hook-functions.ts | 2 +- .../execution-recovery.service.test.ts | 2 +- .../executions/execution-recovery.service.ts | 2 +- .../src/executions/execution.service.ee.ts | 2 +- .../cli/src/executions/execution.service.ts | 2 +- packages/cli/src/expression-evaluator.ts | 2 +- packages/cli/src/external-hooks.ts | 2 +- .../external-secrets-manager.ee.test.ts | 2 +- .../external-secrets-helper.ee.ts | 2 +- .../external-secrets-manager.ee.ts | 2 +- .../external-secrets-providers.ee.ts | 2 +- .../external-secrets.service.ee.ts | 2 +- .../aws-secrets/aws-secrets-manager.ts | 2 +- .../azure-key-vault/azure-key-vault.ts | 2 +- .../gcp-secrets-manager.ts | 2 +- .../external-secrets.ee/providers/vault.ts | 2 +- packages/cli/src/help.ts | 2 +- packages/cli/src/ldap.ee/helpers.ee.ts | 2 +- packages/cli/src/ldap.ee/ldap.service.ee.ts | 2 +- packages/cli/src/license.ts | 2 +- packages/cli/src/license/license.service.ts | 2 +- .../cli/src/load-nodes-and-credentials.ts | 2 +- packages/cli/src/manual-execution.service.ts | 2 +- .../src/metrics/license-metrics.service.ts | 2 +- .../src/metrics/prometheus-metrics.service.ts | 2 +- packages/cli/src/mfa/helpers.ts | 2 +- packages/cli/src/mfa/mfa.service.ts | 2 +- packages/cli/src/mfa/totp.service.ts | 2 +- packages/cli/src/middlewares/body-parser.ts | 2 +- packages/cli/src/node-types.ts | 2 +- .../cli/src/permissions.ee/check-access.ts | 2 +- packages/cli/src/posthog/index.ts | 2 +- packages/cli/src/public-api/index.ts | 2 +- .../v1/handlers/audit/audit.handler.ts | 2 +- .../credentials/credentials.handler.ts | 2 +- .../credentials/credentials.middleware.ts | 2 +- .../credentials/credentials.service.ts | 2 +- .../handlers/executions/executions.handler.ts | 2 +- .../v1/handlers/projects/projects.handler.ts | 2 +- .../source-control/source-control.handler.ts | 2 +- .../v1/handlers/tags/tags.handler.ts | 2 +- .../v1/handlers/users/users.handler.ee.ts | 2 +- .../v1/handlers/users/users.service.ee.ts | 2 +- .../handlers/variables/variables.handler.ts | 2 +- .../handlers/workflows/workflows.handler.ts | 2 +- .../handlers/workflows/workflows.service.ts | 2 +- .../shared/middlewares/global.middleware.ts | 2 +- .../src/push/__tests__/websocket.push.test.ts | 2 +- packages/cli/src/push/abstract.push.ts | 2 +- packages/cli/src/push/index.ts | 2 +- packages/cli/src/push/sse.push.ts | 2 +- packages/cli/src/push/websocket.push.ts | 2 +- packages/cli/src/response-helper.ts | 2 +- .../scaling/__tests__/scaling.service.test.ts | 2 +- packages/cli/src/scaling/job-processor.ts | 2 +- .../cli/src/scaling/multi-main-setup.ee.ts | 2 +- .../src/scaling/pubsub/publisher.service.ts | 2 +- .../cli/src/scaling/pubsub/pubsub-handler.ts | 2 +- .../src/scaling/pubsub/subscriber.service.ts | 2 +- packages/cli/src/scaling/scaling.service.ts | 2 +- packages/cli/src/scaling/worker-server.ts | 2 +- .../src/scaling/worker-status.service.ee.ts | 2 +- packages/cli/src/secrets-helpers.ee.ts | 2 +- .../credentials-risk-reporter.ts | 2 +- .../risk-reporters/database-risk-reporter.ts | 2 +- .../filesystem-risk-reporter.ts | 2 +- .../risk-reporters/instance-risk-reporter.ts | 2 +- .../risk-reporters/nodes-risk-reporter.ts | 2 +- .../security-audit/security-audit.service.ts | 2 +- packages/cli/src/server.ts | 2 +- .../execution-metadata.service.test.ts | 2 +- .../__tests__/orchestration.service.test.ts | 2 +- .../__tests__/password.utility.test.ts | 2 +- .../workflow-statistics.service.test.ts | 2 +- packages/cli/src/services/access.service.ts | 2 +- .../src/services/active-workflows.service.ts | 2 +- packages/cli/src/services/ai.service.ts | 2 +- .../src/services/annotation-tag.service.ee.ts | 2 +- .../__tests__/cache-mock.service.test.ts | 2 +- .../cache/__tests__/cache.service.test.ts | 2 +- .../cli/src/services/cache/cache.service.ts | 2 +- .../services/community-packages.service.ts | 2 +- .../services/credentials-tester.service.ts | 2 +- packages/cli/src/services/cta.service.ts | 2 +- packages/cli/src/services/curl.service.ts | 2 +- .../dynamic-node-parameters.service.ts | 2 +- .../services/execution-metadata.service.ts | 2 +- packages/cli/src/services/frontend.service.ts | 2 +- packages/cli/src/services/hooks.service.ts | 2 +- packages/cli/src/services/import.service.ts | 2 +- packages/cli/src/services/jwt.service.ts | 2 +- packages/cli/src/services/naming.service.ts | 2 +- .../cli/src/services/orchestration.service.ts | 2 +- .../cli/src/services/ownership.service.ts | 2 +- packages/cli/src/services/password.utility.ts | 2 +- .../cli/src/services/project.service.ee.ts | 2 +- .../src/services/pruning/pruning.service.ts | 2 +- .../src/services/public-api-key.service.ts | 2 +- .../cli/src/services/redis-client.service.ts | 2 +- packages/cli/src/services/role.service.ts | 2 +- packages/cli/src/services/tag.service.ts | 2 +- packages/cli/src/services/url.service.ts | 2 +- packages/cli/src/services/user.service.ts | 2 +- .../src/services/workflow-loader.service.ts | 2 +- .../services/workflow-statistics.service.ts | 2 +- .../__tests__/shutdown.service.test.ts | 2 +- packages/cli/src/shutdown/shutdown.service.ts | 2 +- packages/cli/src/sso.ee/saml/saml-helpers.ts | 2 +- .../cli/src/sso.ee/saml/saml-validator.ts | 2 +- .../cli/src/sso.ee/saml/saml.service.ee.ts | 2 +- .../src/sso.ee/saml/service-provider.ee.ts | 2 +- packages/cli/src/sso.ee/sso-helpers.ts | 2 +- .../subworkflow-policy-checker.service.ts | 2 +- .../auth/task-runner-auth.controller.ts | 2 +- .../auth/task-runner-auth.service.ts | 2 +- ...default-task-runner-disconnect-analyzer.ts | 2 +- ...nternal-task-runner-disconnect-analyzer.ts | 2 +- .../src/task-runners/task-broker.service.ts | 2 +- .../task-managers/local-task-requester.ts | 2 +- .../task-managers/task-requester.ts | 2 +- .../task-runner-lifecycle-events.ts | 2 +- .../src/task-runners/task-runner-module.ts | 2 +- .../src/task-runners/task-runner-process.ts | 2 +- .../src/task-runners/task-runner-server.ts | 2 +- .../src/task-runners/task-runner-ws-server.ts | 2 +- packages/cli/src/telemetry/index.ts | 2 +- .../src/user-management/email/node-mailer.ts | 2 +- .../email/user-management-mailer.ts | 2 +- .../src/user-management/permission-checker.ts | 2 +- packages/cli/src/wait-tracker.ts | 2 +- packages/cli/src/webhooks/live-webhooks.ts | 2 +- .../test-webhook-registrations.service.ts | 2 +- packages/cli/src/webhooks/test-webhooks.ts | 2 +- packages/cli/src/webhooks/waiting-forms.ts | 2 +- packages/cli/src/webhooks/waiting-webhooks.ts | 2 +- packages/cli/src/webhooks/webhook-helpers.ts | 2 +- packages/cli/src/webhooks/webhook-server.ts | 2 +- packages/cli/src/webhooks/webhook.service.ts | 2 +- .../src/workflow-execute-additional-data.ts | 2 +- packages/cli/src/workflow-helpers.ts | 2 +- packages/cli/src/workflow-runner.ts | 2 +- .../workflows/workflow-execution.service.ts | 2 +- .../workflow-history-helper.ee.ts | 2 +- .../workflow-history-manager.ee.ts | 2 +- .../workflow-history.service.ee.ts | 2 +- .../src/workflows/workflow-sharing.service.ts | 2 +- .../workflows/workflow-static-data.service.ts | 2 +- .../cli/src/workflows/workflow.service.ee.ts | 2 +- .../cli/src/workflows/workflow.service.ts | 2 +- .../active-workflow-manager.test.ts | 2 +- .../cli/test/integration/ai/ai.api.test.ts | 2 +- .../cli/test/integration/api-keys.api.test.ts | 2 +- .../cli/test/integration/auth.api.test.ts | 2 +- .../collaboration.service.test.ts | 2 +- .../integration/commands/ldap/reset.test.ts | 2 +- .../integration/commands/license.cmd.test.ts | 2 +- .../integration/commands/reset.cmd.test.ts | 2 +- .../integration/commands/worker.cmd.test.ts | 2 +- .../invitation.controller.integration.test.ts | 2 +- .../controllers/oauth/oauth2.api.test.ts | 2 +- .../integration/credentials-helper.test.ts | 2 +- .../credentials/credentials.api.ee.test.ts | 2 +- .../credentials/credentials.api.test.ts | 2 +- .../credentials/credentials.service.test.ts | 2 +- .../cli/test/integration/cta.service.test.ts | 2 +- .../repositories/execution.repository.test.ts | 2 +- .../repositories/project.repository.test.ts | 2 +- .../repositories/workflow.repository.test.ts | 2 +- .../test/integration/debug.controller.test.ts | 2 +- .../source-control-import.service.test.ts | 2 +- .../environments/source-control.test.ts | 2 +- .../evaluation/metrics.api.test.ts | 2 +- .../evaluation/test-definitions.api.test.ts | 2 +- .../evaluation/test-runs.api.test.ts | 2 +- .../cli/test/integration/eventbus.ee.test.ts | 2 +- .../execution.service.integration.test.ts | 2 +- .../external-secrets.api.test.ts | 2 +- .../test/integration/import.service.test.ts | 2 +- .../test/integration/ldap/ldap.api.test.ts | 2 +- .../license-metrics.repository.test.ts | 2 +- packages/cli/test/integration/me.api.test.ts | 2 +- .../cli/test/integration/mfa/mfa.api.test.ts | 2 +- .../cli/test/integration/owner.api.test.ts | 2 +- .../integration/password-reset.api.test.ts | 2 +- .../integration/permission-checker.test.ts | 2 +- .../cli/test/integration/project.api.test.ts | 2 +- .../project.service.integration.test.ts | 2 +- .../integration/prometheus-metrics.test.ts | 2 +- .../test/integration/pruning.service.test.ts | 2 +- .../public-api/credentials.test.ts | 2 +- .../test/integration/public-api/tags.test.ts | 2 +- .../integration/public-api/workflows.test.ts | 2 +- .../cli/test/integration/role.api.test.ts | 2 +- .../task-runner-module.external.test.ts | 2 +- .../task-runner-module.internal.test.ts | 2 +- .../runners/task-runner-process.test.ts | 2 +- .../credentials-risk-reporter.test.ts | 2 +- .../database-risk-reporter.test.ts | 2 +- .../filesystem-risk-reporter.test.ts | 2 +- .../instance-risk-reporter.test.ts | 2 +- .../nodes-risk-reporter.test.ts | 2 +- .../test/integration/security-audit/utils.ts | 2 +- .../execution-metadata.service.test.ts | 2 +- .../services/project.service.test.ts | 2 +- .../workflow-static-data.service.test.ts | 2 +- .../cli/test/integration/shared/constants.ts | 2 +- .../test/integration/shared/db/credentials.ts | 2 +- .../test/integration/shared/db/executions.ts | 2 +- .../test/integration/shared/db/projects.ts | 2 +- .../cli/test/integration/shared/db/tags.ts | 2 +- .../cli/test/integration/shared/db/users.ts | 2 +- .../test/integration/shared/db/variables.ts | 2 +- .../integration/shared/db/workflow-history.ts | 2 +- .../shared/db/workflow-statistics.ts | 2 +- .../test/integration/shared/db/workflows.ts | 2 +- packages/cli/test/integration/shared/ldap.ts | 2 +- .../cli/test/integration/shared/test-db.ts | 2 +- .../shared/utils/community-nodes.ts | 2 +- .../test/integration/shared/utils/index.ts | 2 +- .../shared/utils/task-broker-test-server.ts | 2 +- .../integration/shared/utils/test-server.ts | 2 +- .../cli/test/integration/tags.api.test.ts | 2 +- .../test/integration/user.repository.test.ts | 2 +- .../cli/test/integration/users.api.test.ts | 2 +- .../cli/test/integration/variables.test.ts | 2 +- .../cli/test/integration/webhooks.test.ts | 2 +- .../workflow-history-manager.test.ts | 2 +- ...tag-mapping.repository.integration.test.ts | 2 +- .../workflow-sharing.service.test.ts | 2 +- .../workflows/workflow.service.ee.test.ts | 2 +- .../workflows/workflow.service.test.ts | 2 +- .../workflows/workflows.controller.ee.test.ts | 2 +- .../workflows/workflows.controller.test.ts | 2 +- packages/cli/test/shared/mocking.ts | 2 +- packages/cli/test/teardown.ts | 2 +- packages/cli/tsconfig.json | 1 + packages/core/package.json | 2 +- packages/core/src/ActiveWorkflows.ts | 2 +- .../core/src/BinaryData/BinaryData.service.ts | 2 +- .../src/BinaryData/ObjectStore.manager.ts | 2 +- packages/core/src/Cipher.ts | 2 +- packages/core/src/Credentials.ts | 2 +- packages/core/src/DirectoryLoader.ts | 2 +- packages/core/src/InstanceSettings.ts | 2 +- packages/core/src/NodeExecuteFunctions.ts | 2 +- .../src/ObjectStore/ObjectStore.service.ee.ts | 2 +- packages/core/src/SSHClientsManager.ts | 2 +- packages/core/src/ScheduledTaskManager.ts | 2 +- packages/core/src/TriggersAndPollers.ts | 2 +- packages/core/src/WorkflowExecute.ts | 2 +- packages/core/src/error-reporter.ts | 2 +- packages/core/src/logging/logger.ts | 2 +- .../__tests__/node-execution-context.test.ts | 2 +- .../__tests__/shared-tests.ts | 2 +- .../base-execute-context.ts | 2 +- .../node-execution-context.ts | 2 +- packages/core/test/Cipher.test.ts | 2 +- packages/core/test/Credentials.test.ts | 2 +- .../core/test/NodeExecuteFunctions.test.ts | 2 +- packages/core/test/utils.ts | 4 +- packages/core/tsconfig.json | 1 + packages/node-dev/commands/build.ts | 2 +- packages/node-dev/package.json | 4 +- packages/node-dev/src/Build.ts | 2 +- packages/nodes-base/nodes/Code/Code.node.ts | 2 +- packages/nodes-base/package.json | 2 +- packages/nodes-base/test/nodes/Helpers.ts | 2 +- patches/typedi@0.10.0.patch | 14 - pnpm-lock.yaml | 60 ++-- pnpm-workspace.yaml | 2 +- turbo.json | 2 + 413 files changed, 979 insertions(+), 452 deletions(-) create mode 100644 packages/@n8n/di/.eslintrc.js create mode 100644 packages/@n8n/di/README.md create mode 100644 packages/@n8n/di/jest.config.js create mode 100644 packages/@n8n/di/package.json create mode 100644 packages/@n8n/di/src/__tests__/di.test.ts create mode 100644 packages/@n8n/di/src/di.ts create mode 100644 packages/@n8n/di/tsconfig.build.json create mode 100644 packages/@n8n/di/tsconfig.json delete mode 100644 patches/typedi@0.10.0.patch diff --git a/package.json b/package.json index 063accd855..90e48e9bd8 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,6 @@ "ws": ">=8.17.1" }, "patchedDependencies": { - "typedi@0.10.0": "patches/typedi@0.10.0.patch", "pkce-challenge@3.0.0": "patches/pkce-challenge@3.0.0.patch", "pyodide@0.23.4": "patches/pyodide@0.23.4.patch", "@types/express-serve-static-core@4.17.43": "patches/@types__express-serve-static-core@4.17.43.patch", diff --git a/packages/@n8n/config/package.json b/packages/@n8n/config/package.json index c4368a75c5..c601e82d77 100644 --- a/packages/@n8n/config/package.json +++ b/packages/@n8n/config/package.json @@ -21,7 +21,7 @@ "dist/**/*" ], "dependencies": { - "reflect-metadata": "0.2.2", - "typedi": "catalog:" + "@n8n/di": "workspace:*", + "reflect-metadata": "catalog:" } } diff --git a/packages/@n8n/config/src/decorators.ts b/packages/@n8n/config/src/decorators.ts index cafdf3fcd4..57eb1500e2 100644 --- a/packages/@n8n/config/src/decorators.ts +++ b/packages/@n8n/config/src/decorators.ts @@ -1,6 +1,6 @@ import 'reflect-metadata'; +import { Container, Service } from '@n8n/di'; import { readFileSync } from 'fs'; -import { Container, Service } from 'typedi'; // eslint-disable-next-line @typescript-eslint/ban-types type Class = Function; @@ -35,7 +35,7 @@ export const Config: ClassDecorator = (ConfigClass: Class) => { for (const [key, { type, envName }] of classMetadata) { if (typeof type === 'function' && globalMetadata.has(type)) { - config[key] = Container.get(type); + config[key] = Container.get(type as Constructable); } else if (envName) { const value = readEnv(envName); if (value === undefined) continue; diff --git a/packages/@n8n/config/test/config.test.ts b/packages/@n8n/config/test/config.test.ts index d6d19c47fe..9fd0a35d5a 100644 --- a/packages/@n8n/config/test/config.test.ts +++ b/packages/@n8n/config/test/config.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import fs from 'fs'; import { mock } from 'jest-mock-extended'; -import { Container } from 'typedi'; import { GlobalConfig } from '../src/index'; diff --git a/packages/@n8n/config/test/decorators.test.ts b/packages/@n8n/config/test/decorators.test.ts index c5c90b70a0..a346b442e0 100644 --- a/packages/@n8n/config/test/decorators.test.ts +++ b/packages/@n8n/config/test/decorators.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { Config, Env } from '../src/decorators'; diff --git a/packages/@n8n/config/tsconfig.json b/packages/@n8n/config/tsconfig.json index 15e134d6b4..f26ea23c24 100644 --- a/packages/@n8n/config/tsconfig.json +++ b/packages/@n8n/config/tsconfig.json @@ -9,5 +9,6 @@ "baseUrl": "src", "tsBuildInfoFile": "dist/typecheck.tsbuildinfo" }, - "include": ["src/**/*.ts", "test/**/*.ts"] + "include": ["src/**/*.ts", "test/**/*.ts"], + "references": [{ "path": "../di/tsconfig.build.json" }] } diff --git a/packages/@n8n/di/.eslintrc.js b/packages/@n8n/di/.eslintrc.js new file mode 100644 index 0000000000..1c42fddcdc --- /dev/null +++ b/packages/@n8n/di/.eslintrc.js @@ -0,0 +1,7 @@ +const sharedOptions = require('@n8n_io/eslint-config/shared'); + +/** @type {import('@types/eslint').ESLint.ConfigData} */ +module.exports = { + extends: ['@n8n_io/eslint-config/base'], + ...sharedOptions(__dirname), +}; diff --git a/packages/@n8n/di/README.md b/packages/@n8n/di/README.md new file mode 100644 index 0000000000..0f6999f225 --- /dev/null +++ b/packages/@n8n/di/README.md @@ -0,0 +1,52 @@ +## @n8n/di + +`@n8n/di` is a dependency injection (DI) container library, based on [`typedi`](https://github.com/typestack/typedi). + +n8n no longer uses `typedi` because: + +- `typedi` is no longer officially maintained +- Need for future-proofing, e.g. stage-3 decorators +- Small enough that it is worth the maintenance burden +- Easier to customize, e.g. to simplify unit tests + +### Usage + +```typescript +// from https://github.com/typestack/typedi/blob/develop/README.md +import { Container, Service } from 'typedi'; + +@Service() +class ExampleInjectedService { + printMessage() { + console.log('I am alive!'); + } +} + +@Service() +class ExampleService { + constructor( + // because we annotated ExampleInjectedService with the @Service() + // decorator TypeDI will automatically inject an instance of + // ExampleInjectedService here when the ExampleService class is requested + // from TypeDI. + public injectedService: ExampleInjectedService + ) {} +} + +const serviceInstance = Container.get(ExampleService); +// we request an instance of ExampleService from TypeDI + +serviceInstance.injectedService.printMessage(); +// logs "I am alive!" to the console +``` + +Requires enabling these flags in `tsconfig.json`: + +```json +{ + "compilerOptions": { + "experimentalDecorators": true, + "emitDecoratorMetadata": true + } +} +``` diff --git a/packages/@n8n/di/jest.config.js b/packages/@n8n/di/jest.config.js new file mode 100644 index 0000000000..d6c48554a7 --- /dev/null +++ b/packages/@n8n/di/jest.config.js @@ -0,0 +1,2 @@ +/** @type {import('jest').Config} */ +module.exports = require('../../../jest.config'); diff --git a/packages/@n8n/di/package.json b/packages/@n8n/di/package.json new file mode 100644 index 0000000000..07b702757f --- /dev/null +++ b/packages/@n8n/di/package.json @@ -0,0 +1,26 @@ +{ + "name": "@n8n/di", + "version": "0.1.0", + "scripts": { + "clean": "rimraf dist .turbo", + "dev": "pnpm watch", + "typecheck": "tsc --noEmit", + "build": "tsc -p tsconfig.build.json", + "format": "biome format --write .", + "format:check": "biome ci .", + "lint": "eslint .", + "lintfix": "eslint . --fix", + "watch": "tsc -p tsconfig.build.json --watch", + "test": "jest", + "test:dev": "jest --watch" + }, + "main": "dist/di.js", + "module": "src/di.ts", + "types": "dist/di.d.ts", + "files": [ + "dist/**/*" + ], + "dependencies": { + "reflect-metadata": "catalog:" + } +} diff --git a/packages/@n8n/di/src/__tests__/di.test.ts b/packages/@n8n/di/src/__tests__/di.test.ts new file mode 100644 index 0000000000..736ff06152 --- /dev/null +++ b/packages/@n8n/di/src/__tests__/di.test.ts @@ -0,0 +1,287 @@ +import { Container, Service } from '../di'; + +@Service() +class SimpleService { + getValue() { + return 'simple'; + } +} + +@Service() +class DependentService { + constructor(readonly simple: SimpleService) {} + + getValue() { + return this.simple.getValue() + '-dependent'; + } +} + +class CustomFactory { + getValue() { + return 'factory-made'; + } +} + +@Service({ factory: () => new CustomFactory() }) +class FactoryService { + getValue() { + return 'should-not-be-called'; + } +} + +abstract class AbstractService { + abstract getValue(): string; +} + +@Service() +class ConcreteService extends AbstractService { + getValue(): string { + return 'concrete'; + } +} + +describe('DI Container', () => { + beforeEach(() => { + jest.clearAllMocks(); + Container.reset(); + }); + + describe('basic functionality', () => { + it('should create a simple instance', () => { + const instance = Container.get(SimpleService); + expect(instance).toBeInstanceOf(SimpleService); + expect(instance.getValue()).toBe('simple'); + }); + + it('should return same instance on multiple gets', () => { + const instance1 = Container.get(SimpleService); + const instance2 = Container.get(SimpleService); + expect(instance1).toBe(instance2); + }); + + it('should handle classes with no dependencies (empty constructor)', () => { + @Service() + class EmptyConstructorService {} + + const instance = Container.get(EmptyConstructorService); + expect(instance).toBeInstanceOf(EmptyConstructorService); + }); + + it('should throw when trying to resolve an undecorated class', () => { + class UnDecoratedService {} + + expect(() => Container.get(UnDecoratedService)).toThrow(); + }); + }); + + describe('dependency injection', () => { + it('should inject dependencies correctly', () => { + const dependent = Container.get(DependentService); + expect(dependent).toBeInstanceOf(DependentService); + expect(dependent.getValue()).toBe('simple-dependent'); + expect(dependent.simple).toBeInstanceOf(SimpleService); + }); + + it('should handle deep dependency chains', () => { + @Service() + class ServiceC { + getValue() { + return 'C'; + } + } + + @Service() + class ServiceB { + constructor(private c: ServiceC) {} + + getValue() { + return this.c.getValue() + 'B'; + } + } + + @Service() + class ServiceA { + constructor(private b: ServiceB) {} + + getValue() { + return this.b.getValue() + 'A'; + } + } + + const instance = Container.get(ServiceA); + expect(instance.getValue()).toBe('CBA'); + }); + + it('should return undefined for non-decorated dependencies in resolution chain', () => { + class NonDecoratedDep {} + + @Service() + class ServiceWithNonDecoratedDep { + constructor(readonly dep: NonDecoratedDep) {} + } + + const instance = Container.get(ServiceWithNonDecoratedDep); + expect(instance).toBeInstanceOf(ServiceWithNonDecoratedDep); + expect(instance.dep).toBeUndefined(); + }); + }); + + describe('factory handling', () => { + it('should use factory when provided', () => { + const instance = Container.get(FactoryService); + expect(instance).toBeInstanceOf(CustomFactory); + expect(instance.getValue()).toBe('factory-made'); + }); + + it('should preserve factory metadata when setting instance', () => { + const customInstance = new CustomFactory(); + Container.set(FactoryService, customInstance); + const instance = Container.get(FactoryService); + expect(instance).toBe(customInstance); + }); + + it('should preserve factory when resetting container', () => { + const factoryInstance1 = Container.get(FactoryService); + Container.reset(); + const factoryInstance2 = Container.get(FactoryService); + + expect(factoryInstance1).not.toBe(factoryInstance2); + expect(factoryInstance2.getValue()).toBe('factory-made'); + }); + + it('should throw error when factory throws', () => { + @Service({ + factory: () => { + throw new Error('Factory error'); + }, + }) + class ErrorFactoryService {} + + expect(() => Container.get(ErrorFactoryService)).toThrow('Factory error'); + }); + }); + + describe('instance management', () => { + it('should allow manual instance setting', () => { + const customInstance = new SimpleService(); + Container.set(SimpleService, customInstance); + const instance = Container.get(SimpleService); + expect(instance).toBe(customInstance); + }); + }); + + describe('abstract classes', () => { + it('should throw when trying to instantiate an abstract class directly', () => { + @Service() + abstract class TestAbstractClass { + abstract doSomething(): void; + + // Add a concrete method to make the class truly abstract at runtime + constructor() { + if (this.constructor === TestAbstractClass) { + throw new TypeError('Abstract class "TestAbstractClass" cannot be instantiated'); + } + } + } + + expect(() => Container.get(TestAbstractClass)).toThrow( + '[DI] TestAbstractClass is an abstract class, and cannot be instantiated', + ); + }); + + it('should allow setting an implementation for an abstract class', () => { + const concrete = new ConcreteService(); + Container.set(AbstractService, concrete); + + const instance = Container.get(AbstractService); + expect(instance).toBe(concrete); + expect(instance.getValue()).toBe('concrete'); + }); + + it('should allow factory for abstract class', () => { + @Service({ factory: () => new ConcreteService() }) + abstract class FactoryAbstractService { + abstract getValue(): string; + } + + const instance = Container.get(FactoryAbstractService); + expect(instance).toBeInstanceOf(ConcreteService); + expect(instance.getValue()).toBe('concrete'); + }); + }); + + describe('inheritance', () => { + it('should handle inheritance in injectable classes', () => { + @Service() + class BaseService { + getValue() { + return 'base'; + } + } + + @Service() + class DerivedService extends BaseService { + getValue() { + return 'derived-' + super.getValue(); + } + } + + const instance = Container.get(DerivedService); + expect(instance.getValue()).toBe('derived-base'); + }); + + it('should maintain separate instances for base and derived classes', () => { + @Service() + class BaseService { + getValue() { + return 'base'; + } + } + + @Service() + class DerivedService extends BaseService {} + + const baseInstance = Container.get(BaseService); + const derivedInstance = Container.get(DerivedService); + + expect(baseInstance).not.toBe(derivedInstance); + expect(baseInstance).toBeInstanceOf(BaseService); + expect(derivedInstance).toBeInstanceOf(DerivedService); + }); + }); + + describe('type registration checking', () => { + it('should return true for registered classes', () => { + expect(Container.has(SimpleService)).toBe(true); + }); + + it('should return false for unregistered classes', () => { + class UnregisteredService {} + expect(Container.has(UnregisteredService)).toBe(false); + }); + + it('should return true for abstract classes with implementations', () => { + const concrete = new ConcreteService(); + Container.set(AbstractService, concrete); + expect(Container.has(AbstractService)).toBe(true); + }); + + it('should return true for factory-provided services before instantiation', () => { + expect(Container.has(FactoryService)).toBe(true); + }); + + it('should maintain registration after reset', () => { + expect(Container.has(SimpleService)).toBe(true); + Container.reset(); + expect(Container.has(SimpleService)).toBe(true); + }); + + it('should return true after manual instance setting', () => { + class ManualService {} + expect(Container.has(ManualService)).toBe(false); + + Container.set(ManualService, new ManualService()); + expect(Container.has(ManualService)).toBe(true); + }); + }); +}); diff --git a/packages/@n8n/di/src/di.ts b/packages/@n8n/di/src/di.ts new file mode 100644 index 0000000000..a4acb98474 --- /dev/null +++ b/packages/@n8n/di/src/di.ts @@ -0,0 +1,142 @@ +import 'reflect-metadata'; + +/** + * Represents a class constructor type that can be instantiated with 'new' + * @template T The type of instance the constructor creates + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type Constructable = new (...args: any[]) => T; + +type AbstractConstructable = abstract new (...args: unknown[]) => T; + +type ServiceIdentifier = Constructable | AbstractConstructable; + +interface Metadata { + instance?: T; + factory?: () => T; +} + +interface Options { + factory?: () => T; +} + +const instances = new Map(); + +/** + * Decorator that marks a class as available for dependency injection. + * @param options Configuration options for the injectable class + * @param options.factory Optional factory function to create instances of this class + * @returns A class decorator to be applied to the target class + */ +// eslint-disable-next-line @typescript-eslint/ban-types +export function Service(): Function; +// eslint-disable-next-line @typescript-eslint/ban-types +export function Service(options: Options): Function; +export function Service({ factory }: Options = {}) { + return function (target: Constructable) { + instances.set(target, { factory }); + return target; + }; +} + +class DIError extends Error { + constructor(message: string) { + super(`[DI] ${message}`); + } +} + +class ContainerClass { + /** Stack to track types being resolved to detect circular dependencies */ + private readonly resolutionStack: ServiceIdentifier[] = []; + + /** + * Checks if a type is registered in the container + * @template T The type to check for + * @param type The constructor of the type to check + * @returns True if the type is registered (has metadata), false otherwise + */ + has(type: ServiceIdentifier): boolean { + return instances.has(type); + } + + /** + * Retrieves or creates an instance of the specified type from the container + * @template T The type of instance to retrieve + * @param type The constructor of the type to retrieve + * @returns An instance of the specified type with all dependencies injected + * @throws {DIError} If circular dependencies are detected or if the type is not injectable + */ + get(type: ServiceIdentifier): T { + const { resolutionStack } = this; + const metadata = instances.get(type) as Metadata; + if (!metadata) { + // Special case: Allow undefined returns for non-decorated constructor params + // when resolving a dependency chain (i.e., resolutionStack not empty) + if (resolutionStack.length) return undefined as T; + throw new DIError(`${type.name} is not decorated with ${Service.name}`); + } + + if (metadata?.instance) return metadata.instance as T; + + // Check for circular dependencies before proceeding with instantiation + if (resolutionStack.includes(type)) { + throw new DIError( + `Circular dependency detected. ${resolutionStack.map((t) => t.name).join(' -> ')}`, + ); + } + + // Add current type to resolution stack before resolving dependencies + resolutionStack.push(type); + + try { + let instance: T; + + if (metadata?.factory) { + instance = metadata.factory(); + } else { + const paramTypes = (Reflect.getMetadata('design:paramtypes', type) ?? + []) as Constructable[]; + const dependencies = paramTypes.map(

(paramType: Constructable

) => + this.get(paramType), + ); + // Create new instance with resolved dependencies + instance = new (type as Constructable)(...dependencies) as T; + } + + instances.set(type, { ...metadata, instance }); + return instance; + } catch (error) { + if (error instanceof TypeError && error.message.toLowerCase().includes('abstract')) { + throw new DIError(`${type.name} is an abstract class, and cannot be instantiated`); + } + throw error; + } finally { + resolutionStack.pop(); + } + } + + /** + * Manually sets an instance for a specific type in the container + * @template T The type of instance being set + * @param type The constructor of the type to set. This can also be an abstract class + * @param instance The instance to store in the container + */ + set(type: ServiceIdentifier, instance: T): void { + // Preserve any existing metadata (like factory) when setting new instance + const metadata = instances.get(type) ?? {}; + instances.set(type, { ...metadata, instance }); + } + + /** Clears all instantiated instances from the container while preserving type registrations */ + reset(): void { + for (const metadata of instances.values()) { + delete metadata.instance; + } + } +} + +/** + * Global dependency injection container instance + * Used to retrieve and manage class instances and their dependencies + */ +export const Container = new ContainerClass(); diff --git a/packages/@n8n/di/tsconfig.build.json b/packages/@n8n/di/tsconfig.build.json new file mode 100644 index 0000000000..59065a1e2b --- /dev/null +++ b/packages/@n8n/di/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": ["./tsconfig.json", "../../../tsconfig.build.json"], + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "dist", + "tsBuildInfoFile": "dist/build.tsbuildinfo" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/__tests__/**"] +} diff --git a/packages/@n8n/di/tsconfig.json b/packages/@n8n/di/tsconfig.json new file mode 100644 index 0000000000..efe662ed2a --- /dev/null +++ b/packages/@n8n/di/tsconfig.json @@ -0,0 +1,12 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "types": ["node", "jest"], + "baseUrl": "src", + "tsBuildInfoFile": "dist/typecheck.tsbuildinfo", + "experimentalDecorators": true, + "emitDecoratorMetadata": true + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/@n8n/task-runner/package.json b/packages/@n8n/task-runner/package.json index 212909990e..9f2b0f0960 100644 --- a/packages/@n8n/task-runner/package.json +++ b/packages/@n8n/task-runner/package.json @@ -35,6 +35,7 @@ }, "dependencies": { "@n8n/config": "workspace:*", + "@n8n/di": "workspace:*", "@sentry/node": "catalog:", "acorn": "8.14.0", "acorn-walk": "8.3.4", @@ -42,7 +43,6 @@ "n8n-core": "workspace:*", "n8n-workflow": "workspace:*", "nanoid": "catalog:", - "typedi": "catalog:", "ws": "^8.18.0" }, "devDependencies": { diff --git a/packages/@n8n/task-runner/src/start.ts b/packages/@n8n/task-runner/src/start.ts index 93ff742250..536b550d17 100644 --- a/packages/@n8n/task-runner/src/start.ts +++ b/packages/@n8n/task-runner/src/start.ts @@ -1,7 +1,7 @@ import './polyfills'; +import { Container } from '@n8n/di'; import type { ErrorReporter } from 'n8n-core'; import { ensureError, setGlobalState } from 'n8n-workflow'; -import Container from 'typedi'; import { MainConfig } from './config/main-config'; import type { HealthCheckServer } from './health-check-server'; diff --git a/packages/cli/package.json b/packages/cli/package.json index 3afa78ebad..6a22ce1ee7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -89,6 +89,7 @@ "@n8n/api-types": "workspace:*", "@n8n/client-oauth2": "workspace:*", "@n8n/config": "workspace:*", + "@n8n/di": "workspace:*", "@n8n/localtunnel": "3.0.0", "@n8n/n8n-nodes-langchain": "workspace:*", "@n8n/permissions": "workspace:*", @@ -154,7 +155,7 @@ "prom-client": "13.2.0", "psl": "1.9.0", "raw-body": "2.5.1", - "reflect-metadata": "0.2.2", + "reflect-metadata": "catalog:", "replacestream": "4.0.3", "samlify": "2.8.9", "semver": "7.5.4", @@ -165,7 +166,6 @@ "sshpk": "1.17.0", "swagger-ui-express": "5.0.1", "syslog-client": "1.1.1", - "typedi": "catalog:", "uuid": "catalog:", "validator": "13.7.0", "ws": "8.17.1", diff --git a/packages/cli/src/__tests__/workflow-execute-additional-data.test.ts b/packages/cli/src/__tests__/workflow-execute-additional-data.test.ts index 641e239393..4c3af0e696 100644 --- a/packages/cli/src/__tests__/workflow-execute-additional-data.test.ts +++ b/packages/cli/src/__tests__/workflow-execute-additional-data.test.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import type { IWorkflowBase } from 'n8n-workflow'; import type { @@ -8,7 +9,6 @@ import type { INodeExecutionData, } from 'n8n-workflow'; import type PCancelable from 'p-cancelable'; -import Container from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import { CredentialsHelper } from '@/credentials-helper'; diff --git a/packages/cli/src/__tests__/workflow-runner.test.ts b/packages/cli/src/__tests__/workflow-runner.test.ts index 683343b44c..7330f85997 100644 --- a/packages/cli/src/__tests__/workflow-runner.test.ts +++ b/packages/cli/src/__tests__/workflow-runner.test.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { DirectedGraph, WorkflowExecute } from 'n8n-core'; import * as core from 'n8n-core'; @@ -18,7 +19,6 @@ import { type IWorkflowExecuteHooks, } from 'n8n-workflow'; import PCancelable from 'p-cancelable'; -import Container from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import config from '@/config'; diff --git a/packages/cli/src/abstract-server.ts b/packages/cli/src/abstract-server.ts index aadd41fb05..a9340b0a87 100644 --- a/packages/cli/src/abstract-server.ts +++ b/packages/cli/src/abstract-server.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import compression from 'compression'; import express from 'express'; import { engine as expressHandlebars } from 'express-handlebars'; @@ -6,7 +7,6 @@ import { readFile } from 'fs/promises'; import type { Server } from 'http'; import isbot from 'isbot'; import { Logger } from 'n8n-core'; -import { Container, Service } from 'typedi'; import config from '@/config'; import { N8N_VERSION, TEMPLATES_DIR, inDevelopment, inTest } from '@/constants'; diff --git a/packages/cli/src/activation-errors.service.ts b/packages/cli/src/activation-errors.service.ts index 9ddcad9317..1d1bb349aa 100644 --- a/packages/cli/src/activation-errors.service.ts +++ b/packages/cli/src/activation-errors.service.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { CacheService } from '@/services/cache/cache.service'; diff --git a/packages/cli/src/active-executions.ts b/packages/cli/src/active-executions.ts index a3fdcf6fee..9056271f64 100644 --- a/packages/cli/src/active-executions.ts +++ b/packages/cli/src/active-executions.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import type { IDeferredPromise, @@ -9,7 +10,6 @@ import type { import { createDeferredPromise, ExecutionCancelledError, sleep } from 'n8n-workflow'; import { strict as assert } from 'node:assert'; import type PCancelable from 'p-cancelable'; -import { Service } from 'typedi'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; import { ExecutionNotFoundError } from '@/errors/execution-not-found-error'; diff --git a/packages/cli/src/active-workflow-manager.ts b/packages/cli/src/active-workflow-manager.ts index 368e2987c8..a002bc4054 100644 --- a/packages/cli/src/active-workflow-manager.ts +++ b/packages/cli/src/active-workflow-manager.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ +import { Service } from '@n8n/di'; import { ActiveWorkflows, ErrorReporter, @@ -28,7 +29,6 @@ import { WebhookPathTakenError, ApplicationError, } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ActivationErrorsService } from '@/activation-errors.service'; import { ActiveExecutions } from '@/active-executions'; diff --git a/packages/cli/src/auth/auth.service.ts b/packages/cli/src/auth/auth.service.ts index 3a2e4fb0cb..190f788ba2 100644 --- a/packages/cli/src/auth/auth.service.ts +++ b/packages/cli/src/auth/auth.service.ts @@ -1,9 +1,9 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import { createHash } from 'crypto'; import type { NextFunction, Response } from 'express'; import { JsonWebTokenError, TokenExpiredError } from 'jsonwebtoken'; import { Logger } from 'n8n-core'; -import Container, { Service } from 'typedi'; import config from '@/config'; import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES, Time } from '@/constants'; diff --git a/packages/cli/src/auth/jwt.ts b/packages/cli/src/auth/jwt.ts index 63255f5f66..0e35263462 100644 --- a/packages/cli/src/auth/jwt.ts +++ b/packages/cli/src/auth/jwt.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { Response } from 'express'; -import { Container } from 'typedi'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/auth/methods/email.ts b/packages/cli/src/auth/methods/email.ts index 6f378e4357..61f344afaf 100644 --- a/packages/cli/src/auth/methods/email.ts +++ b/packages/cli/src/auth/methods/email.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import type { User } from '@/databases/entities/user'; import { UserRepository } from '@/databases/repositories/user.repository'; diff --git a/packages/cli/src/auth/methods/ldap.ts b/packages/cli/src/auth/methods/ldap.ts index f067994215..5466d0d8cb 100644 --- a/packages/cli/src/auth/methods/ldap.ts +++ b/packages/cli/src/auth/methods/ldap.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import type { User } from '@/databases/entities/user'; import { EventService } from '@/events/event.service'; diff --git a/packages/cli/src/collaboration/collaboration.service.ts b/packages/cli/src/collaboration/collaboration.service.ts index a6e957f510..9b2f3dec8e 100644 --- a/packages/cli/src/collaboration/collaboration.service.ts +++ b/packages/cli/src/collaboration/collaboration.service.ts @@ -1,8 +1,8 @@ import type { PushPayload } from '@n8n/api-types'; +import { Service } from '@n8n/di'; import { ErrorReporter } from 'n8n-core'; import type { Workflow } from 'n8n-workflow'; import { ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { CollaborationState } from '@/collaboration/collaboration.state'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/collaboration/collaboration.state.ts b/packages/cli/src/collaboration/collaboration.state.ts index 556dee2ace..f2a3b31f24 100644 --- a/packages/cli/src/collaboration/collaboration.state.ts +++ b/packages/cli/src/collaboration/collaboration.state.ts @@ -1,6 +1,6 @@ import type { Iso8601DateTimeString } from '@n8n/api-types'; +import { Service } from '@n8n/di'; import type { Workflow } from 'n8n-workflow'; -import { Service } from 'typedi'; import { Time } from '@/constants'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/commands/audit.ts b/packages/cli/src/commands/audit.ts index e98bb8bce0..1bd76bc4ed 100644 --- a/packages/cli/src/commands/audit.ts +++ b/packages/cli/src/commands/audit.ts @@ -1,7 +1,7 @@ import { SecurityConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; import { ApplicationError } from 'n8n-workflow'; -import { Container } from 'typedi'; import { RISK_CATEGORIES } from '@/security-audit/constants'; import { SecurityAuditService } from '@/security-audit/security-audit.service'; diff --git a/packages/cli/src/commands/base-command.ts b/packages/cli/src/commands/base-command.ts index 7692ef79be..56799c5089 100644 --- a/packages/cli/src/commands/base-command.ts +++ b/packages/cli/src/commands/base-command.ts @@ -1,5 +1,6 @@ import 'reflect-metadata'; import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { Command, Errors } from '@oclif/core'; import { BinaryDataService, @@ -10,7 +11,6 @@ import { ErrorReporter, } from 'n8n-core'; import { ApplicationError, ensureError, sleep } from 'n8n-workflow'; -import { Container } from 'typedi'; import type { AbstractServer } from '@/abstract-server'; import config from '@/config'; diff --git a/packages/cli/src/commands/db/revert.ts b/packages/cli/src/commands/db/revert.ts index bc9e0f6b3f..57780d4620 100644 --- a/packages/cli/src/commands/db/revert.ts +++ b/packages/cli/src/commands/db/revert.ts @@ -1,10 +1,10 @@ +import { Container } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { DataSourceOptions as ConnectionOptions } from '@n8n/typeorm'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { MigrationExecutor, DataSource as Connection } from '@n8n/typeorm'; import { Command, Flags } from '@oclif/core'; import { Logger } from 'n8n-core'; -import { Container } from 'typedi'; import { getConnectionOptions } from '@/databases/config'; import type { Migration } from '@/databases/types'; diff --git a/packages/cli/src/commands/execute-batch.ts b/packages/cli/src/commands/execute-batch.ts index 0b19e25652..883cd7068d 100644 --- a/packages/cli/src/commands/execute-batch.ts +++ b/packages/cli/src/commands/execute-batch.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/no-loop-func */ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; import fs from 'fs'; import { diff } from 'json-diff'; @@ -7,7 +8,6 @@ import type { IRun, ITaskData, IWorkflowExecutionDataProcess } from 'n8n-workflo import { ApplicationError, jsonParse } from 'n8n-workflow'; import os from 'os'; import { sep } from 'path'; -import { Container } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/commands/execute.ts b/packages/cli/src/commands/execute.ts index fd49a2b619..786b91f7fc 100644 --- a/packages/cli/src/commands/execute.ts +++ b/packages/cli/src/commands/execute.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; import type { IWorkflowBase, IWorkflowExecutionDataProcess } from 'n8n-workflow'; import { ApplicationError, ExecutionBaseError } from 'n8n-workflow'; -import { Container } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/commands/export/credentials.ts b/packages/cli/src/commands/export/credentials.ts index 4644c2556c..ad0b5784c1 100644 --- a/packages/cli/src/commands/export/credentials.ts +++ b/packages/cli/src/commands/export/credentials.ts @@ -1,9 +1,9 @@ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; import fs from 'fs'; import { Credentials } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; import path from 'path'; -import Container from 'typedi'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import type { ICredentialsDb, ICredentialsDecryptedDb } from '@/interfaces'; diff --git a/packages/cli/src/commands/export/workflow.ts b/packages/cli/src/commands/export/workflow.ts index 8e129eec4d..3fa0f1e046 100644 --- a/packages/cli/src/commands/export/workflow.ts +++ b/packages/cli/src/commands/export/workflow.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; import fs from 'fs'; import { ApplicationError } from 'n8n-workflow'; import path from 'path'; -import Container from 'typedi'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/commands/import/credentials.ts b/packages/cli/src/commands/import/credentials.ts index 5f9e06f256..aae6c7d23e 100644 --- a/packages/cli/src/commands/import/credentials.ts +++ b/packages/cli/src/commands/import/credentials.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { EntityManager } from '@n8n/typeorm'; import { Flags } from '@oclif/core'; @@ -6,7 +7,6 @@ import fs from 'fs'; import { Cipher } from 'n8n-core'; import type { ICredentialsEncrypted } from 'n8n-workflow'; import { ApplicationError, jsonParse } from 'n8n-workflow'; -import { Container } from 'typedi'; import { UM_FIX_INSTRUCTION } from '@/constants'; import { CredentialsEntity } from '@/databases/entities/credentials-entity'; diff --git a/packages/cli/src/commands/import/workflow.ts b/packages/cli/src/commands/import/workflow.ts index 2548ca9523..d8813485a1 100644 --- a/packages/cli/src/commands/import/workflow.ts +++ b/packages/cli/src/commands/import/workflow.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; import glob from 'fast-glob'; import fs from 'fs'; import { ApplicationError, jsonParse } from 'n8n-workflow'; -import { Container } from 'typedi'; import { UM_FIX_INSTRUCTION } from '@/constants'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; diff --git a/packages/cli/src/commands/ldap/reset.ts b/packages/cli/src/commands/ldap/reset.ts index 6aaaa217d6..edbf988434 100644 --- a/packages/cli/src/commands/ldap/reset.ts +++ b/packages/cli/src/commands/ldap/reset.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In } from '@n8n/typeorm'; import { Flags } from '@oclif/core'; import { ApplicationError } from 'n8n-workflow'; -import Container from 'typedi'; import { UM_FIX_INSTRUCTION } from '@/constants'; import { CredentialsService } from '@/credentials/credentials.service'; diff --git a/packages/cli/src/commands/license/clear.ts b/packages/cli/src/commands/license/clear.ts index 427a150ebb..03a2ea4dd4 100644 --- a/packages/cli/src/commands/license/clear.ts +++ b/packages/cli/src/commands/license/clear.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { SETTINGS_LICENSE_CERT_KEY } from '@/constants'; import { SettingsRepository } from '@/databases/repositories/settings.repository'; diff --git a/packages/cli/src/commands/license/info.ts b/packages/cli/src/commands/license/info.ts index 5f3e31a573..cc99e925f7 100644 --- a/packages/cli/src/commands/license/info.ts +++ b/packages/cli/src/commands/license/info.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { License } from '@/license'; diff --git a/packages/cli/src/commands/list/workflow.ts b/packages/cli/src/commands/list/workflow.ts index 39f5689fcc..74f5916b5c 100644 --- a/packages/cli/src/commands/list/workflow.ts +++ b/packages/cli/src/commands/list/workflow.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; -import Container from 'typedi'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/commands/mfa/disable.ts b/packages/cli/src/commands/mfa/disable.ts index 3458593252..a739fbda88 100644 --- a/packages/cli/src/commands/mfa/disable.ts +++ b/packages/cli/src/commands/mfa/disable.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; -import Container from 'typedi'; import { AuthUserRepository } from '@/databases/repositories/auth-user.repository'; diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 847f5a480f..179c3a8052 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; import glob from 'fast-glob'; import { createReadStream, createWriteStream, existsSync } from 'fs'; @@ -9,7 +10,6 @@ import { jsonParse, randomString, type IWorkflowExecutionDataProcess } from 'n8n import path from 'path'; import replaceStream from 'replacestream'; import { pipeline } from 'stream/promises'; -import { Container } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; diff --git a/packages/cli/src/commands/update/workflow.ts b/packages/cli/src/commands/update/workflow.ts index 6c88ed6c43..903d6c9405 100644 --- a/packages/cli/src/commands/update/workflow.ts +++ b/packages/cli/src/commands/update/workflow.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; -import { Container } from 'typedi'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/commands/user-management/reset.ts b/packages/cli/src/commands/user-management/reset.ts index 3c6709e802..3e8a1c14f1 100644 --- a/packages/cli/src/commands/user-management/reset.ts +++ b/packages/cli/src/commands/user-management/reset.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import type { CredentialsEntity } from '@/databases/entities/credentials-entity'; import { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/commands/webhook.ts b/packages/cli/src/commands/webhook.ts index 77ec770aa0..8b6f318576 100644 --- a/packages/cli/src/commands/webhook.ts +++ b/packages/cli/src/commands/webhook.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { Flags } from '@oclif/core'; import { ApplicationError } from 'n8n-workflow'; -import { Container } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import config from '@/config'; diff --git a/packages/cli/src/commands/worker.ts b/packages/cli/src/commands/worker.ts index c69957dacb..f5138f1ef3 100644 --- a/packages/cli/src/commands/worker.ts +++ b/packages/cli/src/commands/worker.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { Flags, type Config } from '@oclif/core'; -import { Container } from 'typedi'; import config from '@/config'; import { N8N_VERSION, inTest } from '@/constants'; diff --git a/packages/cli/src/concurrency/concurrency-control.service.ts b/packages/cli/src/concurrency/concurrency-control.service.ts index ede6cf8997..6088d0f4c3 100644 --- a/packages/cli/src/concurrency/concurrency-control.service.ts +++ b/packages/cli/src/concurrency/concurrency-control.service.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import type { WorkflowExecuteMode as ExecutionMode } from 'n8n-workflow'; -import { Service } from 'typedi'; import config from '@/config'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/src/concurrency/concurrency-queue.ts b/packages/cli/src/concurrency/concurrency-queue.ts index c4c482226c..900018889a 100644 --- a/packages/cli/src/concurrency/concurrency-queue.ts +++ b/packages/cli/src/concurrency/concurrency-queue.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { TypedEmitter } from '@/typed-emitter'; diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts index 1ba49a1ef4..8839d180ff 100644 --- a/packages/cli/src/config/index.ts +++ b/packages/cli/src/config/index.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import convict from 'convict'; import { flatten } from 'flat'; import { readFileSync } from 'fs'; @@ -7,7 +8,6 @@ import { Logger } from 'n8n-core'; import { ApplicationError, setGlobalState } from 'n8n-workflow'; import assert from 'node:assert'; import colors from 'picocolors'; -import { Container } from 'typedi'; import { inTest, inE2ETests } from '@/constants'; diff --git a/packages/cli/src/config/schema.ts b/packages/cli/src/config/schema.ts index e8d28cb782..e5bda7d81b 100644 --- a/packages/cli/src/config/schema.ts +++ b/packages/cli/src/config/schema.ts @@ -1,8 +1,8 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import convict from 'convict'; import { InstanceSettings } from 'n8n-core'; import path from 'path'; -import { Container } from 'typedi'; import { ensureStringArray } from './utils'; diff --git a/packages/cli/src/controllers/__tests__/api-keys.controller.test.ts b/packages/cli/src/controllers/__tests__/api-keys.controller.test.ts index 3f34fc1d2c..dc40d3357d 100644 --- a/packages/cli/src/controllers/__tests__/api-keys.controller.test.ts +++ b/packages/cli/src/controllers/__tests__/api-keys.controller.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import { Container } from 'typedi'; import type { ApiKey } from '@/databases/entities/api-key'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/controllers/__tests__/me.controller.test.ts b/packages/cli/src/controllers/__tests__/me.controller.test.ts index 37c391a2dc..9ba6f8ada7 100644 --- a/packages/cli/src/controllers/__tests__/me.controller.test.ts +++ b/packages/cli/src/controllers/__tests__/me.controller.test.ts @@ -1,8 +1,8 @@ import { UserUpdateRequestDto } from '@n8n/api-types'; +import { Container } from '@n8n/di'; import type { Response } from 'express'; import { mock, anyObject } from 'jest-mock-extended'; import jwt from 'jsonwebtoken'; -import { Container } from 'typedi'; import { AUTH_COOKIE_NAME } from '@/constants'; import { MeController } from '@/controllers/me.controller'; diff --git a/packages/cli/src/controllers/e2e.controller.ts b/packages/cli/src/controllers/e2e.controller.ts index aa0226c754..c846553d30 100644 --- a/packages/cli/src/controllers/e2e.controller.ts +++ b/packages/cli/src/controllers/e2e.controller.ts @@ -1,7 +1,7 @@ import type { PushMessage } from '@n8n/api-types'; +import { Container } from '@n8n/di'; import { Request } from 'express'; import { Logger } from 'n8n-core'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; diff --git a/packages/cli/src/controllers/oauth/__tests__/oauth1-credential.controller.test.ts b/packages/cli/src/controllers/oauth/__tests__/oauth1-credential.controller.test.ts index 0c51f29f22..570181aa78 100644 --- a/packages/cli/src/controllers/oauth/__tests__/oauth1-credential.controller.test.ts +++ b/packages/cli/src/controllers/oauth/__tests__/oauth1-credential.controller.test.ts @@ -1,10 +1,10 @@ +import { Container } from '@n8n/di'; import Csrf from 'csrf'; import type { Response } from 'express'; import { mock } from 'jest-mock-extended'; import { Cipher } from 'n8n-core'; import { Logger } from 'n8n-core'; import nock from 'nock'; -import Container from 'typedi'; import { Time } from '@/constants'; import { OAuth1CredentialController } from '@/controllers/oauth/oauth1-credential.controller'; diff --git a/packages/cli/src/controllers/oauth/__tests__/oauth2-credential.controller.test.ts b/packages/cli/src/controllers/oauth/__tests__/oauth2-credential.controller.test.ts index c1c240425e..53bba08c58 100644 --- a/packages/cli/src/controllers/oauth/__tests__/oauth2-credential.controller.test.ts +++ b/packages/cli/src/controllers/oauth/__tests__/oauth2-credential.controller.test.ts @@ -1,10 +1,10 @@ +import { Container } from '@n8n/di'; import Csrf from 'csrf'; import { type Response } from 'express'; import { mock } from 'jest-mock-extended'; import { Cipher } from 'n8n-core'; import { Logger } from 'n8n-core'; import nock from 'nock'; -import Container from 'typedi'; import { Time } from '@/constants'; import { OAuth2CredentialController } from '@/controllers/oauth/oauth2-credential.controller'; diff --git a/packages/cli/src/controllers/oauth/abstract-oauth.controller.ts b/packages/cli/src/controllers/oauth/abstract-oauth.controller.ts index 97fb7be24a..bac924a023 100644 --- a/packages/cli/src/controllers/oauth/abstract-oauth.controller.ts +++ b/packages/cli/src/controllers/oauth/abstract-oauth.controller.ts @@ -1,10 +1,10 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import Csrf from 'csrf'; import type { Response } from 'express'; import { Credentials, Logger } from 'n8n-core'; import type { ICredentialDataDecryptedObject, IWorkflowExecuteAdditionalData } from 'n8n-workflow'; import { jsonParse, ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { RESPONSE_ERROR_MESSAGES, Time } from '@/constants'; import { CredentialsHelper } from '@/credentials-helper'; diff --git a/packages/cli/src/crash-journal.ts b/packages/cli/src/crash-journal.ts index 8afae1e88c..93f7b2e737 100644 --- a/packages/cli/src/crash-journal.ts +++ b/packages/cli/src/crash-journal.ts @@ -1,9 +1,9 @@ +import { Container } from '@n8n/di'; import { existsSync } from 'fs'; import { mkdir, utimes, open, rm } from 'fs/promises'; import { InstanceSettings, Logger } from 'n8n-core'; import { sleep } from 'n8n-workflow'; import { join, dirname } from 'path'; -import { Container } from 'typedi'; import { inProduction } from '@/constants'; diff --git a/packages/cli/src/credential-types.ts b/packages/cli/src/credential-types.ts index a6d3f29eb0..5720b7cdbe 100644 --- a/packages/cli/src/credential-types.ts +++ b/packages/cli/src/credential-types.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import type { ICredentialType, ICredentialTypes } from 'n8n-workflow'; -import { Service } from 'typedi'; import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials'; diff --git a/packages/cli/src/credentials-helper.ts b/packages/cli/src/credentials-helper.ts index 967ee9efe4..4c869222b5 100644 --- a/packages/cli/src/credentials-helper.ts +++ b/packages/cli/src/credentials-helper.ts @@ -2,6 +2,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-return */ +import { Service } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In } from '@n8n/typeorm'; import { Credentials, getAdditionalKeys } from 'n8n-core'; @@ -26,7 +27,6 @@ import type { IDataObject, } from 'n8n-workflow'; import { ICredentialsHelper, NodeHelpers, Workflow, ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { CredentialTypes } from '@/credential-types'; import { CredentialsOverwrites } from '@/credentials-overwrites'; diff --git a/packages/cli/src/credentials-overwrites.ts b/packages/cli/src/credentials-overwrites.ts index 30f6bedfb8..6689649b0f 100644 --- a/packages/cli/src/credentials-overwrites.ts +++ b/packages/cli/src/credentials-overwrites.ts @@ -1,8 +1,8 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import type { ICredentialDataDecryptedObject } from 'n8n-workflow'; import { deepCopy, jsonParse } from 'n8n-workflow'; -import { Service } from 'typedi'; import { CredentialTypes } from '@/credential-types'; import type { ICredentialsOverwrite } from '@/interfaces'; diff --git a/packages/cli/src/credentials/credentials.service.ee.ts b/packages/cli/src/credentials/credentials.service.ee.ts index 949748600d..c53110666b 100644 --- a/packages/cli/src/credentials/credentials.service.ee.ts +++ b/packages/cli/src/credentials/credentials.service.ee.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In, type EntityManager } from '@n8n/typeorm'; import type { ICredentialDataDecryptedObject } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { CredentialsEntity } from '@/databases/entities/credentials-entity'; import { Project } from '@/databases/entities/project'; diff --git a/packages/cli/src/credentials/credentials.service.ts b/packages/cli/src/credentials/credentials.service.ts index e7e0447417..0761a4ad48 100644 --- a/packages/cli/src/credentials/credentials.service.ts +++ b/packages/cli/src/credentials/credentials.service.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { @@ -14,7 +15,6 @@ import type { INodeProperties, } from 'n8n-workflow'; import { ApplicationError, CREDENTIAL_EMPTY_VALUE, deepCopy, NodeHelpers } from 'n8n-workflow'; -import { Service } from 'typedi'; import { CREDENTIAL_BLANKING_VALUE } from '@/constants'; import { CredentialTypes } from '@/credential-types'; diff --git a/packages/cli/src/databases/config.ts b/packages/cli/src/databases/config.ts index 8845bd0b13..45348e0079 100644 --- a/packages/cli/src/databases/config.ts +++ b/packages/cli/src/databases/config.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { DataSourceOptions, LoggerOptions } from '@n8n/typeorm'; import type { MysqlConnectionOptions } from '@n8n/typeorm/driver/mysql/MysqlConnectionOptions'; import type { PostgresConnectionOptions } from '@n8n/typeorm/driver/postgres/PostgresConnectionOptions'; @@ -8,7 +9,6 @@ import { InstanceSettings } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; import path from 'path'; import type { TlsOptions } from 'tls'; -import { Container } from 'typedi'; import { entities } from './entities'; import { mysqlMigrations } from './migrations/mysqldb'; diff --git a/packages/cli/src/databases/entities/abstract-entity.ts b/packages/cli/src/databases/entities/abstract-entity.ts index 0626a5621f..ac16b55bf5 100644 --- a/packages/cli/src/databases/entities/abstract-entity.ts +++ b/packages/cli/src/databases/entities/abstract-entity.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { ColumnOptions } from '@n8n/typeorm'; import { BeforeInsert, @@ -8,7 +9,6 @@ import { UpdateDateColumn, } from '@n8n/typeorm'; import type { Class } from 'n8n-core'; -import { Container } from 'typedi'; import { generateNanoId } from '../utils/generators'; diff --git a/packages/cli/src/databases/migrations/common/1711390882123-MoveSshKeysToDatabase.ts b/packages/cli/src/databases/migrations/common/1711390882123-MoveSshKeysToDatabase.ts index f8d4eb60a9..2db009da07 100644 --- a/packages/cli/src/databases/migrations/common/1711390882123-MoveSshKeysToDatabase.ts +++ b/packages/cli/src/databases/migrations/common/1711390882123-MoveSshKeysToDatabase.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import { Cipher, InstanceSettings } from 'n8n-core'; import { jsonParse } from 'n8n-workflow'; import { readFile, writeFile, rm } from 'node:fs/promises'; import path from 'node:path'; -import Container from 'typedi'; import type { MigrationContext, ReversibleMigration } from '@/databases/types'; diff --git a/packages/cli/src/databases/migrations/sqlite/1690000000002-MigrateIntegerKeysToString.ts b/packages/cli/src/databases/migrations/sqlite/1690000000002-MigrateIntegerKeysToString.ts index 99cbef5aac..1c72db35ed 100644 --- a/packages/cli/src/databases/migrations/sqlite/1690000000002-MigrateIntegerKeysToString.ts +++ b/packages/cli/src/databases/migrations/sqlite/1690000000002-MigrateIntegerKeysToString.ts @@ -1,8 +1,8 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { statSync } from 'fs'; import { InstanceSettings } from 'n8n-core'; import path from 'path'; -import { Container } from 'typedi'; import type { MigrationContext, IrreversibleMigration } from '@/databases/types'; diff --git a/packages/cli/src/databases/repositories/__tests__/credentials.repository.test.ts b/packages/cli/src/databases/repositories/__tests__/credentials.repository.test.ts index 439b806a9a..7b70587d65 100644 --- a/packages/cli/src/databases/repositories/__tests__/credentials.repository.test.ts +++ b/packages/cli/src/databases/repositories/__tests__/credentials.repository.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import { Container } from 'typedi'; import { CredentialsEntity } from '@/databases/entities/credentials-entity'; import { mockEntityManager } from '@test/mocking'; diff --git a/packages/cli/src/databases/repositories/__tests__/execution.repository.test.ts b/packages/cli/src/databases/repositories/__tests__/execution.repository.test.ts index 10d1371f37..8e36f0189b 100644 --- a/packages/cli/src/databases/repositories/__tests__/execution.repository.test.ts +++ b/packages/cli/src/databases/repositories/__tests__/execution.repository.test.ts @@ -1,10 +1,10 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { SelectQueryBuilder } from '@n8n/typeorm'; import { Not, LessThanOrEqual } from '@n8n/typeorm'; import { mock } from 'jest-mock-extended'; import { BinaryDataService } from 'n8n-core'; import { nanoid } from 'nanoid'; -import Container from 'typedi'; import { ExecutionEntity } from '@/databases/entities/execution-entity'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/src/databases/repositories/__tests__/shared-credentials.repository.test.ts b/packages/cli/src/databases/repositories/__tests__/shared-credentials.repository.test.ts index 5f8b441235..d7e108389a 100644 --- a/packages/cli/src/databases/repositories/__tests__/shared-credentials.repository.test.ts +++ b/packages/cli/src/databases/repositories/__tests__/shared-credentials.repository.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { hasScope } from '@n8n/permissions'; import { In } from '@n8n/typeorm'; import { mock } from 'jest-mock-extended'; -import { Container } from 'typedi'; import type { CredentialsEntity } from '@/databases/entities/credentials-entity'; import { SharedCredentials } from '@/databases/entities/shared-credentials'; diff --git a/packages/cli/src/databases/repositories/__tests__/workflow-statistics.test.ts b/packages/cli/src/databases/repositories/__tests__/workflow-statistics.test.ts index 202938e526..b1d36b0263 100644 --- a/packages/cli/src/databases/repositories/__tests__/workflow-statistics.test.ts +++ b/packages/cli/src/databases/repositories/__tests__/workflow-statistics.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { type InsertResult, QueryFailedError } from '@n8n/typeorm'; import { mock, mockClear } from 'jest-mock-extended'; -import { Container } from 'typedi'; import { StatisticsNames, WorkflowStatistics } from '@/databases/entities/workflow-statistics'; import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository'; diff --git a/packages/cli/src/databases/repositories/annotation-tag-mapping.repository.ee.ts b/packages/cli/src/databases/repositories/annotation-tag-mapping.repository.ee.ts index 07bb79815b..7f1039c3a1 100644 --- a/packages/cli/src/databases/repositories/annotation-tag-mapping.repository.ee.ts +++ b/packages/cli/src/databases/repositories/annotation-tag-mapping.repository.ee.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { AnnotationTagMapping } from '@/databases/entities/annotation-tag-mapping.ee'; diff --git a/packages/cli/src/databases/repositories/annotation-tag.repository.ee.ts b/packages/cli/src/databases/repositories/annotation-tag.repository.ee.ts index e3aa993460..3f4d5c161f 100644 --- a/packages/cli/src/databases/repositories/annotation-tag.repository.ee.ts +++ b/packages/cli/src/databases/repositories/annotation-tag.repository.ee.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { AnnotationTagEntity } from '@/databases/entities/annotation-tag-entity.ee'; diff --git a/packages/cli/src/databases/repositories/api-key.repository.ts b/packages/cli/src/databases/repositories/api-key.repository.ts index 21ad2c3e40..b24a8984dc 100644 --- a/packages/cli/src/databases/repositories/api-key.repository.ts +++ b/packages/cli/src/databases/repositories/api-key.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { ApiKey } from '../entities/api-key'; diff --git a/packages/cli/src/databases/repositories/auth-identity.repository.ts b/packages/cli/src/databases/repositories/auth-identity.repository.ts index 349fe29cd5..1036994680 100644 --- a/packages/cli/src/databases/repositories/auth-identity.repository.ts +++ b/packages/cli/src/databases/repositories/auth-identity.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { AuthIdentity } from '../entities/auth-identity'; diff --git a/packages/cli/src/databases/repositories/auth-provider-sync-history.repository.ts b/packages/cli/src/databases/repositories/auth-provider-sync-history.repository.ts index d4c5d50b5a..6f217e7454 100644 --- a/packages/cli/src/databases/repositories/auth-provider-sync-history.repository.ts +++ b/packages/cli/src/databases/repositories/auth-provider-sync-history.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { AuthProviderSyncHistory } from '../entities/auth-provider-sync-history'; diff --git a/packages/cli/src/databases/repositories/auth-user.repository.ts b/packages/cli/src/databases/repositories/auth-user.repository.ts index 0d94fc9ba6..c5a06d9b66 100644 --- a/packages/cli/src/databases/repositories/auth-user.repository.ts +++ b/packages/cli/src/databases/repositories/auth-user.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { AuthUser } from '../entities/auth-user'; diff --git a/packages/cli/src/databases/repositories/credentials.repository.ts b/packages/cli/src/databases/repositories/credentials.repository.ts index 5b88a4ed87..42fac4f8dc 100644 --- a/packages/cli/src/databases/repositories/credentials.repository.ts +++ b/packages/cli/src/databases/repositories/credentials.repository.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; import { DataSource, In, Repository, Like } from '@n8n/typeorm'; import type { FindManyOptions, FindOptionsWhere } from '@n8n/typeorm'; -import { Service } from 'typedi'; import type { ListQuery } from '@/requests'; import { RoleService } from '@/services/role.service'; diff --git a/packages/cli/src/databases/repositories/event-destinations.repository.ts b/packages/cli/src/databases/repositories/event-destinations.repository.ts index 56a2ab0f90..2af7bca8bb 100644 --- a/packages/cli/src/databases/repositories/event-destinations.repository.ts +++ b/packages/cli/src/databases/repositories/event-destinations.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { EventDestinations } from '../entities/event-destinations'; diff --git a/packages/cli/src/databases/repositories/execution-annotation.repository.ts b/packages/cli/src/databases/repositories/execution-annotation.repository.ts index 97ca972733..a8329669f9 100644 --- a/packages/cli/src/databases/repositories/execution-annotation.repository.ts +++ b/packages/cli/src/databases/repositories/execution-annotation.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { ExecutionAnnotation } from '@/databases/entities/execution-annotation.ee'; diff --git a/packages/cli/src/databases/repositories/execution-data.repository.ts b/packages/cli/src/databases/repositories/execution-data.repository.ts index f7de742941..75463fd0f5 100644 --- a/packages/cli/src/databases/repositories/execution-data.repository.ts +++ b/packages/cli/src/databases/repositories/execution-data.repository.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import { DataSource, In, Repository } from '@n8n/typeorm'; import type { EntityManager } from '@n8n/typeorm'; import type { QueryDeepPartialEntity } from '@n8n/typeorm/query-builder/QueryPartialEntity'; -import { Service } from 'typedi'; import { ExecutionData } from '../entities/execution-data'; diff --git a/packages/cli/src/databases/repositories/execution-metadata.repository.ts b/packages/cli/src/databases/repositories/execution-metadata.repository.ts index efaf239c4a..e0f27e6c09 100644 --- a/packages/cli/src/databases/repositories/execution-metadata.repository.ts +++ b/packages/cli/src/databases/repositories/execution-metadata.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { ExecutionMetadata } from '../entities/execution-metadata'; diff --git a/packages/cli/src/databases/repositories/execution.repository.ts b/packages/cli/src/databases/repositories/execution.repository.ts index 617dde9136..160b7ace87 100644 --- a/packages/cli/src/databases/repositories/execution.repository.ts +++ b/packages/cli/src/databases/repositories/execution.repository.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import type { FindManyOptions, FindOneOptions, @@ -29,7 +30,6 @@ import type { ExecutionSummary, IRunExecutionData, } from 'n8n-workflow'; -import { Service } from 'typedi'; import { AnnotationTagEntity } from '@/databases/entities/annotation-tag-entity.ee'; import { AnnotationTagMapping } from '@/databases/entities/annotation-tag-mapping.ee'; diff --git a/packages/cli/src/databases/repositories/installed-nodes.repository.ts b/packages/cli/src/databases/repositories/installed-nodes.repository.ts index 880b4375ca..68fc564ca3 100644 --- a/packages/cli/src/databases/repositories/installed-nodes.repository.ts +++ b/packages/cli/src/databases/repositories/installed-nodes.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { InstalledNodes } from '../entities/installed-nodes'; diff --git a/packages/cli/src/databases/repositories/installed-packages.repository.ts b/packages/cli/src/databases/repositories/installed-packages.repository.ts index 77faf96817..873880dc90 100644 --- a/packages/cli/src/databases/repositories/installed-packages.repository.ts +++ b/packages/cli/src/databases/repositories/installed-packages.repository.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; import type { PackageDirectoryLoader } from 'n8n-core'; -import { Service } from 'typedi'; import { InstalledNodesRepository } from './installed-nodes.repository'; import { InstalledPackages } from '../entities/installed-packages'; diff --git a/packages/cli/src/databases/repositories/invalid-auth-token.repository.ts b/packages/cli/src/databases/repositories/invalid-auth-token.repository.ts index 94909b998d..b9c8e0a4d9 100644 --- a/packages/cli/src/databases/repositories/invalid-auth-token.repository.ts +++ b/packages/cli/src/databases/repositories/invalid-auth-token.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { InvalidAuthToken } from '../entities/invalid-auth-token'; diff --git a/packages/cli/src/databases/repositories/license-metrics.repository.ts b/packages/cli/src/databases/repositories/license-metrics.repository.ts index d6cc7c1409..26f4bd7328 100644 --- a/packages/cli/src/databases/repositories/license-metrics.repository.ts +++ b/packages/cli/src/databases/repositories/license-metrics.repository.ts @@ -1,6 +1,6 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { DataSource, Repository, Entity } from '@n8n/typeorm'; -import { Service } from 'typedi'; @Entity() export class LicenseMetrics {} diff --git a/packages/cli/src/databases/repositories/processed-data.repository.ts b/packages/cli/src/databases/repositories/processed-data.repository.ts index f02fbf270a..0063cdf9db 100644 --- a/packages/cli/src/databases/repositories/processed-data.repository.ts +++ b/packages/cli/src/databases/repositories/processed-data.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { ProcessedData } from '../entities/processed-data'; diff --git a/packages/cli/src/databases/repositories/project-relation.repository.ts b/packages/cli/src/databases/repositories/project-relation.repository.ts index 8d8faba1ba..75aaed76df 100644 --- a/packages/cli/src/databases/repositories/project-relation.repository.ts +++ b/packages/cli/src/databases/repositories/project-relation.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, In, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { ProjectRelation, type ProjectRole } from '../entities/project-relation'; diff --git a/packages/cli/src/databases/repositories/project.repository.ts b/packages/cli/src/databases/repositories/project.repository.ts index c67d4e9456..052668743b 100644 --- a/packages/cli/src/databases/repositories/project.repository.ts +++ b/packages/cli/src/databases/repositories/project.repository.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import type { EntityManager } from '@n8n/typeorm'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { Project } from '../entities/project'; diff --git a/packages/cli/src/databases/repositories/settings.repository.ts b/packages/cli/src/databases/repositories/settings.repository.ts index a00f52b4e7..6e28b71c1b 100644 --- a/packages/cli/src/databases/repositories/settings.repository.ts +++ b/packages/cli/src/databases/repositories/settings.repository.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; import { ErrorReporter } from 'n8n-core'; -import { Service } from 'typedi'; import config from '@/config'; import { EXTERNAL_SECRETS_DB_KEY } from '@/external-secrets.ee/constants'; diff --git a/packages/cli/src/databases/repositories/shared-credentials.repository.ts b/packages/cli/src/databases/repositories/shared-credentials.repository.ts index 516c546929..d7e074595c 100644 --- a/packages/cli/src/databases/repositories/shared-credentials.repository.ts +++ b/packages/cli/src/databases/repositories/shared-credentials.repository.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; import type { EntityManager, FindOptionsRelations, FindOptionsWhere } from '@n8n/typeorm'; import { DataSource, In, Not, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { RoleService } from '@/services/role.service'; diff --git a/packages/cli/src/databases/repositories/shared-workflow.repository.ts b/packages/cli/src/databases/repositories/shared-workflow.repository.ts index 8f4bedcb15..f0a574fa0c 100644 --- a/packages/cli/src/databases/repositories/shared-workflow.repository.ts +++ b/packages/cli/src/databases/repositories/shared-workflow.repository.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; import { DataSource, Repository, In, Not } from '@n8n/typeorm'; import type { EntityManager, FindManyOptions, FindOptionsWhere } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { RoleService } from '@/services/role.service'; diff --git a/packages/cli/src/databases/repositories/tag.repository.ts b/packages/cli/src/databases/repositories/tag.repository.ts index 800fe225ae..f58b0e5b68 100644 --- a/packages/cli/src/databases/repositories/tag.repository.ts +++ b/packages/cli/src/databases/repositories/tag.repository.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import type { EntityManager } from '@n8n/typeorm'; import { DataSource, In, Repository } from '@n8n/typeorm'; import intersection from 'lodash/intersection'; -import { Service } from 'typedi'; import { TagEntity } from '../entities/tag-entity'; import type { WorkflowEntity } from '../entities/workflow-entity'; diff --git a/packages/cli/src/databases/repositories/test-definition.repository.ee.ts b/packages/cli/src/databases/repositories/test-definition.repository.ee.ts index 6866608b02..0955e6f89d 100644 --- a/packages/cli/src/databases/repositories/test-definition.repository.ee.ts +++ b/packages/cli/src/databases/repositories/test-definition.repository.ee.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import type { FindManyOptions, FindOptionsWhere } from '@n8n/typeorm'; import { DataSource, In, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { TestDefinition } from '@/databases/entities/test-definition.ee'; import { ForbiddenError } from '@/errors/response-errors/forbidden.error'; diff --git a/packages/cli/src/databases/repositories/test-metric.repository.ee.ts b/packages/cli/src/databases/repositories/test-metric.repository.ee.ts index 01635ef8f7..a08cf414f8 100644 --- a/packages/cli/src/databases/repositories/test-metric.repository.ee.ts +++ b/packages/cli/src/databases/repositories/test-metric.repository.ee.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { TestMetric } from '@/databases/entities/test-metric.ee'; diff --git a/packages/cli/src/databases/repositories/test-run.repository.ee.ts b/packages/cli/src/databases/repositories/test-run.repository.ee.ts index 1e889aadc7..f0f235c551 100644 --- a/packages/cli/src/databases/repositories/test-run.repository.ee.ts +++ b/packages/cli/src/databases/repositories/test-run.repository.ee.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import type { FindManyOptions } from '@n8n/typeorm'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import type { AggregatedTestRunMetrics } from '@/databases/entities/test-run.ee'; import { TestRun } from '@/databases/entities/test-run.ee'; diff --git a/packages/cli/src/databases/repositories/user.repository.ts b/packages/cli/src/databases/repositories/user.repository.ts index 61a4edffa5..d785ce407d 100644 --- a/packages/cli/src/databases/repositories/user.repository.ts +++ b/packages/cli/src/databases/repositories/user.repository.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import type { DeepPartial, EntityManager, FindManyOptions } from '@n8n/typeorm'; import { DataSource, In, IsNull, Not, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import type { ListQuery } from '@/requests'; diff --git a/packages/cli/src/databases/repositories/variables.repository.ts b/packages/cli/src/databases/repositories/variables.repository.ts index 2f2500250b..5ea9711935 100644 --- a/packages/cli/src/databases/repositories/variables.repository.ts +++ b/packages/cli/src/databases/repositories/variables.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { Variables } from '../entities/variables'; diff --git a/packages/cli/src/databases/repositories/webhook.repository.ts b/packages/cli/src/databases/repositories/webhook.repository.ts index b89b9fba0f..5254793a78 100644 --- a/packages/cli/src/databases/repositories/webhook.repository.ts +++ b/packages/cli/src/databases/repositories/webhook.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { WebhookEntity } from '../entities/webhook-entity'; diff --git a/packages/cli/src/databases/repositories/workflow-history.repository.ts b/packages/cli/src/databases/repositories/workflow-history.repository.ts index ca791ebcb7..7e0cdfac1e 100644 --- a/packages/cli/src/databases/repositories/workflow-history.repository.ts +++ b/packages/cli/src/databases/repositories/workflow-history.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, LessThan, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { WorkflowHistory } from '../entities/workflow-history'; diff --git a/packages/cli/src/databases/repositories/workflow-statistics.repository.ts b/packages/cli/src/databases/repositories/workflow-statistics.repository.ts index c2ea18fe2c..ad94e83ec1 100644 --- a/packages/cli/src/databases/repositories/workflow-statistics.repository.ts +++ b/packages/cli/src/databases/repositories/workflow-statistics.repository.ts @@ -1,6 +1,6 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { DataSource, MoreThanOrEqual, QueryFailedError, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/databases/repositories/workflow-tag-mapping.repository.ts b/packages/cli/src/databases/repositories/workflow-tag-mapping.repository.ts index 108affaf11..0196437891 100644 --- a/packages/cli/src/databases/repositories/workflow-tag-mapping.repository.ts +++ b/packages/cli/src/databases/repositories/workflow-tag-mapping.repository.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DataSource, Repository } from '@n8n/typeorm'; -import { Service } from 'typedi'; import { WorkflowTagMapping } from '../entities/workflow-tag-mapping'; diff --git a/packages/cli/src/databases/repositories/workflow.repository.ts b/packages/cli/src/databases/repositories/workflow.repository.ts index 5dcd369def..7edabdde96 100644 --- a/packages/cli/src/databases/repositories/workflow.repository.ts +++ b/packages/cli/src/databases/repositories/workflow.repository.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { DataSource, Repository, @@ -10,7 +11,6 @@ import { type FindManyOptions, type FindOptionsRelations, } from '@n8n/typeorm'; -import { Service } from 'typedi'; import config from '@/config'; import type { ListQuery } from '@/requests'; diff --git a/packages/cli/src/databases/subscribers/user-subscriber.ts b/packages/cli/src/databases/subscribers/user-subscriber.ts index 2dc6a1d8e2..485eeb6fc5 100644 --- a/packages/cli/src/databases/subscribers/user-subscriber.ts +++ b/packages/cli/src/databases/subscribers/user-subscriber.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import type { EntitySubscriberInterface, UpdateEvent } from '@n8n/typeorm'; import { EventSubscriber } from '@n8n/typeorm'; import { ErrorReporter, Logger } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; -import { Container } from 'typedi'; import { Project } from '../entities/project'; import { User } from '../entities/user'; diff --git a/packages/cli/src/databases/utils/migration-helpers.ts b/packages/cli/src/databases/utils/migration-helpers.ts index 70839b9337..e248f19c83 100644 --- a/packages/cli/src/databases/utils/migration-helpers.ts +++ b/packages/cli/src/databases/utils/migration-helpers.ts @@ -1,10 +1,10 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { ObjectLiteral } from '@n8n/typeorm'; import type { QueryRunner } from '@n8n/typeorm/query-runner/QueryRunner'; import { readFileSync, rmSync } from 'fs'; import { InstanceSettings, Logger } from 'n8n-core'; import { ApplicationError, jsonParse } from 'n8n-workflow'; -import { Container } from 'typedi'; import { inTest } from '@/constants'; import { createSchemaBuilder } from '@/databases/dsl'; diff --git a/packages/cli/src/databases/utils/transformers.ts b/packages/cli/src/databases/utils/transformers.ts index a18d0cf633..7a454d519c 100644 --- a/packages/cli/src/databases/utils/transformers.ts +++ b/packages/cli/src/databases/utils/transformers.ts @@ -1,7 +1,7 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { ValueTransformer, FindOperator } from '@n8n/typeorm'; import { jsonParse } from 'n8n-workflow'; -import { Container } from 'typedi'; export const idStringifier = { from: (value?: number): string | undefined => value?.toString(), diff --git a/packages/cli/src/db.ts b/packages/cli/src/db.ts index e1c2b0e402..6f336d659d 100644 --- a/packages/cli/src/db.ts +++ b/packages/cli/src/db.ts @@ -1,10 +1,10 @@ +import { Container } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { EntityManager } from '@n8n/typeorm'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { DataSource as Connection } from '@n8n/typeorm'; import { ErrorReporter } from 'n8n-core'; import { DbConnectionTimeoutError, ensureError } from 'n8n-workflow'; -import { Container } from 'typedi'; import { inTest } from '@/constants'; import { getConnectionOptions, arePostgresOptions } from '@/databases/config'; diff --git a/packages/cli/src/decorators/__tests__/on-shutdown.test.ts b/packages/cli/src/decorators/__tests__/on-shutdown.test.ts index 774ae2ef48..a5c720c993 100644 --- a/packages/cli/src/decorators/__tests__/on-shutdown.test.ts +++ b/packages/cli/src/decorators/__tests__/on-shutdown.test.ts @@ -1,5 +1,5 @@ +import { Container, Service } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container, { Service } from 'typedi'; import { OnShutdown } from '@/decorators/on-shutdown'; import { ShutdownService } from '@/shutdown/shutdown.service'; diff --git a/packages/cli/src/decorators/controller.registry.ts b/packages/cli/src/decorators/controller.registry.ts index c68945ca07..645a675011 100644 --- a/packages/cli/src/decorators/controller.registry.ts +++ b/packages/cli/src/decorators/controller.registry.ts @@ -1,9 +1,9 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import { Router } from 'express'; import type { Application, Request, Response, RequestHandler } from 'express'; import { rateLimit as expressRateLimit } from 'express-rate-limit'; import { ApplicationError } from 'n8n-workflow'; -import { Container, Service } from 'typedi'; import type { ZodClass } from 'zod-class'; import { AuthService } from '@/auth/auth.service'; @@ -73,7 +73,7 @@ export class ControllerRegistry { .replace(/\/$/, ''); app.use(prefix, router); - const controller = Container.get(controllerClass); + const controller = Container.get(controllerClass) as Controller; const controllerMiddlewares = metadata.middlewares.map( (handlerName) => controller[handlerName].bind(controller) as RequestHandler, ); diff --git a/packages/cli/src/decorators/on-shutdown.ts b/packages/cli/src/decorators/on-shutdown.ts index dbcb547d42..3d17002105 100644 --- a/packages/cli/src/decorators/on-shutdown.ts +++ b/packages/cli/src/decorators/on-shutdown.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { ApplicationError } from 'n8n-workflow'; -import { Container } from 'typedi'; import { DEFAULT_SHUTDOWN_PRIORITY } from '@/constants'; import { type ServiceClass, ShutdownService } from '@/shutdown/shutdown.service'; diff --git a/packages/cli/src/decorators/rest-controller.ts b/packages/cli/src/decorators/rest-controller.ts index d540f6a8ac..cdd32b6e21 100644 --- a/packages/cli/src/decorators/rest-controller.ts +++ b/packages/cli/src/decorators/rest-controller.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { getControllerMetadata } from './controller.registry'; import type { Controller } from './types'; diff --git a/packages/cli/src/decorators/types.ts b/packages/cli/src/decorators/types.ts index f410df7831..17a7425882 100644 --- a/packages/cli/src/decorators/types.ts +++ b/packages/cli/src/decorators/types.ts @@ -1,6 +1,6 @@ +import type { Constructable } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; import type { RequestHandler } from 'express'; -import type { Class } from 'n8n-core'; import type { BooleanLicenseFeature } from '@/interfaces'; @@ -46,5 +46,5 @@ export interface ControllerMetadata { routes: Map; } -export type Controller = Class & +export type Controller = Constructable & Record Promise>; diff --git a/packages/cli/src/deduplication/deduplication-helper.ts b/packages/cli/src/deduplication/deduplication-helper.ts index a913a21a8c..dc6b59ac29 100644 --- a/packages/cli/src/deduplication/deduplication-helper.ts +++ b/packages/cli/src/deduplication/deduplication-helper.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { createHash } from 'crypto'; import { type ICheckProcessedContextData, @@ -10,7 +11,6 @@ import { tryToParseDateTime, } from 'n8n-workflow'; import * as assert from 'node:assert/strict'; -import { Container } from 'typedi'; import type { ProcessedData } from '@/databases/entities/processed-data'; import { ProcessedDataRepository } from '@/databases/repositories/processed-data.repository'; diff --git a/packages/cli/src/deprecation/deprecation.service.ts b/packages/cli/src/deprecation/deprecation.service.ts index b3c4cb7d21..1b2e6c6174 100644 --- a/packages/cli/src/deprecation/deprecation.service.ts +++ b/packages/cli/src/deprecation/deprecation.service.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; type EnvVarName = string; diff --git a/packages/cli/src/environments.ee/source-control/__tests__/source-control-export.service.test.ts b/packages/cli/src/environments.ee/source-control/__tests__/source-control-export.service.test.ts index b04d8a2239..2e5a5e63e3 100644 --- a/packages/cli/src/environments.ee/source-control/__tests__/source-control-export.service.test.ts +++ b/packages/cli/src/environments.ee/source-control/__tests__/source-control-export.service.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import mock from 'jest-mock-extended/lib/Mock'; import { Cipher, type InstanceSettings } from 'n8n-core'; import { ApplicationError, deepCopy } from 'n8n-workflow'; -import Container from 'typedi'; import type { CredentialsEntity } from '@/databases/entities/credentials-entity'; import type { SharedCredentials } from '@/databases/entities/shared-credentials'; diff --git a/packages/cli/src/environments.ee/source-control/__tests__/source-control-helper.ee.test.ts b/packages/cli/src/environments.ee/source-control/__tests__/source-control-helper.ee.test.ts index 5ecb04cf8a..c6d1b3857b 100644 --- a/packages/cli/src/environments.ee/source-control/__tests__/source-control-helper.ee.test.ts +++ b/packages/cli/src/environments.ee/source-control/__tests__/source-control-helper.ee.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { constants as fsConstants, accessSync } from 'fs'; import { InstanceSettings } from 'n8n-core'; import path from 'path'; -import Container from 'typedi'; import { SOURCE_CONTROL_SSH_FOLDER, diff --git a/packages/cli/src/environments.ee/source-control/__tests__/source-control.service.test.ts b/packages/cli/src/environments.ee/source-control/__tests__/source-control.service.test.ts index 8b32062d55..9024a0a32c 100644 --- a/packages/cli/src/environments.ee/source-control/__tests__/source-control.service.test.ts +++ b/packages/cli/src/environments.ee/source-control/__tests__/source-control.service.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { InstanceSettings } from 'n8n-core'; -import { Container } from 'typedi'; import { SourceControlPreferencesService } from '@/environments.ee/source-control/source-control-preferences.service.ee'; import { SourceControlService } from '@/environments.ee/source-control/source-control.service.ee'; diff --git a/packages/cli/src/environments.ee/source-control/middleware/source-control-enabled-middleware.ee.ts b/packages/cli/src/environments.ee/source-control/middleware/source-control-enabled-middleware.ee.ts index 2a8480561d..4157374d56 100644 --- a/packages/cli/src/environments.ee/source-control/middleware/source-control-enabled-middleware.ee.ts +++ b/packages/cli/src/environments.ee/source-control/middleware/source-control-enabled-middleware.ee.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { RequestHandler } from 'express'; -import { Container } from 'typedi'; import { isSourceControlLicensed } from '../source-control-helper.ee'; import { SourceControlPreferencesService } from '../source-control-preferences.service.ee'; diff --git a/packages/cli/src/environments.ee/source-control/source-control-export.service.ee.ts b/packages/cli/src/environments.ee/source-control/source-control-export.service.ee.ts index cb678d534d..4980460318 100644 --- a/packages/cli/src/environments.ee/source-control/source-control-export.service.ee.ts +++ b/packages/cli/src/environments.ee/source-control/source-control-export.service.ee.ts @@ -1,9 +1,9 @@ +import { Container, Service } from '@n8n/di'; import { rmSync } from 'fs'; import { Credentials, InstanceSettings, Logger } from 'n8n-core'; import { ApplicationError, type ICredentialDataDecryptedObject } from 'n8n-workflow'; import { writeFile as fsWriteFile, rm as fsRm } from 'node:fs/promises'; import path from 'path'; -import Container, { Service } from 'typedi'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository'; diff --git a/packages/cli/src/environments.ee/source-control/source-control-git.service.ee.ts b/packages/cli/src/environments.ee/source-control/source-control-git.service.ee.ts index 0d87d4c2d1..01aaf78c68 100644 --- a/packages/cli/src/environments.ee/source-control/source-control-git.service.ee.ts +++ b/packages/cli/src/environments.ee/source-control/source-control-git.service.ee.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import { execSync } from 'child_process'; import { Logger } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; @@ -12,7 +13,6 @@ import type { SimpleGitOptions, StatusResult, } from 'simple-git'; -import { Service } from 'typedi'; import type { User } from '@/databases/entities/user'; import { OwnershipService } from '@/services/ownership.service'; diff --git a/packages/cli/src/environments.ee/source-control/source-control-helper.ee.ts b/packages/cli/src/environments.ee/source-control/source-control-helper.ee.ts index 6e8b92f09b..031155a5b5 100644 --- a/packages/cli/src/environments.ee/source-control/source-control-helper.ee.ts +++ b/packages/cli/src/environments.ee/source-control/source-control-helper.ee.ts @@ -1,10 +1,10 @@ +import { Container } from '@n8n/di'; import { generateKeyPairSync } from 'crypto'; import { constants as fsConstants, mkdirSync, accessSync } from 'fs'; import { Logger } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; import { ok } from 'node:assert/strict'; import path from 'path'; -import { Container } from 'typedi'; import { License } from '@/license'; import { isContainedWithin } from '@/utils/path-util'; diff --git a/packages/cli/src/environments.ee/source-control/source-control-import.service.ee.ts b/packages/cli/src/environments.ee/source-control/source-control-import.service.ee.ts index 10ae293b60..8da041297b 100644 --- a/packages/cli/src/environments.ee/source-control/source-control-import.service.ee.ts +++ b/packages/cli/src/environments.ee/source-control/source-control-import.service.ee.ts @@ -1,3 +1,4 @@ +import { Container, Service } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In } from '@n8n/typeorm'; import glob from 'fast-glob'; @@ -5,7 +6,6 @@ import { Credentials, ErrorReporter, InstanceSettings, Logger } from 'n8n-core'; import { ApplicationError, jsonParse, ensureError } from 'n8n-workflow'; import { readFile as fsReadFile } from 'node:fs/promises'; import path from 'path'; -import { Container, Service } from 'typedi'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/src/environments.ee/source-control/source-control-preferences.service.ee.ts b/packages/cli/src/environments.ee/source-control/source-control-preferences.service.ee.ts index ec46e02454..e530d9d530 100644 --- a/packages/cli/src/environments.ee/source-control/source-control-preferences.service.ee.ts +++ b/packages/cli/src/environments.ee/source-control/source-control-preferences.service.ee.ts @@ -1,3 +1,4 @@ +import { Container, Service } from '@n8n/di'; import type { ValidationError } from 'class-validator'; import { validate } from 'class-validator'; import { rm as fsRm } from 'fs/promises'; @@ -5,7 +6,6 @@ import { Cipher, InstanceSettings, Logger } from 'n8n-core'; import { ApplicationError, jsonParse } from 'n8n-workflow'; import { writeFile, chmod, readFile } from 'node:fs/promises'; import path from 'path'; -import Container, { Service } from 'typedi'; import config from '@/config'; import { SettingsRepository } from '@/databases/repositories/settings.repository'; diff --git a/packages/cli/src/environments.ee/source-control/source-control.service.ee.ts b/packages/cli/src/environments.ee/source-control/source-control.service.ee.ts index 8fcb1f3571..3952b6d6b5 100644 --- a/packages/cli/src/environments.ee/source-control/source-control.service.ee.ts +++ b/packages/cli/src/environments.ee/source-control/source-control.service.ee.ts @@ -1,9 +1,9 @@ +import { Service } from '@n8n/di'; import { writeFileSync } from 'fs'; import { Logger } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; import path from 'path'; import type { PushResult } from 'simple-git'; -import { Service } from 'typedi'; import type { TagEntity } from '@/databases/entities/tag-entity'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/environments.ee/variables/environment-helpers.ts b/packages/cli/src/environments.ee/variables/environment-helpers.ts index 720d2f3a23..dd9a17c95b 100644 --- a/packages/cli/src/environments.ee/variables/environment-helpers.ts +++ b/packages/cli/src/environments.ee/variables/environment-helpers.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { License } from '@/license'; diff --git a/packages/cli/src/environments.ee/variables/variables.service.ee.ts b/packages/cli/src/environments.ee/variables/variables.service.ee.ts index 38ad5703ea..ebb134efd3 100644 --- a/packages/cli/src/environments.ee/variables/variables.service.ee.ts +++ b/packages/cli/src/environments.ee/variables/variables.service.ee.ts @@ -1,4 +1,4 @@ -import { Container, Service } from 'typedi'; +import { Container, Service } from '@n8n/di'; import type { Variables } from '@/databases/entities/variables'; import { VariablesRepository } from '@/databases/repositories/variables.repository'; diff --git a/packages/cli/src/evaluation.ee/test-definition.service.ee.ts b/packages/cli/src/evaluation.ee/test-definition.service.ee.ts index e9a31e7eee..75fbeedfe9 100644 --- a/packages/cli/src/evaluation.ee/test-definition.service.ee.ts +++ b/packages/cli/src/evaluation.ee/test-definition.service.ee.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { MockedNodeItem, TestDefinition } from '@/databases/entities/test-definition.ee'; import { AnnotationTagRepository } from '@/databases/repositories/annotation-tag.repository.ee'; diff --git a/packages/cli/src/evaluation.ee/test-runner/test-runner.service.ee.ts b/packages/cli/src/evaluation.ee/test-runner/test-runner.service.ee.ts index 9fcbe1de7c..65c6c2d300 100644 --- a/packages/cli/src/evaluation.ee/test-runner/test-runner.service.ee.ts +++ b/packages/cli/src/evaluation.ee/test-runner/test-runner.service.ee.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import { parse } from 'flatted'; import type { IDataObject, @@ -8,7 +9,6 @@ import type { } from 'n8n-workflow'; import { NodeConnectionType, Workflow } from 'n8n-workflow'; import assert from 'node:assert'; -import { Service } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import type { ExecutionEntity } from '@/databases/entities/execution-entity'; diff --git a/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-from-db.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-from-db.ts index 90049da1ff..f091d529e4 100644 --- a/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-from-db.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-from-db.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { Logger } from 'n8n-core'; import { MessageEventBusDestinationTypeNames } from 'n8n-workflow'; -import { Container } from 'typedi'; import type { EventDestinations } from '@/databases/entities/event-destinations'; diff --git a/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee.ts index c0e7657e0f..b1f0675dab 100644 --- a/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee.ts @@ -1,4 +1,5 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ +import { Container } from '@n8n/di'; import { Logger } from 'n8n-core'; import type { MessageEventBusDestinationOptions, @@ -6,7 +7,6 @@ import type { } from 'n8n-workflow'; import { MessageEventBusDestinationTypeNames } from 'n8n-workflow'; import syslog from 'syslog-client'; -import Container from 'typedi'; import { MessageEventBusDestination } from './message-event-bus-destination.ee'; import { eventMessageGenericDestinationTestEvent } from '../event-message-classes/event-message-generic'; diff --git a/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee.ts index 8bc967e789..34d4eec569 100644 --- a/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ +import { Container } from '@n8n/di'; import axios from 'axios'; import type { AxiosRequestConfig, Method } from 'axios'; import { Agent as HTTPSAgent } from 'https'; @@ -11,7 +12,6 @@ import type { IWorkflowExecuteAdditionalData, MessageEventBusDestinationWebhookOptions, } from 'n8n-workflow'; -import Container from 'typedi'; import { CredentialsHelper } from '@/credentials-helper'; import * as SecretsHelpers from '@/external-secrets.ee/external-secrets-helper.ee'; diff --git a/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination.ee.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination.ee.ts index c3aaf71173..6f990a5cfb 100644 --- a/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination.ee.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination.ee.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { Logger } from 'n8n-core'; import type { INodeCredentials, MessageEventBusDestinationOptions } from 'n8n-workflow'; import { MessageEventBusDestinationTypeNames } from 'n8n-workflow'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import { EventDestinationsRepository } from '@/databases/repositories/event-destinations.repository'; diff --git a/packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer.ts b/packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer.ts index c418035a70..0cc5d5e3a6 100644 --- a/packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer.ts +++ b/packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { once as eventOnce } from 'events'; import { createReadStream, existsSync, rmSync } from 'fs'; import remove from 'lodash/remove'; @@ -8,7 +9,6 @@ import { InstanceSettings, Logger } from 'n8n-core'; import { EventMessageTypeNames, jsonParse } from 'n8n-workflow'; import path, { parse } from 'path'; import readline from 'readline'; -import Container from 'typedi'; import { Worker } from 'worker_threads'; import { inTest } from '@/constants'; diff --git a/packages/cli/src/eventbus/message-event-bus/message-event-bus.ts b/packages/cli/src/eventbus/message-event-bus/message-event-bus.ts index 2cd35a596f..22a974f5ee 100644 --- a/packages/cli/src/eventbus/message-event-bus/message-event-bus.ts +++ b/packages/cli/src/eventbus/message-event-bus/message-event-bus.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { DeleteResult } from '@n8n/typeorm'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import @@ -7,7 +8,6 @@ import EventEmitter from 'events'; import uniqby from 'lodash/uniqBy'; import { Logger } from 'n8n-core'; import type { MessageEventBusDestinationOptions } from 'n8n-workflow'; -import { Service } from 'typedi'; import config from '@/config'; import { EventDestinationsRepository } from '@/databases/repositories/event-destinations.repository'; diff --git a/packages/cli/src/events/event.service.ts b/packages/cli/src/events/event.service.ts index b8e00ecea7..dbcb5f2955 100644 --- a/packages/cli/src/events/event.service.ts +++ b/packages/cli/src/events/event.service.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { TypedEmitter } from '@/typed-emitter'; diff --git a/packages/cli/src/events/relays/event-relay.ts b/packages/cli/src/events/relays/event-relay.ts index 13e7dc01be..742bfcba27 100644 --- a/packages/cli/src/events/relays/event-relay.ts +++ b/packages/cli/src/events/relays/event-relay.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { EventService } from '@/events/event.service'; import type { RelayEventMap } from '@/events/maps/relay.event-map'; diff --git a/packages/cli/src/events/relays/log-streaming.event-relay.ts b/packages/cli/src/events/relays/log-streaming.event-relay.ts index c65af2874c..b048b09a83 100644 --- a/packages/cli/src/events/relays/log-streaming.event-relay.ts +++ b/packages/cli/src/events/relays/log-streaming.event-relay.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import type { IWorkflowBase } from 'n8n-workflow'; -import { Service } from 'typedi'; import { Redactable } from '@/decorators/redactable'; import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; diff --git a/packages/cli/src/events/relays/telemetry.event-relay.ts b/packages/cli/src/events/relays/telemetry.event-relay.ts index a34646f100..221449bbab 100644 --- a/packages/cli/src/events/relays/telemetry.event-relay.ts +++ b/packages/cli/src/events/relays/telemetry.event-relay.ts @@ -1,11 +1,11 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { snakeCase } from 'change-case'; import { InstanceSettings } from 'n8n-core'; import type { ExecutionStatus, INodesGraphResult, ITelemetryTrackProperties } from 'n8n-workflow'; import { TelemetryHelpers } from 'n8n-workflow'; import os from 'node:os'; import { get as pslGet } from 'psl'; -import { Service } from 'typedi'; import config from '@/config'; import { N8N_VERSION } from '@/constants'; diff --git a/packages/cli/src/execution-lifecycle-hooks/restore-binary-data-id.ts b/packages/cli/src/execution-lifecycle-hooks/restore-binary-data-id.ts index 15ac8b905c..47c1031859 100644 --- a/packages/cli/src/execution-lifecycle-hooks/restore-binary-data-id.ts +++ b/packages/cli/src/execution-lifecycle-hooks/restore-binary-data-id.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import type { BinaryData } from 'n8n-core'; import { BinaryDataService, Logger } from 'n8n-core'; import type { IRun, WorkflowExecuteMode } from 'n8n-workflow'; -import Container from 'typedi'; import config from '@/config'; diff --git a/packages/cli/src/execution-lifecycle-hooks/save-execution-progress.ts b/packages/cli/src/execution-lifecycle-hooks/save-execution-progress.ts index 2047c9e82e..9e751c90f6 100644 --- a/packages/cli/src/execution-lifecycle-hooks/save-execution-progress.ts +++ b/packages/cli/src/execution-lifecycle-hooks/save-execution-progress.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { ErrorReporter, Logger } from 'n8n-core'; import type { IRunExecutionData, ITaskData, IWorkflowBase } from 'n8n-workflow'; -import { Container } from 'typedi'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; import { toSaveSettings } from '@/execution-lifecycle-hooks/to-save-settings'; diff --git a/packages/cli/src/execution-lifecycle-hooks/shared/shared-hook-functions.ts b/packages/cli/src/execution-lifecycle-hooks/shared/shared-hook-functions.ts index 4c91222126..657c430e17 100644 --- a/packages/cli/src/execution-lifecycle-hooks/shared/shared-hook-functions.ts +++ b/packages/cli/src/execution-lifecycle-hooks/shared/shared-hook-functions.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import pick from 'lodash/pick'; import { Logger } from 'n8n-core'; import { ensureError, type ExecutionStatus, type IRun, type IWorkflowBase } from 'n8n-workflow'; -import { Container } from 'typedi'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; import type { IExecutionDb, UpdateExecutionPayload } from '@/interfaces'; 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 0e6017a2bd..9cb681a7ef 100644 --- a/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts +++ b/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import { stringify } from 'flatted'; import { mock } from 'jest-mock-extended'; import { InstanceSettings } from 'n8n-core'; import { randomInt } from 'n8n-workflow'; -import Container from 'typedi'; import { ARTIFICIAL_TASK_DATA } from '@/constants'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/src/executions/execution-recovery.service.ts b/packages/cli/src/executions/execution-recovery.service.ts index f307ce0677..503e53d023 100644 --- a/packages/cli/src/executions/execution-recovery.service.ts +++ b/packages/cli/src/executions/execution-recovery.service.ts @@ -1,8 +1,8 @@ +import { Service } from '@n8n/di'; import type { DateTime } from 'luxon'; import { InstanceSettings, Logger } from 'n8n-core'; import { sleep } from 'n8n-workflow'; import type { IRun, ITaskData } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ARTIFICIAL_TASK_DATA } from '@/constants'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/src/executions/execution.service.ee.ts b/packages/cli/src/executions/execution.service.ee.ts index cb4ae332ed..b345ef6c99 100644 --- a/packages/cli/src/executions/execution.service.ee.ts +++ b/packages/cli/src/executions/execution.service.ee.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; import type { IExecutionResponse, IExecutionFlattedResponse } from '@/interfaces'; diff --git a/packages/cli/src/executions/execution.service.ts b/packages/cli/src/executions/execution.service.ts index 9eba37773f..7daff214bb 100644 --- a/packages/cli/src/executions/execution.service.ts +++ b/packages/cli/src/executions/execution.service.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { validate as jsonSchemaValidate } from 'jsonschema'; import { Logger } from 'n8n-core'; import type { @@ -16,7 +17,6 @@ import { Workflow, WorkflowOperationError, } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service'; diff --git a/packages/cli/src/expression-evaluator.ts b/packages/cli/src/expression-evaluator.ts index 434c78e114..d77838dbc1 100644 --- a/packages/cli/src/expression-evaluator.ts +++ b/packages/cli/src/expression-evaluator.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { ErrorReporter } from 'n8n-core'; import { ExpressionEvaluatorProxy } from 'n8n-workflow'; -import Container from 'typedi'; import config from '@/config'; diff --git a/packages/cli/src/external-hooks.ts b/packages/cli/src/external-hooks.ts index 764625fa23..8a0ba82c98 100644 --- a/packages/cli/src/external-hooks.ts +++ b/packages/cli/src/external-hooks.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-var-requires */ +import { Service } from '@n8n/di'; import { ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import config from '@/config'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; diff --git a/packages/cli/src/external-secrets.ee/__tests__/external-secrets-manager.ee.test.ts b/packages/cli/src/external-secrets.ee/__tests__/external-secrets-manager.ee.test.ts index 341558a5fe..f3ff03af85 100644 --- a/packages/cli/src/external-secrets.ee/__tests__/external-secrets-manager.ee.test.ts +++ b/packages/cli/src/external-secrets.ee/__tests__/external-secrets-manager.ee.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { Cipher } from 'n8n-core'; -import { Container } from 'typedi'; import { SettingsRepository } from '@/databases/repositories/settings.repository'; import { ExternalSecretsManager } from '@/external-secrets.ee/external-secrets-manager.ee'; diff --git a/packages/cli/src/external-secrets.ee/external-secrets-helper.ee.ts b/packages/cli/src/external-secrets.ee/external-secrets-helper.ee.ts index 946badde42..d2a8ba34bb 100644 --- a/packages/cli/src/external-secrets.ee/external-secrets-helper.ee.ts +++ b/packages/cli/src/external-secrets.ee/external-secrets-helper.ee.ts @@ -1,5 +1,5 @@ import { GlobalConfig } from '@n8n/config'; -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { License } from '@/license'; diff --git a/packages/cli/src/external-secrets.ee/external-secrets-manager.ee.ts b/packages/cli/src/external-secrets.ee/external-secrets-manager.ee.ts index d4adf17255..83579c3e8e 100644 --- a/packages/cli/src/external-secrets.ee/external-secrets-manager.ee.ts +++ b/packages/cli/src/external-secrets.ee/external-secrets-manager.ee.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { Cipher, Logger } from 'n8n-core'; import { jsonParse, type IDataObject, ApplicationError, ensureError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { SettingsRepository } from '@/databases/repositories/settings.repository'; import { EventService } from '@/events/event.service'; diff --git a/packages/cli/src/external-secrets.ee/external-secrets-providers.ee.ts b/packages/cli/src/external-secrets.ee/external-secrets-providers.ee.ts index 642c107603..8be0f4af06 100644 --- a/packages/cli/src/external-secrets.ee/external-secrets-providers.ee.ts +++ b/packages/cli/src/external-secrets.ee/external-secrets-providers.ee.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { SecretsProvider } from '@/interfaces'; diff --git a/packages/cli/src/external-secrets.ee/external-secrets.service.ee.ts b/packages/cli/src/external-secrets.ee/external-secrets.service.ee.ts index aab3b2069a..f9f0613348 100644 --- a/packages/cli/src/external-secrets.ee/external-secrets.service.ee.ts +++ b/packages/cli/src/external-secrets.ee/external-secrets.service.ee.ts @@ -1,6 +1,6 @@ +import { Container, Service } from '@n8n/di'; import type { IDataObject } from 'n8n-workflow'; import { deepCopy } from 'n8n-workflow'; -import Container, { Service } from 'typedi'; import { CREDENTIAL_BLANKING_VALUE } from '@/constants'; import { ExternalSecretsProviderNotFoundError } from '@/errors/external-secrets-provider-not-found.error'; diff --git a/packages/cli/src/external-secrets.ee/providers/aws-secrets/aws-secrets-manager.ts b/packages/cli/src/external-secrets.ee/providers/aws-secrets/aws-secrets-manager.ts index b22c2f2436..3e43041735 100644 --- a/packages/cli/src/external-secrets.ee/providers/aws-secrets/aws-secrets-manager.ts +++ b/packages/cli/src/external-secrets.ee/providers/aws-secrets/aws-secrets-manager.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { Logger } from 'n8n-core'; import type { INodeProperties } from 'n8n-workflow'; -import Container from 'typedi'; import { UnknownAuthTypeError } from '@/errors/unknown-auth-type.error'; import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets.ee/constants'; diff --git a/packages/cli/src/external-secrets.ee/providers/azure-key-vault/azure-key-vault.ts b/packages/cli/src/external-secrets.ee/providers/azure-key-vault/azure-key-vault.ts index a03ef468b6..ce83b09146 100644 --- a/packages/cli/src/external-secrets.ee/providers/azure-key-vault/azure-key-vault.ts +++ b/packages/cli/src/external-secrets.ee/providers/azure-key-vault/azure-key-vault.ts @@ -1,8 +1,8 @@ import type { SecretClient } from '@azure/keyvault-secrets'; +import { Container } from '@n8n/di'; import { Logger } from 'n8n-core'; import { ensureError } from 'n8n-workflow'; import type { INodeProperties } from 'n8n-workflow'; -import Container from 'typedi'; import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets.ee/constants'; import type { SecretsProvider, SecretsProviderState } from '@/interfaces'; diff --git a/packages/cli/src/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.ts b/packages/cli/src/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.ts index fe039fd50a..72f9380ff4 100644 --- a/packages/cli/src/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.ts +++ b/packages/cli/src/external-secrets.ee/providers/gcp-secrets-manager/gcp-secrets-manager.ts @@ -1,7 +1,7 @@ import type { SecretManagerServiceClient as GcpClient } from '@google-cloud/secret-manager'; +import { Container } from '@n8n/di'; import { Logger } from 'n8n-core'; import { ensureError, jsonParse, type INodeProperties } from 'n8n-workflow'; -import Container from 'typedi'; import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets.ee/constants'; import type { SecretsProvider, SecretsProviderState } from '@/interfaces'; diff --git a/packages/cli/src/external-secrets.ee/providers/vault.ts b/packages/cli/src/external-secrets.ee/providers/vault.ts index 8030832376..e27df4cc6d 100644 --- a/packages/cli/src/external-secrets.ee/providers/vault.ts +++ b/packages/cli/src/external-secrets.ee/providers/vault.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import type { AxiosInstance, AxiosResponse } from 'axios'; import axios from 'axios'; import { Logger } from 'n8n-core'; import type { IDataObject, INodeProperties } from 'n8n-workflow'; -import { Container } from 'typedi'; import type { SecretsProviderSettings, SecretsProviderState } from '@/interfaces'; import { SecretsProvider } from '@/interfaces'; diff --git a/packages/cli/src/help.ts b/packages/cli/src/help.ts index 168b9c9079..9213048fdd 100644 --- a/packages/cli/src/help.ts +++ b/packages/cli/src/help.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { Help } from '@oclif/core'; import { Logger } from 'n8n-core'; -import { Container } from 'typedi'; // oclif expects a default export // eslint-disable-next-line import/no-default-export diff --git a/packages/cli/src/ldap.ee/helpers.ee.ts b/packages/cli/src/ldap.ee/helpers.ee.ts index 7af0917054..dcc643d808 100644 --- a/packages/cli/src/ldap.ee/helpers.ee.ts +++ b/packages/cli/src/ldap.ee/helpers.ee.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import { validate } from 'jsonschema'; import type { Entry as LdapUser } from 'ldapts'; import { Filter } from 'ldapts/filters/Filter'; import { randomString } from 'n8n-workflow'; -import { Container } from 'typedi'; import config from '@/config'; import { AuthIdentity } from '@/databases/entities/auth-identity'; diff --git a/packages/cli/src/ldap.ee/ldap.service.ee.ts b/packages/cli/src/ldap.ee/ldap.service.ee.ts index 9a794bd5fc..a4d9cbc97d 100644 --- a/packages/cli/src/ldap.ee/ldap.service.ee.ts +++ b/packages/cli/src/ldap.ee/ldap.service.ee.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { QueryFailedError } from '@n8n/typeorm'; import type { Entry as LdapUser, ClientOptions } from 'ldapts'; @@ -5,7 +6,6 @@ import { Client } from 'ldapts'; import { Cipher, Logger } from 'n8n-core'; import { ApplicationError, jsonParse } from 'n8n-workflow'; import type { ConnectionOptions } from 'tls'; -import { Service } from 'typedi'; import config from '@/config'; import type { RunningMode, SyncStatus } from '@/databases/entities/auth-provider-sync-history'; diff --git a/packages/cli/src/license.ts b/packages/cli/src/license.ts index ded98d3f3c..7a747530c2 100644 --- a/packages/cli/src/license.ts +++ b/packages/cli/src/license.ts @@ -1,8 +1,8 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import type { TEntitlement, TFeatures, TLicenseBlock } from '@n8n_io/license-sdk'; import { LicenseManager } from '@n8n_io/license-sdk'; import { InstanceSettings, ObjectStoreService, Logger } from 'n8n-core'; -import Container, { Service } from 'typedi'; import config from '@/config'; import { SettingsRepository } from '@/databases/repositories/settings.repository'; diff --git a/packages/cli/src/license/license.service.ts b/packages/cli/src/license/license.service.ts index 750b42b432..bd2eca414c 100644 --- a/packages/cli/src/license/license.service.ts +++ b/packages/cli/src/license/license.service.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import axios, { AxiosError } from 'axios'; import { Logger } from 'n8n-core'; import { ensureError } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { User } from '@/databases/entities/user'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/load-nodes-and-credentials.ts b/packages/cli/src/load-nodes-and-credentials.ts index e462bd4157..b027192388 100644 --- a/packages/cli/src/load-nodes-and-credentials.ts +++ b/packages/cli/src/load-nodes-and-credentials.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import glob from 'fast-glob'; import fsPromises from 'fs/promises'; import type { Class, DirectoryLoader, Types } from 'n8n-core'; @@ -28,7 +29,6 @@ import type { import { ApplicationError, NodeConnectionType } from 'n8n-workflow'; import path from 'path'; import picocolors from 'picocolors'; -import { Container, Service } from 'typedi'; import { CUSTOM_API_CALL_KEY, diff --git a/packages/cli/src/manual-execution.service.ts b/packages/cli/src/manual-execution.service.ts index c6749696fe..fd6c27215f 100644 --- a/packages/cli/src/manual-execution.service.ts +++ b/packages/cli/src/manual-execution.service.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import * as a from 'assert/strict'; import { DirectedGraph, @@ -15,7 +16,6 @@ import type { Workflow, } from 'n8n-workflow'; import type PCancelable from 'p-cancelable'; -import { Service } from 'typedi'; @Service() export class ManualExecutionService { diff --git a/packages/cli/src/metrics/license-metrics.service.ts b/packages/cli/src/metrics/license-metrics.service.ts index 338fa70a3e..bd4ca6055b 100644 --- a/packages/cli/src/metrics/license-metrics.service.ts +++ b/packages/cli/src/metrics/license-metrics.service.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { LicenseMetricsRepository } from '@/databases/repositories/license-metrics.repository'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/metrics/prometheus-metrics.service.ts b/packages/cli/src/metrics/prometheus-metrics.service.ts index 41714d25ad..b17b8f8578 100644 --- a/packages/cli/src/metrics/prometheus-metrics.service.ts +++ b/packages/cli/src/metrics/prometheus-metrics.service.ts @@ -1,11 +1,11 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import type express from 'express'; import promBundle from 'express-prom-bundle'; import { InstanceSettings } from 'n8n-core'; import { EventMessageTypeNames } from 'n8n-workflow'; import promClient, { type Counter, type Gauge } from 'prom-client'; import semverParse from 'semver/functions/parse'; -import { Service } from 'typedi'; import config from '@/config'; import { N8N_VERSION } from '@/constants'; diff --git a/packages/cli/src/mfa/helpers.ts b/packages/cli/src/mfa/helpers.ts index d08ed98c16..9e785d293c 100644 --- a/packages/cli/src/mfa/helpers.ts +++ b/packages/cli/src/mfa/helpers.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import config from '@/config'; import { UserRepository } from '@/databases/repositories/user.repository'; diff --git a/packages/cli/src/mfa/mfa.service.ts b/packages/cli/src/mfa/mfa.service.ts index 84433f5f18..19bc9aead0 100644 --- a/packages/cli/src/mfa/mfa.service.ts +++ b/packages/cli/src/mfa/mfa.service.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { Cipher } from 'n8n-core'; -import { Service } from 'typedi'; import { v4 as uuid } from 'uuid'; import { AuthUserRepository } from '@/databases/repositories/auth-user.repository'; diff --git a/packages/cli/src/mfa/totp.service.ts b/packages/cli/src/mfa/totp.service.ts index ec9f651635..5d543fd2b1 100644 --- a/packages/cli/src/mfa/totp.service.ts +++ b/packages/cli/src/mfa/totp.service.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import OTPAuth from 'otpauth'; -import { Service } from 'typedi'; @Service() export class TOTPService { diff --git a/packages/cli/src/middlewares/body-parser.ts b/packages/cli/src/middlewares/body-parser.ts index 59327ea080..699ff72c6b 100644 --- a/packages/cli/src/middlewares/body-parser.ts +++ b/packages/cli/src/middlewares/body-parser.ts @@ -1,11 +1,11 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { Request, RequestHandler } from 'express'; import { parseIncomingMessage } from 'n8n-core'; import { jsonParse } from 'n8n-workflow'; import { parse as parseQueryString } from 'querystring'; import getRawBody from 'raw-body'; import { type Readable } from 'stream'; -import Container from 'typedi'; import { Parser as XmlParser } from 'xml2js'; import { createGunzip, createInflate } from 'zlib'; diff --git a/packages/cli/src/node-types.ts b/packages/cli/src/node-types.ts index 1837cd7bcc..77d872dc26 100644 --- a/packages/cli/src/node-types.ts +++ b/packages/cli/src/node-types.ts @@ -1,10 +1,10 @@ +import { Service } from '@n8n/di'; import type { NeededNodeType } from '@n8n/task-runner'; import type { Dirent } from 'fs'; import { readdir } from 'fs/promises'; import type { INodeType, INodeTypeDescription, INodeTypes, IVersionedNodeType } from 'n8n-workflow'; import { ApplicationError, NodeHelpers } from 'n8n-workflow'; import { join, dirname } from 'path'; -import { Service } from 'typedi'; import { LoadNodesAndCredentials } from './load-nodes-and-credentials'; diff --git a/packages/cli/src/permissions.ee/check-access.ts b/packages/cli/src/permissions.ee/check-access.ts index f4abfcc00f..062e3c1865 100644 --- a/packages/cli/src/permissions.ee/check-access.ts +++ b/packages/cli/src/permissions.ee/check-access.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In } from '@n8n/typeorm'; import { ApplicationError } from 'n8n-workflow'; -import { Container } from 'typedi'; import type { User } from '@/databases/entities/user'; import { ProjectRepository } from '@/databases/repositories/project.repository'; diff --git a/packages/cli/src/posthog/index.ts b/packages/cli/src/posthog/index.ts index be025c8a85..6dcc6dd650 100644 --- a/packages/cli/src/posthog/index.ts +++ b/packages/cli/src/posthog/index.ts @@ -1,8 +1,8 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { InstanceSettings } from 'n8n-core'; import type { FeatureFlags, ITelemetryTrackProperties } from 'n8n-workflow'; import type { PostHog } from 'posthog-node'; -import { Service } from 'typedi'; import type { PublicUser } from '@/interfaces'; diff --git a/packages/cli/src/public-api/index.ts b/packages/cli/src/public-api/index.ts index 92b3602828..1696135990 100644 --- a/packages/cli/src/public-api/index.ts +++ b/packages/cli/src/public-api/index.ts @@ -1,11 +1,11 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { Router } from 'express'; import express from 'express'; import type { HttpError } from 'express-openapi-validator/dist/framework/types'; import fs from 'fs/promises'; import path from 'path'; import type { JsonObject } from 'swagger-ui-express'; -import { Container } from 'typedi'; import validator from 'validator'; import YAML from 'yamljs'; diff --git a/packages/cli/src/public-api/v1/handlers/audit/audit.handler.ts b/packages/cli/src/public-api/v1/handlers/audit/audit.handler.ts index eb611d9ba5..595dd0cf42 100644 --- a/packages/cli/src/public-api/v1/handlers/audit/audit.handler.ts +++ b/packages/cli/src/public-api/v1/handlers/audit/audit.handler.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { Response } from 'express'; -import Container from 'typedi'; import type { AuditRequest } from '@/public-api/types'; import { globalScope } from '@/public-api/v1/shared/middlewares/global.middleware'; diff --git a/packages/cli/src/public-api/v1/handlers/credentials/credentials.handler.ts b/packages/cli/src/public-api/v1/handlers/credentials/credentials.handler.ts index d987aa827e..ef029cdaf6 100644 --- a/packages/cli/src/public-api/v1/handlers/credentials/credentials.handler.ts +++ b/packages/cli/src/public-api/v1/handlers/credentials/credentials.handler.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ +import { Container } from '@n8n/di'; import type express from 'express'; -import { Container } from 'typedi'; import { z } from 'zod'; import { CredentialTypes } from '@/credential-types'; diff --git a/packages/cli/src/public-api/v1/handlers/credentials/credentials.middleware.ts b/packages/cli/src/public-api/v1/handlers/credentials/credentials.middleware.ts index 59ebb7b6d0..181092a9b9 100644 --- a/packages/cli/src/public-api/v1/handlers/credentials/credentials.middleware.ts +++ b/packages/cli/src/public-api/v1/handlers/credentials/credentials.middleware.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/no-invalid-void-type */ +import { Container } from '@n8n/di'; import type express from 'express'; import { validate } from 'jsonschema'; -import { Container } from 'typedi'; import { CredentialTypes } from '@/credential-types'; import { CredentialsHelper } from '@/credentials-helper'; diff --git a/packages/cli/src/public-api/v1/handlers/credentials/credentials.service.ts b/packages/cli/src/public-api/v1/handlers/credentials/credentials.service.ts index 2477ef928f..4e2754a12e 100644 --- a/packages/cli/src/public-api/v1/handlers/credentials/credentials.service.ts +++ b/packages/cli/src/public-api/v1/handlers/credentials/credentials.service.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { Credentials } from 'n8n-core'; import type { DisplayCondition, @@ -5,7 +6,6 @@ import type { INodeProperties, INodePropertyOptions, } from 'n8n-workflow'; -import { Container } from 'typedi'; import { CredentialsEntity } from '@/databases/entities/credentials-entity'; import { SharedCredentials } from '@/databases/entities/shared-credentials'; diff --git a/packages/cli/src/public-api/v1/handlers/executions/executions.handler.ts b/packages/cli/src/public-api/v1/handlers/executions/executions.handler.ts index 896a4f2d0d..1eedc8de8b 100644 --- a/packages/cli/src/public-api/v1/handlers/executions/executions.handler.ts +++ b/packages/cli/src/public-api/v1/handlers/executions/executions.handler.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import type express from 'express'; import { replaceCircularReferences } from 'n8n-workflow'; -import { Container } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service'; diff --git a/packages/cli/src/public-api/v1/handlers/projects/projects.handler.ts b/packages/cli/src/public-api/v1/handlers/projects/projects.handler.ts index ea7220f788..a693058f93 100644 --- a/packages/cli/src/public-api/v1/handlers/projects/projects.handler.ts +++ b/packages/cli/src/public-api/v1/handlers/projects/projects.handler.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { Response } from 'express'; -import Container from 'typedi'; import { ProjectController } from '@/controllers/project.controller'; import { ProjectRepository } from '@/databases/repositories/project.repository'; diff --git a/packages/cli/src/public-api/v1/handlers/source-control/source-control.handler.ts b/packages/cli/src/public-api/v1/handlers/source-control/source-control.handler.ts index 6f960980ca..646a3f075e 100644 --- a/packages/cli/src/public-api/v1/handlers/source-control/source-control.handler.ts +++ b/packages/cli/src/public-api/v1/handlers/source-control/source-control.handler.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import type express from 'express'; import type { StatusResult } from 'simple-git'; -import { Container } from 'typedi'; import { getTrackingInformationFromPullResult, diff --git a/packages/cli/src/public-api/v1/handlers/tags/tags.handler.ts b/packages/cli/src/public-api/v1/handlers/tags/tags.handler.ts index daf5d78414..821be0c5fd 100644 --- a/packages/cli/src/public-api/v1/handlers/tags/tags.handler.ts +++ b/packages/cli/src/public-api/v1/handlers/tags/tags.handler.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { FindManyOptions } from '@n8n/typeorm'; import type express from 'express'; -import { Container } from 'typedi'; import type { TagEntity } from '@/databases/entities/tag-entity'; import { TagRepository } from '@/databases/repositories/tag.repository'; diff --git a/packages/cli/src/public-api/v1/handlers/users/users.handler.ee.ts b/packages/cli/src/public-api/v1/handlers/users/users.handler.ee.ts index e6c36be3ce..1a544aca29 100644 --- a/packages/cli/src/public-api/v1/handlers/users/users.handler.ee.ts +++ b/packages/cli/src/public-api/v1/handlers/users/users.handler.ee.ts @@ -1,7 +1,7 @@ import { InviteUsersRequestDto, RoleChangeRequestDto } from '@n8n/api-types'; +import { Container } from '@n8n/di'; import type express from 'express'; import type { Response } from 'express'; -import { Container } from 'typedi'; import { InvitationController } from '@/controllers/invitation.controller'; import { UsersController } from '@/controllers/users.controller'; diff --git a/packages/cli/src/public-api/v1/handlers/users/users.service.ee.ts b/packages/cli/src/public-api/v1/handlers/users/users.service.ee.ts index f4e1b86878..fa50ce3cf0 100644 --- a/packages/cli/src/public-api/v1/handlers/users/users.service.ee.ts +++ b/packages/cli/src/public-api/v1/handlers/users/users.service.ee.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In } from '@n8n/typeorm'; import pick from 'lodash/pick'; -import { Container } from 'typedi'; import { validate as uuidValidate } from 'uuid'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/public-api/v1/handlers/variables/variables.handler.ts b/packages/cli/src/public-api/v1/handlers/variables/variables.handler.ts index 9e5b6dabe6..d3eec9b2d5 100644 --- a/packages/cli/src/public-api/v1/handlers/variables/variables.handler.ts +++ b/packages/cli/src/public-api/v1/handlers/variables/variables.handler.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { Response } from 'express'; -import Container from 'typedi'; import { VariablesRepository } from '@/databases/repositories/variables.repository'; import { VariablesController } from '@/environments.ee/variables/variables.controller.ee'; diff --git a/packages/cli/src/public-api/v1/handlers/workflows/workflows.handler.ts b/packages/cli/src/public-api/v1/handlers/workflows/workflows.handler.ts index 500eaf0d13..b79ea4547b 100644 --- a/packages/cli/src/public-api/v1/handlers/workflows/workflows.handler.ts +++ b/packages/cli/src/public-api/v1/handlers/workflows/workflows.handler.ts @@ -1,9 +1,9 @@ +import { Container } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { FindOptionsWhere } from '@n8n/typeorm'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In, Like, QueryFailedError } from '@n8n/typeorm'; import type express from 'express'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import { z } from 'zod'; diff --git a/packages/cli/src/public-api/v1/handlers/workflows/workflows.service.ts b/packages/cli/src/public-api/v1/handlers/workflows/workflows.service.ts index f4a2d38156..53e67d8b0d 100644 --- a/packages/cli/src/public-api/v1/handlers/workflows/workflows.service.ts +++ b/packages/cli/src/public-api/v1/handlers/workflows/workflows.service.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; -import { Container } from 'typedi'; import config from '@/config'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/src/public-api/v1/shared/middlewares/global.middleware.ts b/packages/cli/src/public-api/v1/shared/middlewares/global.middleware.ts index ace75ef610..3343d8daac 100644 --- a/packages/cli/src/public-api/v1/shared/middlewares/global.middleware.ts +++ b/packages/cli/src/public-api/v1/shared/middlewares/global.middleware.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-invalid-void-type */ +import { Container } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; import type express from 'express'; -import { Container } from 'typedi'; import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error'; import type { BooleanLicenseFeature } from '@/interfaces'; diff --git a/packages/cli/src/push/__tests__/websocket.push.test.ts b/packages/cli/src/push/__tests__/websocket.push.test.ts index c13a319ebf..64a5526300 100644 --- a/packages/cli/src/push/__tests__/websocket.push.test.ts +++ b/packages/cli/src/push/__tests__/websocket.push.test.ts @@ -1,7 +1,7 @@ import type { PushMessage } from '@n8n/api-types'; +import { Container } from '@n8n/di'; import { EventEmitter } from 'events'; import { Logger } from 'n8n-core'; -import { Container } from 'typedi'; import type WebSocket from 'ws'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/push/abstract.push.ts b/packages/cli/src/push/abstract.push.ts index b1c4514d8d..d42fddb556 100644 --- a/packages/cli/src/push/abstract.push.ts +++ b/packages/cli/src/push/abstract.push.ts @@ -1,7 +1,7 @@ import type { PushMessage } from '@n8n/api-types'; +import { Service } from '@n8n/di'; import { ErrorReporter, Logger } from 'n8n-core'; import { assert, jsonStringify } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { User } from '@/databases/entities/user'; import type { OnPushMessage } from '@/push/types'; diff --git a/packages/cli/src/push/index.ts b/packages/cli/src/push/index.ts index 20d0c7a9c5..e795df5722 100644 --- a/packages/cli/src/push/index.ts +++ b/packages/cli/src/push/index.ts @@ -1,11 +1,11 @@ import type { PushMessage } from '@n8n/api-types'; +import { Container, Service } from '@n8n/di'; import type { Application } from 'express'; import { ServerResponse } from 'http'; import type { Server } from 'http'; import { InstanceSettings, Logger } from 'n8n-core'; import { deepCopy } from 'n8n-workflow'; import type { Socket } from 'net'; -import { Container, Service } from 'typedi'; import { parse as parseUrl } from 'url'; import { Server as WSServer } from 'ws'; diff --git a/packages/cli/src/push/sse.push.ts b/packages/cli/src/push/sse.push.ts index 04e39d6d79..9c92cc8cb3 100644 --- a/packages/cli/src/push/sse.push.ts +++ b/packages/cli/src/push/sse.push.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/push/websocket.push.ts b/packages/cli/src/push/websocket.push.ts index 97e45028b2..297490f6cf 100644 --- a/packages/cli/src/push/websocket.push.ts +++ b/packages/cli/src/push/websocket.push.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import type WebSocket from 'ws'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/response-helper.ts b/packages/cli/src/response-helper.ts index f7f448cc9d..74f274560e 100644 --- a/packages/cli/src/response-helper.ts +++ b/packages/cli/src/response-helper.ts @@ -1,10 +1,10 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ +import { Container } from '@n8n/di'; import type { Request, Response } from 'express'; import { ErrorReporter, Logger } from 'n8n-core'; import { FORM_TRIGGER_PATH_IDENTIFIER, NodeApiError } from 'n8n-workflow'; import { Readable } from 'node:stream'; import picocolors from 'picocolors'; -import Container from 'typedi'; import { inDevelopment } from '@/constants'; diff --git a/packages/cli/src/scaling/__tests__/scaling.service.test.ts b/packages/cli/src/scaling/__tests__/scaling.service.test.ts index 56836b18c6..2d03dac507 100644 --- a/packages/cli/src/scaling/__tests__/scaling.service.test.ts +++ b/packages/cli/src/scaling/__tests__/scaling.service.test.ts @@ -1,9 +1,9 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import * as BullModule from 'bull'; import { mock } from 'jest-mock-extended'; import { InstanceSettings } from 'n8n-core'; import { ApplicationError, ExecutionCancelledError } from 'n8n-workflow'; -import Container from 'typedi'; import { mockInstance, mockLogger } from '@test/mocking'; diff --git a/packages/cli/src/scaling/job-processor.ts b/packages/cli/src/scaling/job-processor.ts index 16a5efd3b3..2aff0787c4 100644 --- a/packages/cli/src/scaling/job-processor.ts +++ b/packages/cli/src/scaling/job-processor.ts @@ -1,4 +1,5 @@ import type { RunningJobSummary } from '@n8n/api-types'; +import { Service } from '@n8n/di'; import { InstanceSettings, WorkflowExecute, ErrorReporter, Logger } from 'n8n-core'; import type { ExecutionStatus, @@ -8,7 +9,6 @@ import type { } from 'n8n-workflow'; import { BINARY_ENCODING, ApplicationError, Workflow } from 'n8n-workflow'; import type PCancelable from 'p-cancelable'; -import { Service } from 'typedi'; import config from '@/config'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/src/scaling/multi-main-setup.ee.ts b/packages/cli/src/scaling/multi-main-setup.ee.ts index 1a2554965c..52f186bdcc 100644 --- a/packages/cli/src/scaling/multi-main-setup.ee.ts +++ b/packages/cli/src/scaling/multi-main-setup.ee.ts @@ -1,6 +1,6 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { InstanceSettings, Logger } from 'n8n-core'; -import { Service } from 'typedi'; import config from '@/config'; import { Time } from '@/constants'; diff --git a/packages/cli/src/scaling/pubsub/publisher.service.ts b/packages/cli/src/scaling/pubsub/publisher.service.ts index 551d1b6caf..a0d2079704 100644 --- a/packages/cli/src/scaling/pubsub/publisher.service.ts +++ b/packages/cli/src/scaling/pubsub/publisher.service.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import type { Redis as SingleNodeClient, Cluster as MultiNodeClient } from 'ioredis'; import { InstanceSettings, Logger } from 'n8n-core'; import type { LogMetadata } from 'n8n-workflow'; -import { Service } from 'typedi'; import config from '@/config'; import { RedisClientService } from '@/services/redis-client.service'; diff --git a/packages/cli/src/scaling/pubsub/pubsub-handler.ts b/packages/cli/src/scaling/pubsub/pubsub-handler.ts index 9059027704..25b189c141 100644 --- a/packages/cli/src/scaling/pubsub/pubsub-handler.ts +++ b/packages/cli/src/scaling/pubsub/pubsub-handler.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { InstanceSettings } from 'n8n-core'; import { ensureError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/scaling/pubsub/subscriber.service.ts b/packages/cli/src/scaling/pubsub/subscriber.service.ts index c2d5498243..4d2b5e3314 100644 --- a/packages/cli/src/scaling/pubsub/subscriber.service.ts +++ b/packages/cli/src/scaling/pubsub/subscriber.service.ts @@ -1,9 +1,9 @@ +import { Service } from '@n8n/di'; import type { Redis as SingleNodeClient, Cluster as MultiNodeClient } from 'ioredis'; import debounce from 'lodash/debounce'; import { InstanceSettings, Logger } from 'n8n-core'; import { jsonParse } from 'n8n-workflow'; import type { LogMetadata } from 'n8n-workflow'; -import { Service } from 'typedi'; import config from '@/config'; import { EventService } from '@/events/event.service'; diff --git a/packages/cli/src/scaling/scaling.service.ts b/packages/cli/src/scaling/scaling.service.ts index 1963aa9ac9..536e835c72 100644 --- a/packages/cli/src/scaling/scaling.service.ts +++ b/packages/cli/src/scaling/scaling.service.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import { ErrorReporter, InstanceSettings, Logger } from 'n8n-core'; import { ApplicationError, @@ -10,7 +11,6 @@ import { } from 'n8n-workflow'; import type { IExecuteResponsePromiseData } from 'n8n-workflow'; import assert, { strict } from 'node:assert'; -import Container, { Service } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import config from '@/config'; diff --git a/packages/cli/src/scaling/worker-server.ts b/packages/cli/src/scaling/worker-server.ts index 8112f3a4f5..07b9533626 100644 --- a/packages/cli/src/scaling/worker-server.ts +++ b/packages/cli/src/scaling/worker-server.ts @@ -1,11 +1,11 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import type { Application } from 'express'; import express from 'express'; import { InstanceSettings, Logger } from 'n8n-core'; import { strict as assert } from 'node:assert'; import http from 'node:http'; import type { Server } from 'node:http'; -import { Service } from 'typedi'; import { CredentialsOverwrites } from '@/credentials-overwrites'; import * as Db from '@/db'; diff --git a/packages/cli/src/scaling/worker-status.service.ee.ts b/packages/cli/src/scaling/worker-status.service.ee.ts index a50a1b8d2e..226ee3f70f 100644 --- a/packages/cli/src/scaling/worker-status.service.ee.ts +++ b/packages/cli/src/scaling/worker-status.service.ee.ts @@ -1,7 +1,7 @@ import type { WorkerStatus } from '@n8n/api-types'; +import { Service } from '@n8n/di'; import { InstanceSettings } from 'n8n-core'; import os from 'node:os'; -import { Service } from 'typedi'; import { N8N_VERSION } from '@/constants'; diff --git a/packages/cli/src/secrets-helpers.ee.ts b/packages/cli/src/secrets-helpers.ee.ts index fdc18c4b85..7390bf8795 100644 --- a/packages/cli/src/secrets-helpers.ee.ts +++ b/packages/cli/src/secrets-helpers.ee.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import type { SecretsHelpersBase } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ExternalSecretsManager } from './external-secrets.ee/external-secrets-manager.ee'; diff --git a/packages/cli/src/security-audit/risk-reporters/credentials-risk-reporter.ts b/packages/cli/src/security-audit/risk-reporters/credentials-risk-reporter.ts index 0c8d84211e..ca8bf11415 100644 --- a/packages/cli/src/security-audit/risk-reporters/credentials-risk-reporter.ts +++ b/packages/cli/src/security-audit/risk-reporters/credentials-risk-reporter.ts @@ -1,6 +1,6 @@ import { SecurityConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import type { IWorkflowBase } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; diff --git a/packages/cli/src/security-audit/risk-reporters/database-risk-reporter.ts b/packages/cli/src/security-audit/risk-reporters/database-risk-reporter.ts index 9dad0829ae..f66ae02282 100644 --- a/packages/cli/src/security-audit/risk-reporters/database-risk-reporter.ts +++ b/packages/cli/src/security-audit/risk-reporters/database-risk-reporter.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { WorkflowEntity as Workflow } from '@/databases/entities/workflow-entity'; import { diff --git a/packages/cli/src/security-audit/risk-reporters/filesystem-risk-reporter.ts b/packages/cli/src/security-audit/risk-reporters/filesystem-risk-reporter.ts index 645e6f8684..a73b152d2e 100644 --- a/packages/cli/src/security-audit/risk-reporters/filesystem-risk-reporter.ts +++ b/packages/cli/src/security-audit/risk-reporters/filesystem-risk-reporter.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; import { FILESYSTEM_INTERACTION_NODE_TYPES, FILESYSTEM_REPORT } from '@/security-audit/constants'; diff --git a/packages/cli/src/security-audit/risk-reporters/instance-risk-reporter.ts b/packages/cli/src/security-audit/risk-reporters/instance-risk-reporter.ts index 92874e87f0..8d870b5d76 100644 --- a/packages/cli/src/security-audit/risk-reporters/instance-risk-reporter.ts +++ b/packages/cli/src/security-audit/risk-reporters/instance-risk-reporter.ts @@ -1,7 +1,7 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import axios from 'axios'; import { InstanceSettings, Logger } from 'n8n-core'; -import { Service } from 'typedi'; import config from '@/config'; import { getN8nPackageJson, inDevelopment } from '@/constants'; diff --git a/packages/cli/src/security-audit/risk-reporters/nodes-risk-reporter.ts b/packages/cli/src/security-audit/risk-reporters/nodes-risk-reporter.ts index 4908ff9329..58f6da5e18 100644 --- a/packages/cli/src/security-audit/risk-reporters/nodes-risk-reporter.ts +++ b/packages/cli/src/security-audit/risk-reporters/nodes-risk-reporter.ts @@ -1,7 +1,7 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import glob from 'fast-glob'; import * as path from 'path'; -import { Service } from 'typedi'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials'; diff --git a/packages/cli/src/security-audit/security-audit.service.ts b/packages/cli/src/security-audit/security-audit.service.ts index 97b5424a19..b0946b5409 100644 --- a/packages/cli/src/security-audit/security-audit.service.ts +++ b/packages/cli/src/security-audit/security-audit.service.ts @@ -1,5 +1,5 @@ import { SecurityConfig } from '@n8n/config'; -import Container, { Service } from 'typedi'; +import { Container, Service } from '@n8n/di'; import config from '@/config'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/server.ts b/packages/cli/src/server.ts index b2b1c3a1c8..09e3774aae 100644 --- a/packages/cli/src/server.ts +++ b/packages/cli/src/server.ts @@ -1,10 +1,10 @@ +import { Container, Service } from '@n8n/di'; import cookieParser from 'cookie-parser'; import express from 'express'; import { access as fsAccess } from 'fs/promises'; import helmet from 'helmet'; import { InstanceSettings } from 'n8n-core'; import { resolve } from 'path'; -import { Container, Service } from 'typedi'; import { AbstractServer } from '@/abstract-server'; import config from '@/config'; diff --git a/packages/cli/src/services/__tests__/execution-metadata.service.test.ts b/packages/cli/src/services/__tests__/execution-metadata.service.test.ts index 4b713d6872..309da5a354 100644 --- a/packages/cli/src/services/__tests__/execution-metadata.service.test.ts +++ b/packages/cli/src/services/__tests__/execution-metadata.service.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { ExecutionMetadataRepository } from '@/databases/repositories/execution-metadata.repository'; import { ExecutionMetadataService } from '@/services/execution-metadata.service'; diff --git a/packages/cli/src/services/__tests__/orchestration.service.test.ts b/packages/cli/src/services/__tests__/orchestration.service.test.ts index 45e79036ac..89c043a589 100644 --- a/packages/cli/src/services/__tests__/orchestration.service.test.ts +++ b/packages/cli/src/services/__tests__/orchestration.service.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import type Redis from 'ioredis'; import { mock } from 'jest-mock-extended'; import { InstanceSettings } from 'n8n-core'; -import Container from 'typedi'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import config from '@/config'; diff --git a/packages/cli/src/services/__tests__/password.utility.test.ts b/packages/cli/src/services/__tests__/password.utility.test.ts index ff2956844b..4662f7c32a 100644 --- a/packages/cli/src/services/__tests__/password.utility.test.ts +++ b/packages/cli/src/services/__tests__/password.utility.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { PasswordUtility } from '@/services/password.utility'; diff --git a/packages/cli/src/services/__tests__/workflow-statistics.service.test.ts b/packages/cli/src/services/__tests__/workflow-statistics.service.test.ts index 6d28dbe563..6336eb546a 100644 --- a/packages/cli/src/services/__tests__/workflow-statistics.service.test.ts +++ b/packages/cli/src/services/__tests__/workflow-statistics.service.test.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { QueryFailedError, type DataSource, @@ -8,7 +9,6 @@ import { import { mocked } from 'jest-mock'; import { mock } from 'jest-mock-extended'; import type { INode, IRun, WorkflowExecuteMode } from 'n8n-workflow'; -import { Container } from 'typedi'; import config from '@/config'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/src/services/access.service.ts b/packages/cli/src/services/access.service.ts index 49ac7bfe23..7a7030b93e 100644 --- a/packages/cli/src/services/access.service.ts +++ b/packages/cli/src/services/access.service.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import type { Workflow } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { User } from '@/databases/entities/user'; import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository'; diff --git a/packages/cli/src/services/active-workflows.service.ts b/packages/cli/src/services/active-workflows.service.ts index d2c50c74c2..98b96af33a 100644 --- a/packages/cli/src/services/active-workflows.service.ts +++ b/packages/cli/src/services/active-workflows.service.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; -import { Service } from 'typedi'; import { ActivationErrorsService } from '@/activation-errors.service'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/services/ai.service.ts b/packages/cli/src/services/ai.service.ts index 6a39306ef5..32c6c8b0f9 100644 --- a/packages/cli/src/services/ai.service.ts +++ b/packages/cli/src/services/ai.service.ts @@ -4,9 +4,9 @@ import type { AiChatRequestDto, } from '@n8n/api-types'; import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { AiAssistantClient } from '@n8n_io/ai-assistant-sdk'; import { assert, type IUser } from 'n8n-workflow'; -import { Service } from 'typedi'; import { N8N_VERSION } from '../constants'; import { License } from '../license'; diff --git a/packages/cli/src/services/annotation-tag.service.ee.ts b/packages/cli/src/services/annotation-tag.service.ee.ts index 671395168c..9c56a7bee4 100644 --- a/packages/cli/src/services/annotation-tag.service.ee.ts +++ b/packages/cli/src/services/annotation-tag.service.ee.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { AnnotationTagEntity } from '@/databases/entities/annotation-tag-entity.ee'; import { AnnotationTagRepository } from '@/databases/repositories/annotation-tag.repository.ee'; diff --git a/packages/cli/src/services/cache/__tests__/cache-mock.service.test.ts b/packages/cli/src/services/cache/__tests__/cache-mock.service.test.ts index d515aae5be..a6863997a5 100644 --- a/packages/cli/src/services/cache/__tests__/cache-mock.service.test.ts +++ b/packages/cli/src/services/cache/__tests__/cache-mock.service.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import { CacheService } from '@/services/cache/cache.service'; diff --git a/packages/cli/src/services/cache/__tests__/cache.service.test.ts b/packages/cli/src/services/cache/__tests__/cache.service.test.ts index e87e46984b..5aaaf4b860 100644 --- a/packages/cli/src/services/cache/__tests__/cache.service.test.ts +++ b/packages/cli/src/services/cache/__tests__/cache.service.test.ts @@ -1,6 +1,6 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { sleep } from 'n8n-workflow'; -import Container from 'typedi'; import config from '@/config'; import { CacheService } from '@/services/cache/cache.service'; diff --git a/packages/cli/src/services/cache/cache.service.ts b/packages/cli/src/services/cache/cache.service.ts index f82bac3d02..ab681d3e5b 100644 --- a/packages/cli/src/services/cache/cache.service.ts +++ b/packages/cli/src/services/cache/cache.service.ts @@ -1,7 +1,7 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import { caching } from 'cache-manager'; import { ApplicationError, jsonStringify } from 'n8n-workflow'; -import Container, { Service } from 'typedi'; import config from '@/config'; import { Time } from '@/constants'; diff --git a/packages/cli/src/services/community-packages.service.ts b/packages/cli/src/services/community-packages.service.ts index a94b4d5c4f..c85872c5e2 100644 --- a/packages/cli/src/services/community-packages.service.ts +++ b/packages/cli/src/services/community-packages.service.ts @@ -1,11 +1,11 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import axios from 'axios'; import { exec } from 'child_process'; import { access as fsAccess, mkdir as fsMkdir } from 'fs/promises'; import type { PackageDirectoryLoader } from 'n8n-core'; import { InstanceSettings, Logger } from 'n8n-core'; import { ApplicationError, type PublicInstalledPackage } from 'n8n-workflow'; -import { Service } from 'typedi'; import { promisify } from 'util'; import { diff --git a/packages/cli/src/services/credentials-tester.service.ts b/packages/cli/src/services/credentials-tester.service.ts index 0709d77e06..1954923481 100644 --- a/packages/cli/src/services/credentials-tester.service.ts +++ b/packages/cli/src/services/credentials-tester.service.ts @@ -3,6 +3,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-call */ +import { Service } from '@n8n/di'; import get from 'lodash/get'; import { ErrorReporter, @@ -30,7 +31,6 @@ import type { IDataObject, } from 'n8n-workflow'; import { VersionedNodeType, NodeHelpers, Workflow, ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { CredentialTypes } from '@/credential-types'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/services/cta.service.ts b/packages/cli/src/services/cta.service.ts index 221674cfa7..ec0763dcda 100644 --- a/packages/cli/src/services/cta.service.ts +++ b/packages/cli/src/services/cta.service.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { User } from '@/databases/entities/user'; import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository'; diff --git a/packages/cli/src/services/curl.service.ts b/packages/cli/src/services/curl.service.ts index 8875fd9828..fae967154e 100644 --- a/packages/cli/src/services/curl.service.ts +++ b/packages/cli/src/services/curl.service.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import get from 'lodash/get'; import type { IDataObject } from 'n8n-workflow'; import { jsonParse } from 'n8n-workflow'; -import { Service } from 'typedi'; import curlconverter from 'curlconverter'; diff --git a/packages/cli/src/services/dynamic-node-parameters.service.ts b/packages/cli/src/services/dynamic-node-parameters.service.ts index 65c40ef0b6..0cde1c8489 100644 --- a/packages/cli/src/services/dynamic-node-parameters.service.ts +++ b/packages/cli/src/services/dynamic-node-parameters.service.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import { LoadOptionsContext, RoutingNode, LocalLoadOptionsContext } from 'n8n-core'; import type { ILoadOptions, @@ -20,7 +21,6 @@ import type { ILocalLoadOptionsFunctions, } from 'n8n-workflow'; import { Workflow, ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { NodeTypes } from '@/node-types'; diff --git a/packages/cli/src/services/execution-metadata.service.ts b/packages/cli/src/services/execution-metadata.service.ts index b88b68f12f..0c66b1daa2 100644 --- a/packages/cli/src/services/execution-metadata.service.ts +++ b/packages/cli/src/services/execution-metadata.service.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { ExecutionMetadata } from '@/databases/entities/execution-metadata'; import { ExecutionMetadataRepository } from '@/databases/repositories/execution-metadata.repository'; diff --git a/packages/cli/src/services/frontend.service.ts b/packages/cli/src/services/frontend.service.ts index 34b4b3d6b9..099ae2c935 100644 --- a/packages/cli/src/services/frontend.service.ts +++ b/packages/cli/src/services/frontend.service.ts @@ -1,12 +1,12 @@ import type { FrontendSettings, ITelemetrySettings } from '@n8n/api-types'; import { GlobalConfig, FrontendConfig, SecurityConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import { createWriteStream } from 'fs'; import { mkdir } from 'fs/promises'; import uniq from 'lodash/uniq'; import { InstanceSettings, Logger } from 'n8n-core'; import type { ICredentialType, INodeTypeBaseDescription } from 'n8n-workflow'; import path from 'path'; -import { Container, Service } from 'typedi'; import config from '@/config'; import { inE2ETests, LICENSE_FEATURES, N8N_VERSION } from '@/constants'; diff --git a/packages/cli/src/services/hooks.service.ts b/packages/cli/src/services/hooks.service.ts index 19b2f8deb8..2d2b137279 100644 --- a/packages/cli/src/services/hooks.service.ts +++ b/packages/cli/src/services/hooks.service.ts @@ -1,9 +1,9 @@ +import { Service } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { FindManyOptions, FindOneOptions, FindOptionsWhere } from '@n8n/typeorm'; import type { QueryDeepPartialEntity } from '@n8n/typeorm/query-builder/QueryPartialEntity'; import RudderStack, { type constructorOptions } from '@rudderstack/rudder-sdk-node'; import type { NextFunction, Response } from 'express'; -import { Service } from 'typedi'; import { AuthService } from '@/auth/auth.service'; import type { AuthUser } from '@/databases/entities/auth-user'; diff --git a/packages/cli/src/services/import.service.ts b/packages/cli/src/services/import.service.ts index 4f63357dd6..dcb7bff0ad 100644 --- a/packages/cli/src/services/import.service.ts +++ b/packages/cli/src/services/import.service.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import { type INode, type INodeCredentialsDetails } from 'n8n-workflow'; -import { Service } from 'typedi'; import { v4 as uuid } from 'uuid'; import { Project } from '@/databases/entities/project'; diff --git a/packages/cli/src/services/jwt.service.ts b/packages/cli/src/services/jwt.service.ts index 8058de10dd..0601309013 100644 --- a/packages/cli/src/services/jwt.service.ts +++ b/packages/cli/src/services/jwt.service.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import { createHash } from 'crypto'; import jwt from 'jsonwebtoken'; import { InstanceSettings } from 'n8n-core'; -import { Service } from 'typedi'; import config from '@/config'; diff --git a/packages/cli/src/services/naming.service.ts b/packages/cli/src/services/naming.service.ts index a715b2b360..70384ac15a 100644 --- a/packages/cli/src/services/naming.service.ts +++ b/packages/cli/src/services/naming.service.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/services/orchestration.service.ts b/packages/cli/src/services/orchestration.service.ts index adf03d97bf..2745108c69 100644 --- a/packages/cli/src/services/orchestration.service.ts +++ b/packages/cli/src/services/orchestration.service.ts @@ -1,6 +1,6 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import { InstanceSettings } from 'n8n-core'; -import Container, { Service } from 'typedi'; import config from '@/config'; import type { Publisher } from '@/scaling/pubsub/publisher.service'; diff --git a/packages/cli/src/services/ownership.service.ts b/packages/cli/src/services/ownership.service.ts index 22403304a1..21ce4b573a 100644 --- a/packages/cli/src/services/ownership.service.ts +++ b/packages/cli/src/services/ownership.service.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { Project } from '@/databases/entities/project'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/services/password.utility.ts b/packages/cli/src/services/password.utility.ts index 352002fa95..f4119c47a0 100644 --- a/packages/cli/src/services/password.utility.ts +++ b/packages/cli/src/services/password.utility.ts @@ -1,5 +1,5 @@ +import { Service as Utility } from '@n8n/di'; import { compare, hash } from 'bcryptjs'; -import { Service as Utility } from 'typedi'; const SALT_ROUNDS = 10; diff --git a/packages/cli/src/services/project.service.ee.ts b/packages/cli/src/services/project.service.ee.ts index af4505217f..aa93360287 100644 --- a/packages/cli/src/services/project.service.ee.ts +++ b/packages/cli/src/services/project.service.ee.ts @@ -1,10 +1,10 @@ +import { Container, Service } from '@n8n/di'; import { type Scope } from '@n8n/permissions'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { FindOptionsWhere, EntityManager } from '@n8n/typeorm'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In, Not } from '@n8n/typeorm'; import { ApplicationError } from 'n8n-workflow'; -import Container, { Service } from 'typedi'; import { UNLIMITED_LICENSE_QUOTA } from '@/constants'; import type { ProjectIcon, ProjectType } from '@/databases/entities/project'; diff --git a/packages/cli/src/services/pruning/pruning.service.ts b/packages/cli/src/services/pruning/pruning.service.ts index 15d81dc48e..749c2d9d45 100644 --- a/packages/cli/src/services/pruning/pruning.service.ts +++ b/packages/cli/src/services/pruning/pruning.service.ts @@ -1,8 +1,8 @@ import { ExecutionsConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { BinaryDataService, InstanceSettings, Logger } from 'n8n-core'; import { ensureError } from 'n8n-workflow'; import { strict } from 'node:assert'; -import { Service } from 'typedi'; import { Time } from '@/constants'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/src/services/public-api-key.service.ts b/packages/cli/src/services/public-api-key.service.ts index bca3cd0d62..a6b1133bc2 100644 --- a/packages/cli/src/services/public-api-key.service.ts +++ b/packages/cli/src/services/public-api-key.service.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import type { OpenAPIV3 } from 'openapi-types'; -import { Service } from 'typedi'; import { ApiKey } from '@/databases/entities/api-key'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/services/redis-client.service.ts b/packages/cli/src/services/redis-client.service.ts index 894d3af671..6dea89a801 100644 --- a/packages/cli/src/services/redis-client.service.ts +++ b/packages/cli/src/services/redis-client.service.ts @@ -1,8 +1,8 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import ioRedis from 'ioredis'; import type { Cluster, RedisOptions } from 'ioredis'; import { Logger } from 'n8n-core'; -import { Service } from 'typedi'; import { Debounce } from '@/decorators/debounce'; import { TypedEmitter } from '@/typed-emitter'; diff --git a/packages/cli/src/services/role.service.ts b/packages/cli/src/services/role.service.ts index a4fd5daee1..7590dca2d5 100644 --- a/packages/cli/src/services/role.service.ts +++ b/packages/cli/src/services/role.service.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { combineScopes, type Resource, type Scope } from '@n8n/permissions'; import { ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { CredentialsEntity } from '@/databases/entities/credentials-entity'; import type { ProjectRelation, ProjectRole } from '@/databases/entities/project-relation'; diff --git a/packages/cli/src/services/tag.service.ts b/packages/cli/src/services/tag.service.ts index 7ed3feebff..09695f44ff 100644 --- a/packages/cli/src/services/tag.service.ts +++ b/packages/cli/src/services/tag.service.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import type { TagEntity } from '@/databases/entities/tag-entity'; import { TagRepository } from '@/databases/repositories/tag.repository'; diff --git a/packages/cli/src/services/url.service.ts b/packages/cli/src/services/url.service.ts index f9d3fcdbbd..3851c011ca 100644 --- a/packages/cli/src/services/url.service.ts +++ b/packages/cli/src/services/url.service.ts @@ -1,5 +1,5 @@ import { GlobalConfig } from '@n8n/config'; -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import config from '@/config'; diff --git a/packages/cli/src/services/user.service.ts b/packages/cli/src/services/user.service.ts index 3d2cb30471..ab188fc972 100644 --- a/packages/cli/src/services/user.service.ts +++ b/packages/cli/src/services/user.service.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import type { IUserSettings } from 'n8n-workflow'; import { ApplicationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { User, AssignableRole } from '@/databases/entities/user'; import { UserRepository } from '@/databases/repositories/user.repository'; diff --git a/packages/cli/src/services/workflow-loader.service.ts b/packages/cli/src/services/workflow-loader.service.ts index ca1a9ff48c..5d5e08c1fe 100644 --- a/packages/cli/src/services/workflow-loader.service.ts +++ b/packages/cli/src/services/workflow-loader.service.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { ApplicationError, type IWorkflowBase, type IWorkflowLoader } from 'n8n-workflow'; -import { Service } from 'typedi'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/src/services/workflow-statistics.service.ts b/packages/cli/src/services/workflow-statistics.service.ts index 9c0282eb85..efcdc8320f 100644 --- a/packages/cli/src/services/workflow-statistics.service.ts +++ b/packages/cli/src/services/workflow-statistics.service.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import type { INode, IRun, IWorkflowBase } from 'n8n-workflow'; -import { Service } from 'typedi'; import { StatisticsNames } from '@/databases/entities/workflow-statistics'; import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository'; diff --git a/packages/cli/src/shutdown/__tests__/shutdown.service.test.ts b/packages/cli/src/shutdown/__tests__/shutdown.service.test.ts index 26d6471584..41afed9398 100644 --- a/packages/cli/src/shutdown/__tests__/shutdown.service.test.ts +++ b/packages/cli/src/shutdown/__tests__/shutdown.service.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import type { ErrorReporter } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; -import Container from 'typedi'; import type { ServiceClass } from '@/shutdown/shutdown.service'; import { ShutdownService } from '@/shutdown/shutdown.service'; diff --git a/packages/cli/src/shutdown/shutdown.service.ts b/packages/cli/src/shutdown/shutdown.service.ts index 1597b2a27f..d31ca9b154 100644 --- a/packages/cli/src/shutdown/shutdown.service.ts +++ b/packages/cli/src/shutdown/shutdown.service.ts @@ -1,7 +1,7 @@ +import { Container, Service } from '@n8n/di'; import { type Class, ErrorReporter } from 'n8n-core'; import { Logger } from 'n8n-core'; import { ApplicationError, assert } from 'n8n-workflow'; -import { Container, Service } from 'typedi'; import { LOWEST_SHUTDOWN_PRIORITY, HIGHEST_SHUTDOWN_PRIORITY } from '@/constants'; diff --git a/packages/cli/src/sso.ee/saml/saml-helpers.ts b/packages/cli/src/sso.ee/saml/saml-helpers.ts index 8479314d4b..b0620acdd3 100644 --- a/packages/cli/src/sso.ee/saml/saml-helpers.ts +++ b/packages/cli/src/sso.ee/saml/saml-helpers.ts @@ -1,7 +1,7 @@ import type { SamlAcsDto, SamlPreferences } from '@n8n/api-types'; +import { Container } from '@n8n/di'; import { randomString } from 'n8n-workflow'; import type { FlowResult } from 'samlify/types/src/flow'; -import { Container } from 'typedi'; import config from '@/config'; import { AuthIdentity } from '@/databases/entities/auth-identity'; diff --git a/packages/cli/src/sso.ee/saml/saml-validator.ts b/packages/cli/src/sso.ee/saml/saml-validator.ts index 570b279c72..e2deaa6b6d 100644 --- a/packages/cli/src/sso.ee/saml/saml-validator.ts +++ b/packages/cli/src/sso.ee/saml/saml-validator.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; -import { Service } from 'typedi'; import type { XMLFileInfo, XMLLintOptions, XMLValidationResult } from 'xmllint-wasm'; @Service() diff --git a/packages/cli/src/sso.ee/saml/saml.service.ee.ts b/packages/cli/src/sso.ee/saml/saml.service.ee.ts index fd03471b67..a0d20e4102 100644 --- a/packages/cli/src/sso.ee/saml/saml.service.ee.ts +++ b/packages/cli/src/sso.ee/saml/saml.service.ee.ts @@ -1,4 +1,5 @@ import type { SamlPreferences } from '@n8n/api-types'; +import { Service } from '@n8n/di'; import axios from 'axios'; import type express from 'express'; import https from 'https'; @@ -6,7 +7,6 @@ import { Logger } from 'n8n-core'; import { ApplicationError, jsonParse } from 'n8n-workflow'; import type { IdentityProviderInstance, ServiceProviderInstance } from 'samlify'; import type { BindingContext, PostBindingContext } from 'samlify/types/src/entity'; -import { Service } from 'typedi'; import type { Settings } from '@/databases/entities/settings'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/sso.ee/saml/service-provider.ee.ts b/packages/cli/src/sso.ee/saml/service-provider.ee.ts index 0522c80b51..2fa82eda0a 100644 --- a/packages/cli/src/sso.ee/saml/service-provider.ee.ts +++ b/packages/cli/src/sso.ee/saml/service-provider.ee.ts @@ -1,6 +1,6 @@ import type { SamlPreferences } from '@n8n/api-types'; +import { Container } from '@n8n/di'; import type { ServiceProviderInstance } from 'samlify'; -import { Container } from 'typedi'; import { UrlService } from '@/services/url.service'; diff --git a/packages/cli/src/sso.ee/sso-helpers.ts b/packages/cli/src/sso.ee/sso-helpers.ts index f600e72cfd..d69d9bc3a8 100644 --- a/packages/cli/src/sso.ee/sso-helpers.ts +++ b/packages/cli/src/sso.ee/sso-helpers.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import config from '@/config'; import type { AuthProviderType } from '@/databases/entities/auth-identity'; diff --git a/packages/cli/src/subworkflows/subworkflow-policy-checker.service.ts b/packages/cli/src/subworkflows/subworkflow-policy-checker.service.ts index 0415977e2e..218c083c54 100644 --- a/packages/cli/src/subworkflows/subworkflow-policy-checker.service.ts +++ b/packages/cli/src/subworkflows/subworkflow-policy-checker.service.ts @@ -1,7 +1,7 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import { type Workflow, type INode, type WorkflowSettings } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { Project } from '@/databases/entities/project'; import { SubworkflowPolicyDenialError } from '@/errors/subworkflow-policy-denial.error'; diff --git a/packages/cli/src/task-runners/auth/task-runner-auth.controller.ts b/packages/cli/src/task-runners/auth/task-runner-auth.controller.ts index 0213d2b408..4ea5f3b6f4 100644 --- a/packages/cli/src/task-runners/auth/task-runner-auth.controller.ts +++ b/packages/cli/src/task-runners/auth/task-runner-auth.controller.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import type { NextFunction, Response } from 'express'; -import { Service } from 'typedi'; import type { AuthlessRequest } from '@/requests'; diff --git a/packages/cli/src/task-runners/auth/task-runner-auth.service.ts b/packages/cli/src/task-runners/auth/task-runner-auth.service.ts index 5907cf6678..c16afc5c63 100644 --- a/packages/cli/src/task-runners/auth/task-runner-auth.service.ts +++ b/packages/cli/src/task-runners/auth/task-runner-auth.service.ts @@ -1,6 +1,6 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { randomBytes } from 'crypto'; -import { Service } from 'typedi'; import { Time } from '@/constants'; import { CacheService } from '@/services/cache/cache.service'; diff --git a/packages/cli/src/task-runners/default-task-runner-disconnect-analyzer.ts b/packages/cli/src/task-runners/default-task-runner-disconnect-analyzer.ts index 3033a1f762..a0193c40e0 100644 --- a/packages/cli/src/task-runners/default-task-runner-disconnect-analyzer.ts +++ b/packages/cli/src/task-runners/default-task-runner-disconnect-analyzer.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import config from '@/config'; diff --git a/packages/cli/src/task-runners/internal-task-runner-disconnect-analyzer.ts b/packages/cli/src/task-runners/internal-task-runner-disconnect-analyzer.ts index 0af942bc9e..a84682e521 100644 --- a/packages/cli/src/task-runners/internal-task-runner-disconnect-analyzer.ts +++ b/packages/cli/src/task-runners/internal-task-runner-disconnect-analyzer.ts @@ -1,5 +1,5 @@ import { TaskRunnersConfig } from '@n8n/config'; -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { DefaultTaskRunnerDisconnectAnalyzer } from './default-task-runner-disconnect-analyzer'; import { TaskRunnerOomError } from './errors/task-runner-oom-error'; diff --git a/packages/cli/src/task-runners/task-broker.service.ts b/packages/cli/src/task-runners/task-broker.service.ts index 86c39b54e1..42e0d3cd25 100644 --- a/packages/cli/src/task-runners/task-broker.service.ts +++ b/packages/cli/src/task-runners/task-broker.service.ts @@ -1,4 +1,5 @@ import { TaskRunnersConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import type { BrokerMessage, RequesterMessage, @@ -8,7 +9,6 @@ import type { import { Logger } from 'n8n-core'; import { ApplicationError } from 'n8n-workflow'; import { nanoid } from 'nanoid'; -import { Service } from 'typedi'; import config from '@/config'; import { Time } from '@/constants'; diff --git a/packages/cli/src/task-runners/task-managers/local-task-requester.ts b/packages/cli/src/task-runners/task-managers/local-task-requester.ts index 0aa83c4a6f..1de959936b 100644 --- a/packages/cli/src/task-runners/task-managers/local-task-requester.ts +++ b/packages/cli/src/task-runners/task-managers/local-task-requester.ts @@ -1,5 +1,5 @@ +import { Container, Service } from '@n8n/di'; import type { RequesterMessage } from '@n8n/task-runner'; -import Container, { Service } from 'typedi'; import { NodeTypes } from '@/node-types'; diff --git a/packages/cli/src/task-runners/task-managers/task-requester.ts b/packages/cli/src/task-runners/task-managers/task-requester.ts index 52e75678e4..8124df8e13 100644 --- a/packages/cli/src/task-runners/task-managers/task-requester.ts +++ b/packages/cli/src/task-runners/task-managers/task-requester.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import type { TaskResultData, RequesterMessage, BrokerMessage, TaskData } from '@n8n/task-runner'; import { AVAILABLE_RPC_METHODS } from '@n8n/task-runner'; import { isSerializedBuffer, toBuffer } from 'n8n-core'; @@ -18,7 +19,6 @@ import type { Result, } from 'n8n-workflow'; import { nanoid } from 'nanoid'; -import { Service } from 'typedi'; import { NodeTypes } from '@/node-types'; diff --git a/packages/cli/src/task-runners/task-runner-lifecycle-events.ts b/packages/cli/src/task-runners/task-runner-lifecycle-events.ts index d513b1583d..f269caeb64 100644 --- a/packages/cli/src/task-runners/task-runner-lifecycle-events.ts +++ b/packages/cli/src/task-runners/task-runner-lifecycle-events.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { TypedEmitter } from '@/typed-emitter'; diff --git a/packages/cli/src/task-runners/task-runner-module.ts b/packages/cli/src/task-runners/task-runner-module.ts index 0608b24972..bcc54f653f 100644 --- a/packages/cli/src/task-runners/task-runner-module.ts +++ b/packages/cli/src/task-runners/task-runner-module.ts @@ -1,8 +1,8 @@ import { TaskRunnersConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import { ErrorReporter, Logger } from 'n8n-core'; import { sleep } from 'n8n-workflow'; import * as a from 'node:assert/strict'; -import Container, { Service } from 'typedi'; import { OnShutdown } from '@/decorators/on-shutdown'; import type { TaskRunnerRestartLoopError } from '@/task-runners/errors/task-runner-restart-loop-error'; diff --git a/packages/cli/src/task-runners/task-runner-process.ts b/packages/cli/src/task-runners/task-runner-process.ts index aa8c9e7615..5129ae98b1 100644 --- a/packages/cli/src/task-runners/task-runner-process.ts +++ b/packages/cli/src/task-runners/task-runner-process.ts @@ -1,9 +1,9 @@ import { TaskRunnersConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import * as a from 'node:assert/strict'; import { spawn } from 'node:child_process'; import * as process from 'node:process'; -import { Service } from 'typedi'; import { OnShutdown } from '@/decorators/on-shutdown'; diff --git a/packages/cli/src/task-runners/task-runner-server.ts b/packages/cli/src/task-runners/task-runner-server.ts index 1e92916e3c..6e68c4fb32 100644 --- a/packages/cli/src/task-runners/task-runner-server.ts +++ b/packages/cli/src/task-runners/task-runner-server.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import compression from 'compression'; import express from 'express'; import { Logger } from 'n8n-core'; @@ -7,7 +8,6 @@ import { randomBytes } from 'node:crypto'; import { ServerResponse, type Server, createServer as createHttpServer } from 'node:http'; import type { AddressInfo, Socket } from 'node:net'; import { parse as parseUrl } from 'node:url'; -import { Service } from 'typedi'; import { Server as WSServer } from 'ws'; import { inTest } from '@/constants'; diff --git a/packages/cli/src/task-runners/task-runner-ws-server.ts b/packages/cli/src/task-runners/task-runner-ws-server.ts index dde666a584..dbec7cef3e 100644 --- a/packages/cli/src/task-runners/task-runner-ws-server.ts +++ b/packages/cli/src/task-runners/task-runner-ws-server.ts @@ -1,8 +1,8 @@ import { TaskRunnersConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import type { BrokerMessage, RunnerMessage } from '@n8n/task-runner'; import { Logger } from 'n8n-core'; import { ApplicationError, jsonStringify } from 'n8n-workflow'; -import { Service } from 'typedi'; import type WebSocket from 'ws'; import { Time, WsStatusCodes } from '@/constants'; diff --git a/packages/cli/src/telemetry/index.ts b/packages/cli/src/telemetry/index.ts index 051ae4cf25..5b16656713 100644 --- a/packages/cli/src/telemetry/index.ts +++ b/packages/cli/src/telemetry/index.ts @@ -1,9 +1,9 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import type RudderStack from '@rudderstack/rudder-sdk-node'; import axios from 'axios'; import { InstanceSettings, Logger } from 'n8n-core'; import type { ITelemetryTrackProperties } from 'n8n-workflow'; -import { Container, Service } from 'typedi'; import { LOWEST_SHUTDOWN_PRIORITY, N8N_VERSION } from '@/constants'; import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository'; diff --git a/packages/cli/src/user-management/email/node-mailer.ts b/packages/cli/src/user-management/email/node-mailer.ts index 4f4dc4f895..ac555155d2 100644 --- a/packages/cli/src/user-management/email/node-mailer.ts +++ b/packages/cli/src/user-management/email/node-mailer.ts @@ -1,11 +1,11 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { pick } from 'lodash'; import { ErrorReporter, Logger } from 'n8n-core'; import path from 'node:path'; import type { Transporter } from 'nodemailer'; import { createTransport } from 'nodemailer'; import type SMTPConnection from 'nodemailer/lib/smtp-connection'; -import { Service } from 'typedi'; import type { MailData, SendEmailResult } from './interfaces'; diff --git a/packages/cli/src/user-management/email/user-management-mailer.ts b/packages/cli/src/user-management/email/user-management-mailer.ts index 25794cec8d..53320c61e1 100644 --- a/packages/cli/src/user-management/email/user-management-mailer.ts +++ b/packages/cli/src/user-management/email/user-management-mailer.ts @@ -1,10 +1,10 @@ import { GlobalConfig } from '@n8n/config'; +import { Container, Service } from '@n8n/di'; import { existsSync } from 'fs'; import { readFile } from 'fs/promises'; import Handlebars from 'handlebars'; import { Logger } from 'n8n-core'; import { join as pathJoin } from 'path'; -import { Container, Service } from 'typedi'; import { inTest } from '@/constants'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/src/user-management/permission-checker.ts b/packages/cli/src/user-management/permission-checker.ts index 51a6e8c6a3..72ac867061 100644 --- a/packages/cli/src/user-management/permission-checker.ts +++ b/packages/cli/src/user-management/permission-checker.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import type { INode } from 'n8n-workflow'; import { CredentialAccessError, NodeOperationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository'; import { OwnershipService } from '@/services/ownership.service'; diff --git a/packages/cli/src/wait-tracker.ts b/packages/cli/src/wait-tracker.ts index 02480110ae..d3c9d54c3a 100644 --- a/packages/cli/src/wait-tracker.ts +++ b/packages/cli/src/wait-tracker.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { InstanceSettings, Logger } from 'n8n-core'; import { ApplicationError, type IWorkflowExecutionDataProcess } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/src/webhooks/live-webhooks.ts b/packages/cli/src/webhooks/live-webhooks.ts index 1ebfef3470..440e8254dc 100644 --- a/packages/cli/src/webhooks/live-webhooks.ts +++ b/packages/cli/src/webhooks/live-webhooks.ts @@ -1,8 +1,8 @@ +import { Service } from '@n8n/di'; import type { Response } from 'express'; import { Logger } from 'n8n-core'; import { Workflow, CHAT_TRIGGER_NODE_TYPE } from 'n8n-workflow'; import type { INode, IWebhookData, IHttpRequestMethods } from 'n8n-workflow'; -import { Service } from 'typedi'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; import { NotFoundError } from '@/errors/response-errors/not-found.error'; diff --git a/packages/cli/src/webhooks/test-webhook-registrations.service.ts b/packages/cli/src/webhooks/test-webhook-registrations.service.ts index e25b3102db..565608c583 100644 --- a/packages/cli/src/webhooks/test-webhook-registrations.service.ts +++ b/packages/cli/src/webhooks/test-webhook-registrations.service.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { InstanceSettings } from 'n8n-core'; import type { IWebhookData } from 'n8n-workflow'; -import { Service } from 'typedi'; import { TEST_WEBHOOK_TIMEOUT, TEST_WEBHOOK_TIMEOUT_BUFFER } from '@/constants'; import type { IWorkflowDb } from '@/interfaces'; diff --git a/packages/cli/src/webhooks/test-webhooks.ts b/packages/cli/src/webhooks/test-webhooks.ts index ff5d47fd50..61d29d7b79 100644 --- a/packages/cli/src/webhooks/test-webhooks.ts +++ b/packages/cli/src/webhooks/test-webhooks.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import type express from 'express'; import { InstanceSettings } from 'n8n-core'; import { WebhookPathTakenError, Workflow } from 'n8n-workflow'; @@ -7,7 +8,6 @@ import type { IHttpRequestMethods, IRunData, } from 'n8n-workflow'; -import { Service } from 'typedi'; import { TEST_WEBHOOK_TIMEOUT } from '@/constants'; import { NotFoundError } from '@/errors/response-errors/not-found.error'; diff --git a/packages/cli/src/webhooks/waiting-forms.ts b/packages/cli/src/webhooks/waiting-forms.ts index cd2de74ed0..93294d24d0 100644 --- a/packages/cli/src/webhooks/waiting-forms.ts +++ b/packages/cli/src/webhooks/waiting-forms.ts @@ -1,8 +1,8 @@ +import { Service } from '@n8n/di'; import axios from 'axios'; import type express from 'express'; import type { IRunData } from 'n8n-workflow'; import { FORM_NODE_TYPE, sleep, Workflow } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ConflictError } from '@/errors/response-errors/conflict.error'; import { NotFoundError } from '@/errors/response-errors/not-found.error'; diff --git a/packages/cli/src/webhooks/waiting-webhooks.ts b/packages/cli/src/webhooks/waiting-webhooks.ts index ed2f8404bc..90413b433d 100644 --- a/packages/cli/src/webhooks/waiting-webhooks.ts +++ b/packages/cli/src/webhooks/waiting-webhooks.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import type express from 'express'; import { Logger } from 'n8n-core'; import { @@ -8,7 +9,6 @@ import { WAIT_NODE_TYPE, Workflow, } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; import { ConflictError } from '@/errors/response-errors/conflict.error'; diff --git a/packages/cli/src/webhooks/webhook-helpers.ts b/packages/cli/src/webhooks/webhook-helpers.ts index 0566e72a10..1711d18056 100644 --- a/packages/cli/src/webhooks/webhook-helpers.ts +++ b/packages/cli/src/webhooks/webhook-helpers.ts @@ -7,6 +7,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/restrict-template-expressions */ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type express from 'express'; import get from 'lodash/get'; import { BinaryDataService, ErrorReporter, Logger } from 'n8n-core'; @@ -39,7 +40,6 @@ import { } from 'n8n-workflow'; import assert from 'node:assert'; import { finished } from 'stream/promises'; -import { Container } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import config from '@/config'; diff --git a/packages/cli/src/webhooks/webhook-server.ts b/packages/cli/src/webhooks/webhook-server.ts index 263375325b..648dcd7bfb 100644 --- a/packages/cli/src/webhooks/webhook-server.ts +++ b/packages/cli/src/webhooks/webhook-server.ts @@ -1,4 +1,4 @@ -import { Service } from 'typedi'; +import { Service } from '@n8n/di'; import { AbstractServer } from '@/abstract-server'; diff --git a/packages/cli/src/webhooks/webhook.service.ts b/packages/cli/src/webhooks/webhook.service.ts index f571c9450b..1a3dbf37cb 100644 --- a/packages/cli/src/webhooks/webhook.service.ts +++ b/packages/cli/src/webhooks/webhook.service.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import { HookContext, WebhookContext, Logger } from 'n8n-core'; import { ApplicationError, Node, NodeHelpers } from 'n8n-workflow'; import type { @@ -12,7 +13,6 @@ import type { WorkflowActivateMode, WorkflowExecuteMode, } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { WebhookEntity } from '@/databases/entities/webhook-entity'; import { WebhookRepository } from '@/databases/repositories/webhook.repository'; diff --git a/packages/cli/src/workflow-execute-additional-data.ts b/packages/cli/src/workflow-execute-additional-data.ts index ac2dab4d88..e350086f9d 100644 --- a/packages/cli/src/workflow-execute-additional-data.ts +++ b/packages/cli/src/workflow-execute-additional-data.ts @@ -4,6 +4,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ import type { PushMessage, PushType } from '@n8n/api-types'; import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { stringify } from 'flatted'; import { ErrorReporter, @@ -39,7 +40,6 @@ import type { ExecuteWorkflowData, RelatedExecution, } from 'n8n-workflow'; -import { Container } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import config from '@/config'; diff --git a/packages/cli/src/workflow-helpers.ts b/packages/cli/src/workflow-helpers.ts index b49e1ae556..36946dd77e 100644 --- a/packages/cli/src/workflow-helpers.ts +++ b/packages/cli/src/workflow-helpers.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import type { IDataObject, INode, @@ -9,7 +10,6 @@ import type { WorkflowOperationError, NodeOperationError, } from 'n8n-workflow'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; diff --git a/packages/cli/src/workflow-runner.ts b/packages/cli/src/workflow-runner.ts index 1b31feb7c7..a5ffb728d6 100644 --- a/packages/cli/src/workflow-runner.ts +++ b/packages/cli/src/workflow-runner.ts @@ -2,6 +2,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-shadow */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ +import { Container, Service } from '@n8n/di'; import { ErrorReporter, InstanceSettings, Logger, WorkflowExecute } from 'n8n-core'; import type { ExecutionError, @@ -15,7 +16,6 @@ import type { } from 'n8n-workflow'; import { ExecutionCancelledError, Workflow } from 'n8n-workflow'; import PCancelable from 'p-cancelable'; -import { Container, Service } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import config from '@/config'; diff --git a/packages/cli/src/workflows/workflow-execution.service.ts b/packages/cli/src/workflows/workflow-execution.service.ts index 10d882121c..3b384f4c53 100644 --- a/packages/cli/src/workflows/workflow-execution.service.ts +++ b/packages/cli/src/workflows/workflow-execution.service.ts @@ -1,4 +1,5 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { ErrorReporter, Logger } from 'n8n-core'; import type { IDeferredPromise, @@ -13,7 +14,6 @@ import type { IWorkflowExecutionDataProcess, } from 'n8n-workflow'; import { SubworkflowOperationError, Workflow } from 'n8n-workflow'; -import { Service } from 'typedi'; import config from '@/config'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/src/workflows/workflow-history.ee/workflow-history-helper.ee.ts b/packages/cli/src/workflows/workflow-history.ee/workflow-history-helper.ee.ts index 11363a45bc..c8b06851e7 100644 --- a/packages/cli/src/workflows/workflow-history.ee/workflow-history-helper.ee.ts +++ b/packages/cli/src/workflows/workflow-history.ee/workflow-history-helper.ee.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import config from '@/config'; import { License } from '@/license'; diff --git a/packages/cli/src/workflows/workflow-history.ee/workflow-history-manager.ee.ts b/packages/cli/src/workflows/workflow-history.ee/workflow-history-manager.ee.ts index f3a25bfb16..b320c144f6 100644 --- a/packages/cli/src/workflows/workflow-history.ee/workflow-history-manager.ee.ts +++ b/packages/cli/src/workflows/workflow-history.ee/workflow-history-manager.ee.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { DateTime } from 'luxon'; -import { Service } from 'typedi'; import { Time } from '@/constants'; import { WorkflowHistoryRepository } from '@/databases/repositories/workflow-history.repository'; diff --git a/packages/cli/src/workflows/workflow-history.ee/workflow-history.service.ee.ts b/packages/cli/src/workflows/workflow-history.ee/workflow-history.service.ee.ts index 2e23a7d64a..05256ec7a6 100644 --- a/packages/cli/src/workflows/workflow-history.ee/workflow-history.service.ee.ts +++ b/packages/cli/src/workflows/workflow-history.ee/workflow-history.service.ee.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { Logger } from 'n8n-core'; import { ensureError } from 'n8n-workflow'; -import { Service } from 'typedi'; import type { User } from '@/databases/entities/user'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; diff --git a/packages/cli/src/workflows/workflow-sharing.service.ts b/packages/cli/src/workflows/workflow-sharing.service.ts index 280c553a5e..220c9adaf9 100644 --- a/packages/cli/src/workflows/workflow-sharing.service.ts +++ b/packages/cli/src/workflows/workflow-sharing.service.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In } from '@n8n/typeorm'; -import { Service } from 'typedi'; import type { ProjectRole } from '@/databases/entities/project-relation'; import type { WorkflowSharingRole } from '@/databases/entities/shared-workflow'; diff --git a/packages/cli/src/workflows/workflow-static-data.service.ts b/packages/cli/src/workflows/workflow-static-data.service.ts index aaff18f319..5ef9a52480 100644 --- a/packages/cli/src/workflows/workflow-static-data.service.ts +++ b/packages/cli/src/workflows/workflow-static-data.service.ts @@ -1,7 +1,7 @@ import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import { ErrorReporter, Logger } from 'n8n-core'; import type { IDataObject, Workflow } from 'n8n-workflow'; -import { Service } from 'typedi'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; import { isWorkflowIdValid } from '@/utils'; diff --git a/packages/cli/src/workflows/workflow.service.ee.ts b/packages/cli/src/workflows/workflow.service.ee.ts index 830a3d2f98..8122e909c4 100644 --- a/packages/cli/src/workflows/workflow.service.ee.ts +++ b/packages/cli/src/workflows/workflow.service.ee.ts @@ -1,9 +1,9 @@ +import { Service } from '@n8n/di'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In, type EntityManager } from '@n8n/typeorm'; import omit from 'lodash/omit'; import { Logger } from 'n8n-core'; import { ApplicationError, NodeOperationError, WorkflowActivationError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import { CredentialsService } from '@/credentials/credentials.service'; diff --git a/packages/cli/src/workflows/workflow.service.ts b/packages/cli/src/workflows/workflow.service.ts index 21f792747e..2141e79ed5 100644 --- a/packages/cli/src/workflows/workflow.service.ts +++ b/packages/cli/src/workflows/workflow.service.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import type { EntityManager } from '@n8n/typeorm'; @@ -7,7 +8,6 @@ import omit from 'lodash/omit'; import pick from 'lodash/pick'; import { BinaryDataService, Logger } from 'n8n-core'; import { NodeApiError } from 'n8n-workflow'; -import { Service } from 'typedi'; import { v4 as uuid } from 'uuid'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; diff --git a/packages/cli/test/integration/active-workflow-manager.test.ts b/packages/cli/test/integration/active-workflow-manager.test.ts index f965efe709..3c98c2a4f1 100644 --- a/packages/cli/test/integration/active-workflow-manager.test.ts +++ b/packages/cli/test/integration/active-workflow-manager.test.ts @@ -1,8 +1,8 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { Logger } from 'n8n-core'; import { NodeApiError, Workflow } from 'n8n-workflow'; import type { IWebhookData, WorkflowActivateMode } from 'n8n-workflow'; -import { Container } from 'typedi'; import { ActiveExecutions } from '@/active-executions'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; diff --git a/packages/cli/test/integration/ai/ai.api.test.ts b/packages/cli/test/integration/ai/ai.api.test.ts index 34255dc72f..721f2296ed 100644 --- a/packages/cli/test/integration/ai/ai.api.test.ts +++ b/packages/cli/test/integration/ai/ai.api.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { randomUUID } from 'crypto'; import { mock } from 'jest-mock-extended'; -import { Container } from 'typedi'; import { FREE_AI_CREDITS_CREDENTIAL_NAME, OPEN_AI_API_CREDENTIAL_TYPE } from '@/constants'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/test/integration/api-keys.api.test.ts b/packages/cli/test/integration/api-keys.api.test.ts index f577e0cf78..14050b543a 100644 --- a/packages/cli/test/integration/api-keys.api.test.ts +++ b/packages/cli/test/integration/api-keys.api.test.ts @@ -1,5 +1,5 @@ import { GlobalConfig } from '@n8n/config'; -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import type { ApiKey } from '@/databases/entities/api-key'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/auth.api.test.ts b/packages/cli/test/integration/auth.api.test.ts index 4fa2a7145c..7fd3f50eac 100644 --- a/packages/cli/test/integration/auth.api.test.ts +++ b/packages/cli/test/integration/auth.api.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import validator from 'validator'; import config from '@/config'; diff --git a/packages/cli/test/integration/collaboration/collaboration.service.test.ts b/packages/cli/test/integration/collaboration/collaboration.service.test.ts index e6951644fd..33ebb9ee31 100644 --- a/packages/cli/test/integration/collaboration/collaboration.service.test.ts +++ b/packages/cli/test/integration/collaboration/collaboration.service.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import type { WorkflowClosedMessage, diff --git a/packages/cli/test/integration/commands/ldap/reset.test.ts b/packages/cli/test/integration/commands/ldap/reset.test.ts index a199310f9c..11051b9d98 100644 --- a/packages/cli/test/integration/commands/ldap/reset.test.ts +++ b/packages/cli/test/integration/commands/ldap/reset.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { EntityNotFoundError } from '@n8n/typeorm'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import { Reset } from '@/commands/ldap/reset'; diff --git a/packages/cli/test/integration/commands/license.cmd.test.ts b/packages/cli/test/integration/commands/license.cmd.test.ts index 363d2feae6..d35c4fdc4a 100644 --- a/packages/cli/test/integration/commands/license.cmd.test.ts +++ b/packages/cli/test/integration/commands/license.cmd.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { ClearLicenseCommand } from '@/commands/license/clear'; import { SETTINGS_LICENSE_CERT_KEY } from '@/constants'; diff --git a/packages/cli/test/integration/commands/reset.cmd.test.ts b/packages/cli/test/integration/commands/reset.cmd.test.ts index 58e8e344e5..19b301f596 100644 --- a/packages/cli/test/integration/commands/reset.cmd.test.ts +++ b/packages/cli/test/integration/commands/reset.cmd.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { Reset } from '@/commands/user-management/reset'; import { CredentialsEntity } from '@/databases/entities/credentials-entity'; diff --git a/packages/cli/test/integration/commands/worker.cmd.test.ts b/packages/cli/test/integration/commands/worker.cmd.test.ts index bbcb15dfa0..8b9cebe854 100644 --- a/packages/cli/test/integration/commands/worker.cmd.test.ts +++ b/packages/cli/test/integration/commands/worker.cmd.test.ts @@ -1,8 +1,8 @@ process.argv[2] = 'worker'; import { TaskRunnersConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { BinaryDataService } from 'n8n-core'; -import Container from 'typedi'; import { Worker } from '@/commands/worker'; import config from '@/config'; 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 f1e8e2a1b9..64ef210ab9 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,5 +1,5 @@ +import { Container } from '@n8n/di'; import { Not } from '@n8n/typeorm'; -import Container from 'typedi'; import type { User } from '@/databases/entities/user'; import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository'; diff --git a/packages/cli/test/integration/controllers/oauth/oauth2.api.test.ts b/packages/cli/test/integration/controllers/oauth/oauth2.api.test.ts index 59a853cee1..f20f9df550 100644 --- a/packages/cli/test/integration/controllers/oauth/oauth2.api.test.ts +++ b/packages/cli/test/integration/controllers/oauth/oauth2.api.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { response as Response } from 'express'; import nock from 'nock'; import { parse as parseQs } from 'querystring'; -import { Container } from 'typedi'; import { OAuth2CredentialController } from '@/controllers/oauth/oauth2-credential.controller'; import { CredentialsHelper } from '@/credentials-helper'; diff --git a/packages/cli/test/integration/credentials-helper.test.ts b/packages/cli/test/integration/credentials-helper.test.ts index b3cb15555b..7b8522589a 100644 --- a/packages/cli/test/integration/credentials-helper.test.ts +++ b/packages/cli/test/integration/credentials-helper.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { CredentialsHelper } from '@/credentials-helper'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/credentials/credentials.api.ee.test.ts b/packages/cli/test/integration/credentials/credentials.api.ee.test.ts index 962f5591d5..039791eaf2 100644 --- a/packages/cli/test/integration/credentials/credentials.api.ee.test.ts +++ b/packages/cli/test/integration/credentials/credentials.api.ee.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { In } from '@n8n/typeorm'; -import { Container } from 'typedi'; import config from '@/config'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/test/integration/credentials/credentials.api.test.ts b/packages/cli/test/integration/credentials/credentials.api.test.ts index 2b3ee73b58..9cfe3260ba 100644 --- a/packages/cli/test/integration/credentials/credentials.api.test.ts +++ b/packages/cli/test/integration/credentials/credentials.api.test.ts @@ -1,8 +1,8 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { Scope } from '@sentry/node'; import { Credentials } from 'n8n-core'; import { randomString } from 'n8n-workflow'; -import { Container } from 'typedi'; import type { Project } from '@/databases/entities/project'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/credentials/credentials.service.test.ts b/packages/cli/test/integration/credentials/credentials.service.test.ts index ecfafada3f..9638228183 100644 --- a/packages/cli/test/integration/credentials/credentials.service.test.ts +++ b/packages/cli/test/integration/credentials/credentials.service.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { CredentialsService } from '@/credentials/credentials.service'; import type { CredentialsEntity } from '@/databases/entities/credentials-entity'; diff --git a/packages/cli/test/integration/cta.service.test.ts b/packages/cli/test/integration/cta.service.test.ts index 68c1f24c5f..366b86e3ec 100644 --- a/packages/cli/test/integration/cta.service.test.ts +++ b/packages/cli/test/integration/cta.service.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import type { User } from '@/databases/entities/user'; import { StatisticsNames } from '@/databases/entities/workflow-statistics'; diff --git a/packages/cli/test/integration/database/repositories/execution.repository.test.ts b/packages/cli/test/integration/database/repositories/execution.repository.test.ts index 1b50415686..cb368b511c 100644 --- a/packages/cli/test/integration/database/repositories/execution.repository.test.ts +++ b/packages/cli/test/integration/database/repositories/execution.repository.test.ts @@ -1,5 +1,5 @@ import { GlobalConfig } from '@n8n/config'; -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { ExecutionDataRepository } from '@/databases/repositories/execution-data.repository'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/test/integration/database/repositories/project.repository.test.ts b/packages/cli/test/integration/database/repositories/project.repository.test.ts index cc494fd542..334929e4e7 100644 --- a/packages/cli/test/integration/database/repositories/project.repository.test.ts +++ b/packages/cli/test/integration/database/repositories/project.repository.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { EntityNotFoundError } from '@n8n/typeorm'; -import Container from 'typedi'; import { AuthIdentity } from '@/databases/entities/auth-identity'; import { ProjectRepository } from '@/databases/repositories/project.repository'; diff --git a/packages/cli/test/integration/database/repositories/workflow.repository.test.ts b/packages/cli/test/integration/database/repositories/workflow.repository.test.ts index acff2cbce9..63b87df7e8 100644 --- a/packages/cli/test/integration/database/repositories/workflow.repository.test.ts +++ b/packages/cli/test/integration/database/repositories/workflow.repository.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/test/integration/debug.controller.test.ts b/packages/cli/test/integration/debug.controller.test.ts index 8ab58bd1a0..7ca483a912 100644 --- a/packages/cli/test/integration/debug.controller.test.ts +++ b/packages/cli/test/integration/debug.controller.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { InstanceSettings } from 'n8n-core'; -import Container from 'typedi'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; diff --git a/packages/cli/test/integration/environments/source-control-import.service.test.ts b/packages/cli/test/integration/environments/source-control-import.service.test.ts index 3faa84b675..6835d18f58 100644 --- a/packages/cli/test/integration/environments/source-control-import.service.test.ts +++ b/packages/cli/test/integration/environments/source-control-import.service.test.ts @@ -1,10 +1,10 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { Cipher } from 'n8n-core'; import type { InstanceSettings } from 'n8n-core'; import * as utils from 'n8n-workflow'; import { nanoid } from 'nanoid'; import fsp from 'node:fs/promises'; -import Container from 'typedi'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository'; diff --git a/packages/cli/test/integration/environments/source-control.test.ts b/packages/cli/test/integration/environments/source-control.test.ts index 7e474e1f9a..11a7ad8a2b 100644 --- a/packages/cli/test/integration/environments/source-control.test.ts +++ b/packages/cli/test/integration/environments/source-control.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import config from '@/config'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/evaluation/metrics.api.test.ts b/packages/cli/test/integration/evaluation/metrics.api.test.ts index d10bb106a5..996fd96148 100644 --- a/packages/cli/test/integration/evaluation/metrics.api.test.ts +++ b/packages/cli/test/integration/evaluation/metrics.api.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import type { TestDefinition } from '@/databases/entities/test-definition.ee'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/evaluation/test-definitions.api.test.ts b/packages/cli/test/integration/evaluation/test-definitions.api.test.ts index 8dd778289d..ad359f8731 100644 --- a/packages/cli/test/integration/evaluation/test-definitions.api.test.ts +++ b/packages/cli/test/integration/evaluation/test-definitions.api.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mockInstance } from 'n8n-core/test/utils'; -import { Container } from 'typedi'; import type { AnnotationTagEntity } from '@/databases/entities/annotation-tag-entity.ee'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/evaluation/test-runs.api.test.ts b/packages/cli/test/integration/evaluation/test-runs.api.test.ts index be8fb0b5d8..8f01029ad2 100644 --- a/packages/cli/test/integration/evaluation/test-runs.api.test.ts +++ b/packages/cli/test/integration/evaluation/test-runs.api.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import type { TestDefinition } from '@/databases/entities/test-definition.ee'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/eventbus.ee.test.ts b/packages/cli/test/integration/eventbus.ee.test.ts index c2b6a7f23c..0be15b6124 100644 --- a/packages/cli/test/integration/eventbus.ee.test.ts +++ b/packages/cli/test/integration/eventbus.ee.test.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import axios from 'axios'; import type { MessageEventBusDestinationSentryOptions, @@ -10,7 +11,6 @@ import { defaultMessageEventBusDestinationWebhookOptions, } from 'n8n-workflow'; import syslog from 'syslog-client'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/execution.service.integration.test.ts b/packages/cli/test/integration/execution.service.integration.test.ts index 27163b3bea..e1de129d7c 100644 --- a/packages/cli/test/integration/execution.service.integration.test.ts +++ b/packages/cli/test/integration/execution.service.integration.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import { ExecutionMetadataRepository } from '@/databases/repositories/execution-metadata.repository'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; diff --git a/packages/cli/test/integration/external-secrets/external-secrets.api.test.ts b/packages/cli/test/integration/external-secrets/external-secrets.api.test.ts index 7e01941c80..095555b72b 100644 --- a/packages/cli/test/integration/external-secrets/external-secrets.api.test.ts +++ b/packages/cli/test/integration/external-secrets/external-secrets.api.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { Cipher } from 'n8n-core'; import { jsonParse, type IDataObject } from 'n8n-workflow'; -import { Container } from 'typedi'; import config from '@/config'; import { CREDENTIAL_BLANKING_VALUE } from '@/constants'; diff --git a/packages/cli/test/integration/import.service.test.ts b/packages/cli/test/integration/import.service.test.ts index 39cadde676..0c40d868ce 100644 --- a/packages/cli/test/integration/import.service.test.ts +++ b/packages/cli/test/integration/import.service.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import type { INode } from 'n8n-workflow'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/test/integration/ldap/ldap.api.test.ts b/packages/cli/test/integration/ldap/ldap.api.test.ts index 884f72315c..9a4c214f10 100644 --- a/packages/cli/test/integration/ldap/ldap.api.test.ts +++ b/packages/cli/test/integration/ldap/ldap.api.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { Not } from '@n8n/typeorm'; import type { Entry as LdapUser } from 'ldapts'; import { Cipher } from 'n8n-core'; -import { Container } from 'typedi'; import config from '@/config'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/license-metrics.repository.test.ts b/packages/cli/test/integration/license-metrics.repository.test.ts index 5396b4681f..298c7d67fd 100644 --- a/packages/cli/test/integration/license-metrics.repository.test.ts +++ b/packages/cli/test/integration/license-metrics.repository.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { StatisticsNames } from '@/databases/entities/workflow-statistics'; import { LicenseMetricsRepository } from '@/databases/repositories/license-metrics.repository'; diff --git a/packages/cli/test/integration/me.api.test.ts b/packages/cli/test/integration/me.api.test.ts index a29f158a32..25cbe20b64 100644 --- a/packages/cli/test/integration/me.api.test.ts +++ b/packages/cli/test/integration/me.api.test.ts @@ -1,6 +1,6 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { IPersonalizationSurveyAnswersV4 } from 'n8n-workflow'; -import { Container } from 'typedi'; import validator from 'validator'; import type { User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/mfa/mfa.api.test.ts b/packages/cli/test/integration/mfa/mfa.api.test.ts index f69d98a74f..935ede4c17 100644 --- a/packages/cli/test/integration/mfa/mfa.api.test.ts +++ b/packages/cli/test/integration/mfa/mfa.api.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { randomString } from 'n8n-workflow'; -import Container from 'typedi'; import { AuthService } from '@/auth/auth.service'; import config from '@/config'; diff --git a/packages/cli/test/integration/owner.api.test.ts b/packages/cli/test/integration/owner.api.test.ts index fe5284ffbe..13f660688e 100644 --- a/packages/cli/test/integration/owner.api.test.ts +++ b/packages/cli/test/integration/owner.api.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import validator from 'validator'; import config from '@/config'; diff --git a/packages/cli/test/integration/password-reset.api.test.ts b/packages/cli/test/integration/password-reset.api.test.ts index 2be4c0f030..826b4ddef9 100644 --- a/packages/cli/test/integration/password-reset.api.test.ts +++ b/packages/cli/test/integration/password-reset.api.test.ts @@ -1,7 +1,7 @@ +import { Container } from '@n8n/di'; import { compare } from 'bcryptjs'; import { mock } from 'jest-mock-extended'; import { randomString } from 'n8n-workflow'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import { AuthService } from '@/auth/auth.service'; diff --git a/packages/cli/test/integration/permission-checker.test.ts b/packages/cli/test/integration/permission-checker.test.ts index 1a0963b685..71dd77b503 100644 --- a/packages/cli/test/integration/permission-checker.test.ts +++ b/packages/cli/test/integration/permission-checker.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import type { INode } from 'n8n-workflow'; import { randomInt } from 'n8n-workflow'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/test/integration/project.api.test.ts b/packages/cli/test/integration/project.api.test.ts index 14707ad764..a75aad9566 100644 --- a/packages/cli/test/integration/project.api.test.ts +++ b/packages/cli/test/integration/project.api.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; import { EntityNotFoundError } from '@n8n/typeorm'; -import Container from 'typedi'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/test/integration/project.service.integration.test.ts b/packages/cli/test/integration/project.service.integration.test.ts index 4c4ad6be5d..b2210b5210 100644 --- a/packages/cli/test/integration/project.service.integration.test.ts +++ b/packages/cli/test/integration/project.service.integration.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository'; import { ProjectService } from '@/services/project.service.ee'; diff --git a/packages/cli/test/integration/prometheus-metrics.test.ts b/packages/cli/test/integration/prometheus-metrics.test.ts index 2a13d2f091..c5accedbc6 100644 --- a/packages/cli/test/integration/prometheus-metrics.test.ts +++ b/packages/cli/test/integration/prometheus-metrics.test.ts @@ -1,7 +1,7 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { parse as semverParse } from 'semver'; import request, { type Response } from 'supertest'; -import { Container } from 'typedi'; import config from '@/config'; import { N8N_VERSION } from '@/constants'; diff --git a/packages/cli/test/integration/pruning.service.test.ts b/packages/cli/test/integration/pruning.service.test.ts index 9d4103e84e..3a97350f79 100644 --- a/packages/cli/test/integration/pruning.service.test.ts +++ b/packages/cli/test/integration/pruning.service.test.ts @@ -1,8 +1,8 @@ import { ExecutionsConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { BinaryDataService, InstanceSettings } from 'n8n-core'; import type { ExecutionStatus } from 'n8n-workflow'; -import Container from 'typedi'; import { Time } from '@/constants'; import type { ExecutionEntity } from '@/databases/entities/execution-entity'; diff --git a/packages/cli/test/integration/public-api/credentials.test.ts b/packages/cli/test/integration/public-api/credentials.test.ts index 953a6e1c95..c6e4dc5c12 100644 --- a/packages/cli/test/integration/public-api/credentials.test.ts +++ b/packages/cli/test/integration/public-api/credentials.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { randomString } from 'n8n-workflow'; -import { Container } from 'typedi'; import type { User } from '@/databases/entities/user'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; diff --git a/packages/cli/test/integration/public-api/tags.test.ts b/packages/cli/test/integration/public-api/tags.test.ts index c2e25cc3f6..2be18285f4 100644 --- a/packages/cli/test/integration/public-api/tags.test.ts +++ b/packages/cli/test/integration/public-api/tags.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import type { User } from '@/databases/entities/user'; import { TagRepository } from '@/databases/repositories/tag.repository'; diff --git a/packages/cli/test/integration/public-api/workflows.test.ts b/packages/cli/test/integration/public-api/workflows.test.ts index 51da846b5b..943d33bc35 100644 --- a/packages/cli/test/integration/public-api/workflows.test.ts +++ b/packages/cli/test/integration/public-api/workflows.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { INode } from 'n8n-workflow'; -import { Container } from 'typedi'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import config from '@/config'; diff --git a/packages/cli/test/integration/role.api.test.ts b/packages/cli/test/integration/role.api.test.ts index ad961c2565..85888347cc 100644 --- a/packages/cli/test/integration/role.api.test.ts +++ b/packages/cli/test/integration/role.api.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; -import { Container } from 'typedi'; import type { ProjectRole } from '@/databases/entities/project-relation'; import type { CredentialSharingRole } from '@/databases/entities/shared-credentials'; diff --git a/packages/cli/test/integration/runners/task-runner-module.external.test.ts b/packages/cli/test/integration/runners/task-runner-module.external.test.ts index afb07c7e66..d111854db6 100644 --- a/packages/cli/test/integration/runners/task-runner-module.external.test.ts +++ b/packages/cli/test/integration/runners/task-runner-module.external.test.ts @@ -1,6 +1,6 @@ import { TaskRunnersConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import { MissingAuthTokenError } from '@/task-runners/errors/missing-auth-token.error'; import { TaskRunnerModule } from '@/task-runners/task-runner-module'; diff --git a/packages/cli/test/integration/runners/task-runner-module.internal.test.ts b/packages/cli/test/integration/runners/task-runner-module.internal.test.ts index 0d4583517e..3c373e9614 100644 --- a/packages/cli/test/integration/runners/task-runner-module.internal.test.ts +++ b/packages/cli/test/integration/runners/task-runner-module.internal.test.ts @@ -1,5 +1,5 @@ import { TaskRunnersConfig } from '@n8n/config'; -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { TaskRunnerModule } from '@/task-runners/task-runner-module'; diff --git a/packages/cli/test/integration/runners/task-runner-process.test.ts b/packages/cli/test/integration/runners/task-runner-process.test.ts index 89aa80d0f4..bd6dae00b0 100644 --- a/packages/cli/test/integration/runners/task-runner-process.test.ts +++ b/packages/cli/test/integration/runners/task-runner-process.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { TaskBroker } from '@/task-runners/task-broker.service'; import { TaskRunnerProcess } from '@/task-runners/task-runner-process'; diff --git a/packages/cli/test/integration/security-audit/credentials-risk-reporter.test.ts b/packages/cli/test/integration/security-audit/credentials-risk-reporter.test.ts index b5b4c122df..ba38f04bd6 100644 --- a/packages/cli/test/integration/security-audit/credentials-risk-reporter.test.ts +++ b/packages/cli/test/integration/security-audit/credentials-risk-reporter.test.ts @@ -1,6 +1,6 @@ import type { SecurityConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; diff --git a/packages/cli/test/integration/security-audit/database-risk-reporter.test.ts b/packages/cli/test/integration/security-audit/database-risk-reporter.test.ts index 3aef57396b..67927426b3 100644 --- a/packages/cli/test/integration/security-audit/database-risk-reporter.test.ts +++ b/packages/cli/test/integration/security-audit/database-risk-reporter.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/test/integration/security-audit/filesystem-risk-reporter.test.ts b/packages/cli/test/integration/security-audit/filesystem-risk-reporter.test.ts index ceb306935f..85ab2e6ec4 100644 --- a/packages/cli/test/integration/security-audit/filesystem-risk-reporter.test.ts +++ b/packages/cli/test/integration/security-audit/filesystem-risk-reporter.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/test/integration/security-audit/instance-risk-reporter.test.ts b/packages/cli/test/integration/security-audit/instance-risk-reporter.test.ts index 58a2a2c9a8..ddf3fce556 100644 --- a/packages/cli/test/integration/security-audit/instance-risk-reporter.test.ts +++ b/packages/cli/test/integration/security-audit/instance-risk-reporter.test.ts @@ -1,7 +1,7 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { NodeConnectionType } from 'n8n-workflow'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/test/integration/security-audit/nodes-risk-reporter.test.ts b/packages/cli/test/integration/security-audit/nodes-risk-reporter.test.ts index c1fb198b69..461685ec5c 100644 --- a/packages/cli/test/integration/security-audit/nodes-risk-reporter.test.ts +++ b/packages/cli/test/integration/security-audit/nodes-risk-reporter.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; diff --git a/packages/cli/test/integration/security-audit/utils.ts b/packages/cli/test/integration/security-audit/utils.ts index d74bcc9d87..d153db28eb 100644 --- a/packages/cli/test/integration/security-audit/utils.ts +++ b/packages/cli/test/integration/security-audit/utils.ts @@ -1,6 +1,6 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import nock from 'nock'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import * as constants from '@/constants'; diff --git a/packages/cli/test/integration/services/execution-metadata.service.test.ts b/packages/cli/test/integration/services/execution-metadata.service.test.ts index b69c78b5fe..7288c4b98f 100644 --- a/packages/cli/test/integration/services/execution-metadata.service.test.ts +++ b/packages/cli/test/integration/services/execution-metadata.service.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { ExecutionMetadataRepository } from '@/databases/repositories/execution-metadata.repository'; import { ExecutionMetadataService } from '@/services/execution-metadata.service'; diff --git a/packages/cli/test/integration/services/project.service.test.ts b/packages/cli/test/integration/services/project.service.test.ts index b475bc83eb..bf83c6159c 100644 --- a/packages/cli/test/integration/services/project.service.test.ts +++ b/packages/cli/test/integration/services/project.service.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; -import Container from 'typedi'; import type { ProjectRole } from '@/databases/entities/project-relation'; import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository'; diff --git a/packages/cli/test/integration/services/workflow-static-data.service.test.ts b/packages/cli/test/integration/services/workflow-static-data.service.test.ts index c6ab9301ce..8cb2cbc1cc 100644 --- a/packages/cli/test/integration/services/workflow-static-data.service.test.ts +++ b/packages/cli/test/integration/services/workflow-static-data.service.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { Workflow } from 'n8n-workflow'; -import Container from 'typedi'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; import { NodeTypes } from '@/node-types'; diff --git a/packages/cli/test/integration/shared/constants.ts b/packages/cli/test/integration/shared/constants.ts index 5fffacbd11..377a0e45a4 100644 --- a/packages/cli/test/integration/shared/constants.ts +++ b/packages/cli/test/integration/shared/constants.ts @@ -1,5 +1,5 @@ import { GlobalConfig } from '@n8n/config'; -import Container from 'typedi'; +import { Container } from '@n8n/di'; export const REST_PATH_SEGMENT = Container.get(GlobalConfig).endpoints.rest; diff --git a/packages/cli/test/integration/shared/db/credentials.ts b/packages/cli/test/integration/shared/db/credentials.ts index 5593b7d55a..08d99354f2 100644 --- a/packages/cli/test/integration/shared/db/credentials.ts +++ b/packages/cli/test/integration/shared/db/credentials.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { CredentialsEntity } from '@/databases/entities/credentials-entity'; import type { Project } from '@/databases/entities/project'; diff --git a/packages/cli/test/integration/shared/db/executions.ts b/packages/cli/test/integration/shared/db/executions.ts index 4dd0b4fa76..9af7ad22ed 100644 --- a/packages/cli/test/integration/shared/db/executions.ts +++ b/packages/cli/test/integration/shared/db/executions.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { AnnotationVote } from 'n8n-workflow'; -import Container from 'typedi'; import type { ExecutionData } from '@/databases/entities/execution-data'; import type { ExecutionEntity } from '@/databases/entities/execution-entity'; diff --git a/packages/cli/test/integration/shared/db/projects.ts b/packages/cli/test/integration/shared/db/projects.ts index 93310d5a99..6ca0fcfad2 100644 --- a/packages/cli/test/integration/shared/db/projects.ts +++ b/packages/cli/test/integration/shared/db/projects.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import type { Project } from '@/databases/entities/project'; import type { ProjectRelation, ProjectRole } from '@/databases/entities/project-relation'; diff --git a/packages/cli/test/integration/shared/db/tags.ts b/packages/cli/test/integration/shared/db/tags.ts index b9d943b938..af5638f902 100644 --- a/packages/cli/test/integration/shared/db/tags.ts +++ b/packages/cli/test/integration/shared/db/tags.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import type { TagEntity } from '@/databases/entities/tag-entity'; import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; diff --git a/packages/cli/test/integration/shared/db/users.ts b/packages/cli/test/integration/shared/db/users.ts index 64c4d8ad85..bb4332f9de 100644 --- a/packages/cli/test/integration/shared/db/users.ts +++ b/packages/cli/test/integration/shared/db/users.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { hash } from 'bcryptjs'; -import Container from 'typedi'; import { AuthIdentity } from '@/databases/entities/auth-identity'; import { type GlobalRole, type User } from '@/databases/entities/user'; diff --git a/packages/cli/test/integration/shared/db/variables.ts b/packages/cli/test/integration/shared/db/variables.ts index 582d3ccc1b..2ff052e7c0 100644 --- a/packages/cli/test/integration/shared/db/variables.ts +++ b/packages/cli/test/integration/shared/db/variables.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { randomString } from 'n8n-workflow'; -import Container from 'typedi'; import { VariablesRepository } from '@/databases/repositories/variables.repository'; import { generateNanoId } from '@/databases/utils/generators'; diff --git a/packages/cli/test/integration/shared/db/workflow-history.ts b/packages/cli/test/integration/shared/db/workflow-history.ts index 31d7e50cf5..ff7a2d5bec 100644 --- a/packages/cli/test/integration/shared/db/workflow-history.ts +++ b/packages/cli/test/integration/shared/db/workflow-history.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { v4 as uuid } from 'uuid'; import type { WorkflowHistory } from '@/databases/entities/workflow-history'; diff --git a/packages/cli/test/integration/shared/db/workflow-statistics.ts b/packages/cli/test/integration/shared/db/workflow-statistics.ts index 842ce6518a..0eee830816 100644 --- a/packages/cli/test/integration/shared/db/workflow-statistics.ts +++ b/packages/cli/test/integration/shared/db/workflow-statistics.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import type { Workflow } from 'n8n-workflow'; -import Container from 'typedi'; import { StatisticsNames, type WorkflowStatistics } from '@/databases/entities/workflow-statistics'; import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository'; diff --git a/packages/cli/test/integration/shared/db/workflows.ts b/packages/cli/test/integration/shared/db/workflows.ts index bc8099e494..dfd272b396 100644 --- a/packages/cli/test/integration/shared/db/workflows.ts +++ b/packages/cli/test/integration/shared/db/workflows.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import type { DeepPartial } from '@n8n/typeorm'; import { NodeConnectionType } from 'n8n-workflow'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import { Project } from '@/databases/entities/project'; diff --git a/packages/cli/test/integration/shared/ldap.ts b/packages/cli/test/integration/shared/ldap.ts index 9f87bd9962..9cf37e6b62 100644 --- a/packages/cli/test/integration/shared/ldap.ts +++ b/packages/cli/test/integration/shared/ldap.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { jsonParse } from 'n8n-workflow'; -import Container from 'typedi'; import { SettingsRepository } from '@/databases/repositories/settings.repository'; import { LDAP_DEFAULT_CONFIGURATION, LDAP_FEATURE_NAME } from '@/ldap.ee/constants'; diff --git a/packages/cli/test/integration/shared/test-db.ts b/packages/cli/test/integration/shared/test-db.ts index 4cfb131fb2..052d383c27 100644 --- a/packages/cli/test/integration/shared/test-db.ts +++ b/packages/cli/test/integration/shared/test-db.ts @@ -1,10 +1,10 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import type { DataSourceOptions, Repository } from '@n8n/typeorm'; import { DataSource as Connection } from '@n8n/typeorm'; import { kebabCase } from 'lodash'; import type { Class } from 'n8n-core'; import { randomString } from 'n8n-workflow'; -import { Container } from 'typedi'; import { getOptionOverrides } from '@/databases/config'; import * as Db from '@/db'; diff --git a/packages/cli/test/integration/shared/utils/community-nodes.ts b/packages/cli/test/integration/shared/utils/community-nodes.ts index d29a9361be..033d86c709 100644 --- a/packages/cli/test/integration/shared/utils/community-nodes.ts +++ b/packages/cli/test/integration/shared/utils/community-nodes.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { NODE_PACKAGE_PREFIX } from '@/constants'; import { InstalledPackages } from '@/databases/entities/installed-packages'; diff --git a/packages/cli/test/integration/shared/utils/index.ts b/packages/cli/test/integration/shared/utils/index.ts index ba99e1ca07..f43b102bd3 100644 --- a/packages/cli/test/integration/shared/utils/index.ts +++ b/packages/cli/test/integration/shared/utils/index.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { BinaryDataService, @@ -13,7 +14,6 @@ import { Set } from 'n8n-nodes-base/nodes/Set/Set.node'; import { Start } from 'n8n-nodes-base/nodes/Start/Start.node'; import type { INodeTypeData, INode } from 'n8n-workflow'; import type request from 'supertest'; -import { Container } from 'typedi'; import { v4 as uuid } from 'uuid'; import config from '@/config'; diff --git a/packages/cli/test/integration/shared/utils/task-broker-test-server.ts b/packages/cli/test/integration/shared/utils/task-broker-test-server.ts index 86651eb04c..63a96678a2 100644 --- a/packages/cli/test/integration/shared/utils/task-broker-test-server.ts +++ b/packages/cli/test/integration/shared/utils/task-broker-test-server.ts @@ -1,7 +1,7 @@ import { TaskRunnersConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import request from 'supertest'; import type TestAgent from 'supertest/lib/agent'; -import Container from 'typedi'; import { TaskRunnerServer } from '@/task-runners/task-runner-server'; diff --git a/packages/cli/test/integration/shared/utils/test-server.ts b/packages/cli/test/integration/shared/utils/test-server.ts index d4c3437728..aab78ef33e 100644 --- a/packages/cli/test/integration/shared/utils/test-server.ts +++ b/packages/cli/test/integration/shared/utils/test-server.ts @@ -1,9 +1,9 @@ +import { Container } from '@n8n/di'; import cookieParser from 'cookie-parser'; import express from 'express'; import { Logger } from 'n8n-core'; import type superagent from 'superagent'; import request from 'supertest'; -import { Container } from 'typedi'; import { URL } from 'url'; import { AuthService } from '@/auth/auth.service'; diff --git a/packages/cli/test/integration/tags.api.test.ts b/packages/cli/test/integration/tags.api.test.ts index e3acc2a650..5d9a724f78 100644 --- a/packages/cli/test/integration/tags.api.test.ts +++ b/packages/cli/test/integration/tags.api.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import { TagRepository } from '@/databases/repositories/tag.repository'; diff --git a/packages/cli/test/integration/user.repository.test.ts b/packages/cli/test/integration/user.repository.test.ts index 4de084ba39..1e5ce846e0 100644 --- a/packages/cli/test/integration/user.repository.test.ts +++ b/packages/cli/test/integration/user.repository.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository'; import { UserRepository } from '@/databases/repositories/user.repository'; diff --git a/packages/cli/test/integration/users.api.test.ts b/packages/cli/test/integration/users.api.test.ts index 9ecacdec0c..01fc50a17f 100644 --- a/packages/cli/test/integration/users.api.test.ts +++ b/packages/cli/test/integration/users.api.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { v4 as uuid } from 'uuid'; import { RESPONSE_ERROR_MESSAGES } from '@/constants'; diff --git a/packages/cli/test/integration/variables.test.ts b/packages/cli/test/integration/variables.test.ts index c331da8e99..cb47fb8a61 100644 --- a/packages/cli/test/integration/variables.test.ts +++ b/packages/cli/test/integration/variables.test.ts @@ -1,4 +1,4 @@ -import { Container } from 'typedi'; +import { Container } from '@n8n/di'; import type { Variables } from '@/databases/entities/variables'; import { VariablesRepository } from '@/databases/repositories/variables.repository'; diff --git a/packages/cli/test/integration/webhooks.test.ts b/packages/cli/test/integration/webhooks.test.ts index 7d7b5105cb..0895f3caa8 100644 --- a/packages/cli/test/integration/webhooks.test.ts +++ b/packages/cli/test/integration/webhooks.test.ts @@ -1,8 +1,8 @@ import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { agent as testAgent } from 'supertest'; import type SuperAgentTest from 'supertest/lib/agent'; -import Container from 'typedi'; import { ExternalHooks } from '@/external-hooks'; import { LiveWebhooks } from '@/webhooks/live-webhooks'; diff --git a/packages/cli/test/integration/workflow-history-manager.test.ts b/packages/cli/test/integration/workflow-history-manager.test.ts index eaf5d74478..12dd037357 100644 --- a/packages/cli/test/integration/workflow-history-manager.test.ts +++ b/packages/cli/test/integration/workflow-history-manager.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { In } from '@n8n/typeorm'; import { DateTime } from 'luxon'; -import Container from 'typedi'; import config from '@/config'; import { WorkflowHistoryRepository } from '@/databases/repositories/workflow-history.repository'; diff --git a/packages/cli/test/integration/workflow-tag-mapping.repository.integration.test.ts b/packages/cli/test/integration/workflow-tag-mapping.repository.integration.test.ts index 563764de7f..c01adbc51a 100644 --- a/packages/cli/test/integration/workflow-tag-mapping.repository.integration.test.ts +++ b/packages/cli/test/integration/workflow-tag-mapping.repository.integration.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { TagRepository } from '@/databases/repositories/tag.repository'; import { WorkflowTagMappingRepository } from '@/databases/repositories/workflow-tag-mapping.repository'; diff --git a/packages/cli/test/integration/workflows/workflow-sharing.service.test.ts b/packages/cli/test/integration/workflows/workflow-sharing.service.test.ts index ab02af5b43..bfd068e2a0 100644 --- a/packages/cli/test/integration/workflows/workflow-sharing.service.test.ts +++ b/packages/cli/test/integration/workflows/workflow-sharing.service.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import type { User } from '@/databases/entities/user'; import { License } from '@/license'; diff --git a/packages/cli/test/integration/workflows/workflow.service.ee.test.ts b/packages/cli/test/integration/workflows/workflow.service.ee.test.ts index 5fbab55840..0bb272d0c6 100644 --- a/packages/cli/test/integration/workflows/workflow.service.ee.test.ts +++ b/packages/cli/test/integration/workflows/workflow.service.ee.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import { CredentialsEntity } from '@/databases/entities/credentials-entity'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; diff --git a/packages/cli/test/integration/workflows/workflow.service.test.ts b/packages/cli/test/integration/workflows/workflow.service.test.ts index 759dbc54c8..8e2c76c981 100644 --- a/packages/cli/test/integration/workflows/workflow.service.test.ts +++ b/packages/cli/test/integration/workflows/workflow.service.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; -import Container from 'typedi'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository'; diff --git a/packages/cli/test/integration/workflows/workflows.controller.ee.test.ts b/packages/cli/test/integration/workflows/workflows.controller.ee.test.ts index 2002843bfe..d376500484 100644 --- a/packages/cli/test/integration/workflows/workflows.controller.ee.test.ts +++ b/packages/cli/test/integration/workflows/workflows.controller.ee.test.ts @@ -1,5 +1,5 @@ +import { Container } from '@n8n/di'; import { ApplicationError, WorkflowActivationError, type INode } from 'n8n-workflow'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; diff --git a/packages/cli/test/integration/workflows/workflows.controller.test.ts b/packages/cli/test/integration/workflows/workflows.controller.test.ts index e7e00d63c8..e69e172f97 100644 --- a/packages/cli/test/integration/workflows/workflows.controller.test.ts +++ b/packages/cli/test/integration/workflows/workflows.controller.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import type { Scope } from '@n8n/permissions'; import type { INode, IPinData } from 'n8n-workflow'; -import Container from 'typedi'; import { v4 as uuid } from 'uuid'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; diff --git a/packages/cli/test/shared/mocking.ts b/packages/cli/test/shared/mocking.ts index 535388c556..9fa9852f98 100644 --- a/packages/cli/test/shared/mocking.ts +++ b/packages/cli/test/shared/mocking.ts @@ -1,9 +1,9 @@ +import { Container } from '@n8n/di'; import { DataSource, EntityManager, type EntityMetadata } from '@n8n/typeorm'; import { mock } from 'jest-mock-extended'; import type { Class } from 'n8n-core'; import type { Logger } from 'n8n-core'; import type { DeepPartial } from 'ts-essentials'; -import { Container } from 'typedi'; export const mockInstance = ( serviceClass: Class, diff --git a/packages/cli/test/teardown.ts b/packages/cli/test/teardown.ts index 1c40bf2df6..4d6339fde9 100644 --- a/packages/cli/test/teardown.ts +++ b/packages/cli/test/teardown.ts @@ -1,7 +1,7 @@ import 'tsconfig-paths/register'; import { GlobalConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import { DataSource as Connection } from '@n8n/typeorm'; -import { Container } from 'typedi'; import { getBootstrapDBOptions, testDbPrefix } from './integration/shared/test-db'; diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 3789372ef8..a427433aa6 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -22,6 +22,7 @@ { "path": "../@n8n/api-types/tsconfig.build.json" }, { "path": "../@n8n/client-oauth2/tsconfig.build.json" }, { "path": "../@n8n/config/tsconfig.build.json" }, + { "path": "../@n8n/di/tsconfig.build.json" }, { "path": "../@n8n/permissions/tsconfig.build.json" } ] } diff --git a/packages/core/package.json b/packages/core/package.json index 401a9f81c7..3b51aacf06 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -39,6 +39,7 @@ "@langchain/core": "catalog:", "@n8n/client-oauth2": "workspace:*", "@n8n/config": "workspace:*", + "@n8n/di": "workspace:*", "@sentry/node": "catalog:", "aws4": "1.11.0", "axios": "catalog:", @@ -61,7 +62,6 @@ "pretty-bytes": "5.6.0", "qs": "6.11.0", "ssh2": "1.15.0", - "typedi": "catalog:", "uuid": "catalog:", "winston": "3.14.2", "xml2js": "catalog:", diff --git a/packages/core/src/ActiveWorkflows.ts b/packages/core/src/ActiveWorkflows.ts index 173f73baca..abd544956a 100644 --- a/packages/core/src/ActiveWorkflows.ts +++ b/packages/core/src/ActiveWorkflows.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import type { IGetExecutePollFunctions, IGetExecuteTriggerFunctions, @@ -16,7 +17,6 @@ import { WorkflowActivationError, WorkflowDeactivationError, } from 'n8n-workflow'; -import { Service } from 'typedi'; import { ErrorReporter } from './error-reporter'; import type { IWorkflowData } from './Interfaces'; diff --git a/packages/core/src/BinaryData/BinaryData.service.ts b/packages/core/src/BinaryData/BinaryData.service.ts index 556a3176de..5876ae075e 100644 --- a/packages/core/src/BinaryData/BinaryData.service.ts +++ b/packages/core/src/BinaryData/BinaryData.service.ts @@ -1,9 +1,9 @@ +import { Container, Service } from '@n8n/di'; import { BINARY_ENCODING } from 'n8n-workflow'; import type { INodeExecutionData, IBinaryData } from 'n8n-workflow'; import { readFile, stat } from 'node:fs/promises'; import prettyBytes from 'pretty-bytes'; import type { Readable } from 'stream'; -import Container, { Service } from 'typedi'; import type { BinaryData } from './types'; import { areConfigModes, binaryToBuffer } from './utils'; diff --git a/packages/core/src/BinaryData/ObjectStore.manager.ts b/packages/core/src/BinaryData/ObjectStore.manager.ts index 65827d4ef0..5a2ab8ef55 100644 --- a/packages/core/src/BinaryData/ObjectStore.manager.ts +++ b/packages/core/src/BinaryData/ObjectStore.manager.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import fs from 'node:fs/promises'; import type { Readable } from 'node:stream'; -import { Service } from 'typedi'; import { v4 as uuid } from 'uuid'; import type { BinaryData } from './types'; diff --git a/packages/core/src/Cipher.ts b/packages/core/src/Cipher.ts index d9ed93ddb6..812c8f452a 100644 --- a/packages/core/src/Cipher.ts +++ b/packages/core/src/Cipher.ts @@ -1,5 +1,5 @@ +import { Service } from '@n8n/di'; import { createHash, createCipheriv, createDecipheriv, randomBytes } from 'crypto'; -import { Service } from 'typedi'; import { InstanceSettings } from './InstanceSettings'; diff --git a/packages/core/src/Credentials.ts b/packages/core/src/Credentials.ts index da6deb742c..f5f8eb834f 100644 --- a/packages/core/src/Credentials.ts +++ b/packages/core/src/Credentials.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import type { ICredentialDataDecryptedObject, ICredentialsEncrypted } from 'n8n-workflow'; import { ApplicationError, ICredentials, jsonParse } from 'n8n-workflow'; -import { Container } from 'typedi'; import { Cipher } from './Cipher'; diff --git a/packages/core/src/DirectoryLoader.ts b/packages/core/src/DirectoryLoader.ts index fe9fee8769..26dace0fd1 100644 --- a/packages/core/src/DirectoryLoader.ts +++ b/packages/core/src/DirectoryLoader.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import glob from 'fast-glob'; import uniqBy from 'lodash/uniqBy'; import type { @@ -19,7 +20,6 @@ import { ApplicationError, applyDeclarativeNodeOptionParameters, jsonParse } fro import { readFileSync } from 'node:fs'; import { readFile } from 'node:fs/promises'; import * as path from 'path'; -import Container from 'typedi'; import { Logger } from '@/logging/logger'; diff --git a/packages/core/src/InstanceSettings.ts b/packages/core/src/InstanceSettings.ts index ebdfb7fd63..d06f68fc12 100644 --- a/packages/core/src/InstanceSettings.ts +++ b/packages/core/src/InstanceSettings.ts @@ -1,9 +1,9 @@ +import { Service } from '@n8n/di'; import { createHash, randomBytes } from 'crypto'; import { ApplicationError, jsonParse, ALPHABET, toResult } from 'n8n-workflow'; import { customAlphabet } from 'nanoid'; import { chmodSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'; import path from 'path'; -import { Service } from 'typedi'; import { Logger } from '@/logging/logger'; diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index 3a0ebf22f9..9504ad1c78 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -13,6 +13,7 @@ import type { OAuth2CredentialData, } from '@n8n/client-oauth2'; import { ClientOAuth2 } from '@n8n/client-oauth2'; +import { Container } from '@n8n/di'; import type { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosResponse } from 'axios'; import axios from 'axios'; import chardet from 'chardet'; @@ -93,7 +94,6 @@ import clientOAuth1 from 'oauth-1.0a'; import path from 'path'; import { stringify } from 'qs'; import { Readable } from 'stream'; -import Container from 'typedi'; import url, { URL, URLSearchParams } from 'url'; import { Logger } from '@/logging/logger'; diff --git a/packages/core/src/ObjectStore/ObjectStore.service.ee.ts b/packages/core/src/ObjectStore/ObjectStore.service.ee.ts index 6379de7789..e1b98c6f50 100644 --- a/packages/core/src/ObjectStore/ObjectStore.service.ee.ts +++ b/packages/core/src/ObjectStore/ObjectStore.service.ee.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import { sign } from 'aws4'; import type { Request as Aws4Options, Credentials as Aws4Credentials } from 'aws4'; import axios from 'axios'; @@ -5,7 +6,6 @@ import type { AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig, Met import { ApplicationError } from 'n8n-workflow'; import { createHash } from 'node:crypto'; import type { Readable } from 'stream'; -import { Service } from 'typedi'; import { Logger } from '@/logging/logger'; diff --git a/packages/core/src/SSHClientsManager.ts b/packages/core/src/SSHClientsManager.ts index 17046a26eb..a29c5facc7 100644 --- a/packages/core/src/SSHClientsManager.ts +++ b/packages/core/src/SSHClientsManager.ts @@ -1,7 +1,7 @@ +import { Service } from '@n8n/di'; import type { SSHCredentials } from 'n8n-workflow'; import { createHash } from 'node:crypto'; import { Client, type ConnectConfig } from 'ssh2'; -import { Service } from 'typedi'; @Service() export class SSHClientsManager { diff --git a/packages/core/src/ScheduledTaskManager.ts b/packages/core/src/ScheduledTaskManager.ts index 00396903a5..0c33f9872c 100644 --- a/packages/core/src/ScheduledTaskManager.ts +++ b/packages/core/src/ScheduledTaskManager.ts @@ -1,6 +1,6 @@ +import { Service } from '@n8n/di'; import { CronJob } from 'cron'; import type { CronExpression, Workflow } from 'n8n-workflow'; -import { Service } from 'typedi'; import { InstanceSettings } from './InstanceSettings'; diff --git a/packages/core/src/TriggersAndPollers.ts b/packages/core/src/TriggersAndPollers.ts index b77926e136..681d50641a 100644 --- a/packages/core/src/TriggersAndPollers.ts +++ b/packages/core/src/TriggersAndPollers.ts @@ -1,3 +1,4 @@ +import { Service } from '@n8n/di'; import { ApplicationError } from 'n8n-workflow'; import type { Workflow, @@ -13,7 +14,6 @@ import type { IExecuteResponsePromiseData, IRun, } from 'n8n-workflow'; -import { Service } from 'typedi'; @Service() export class TriggersAndPollers { diff --git a/packages/core/src/WorkflowExecute.ts b/packages/core/src/WorkflowExecute.ts index ebfad1e204..3817fe32b2 100644 --- a/packages/core/src/WorkflowExecute.ts +++ b/packages/core/src/WorkflowExecute.ts @@ -2,6 +2,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */ +import { Container } from '@n8n/di'; import * as assert from 'assert/strict'; import { setMaxListeners } from 'events'; import { omit } from 'lodash'; @@ -53,7 +54,6 @@ import { Node, } from 'n8n-workflow'; import PCancelable from 'p-cancelable'; -import Container from 'typedi'; import { ErrorReporter } from './error-reporter'; import { ExecuteContext, PollContext } from './node-execution-context'; diff --git a/packages/core/src/error-reporter.ts b/packages/core/src/error-reporter.ts index 910b309270..0bc0f6058e 100644 --- a/packages/core/src/error-reporter.ts +++ b/packages/core/src/error-reporter.ts @@ -1,10 +1,10 @@ +import { Service } from '@n8n/di'; import type { NodeOptions } from '@sentry/node'; import { close } from '@sentry/node'; import type { ErrorEvent, EventHint } from '@sentry/types'; import { AxiosError } from 'axios'; import { ApplicationError, ExecutionCancelledError, type ReportingOptions } from 'n8n-workflow'; import { createHash } from 'node:crypto'; -import { Service } from 'typedi'; import type { InstanceType } from './InstanceSettings'; import { Logger } from './logging/logger'; diff --git a/packages/core/src/logging/logger.ts b/packages/core/src/logging/logger.ts index 654d16f7b0..8115f93c86 100644 --- a/packages/core/src/logging/logger.ts +++ b/packages/core/src/logging/logger.ts @@ -1,5 +1,6 @@ import type { LogScope } from '@n8n/config'; import { GlobalConfig } from '@n8n/config'; +import { Service } from '@n8n/di'; import callsites from 'callsites'; import type { TransformableInfo } from 'logform'; import { LoggerProxy, LOG_LEVELS } from 'n8n-workflow'; @@ -11,7 +12,6 @@ import type { } from 'n8n-workflow'; import path, { basename } from 'node:path'; import pc from 'picocolors'; -import { Service } from 'typedi'; import winston from 'winston'; import { inDevelopment, inProduction } from '@/Constants'; diff --git a/packages/core/src/node-execution-context/__tests__/node-execution-context.test.ts b/packages/core/src/node-execution-context/__tests__/node-execution-context.test.ts index 443460bb33..a0a368df4c 100644 --- a/packages/core/src/node-execution-context/__tests__/node-execution-context.test.ts +++ b/packages/core/src/node-execution-context/__tests__/node-execution-context.test.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import type { Expression, @@ -10,7 +11,6 @@ import type { WorkflowExecuteMode, } from 'n8n-workflow'; import { NodeConnectionType } from 'n8n-workflow'; -import { Container } from 'typedi'; import { InstanceSettings } from '@/InstanceSettings'; diff --git a/packages/core/src/node-execution-context/__tests__/shared-tests.ts b/packages/core/src/node-execution-context/__tests__/shared-tests.ts index 9992507bdd..8b1d23930b 100644 --- a/packages/core/src/node-execution-context/__tests__/shared-tests.ts +++ b/packages/core/src/node-execution-context/__tests__/shared-tests.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { captor, mock, type MockProxy } from 'jest-mock-extended'; import type { IRunExecutionData, @@ -15,7 +16,6 @@ import type { IExecuteWorkflowInfo, } from 'n8n-workflow'; import { ApplicationError, NodeHelpers, WAIT_INDEFINITELY } from 'n8n-workflow'; -import Container from 'typedi'; import { BinaryDataService } from '@/BinaryData/BinaryData.service'; diff --git a/packages/core/src/node-execution-context/base-execute-context.ts b/packages/core/src/node-execution-context/base-execute-context.ts index 24b9e89301..0416870344 100644 --- a/packages/core/src/node-execution-context/base-execute-context.ts +++ b/packages/core/src/node-execution-context/base-execute-context.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { get } from 'lodash'; import type { Workflow, @@ -27,7 +28,6 @@ import { WAIT_INDEFINITELY, WorkflowDataProxy, } from 'n8n-workflow'; -import { Container } from 'typedi'; import { BinaryDataService } from '@/BinaryData/BinaryData.service'; diff --git a/packages/core/src/node-execution-context/node-execution-context.ts b/packages/core/src/node-execution-context/node-execution-context.ts index d303b10ba1..45a205637c 100644 --- a/packages/core/src/node-execution-context/node-execution-context.ts +++ b/packages/core/src/node-execution-context/node-execution-context.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { get } from 'lodash'; import type { FunctionsBase, @@ -26,7 +27,6 @@ import { NodeHelpers, NodeOperationError, } from 'n8n-workflow'; -import { Container } from 'typedi'; import { HTTP_REQUEST_NODE_TYPE, HTTP_REQUEST_TOOL_NODE_TYPE } from '@/Constants'; import { Memoized } from '@/decorators'; diff --git a/packages/core/test/Cipher.test.ts b/packages/core/test/Cipher.test.ts index e3dfa609fa..7f6bcdedf3 100644 --- a/packages/core/test/Cipher.test.ts +++ b/packages/core/test/Cipher.test.ts @@ -1,4 +1,4 @@ -import Container from 'typedi'; +import { Container } from '@n8n/di'; import { Cipher } from '@/Cipher'; import { InstanceSettings } from '@/InstanceSettings'; diff --git a/packages/core/test/Credentials.test.ts b/packages/core/test/Credentials.test.ts index fa7be59267..bf6ba29ca5 100644 --- a/packages/core/test/Credentials.test.ts +++ b/packages/core/test/Credentials.test.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import type { CredentialInformation } from 'n8n-workflow'; -import { Container } from 'typedi'; import { Cipher } from '@/Cipher'; import { Credentials } from '@/Credentials'; diff --git a/packages/core/test/NodeExecuteFunctions.test.ts b/packages/core/test/NodeExecuteFunctions.test.ts index b1b6e96577..703e3f9bef 100644 --- a/packages/core/test/NodeExecuteFunctions.test.ts +++ b/packages/core/test/NodeExecuteFunctions.test.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import FormData from 'form-data'; import { mkdtempSync, readFileSync } from 'fs'; import { IncomingMessage } from 'http'; @@ -19,7 +20,6 @@ import { tmpdir } from 'os'; import { join } from 'path'; import { Readable } from 'stream'; import type { SecureContextOptions } from 'tls'; -import Container from 'typedi'; import { BinaryDataService } from '@/BinaryData/BinaryData.service'; import { InstanceSettings } from '@/InstanceSettings'; diff --git a/packages/core/test/utils.ts b/packages/core/test/utils.ts index f1ed54dd03..49db471e7e 100644 --- a/packages/core/test/utils.ts +++ b/packages/core/test/utils.ts @@ -1,8 +1,8 @@ +import type { Constructable } from '@n8n/di'; +import { Container } from '@n8n/di'; import { mock } from 'jest-mock-extended'; import { Duplex } from 'stream'; import type { DeepPartial } from 'ts-essentials'; -import type { Constructable } from 'typedi'; -import { Container } from 'typedi'; export const mockInstance = ( constructor: Constructable, diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 654ae1be61..111dd828dd 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -16,6 +16,7 @@ "references": [ { "path": "../workflow/tsconfig.build.json" }, { "path": "../@n8n/config/tsconfig.build.json" }, + { "path": "../@n8n/di/tsconfig.build.json" }, { "path": "../@n8n/client-oauth2/tsconfig.build.json" } ] } diff --git a/packages/node-dev/commands/build.ts b/packages/node-dev/commands/build.ts index ce42baf7dd..042a15111d 100644 --- a/packages/node-dev/commands/build.ts +++ b/packages/node-dev/commands/build.ts @@ -1,6 +1,6 @@ +import { Container } from '@n8n/di'; import { Command, Flags } from '@oclif/core'; import { InstanceSettings } from 'n8n-core'; -import { Container } from 'typedi'; import type { IBuildOptions } from '../src'; import { buildFiles } from '../src'; diff --git a/packages/node-dev/package.json b/packages/node-dev/package.json index 96e133aa17..a2fd1b7766 100644 --- a/packages/node-dev/package.json +++ b/packages/node-dev/package.json @@ -39,6 +39,7 @@ "@types/inquirer": "^6.5.0" }, "dependencies": { + "@n8n/di": "workspace:*", "@oclif/core": "4.0.7", "change-case": "^4.1.1", "fast-glob": "catalog:", @@ -46,7 +47,6 @@ "n8n-core": "workspace:*", "n8n-workflow": "workspace:*", "replace-in-file": "^6.0.0", - "tmp-promise": "^3.0.3", - "typedi": "catalog:" + "tmp-promise": "^3.0.3" } } diff --git a/packages/node-dev/src/Build.ts b/packages/node-dev/src/Build.ts index de6d83a2cf..b0446472c2 100644 --- a/packages/node-dev/src/Build.ts +++ b/packages/node-dev/src/Build.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ +import { Container } from '@n8n/di'; import { spawn } from 'child_process'; import glob from 'fast-glob'; import { copyFile, mkdir, readFile, writeFile } from 'fs/promises'; @@ -7,7 +8,6 @@ import { InstanceSettings } from 'n8n-core'; import { jsonParse } from 'n8n-workflow'; import { join, dirname, resolve as resolvePath } from 'path'; import { file as tmpFile } from 'tmp-promise'; -import { Container } from 'typedi'; import type { IBuildOptions } from './Interfaces'; diff --git a/packages/nodes-base/nodes/Code/Code.node.ts b/packages/nodes-base/nodes/Code/Code.node.ts index 99604a712a..24a26923e8 100644 --- a/packages/nodes-base/nodes/Code/Code.node.ts +++ b/packages/nodes-base/nodes/Code/Code.node.ts @@ -1,4 +1,5 @@ import { TaskRunnersConfig } from '@n8n/config'; +import { Container } from '@n8n/di'; import set from 'lodash/set'; import { NodeConnectionType, @@ -9,7 +10,6 @@ import { type INodeType, type INodeTypeDescription, } from 'n8n-workflow'; -import Container from 'typedi'; import { javascriptCodeDescription } from './descriptions/JavascriptCodeDescription'; import { pythonCodeDescription } from './descriptions/PythonCodeDescription'; diff --git a/packages/nodes-base/package.json b/packages/nodes-base/package.json index 0307b66721..51bbf93fea 100644 --- a/packages/nodes-base/package.json +++ b/packages/nodes-base/package.json @@ -851,6 +851,7 @@ "@aws-sdk/client-sso-oidc": "3.666.0", "@kafkajs/confluent-schema-registry": "1.0.6", "@n8n/config": "workspace:*", + "@n8n/di": "workspace:*", "@n8n/imap": "workspace:*", "@n8n/vm2": "3.9.25", "alasql": "4.4.0", @@ -910,7 +911,6 @@ "ssh2-sftp-client": "7.2.3", "tmp-promise": "3.0.3", "ts-ics": "1.2.2", - "typedi": "catalog:", "uuid": "catalog:", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz", "xml2js": "catalog:" diff --git a/packages/nodes-base/test/nodes/Helpers.ts b/packages/nodes-base/test/nodes/Helpers.ts index 19e4f72b40..017e2058f9 100644 --- a/packages/nodes-base/test/nodes/Helpers.ts +++ b/packages/nodes-base/test/nodes/Helpers.ts @@ -1,3 +1,4 @@ +import { Container } from '@n8n/di'; import { readFileSync, readdirSync, mkdtempSync } from 'fs'; import { mock } from 'jest-mock-extended'; import { get } from 'lodash'; @@ -38,7 +39,6 @@ import { ApplicationError, ICredentialsHelper, NodeHelpers, WorkflowHooks } from import nock from 'nock'; import { tmpdir } from 'os'; import path from 'path'; -import { Container } from 'typedi'; import { executeWorkflow } from './ExecuteWorkflow'; import { FAKE_CREDENTIALS_DATA } from './FakeCredentialsMap'; diff --git a/patches/typedi@0.10.0.patch b/patches/typedi@0.10.0.patch deleted file mode 100644 index d9b4ab659c..0000000000 --- a/patches/typedi@0.10.0.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/cjs/container-instance.class.js b/cjs/container-instance.class.js -index e473b1e652aa0b6e7462f7ba93fcef2812483b20..9e57857e5584373b88a9fad3fbb37bbcc56b554a 100644 ---- a/cjs/container-instance.class.js -+++ b/cjs/container-instance.class.js -@@ -234,6 +234,9 @@ class ContainerInstance { - */ - initializeParams(target, paramTypes) { - return paramTypes.map((paramType, index) => { -+ if (paramType === undefined) { -+ throw new ReferenceError(`Circular dependency: Target${target.name}. Index: ${index} `); -+ } - const paramHandler = container_class_1.Container.handlers.find(handler => { - /** - * @Inject()-ed values are stored as parameter handlers and they reference their target diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3b555fd45d..bdefe6baa9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -60,9 +60,9 @@ catalogs: picocolors: specifier: 1.0.1 version: 1.0.1 - typedi: - specifier: 0.10.0 - version: 0.10.0 + reflect-metadata: + specifier: 0.2.2 + version: 0.2.2 uuid: specifier: 10.0.0 version: 10.0.0 @@ -136,9 +136,6 @@ patchedDependencies: pyodide@0.23.4: hash: kzcwsjcayy5m6iezu7r4tdimjq path: patches/pyodide@0.23.4.patch - typedi@0.10.0: - hash: sk6omkefrosihg7lmqbzh7vfxe - path: patches/typedi@0.10.0.patch vue-tsc@2.1.10: hash: z2iuqlt7ype4qnrwd5eymeecl4 path: patches/vue-tsc@2.1.10.patch @@ -380,12 +377,18 @@ importers: packages/@n8n/config: dependencies: + '@n8n/di': + specifier: workspace:* + version: link:../di reflect-metadata: - specifier: 0.2.2 - version: 0.2.2 - typedi: specifier: 'catalog:' - version: 0.10.0(patch_hash=sk6omkefrosihg7lmqbzh7vfxe) + version: 0.2.2 + + packages/@n8n/di: + dependencies: + reflect-metadata: + specifier: 'catalog:' + version: 0.2.2 packages/@n8n/imap: dependencies: @@ -669,6 +672,9 @@ importers: '@n8n/config': specifier: workspace:* version: link:../config + '@n8n/di': + specifier: workspace:* + version: link:../di '@sentry/node': specifier: 'catalog:' version: 8.42.0 @@ -690,9 +696,6 @@ importers: nanoid: specifier: 'catalog:' version: 3.3.8 - typedi: - specifier: 'catalog:' - version: 0.10.0(patch_hash=sk6omkefrosihg7lmqbzh7vfxe) ws: specifier: '>=8.17.1' version: 8.17.1 @@ -772,6 +775,9 @@ importers: '@n8n/config': specifier: workspace:* version: link:../@n8n/config + '@n8n/di': + specifier: workspace:* + version: link:../@n8n/di '@n8n/localtunnel': specifier: 3.0.0 version: 3.0.0 @@ -968,7 +974,7 @@ importers: specifier: 2.5.1 version: 2.5.1 reflect-metadata: - specifier: 0.2.2 + specifier: 'catalog:' version: 0.2.2 replacestream: specifier: 4.0.3 @@ -1000,9 +1006,6 @@ importers: syslog-client: specifier: 1.1.1 version: 1.1.1 - typedi: - specifier: 'catalog:' - version: 0.10.0(patch_hash=sk6omkefrosihg7lmqbzh7vfxe) uuid: specifier: 'catalog:' version: 10.0.0 @@ -1127,6 +1130,9 @@ importers: '@n8n/config': specifier: workspace:* version: link:../@n8n/config + '@n8n/di': + specifier: workspace:* + version: link:../@n8n/di '@sentry/node': specifier: 'catalog:' version: 8.42.0 @@ -1193,9 +1199,6 @@ importers: ssh2: specifier: 1.15.0 version: 1.15.0 - typedi: - specifier: 'catalog:' - version: 0.10.0(patch_hash=sk6omkefrosihg7lmqbzh7vfxe) uuid: specifier: 'catalog:' version: 10.0.0 @@ -1625,6 +1628,9 @@ importers: packages/node-dev: dependencies: + '@n8n/di': + specifier: workspace:* + version: link:../@n8n/di '@oclif/core': specifier: 4.0.7 version: 4.0.7 @@ -1649,9 +1655,6 @@ importers: tmp-promise: specifier: ^3.0.3 version: 3.0.3 - typedi: - specifier: 'catalog:' - version: 0.10.0(patch_hash=sk6omkefrosihg7lmqbzh7vfxe) devDependencies: '@types/inquirer': specifier: ^6.5.0 @@ -1668,6 +1671,9 @@ importers: '@n8n/config': specifier: workspace:* version: link:../@n8n/config + '@n8n/di': + specifier: workspace:* + version: link:../@n8n/di '@n8n/imap': specifier: workspace:* version: link:../@n8n/imap @@ -1845,9 +1851,6 @@ importers: ts-ics: specifier: 1.2.2 version: 1.2.2(date-fns@2.30.0)(lodash@4.17.21)(zod@3.23.8) - typedi: - specifier: 'catalog:' - version: 0.10.0(patch_hash=sk6omkefrosihg7lmqbzh7vfxe) uuid: specifier: 'catalog:' version: 10.0.0 @@ -12615,9 +12618,6 @@ packages: typedarray@0.0.6: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} - typedi@0.10.0: - resolution: {integrity: sha512-v3UJF8xm68BBj6AF4oQML3ikrfK2c9EmZUyLOfShpJuItAqVBHWP/KtpGinkSsIiP6EZyyb6Z3NXyW9dgS9X1w==} - typescript@5.7.2: resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} engines: {node: '>=14.17'} @@ -27008,8 +27008,6 @@ snapshots: typedarray@0.0.6: {} - typedi@0.10.0(patch_hash=sk6omkefrosihg7lmqbzh7vfxe): {} - typescript@5.7.2: {} uc.micro@1.0.6: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 9700a3a45b..817bb12dfb 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -23,7 +23,7 @@ catalog: luxon: 3.4.4 nanoid: 3.3.8 picocolors: 1.0.1 - typedi: 0.10.0 + reflect-metadata: 0.2.2 uuid: 10.0.0 xml2js: 0.6.2 xss: 1.0.15 diff --git a/turbo.json b/turbo.json index 722427c28d..ce2b37e160 100644 --- a/turbo.json +++ b/turbo.json @@ -28,6 +28,7 @@ "dependsOn": [ "@n8n/api-types#lint", "@n8n/config#lint", + "@n8n/di#lint", "@n8n/client-oauth2#lint", "@n8n/imap#lint", "@n8n/permissions#lint", @@ -57,6 +58,7 @@ "dependsOn": [ "@n8n/api-types#test", "@n8n/config#test", + "@n8n/di#test", "@n8n/client-oauth2#test", "@n8n/imap#test", "@n8n/permissions#test",