Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): Use @/databases/ instead of @db/ (no-changelog) #10573

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/cli/src/Db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';

import { inTest } from '@/constants';
import { wrapMigration } from '@/databases/utils/migration-helpers';
import type { Migration } from '@db/types';
import { getConnectionOptions } from '@db/config';
import type { Migration } from '@/databases/types';
import { getConnectionOptions } from '@/databases/config';

let connection: Connection;

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ import type { AuthProviderType } from '@/databases/entities/auth-identity';
import type { SharedCredentials } from '@/databases/entities/shared-credentials';
import type { TagEntity } from '@/databases/entities/tag-entity';
import type { AssignableRole, GlobalRole, User } from '@/databases/entities/User';
import type { CredentialsRepository } from '@db/repositories/credentials.repository';
import type { SettingsRepository } from '@db/repositories/settings.repository';
import type { UserRepository } from '@db/repositories/user.repository';
import type { WorkflowRepository } from '@db/repositories/workflow.repository';
import type { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import type { SettingsRepository } from '@/databases/repositories/settings.repository';
import type { UserRepository } from '@/databases/repositories/user.repository';
import type { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import type { ExternalHooks } from './external-hooks';
import type { LICENSE_FEATURES, LICENSE_QUOTAS } from './constants';
import type { WorkflowWithSharingsAndCredentials } from './workflows/workflows.types';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/PublicApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { OpenAPIV3 } from 'openapi-types';
import type { JsonObject } from 'swagger-ui-express';

import { License } from '@/license';
import { UserRepository } from '@db/repositories/user.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { UrlService } from '@/services/url.service';
import type { AuthenticatedRequest } from '@/requests';
import { GlobalConfig } from '@n8n/config';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/PublicApi/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ExecutionStatus, ICredentialDataDecryptedObject } from 'n8n-workflow';

import type { WorkflowEntity } from '@db/entities/workflow-entity';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import type { TagEntity } from '@/databases/entities/tag-entity';
import type { Risk } from '@/security-audit/types';
import type { AuthlessRequest, AuthenticatedRequest } from '@/requests';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ExternalHooks } from '@/external-hooks';
import type { IDependency, IJsonSchema } from '../../../types';
import type { CredentialRequest } from '@/requests';
import { Container } from 'typedi';
import { CredentialsRepository } from '@db/repositories/credentials.repository';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { ProjectRepository } from '@/databases/repositories/project.repository';
import { EventService } from '@/events/event.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { ExecutionRequest } from '../../../types';
import { getSharedWorkflowIds } from '../workflows/workflows.service';
import { encodeNextCursor } from '../../shared/services/pagination.service';
import { EventService } from '@/events/event.service';
import { ExecutionRepository } from '@db/repositories/execution.repository';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service';

export = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { encodeNextCursor } from '../../shared/services/pagination.service';
import { Container } from 'typedi';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import type { FindManyOptions } from '@n8n/typeorm';
import { TagRepository } from '@db/repositories/tag.repository';
import { TagRepository } from '@/databases/repositories/tag.repository';
import { TagService } from '@/services/tag.service';

export = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Container } from 'typedi';
import { UserRepository } from '@db/repositories/user.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import type { User } from '@/databases/entities/User';
import pick from 'lodash/pick';
import { validate as uuidValidate } from 'uuid';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { v4 as uuid } from 'uuid';

import { ActiveWorkflowManager } from '@/active-workflow-manager';
import config from '@/config';
import { WorkflowEntity } from '@db/entities/workflow-entity';
import { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { ExternalHooks } from '@/external-hooks';
import { addNodeIds, replaceInvalidCredentials } from '@/workflow-helpers';
import type { WorkflowRequest } from '../../../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Container } from 'typedi';
import * as Db from '@/Db';
import type { User } from '@/databases/entities/User';
import { WorkflowEntity } from '@db/entities/workflow-entity';
import { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { WorkflowTagMapping } from '@/databases/entities/workflow-tag-mapping';
import { SharedWorkflow, type WorkflowSharingRole } from '@/databases/entities/shared-workflow';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import type { Project } from '@/databases/entities/project';
import { TagRepository } from '@db/repositories/tag.repository';
import { TagRepository } from '@/databases/repositories/tag.repository';
import { License } from '@/license';
import { WorkflowSharingService } from '@/workflows/workflow-sharing.service';
import type { Scope } from '@n8n/permissions';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/active-executions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { v4 as uuid } from 'uuid';
import type { IExecuteResponsePromiseData, IRun } from 'n8n-workflow';
import { createDeferredPromise } from 'n8n-workflow';
import type { IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { ExecutionRepository } from '@db/repositories/execution.repository';
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { mock } from 'jest-mock-extended';
import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service';
import { mockInstance } from '@test/mocking';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/credentials-helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Workflow } from 'n8n-workflow';
import { CredentialsHelper } from '@/credentials-helper';
import { NodeTypes } from '@/node-types';
import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials';
import { CredentialsRepository } from '@db/repositories/credentials.repository';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { mockInstance } from '@test/mocking';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/active-executions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type {
IWorkflowExecutionDataProcess,
} from '@/Interfaces';
import { isWorkflowIdValid } from '@/utils';
import { ExecutionRepository } from '@db/repositories/execution.repository';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { Logger } from '@/logger';
import { ConcurrencyControlService } from './concurrency/concurrency-control.service';
import config from './config';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/active-workflow-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type { IWorkflowDb } from '@/Interfaces';
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';

import type { WorkflowEntity } from '@db/entities/workflow-entity';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { ActiveExecutions } from '@/active-executions';
import { ExecutionService } from './executions/execution.service';
import {
Expand All @@ -42,7 +42,7 @@ import { NodeTypes } from '@/node-types';
import { ExternalHooks } from '@/external-hooks';
import { WebhookService } from '@/webhooks/webhook.service';
import { Logger } from './logger';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { OrchestrationService } from '@/services/orchestration.service';
import { ActivationErrorsService } from '@/activation-errors.service';
import { ActiveWorkflowsService } from '@/services/activeWorkflows.service';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/auth/__tests__/auth.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import config from '@/config';
import { AUTH_COOKIE_NAME, Time } from '@/constants';
import type { User } from '@/databases/entities/User';
import type { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import type { UserRepository } from '@db/repositories/user.repository';
import type { UserRepository } from '@/databases/repositories/user.repository';
import { JwtService } from '@/services/jwt.service';
import type { UrlService } from '@/services/url.service';
import type { AuthenticatedRequest } from '@/requests';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import config from '@/config';
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES, Time } from '@/constants';
import type { User } from '@/databases/entities/User';
import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error';
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
import { License } from '@/license';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/auth/methods/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { User } from '@/databases/entities/User';
import { PasswordUtility } from '@/services/password.utility';
import { Container } from 'typedi';
import { isLdapLoginEnabled } from '@/ldap/helpers.ee';
import { UserRepository } from '@db/repositories/user.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error';
import { EventService } from '@/events/event.service';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { PostHogClient } from '@/posthog';
import { License } from '@/license';
import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee';
import { initExpressionEvaluator } from '@/expression-evaluator';
import { generateHostInstanceId } from '@db/utils/generators';
import { generateHostInstanceId } from '@/databases/utils/generators';
import { WorkflowHistoryManager } from '@/workflows/workflow-history/workflow-history-manager.ee';
import { ShutdownService } from '@/shutdown/shutdown.service';
import { TelemetryEventRelay } from '@/events/telemetry-event-relay';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/db/revert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { DataSourceOptions as ConnectionOptions } from '@n8n/typeorm';
import { MigrationExecutor, DataSource as Connection } from '@n8n/typeorm';
import { Container } from 'typedi';
import { Logger } from '@/logger';
import { getConnectionOptions } from '@db/config';
import type { Migration } from '@db/types';
import { getConnectionOptions } from '@/databases/config';
import type { Migration } from '@/databases/types';
import { wrapMigration } from '@/databases/utils/migration-helpers';

// This function is extracted to make it easier to unit test it.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { IWorkflowExecutionDataProcess } from '@/Interfaces';
import { findCliWorkflowStart, isWorkflowIdValid } from '@/utils';
import { BaseCommand } from './base-command';

import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { OwnershipService } from '@/services/ownership.service';

export class Execute extends BaseCommand {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/executeBatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ActiveExecutions } from '@/active-executions';
import { WorkflowRunner } from '@/workflow-runner';
import type { IWorkflowDb, IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { User } from '@/databases/entities/User';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { OwnershipService } from '@/services/ownership.service';
import { findCliWorkflowStart } from '@/utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/export/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path';
import { Credentials } from 'n8n-core';
import type { ICredentialsDb, ICredentialsDecryptedDb } from '@/Interfaces';
import { BaseCommand } from '../base-command';
import { CredentialsRepository } from '@db/repositories/credentials.repository';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import Container from 'typedi';
import { ApplicationError } from 'n8n-workflow';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/export/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
import fs from 'fs';
import path from 'path';
import { BaseCommand } from '../base-command';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import Container from 'typedi';
import { ApplicationError } from 'n8n-workflow';

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/commands/import/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import fs from 'fs';
import glob from 'fast-glob';

import { UM_FIX_INSTRUCTION } from '@/constants';
import type { WorkflowEntity } from '@db/entities/workflow-entity';
import { generateNanoId } from '@db/utils/generators';
import { UserRepository } from '@db/repositories/user.repository';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { generateNanoId } from '@/databases/utils/generators';
import { UserRepository } from '@/databases/repositories/user.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import type { IWorkflowToImport } from '@/Interfaces';
import { ImportService } from '@/services/import.service';
import { BaseCommand } from '../base-command';
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/ldap/reset.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Container from 'typedi';
import { LDAP_DEFAULT_CONFIGURATION, LDAP_FEATURE_NAME } from '@/ldap/constants';
import { AuthIdentityRepository } from '@db/repositories/auth-identity.repository';
import { AuthIdentityRepository } from '@/databases/repositories/auth-identity.repository';
import { AuthProviderSyncHistoryRepository } from '@/databases/repositories/auth-provider-sync-history.repository';
import { SettingsRepository } from '@db/repositories/settings.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { SettingsRepository } from '@/databases/repositories/settings.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { BaseCommand } from '../base-command';
import { Flags } from '@oclif/core';
import { ApplicationError } from 'n8n-workflow';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/license/clear.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Container } from 'typedi';
import { SETTINGS_LICENSE_CERT_KEY } from '@/constants';
import { BaseCommand } from '../base-command';
import { SettingsRepository } from '@db/repositories/settings.repository';
import { SettingsRepository } from '@/databases/repositories/settings.repository';
import { License } from '@/license';

export class ClearLicenseCommand extends BaseCommand {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/list/workflow.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Container from 'typedi';
import { Flags } from '@oclif/core';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { BaseCommand } from '../base-command';

export class ListWorkflowCommand extends BaseCommand {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { OrchestrationService } from '@/services/orchestration.service';
import { OrchestrationHandlerMainService } from '@/services/orchestration/main/orchestration.handler.main.service';
import { PruningService } from '@/services/pruning.service';
import { UrlService } from '@/services/url.service';
import { SettingsRepository } from '@db/repositories/settings.repository';
import { ExecutionRepository } from '@db/repositories/execution.repository';
import { SettingsRepository } from '@/databases/repositories/settings.repository';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error';
import { WaitTracker } from '@/wait-tracker';
import { BaseCommand } from './base-command';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/update/workflow.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Container } from 'typedi';
import { Flags } from '@oclif/core';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { BaseCommand } from '../base-command';

export class UpdateWorkflowCommand extends BaseCommand {
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/user-management/reset.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Container } from 'typedi';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { User } from '@/databases/entities/User';
import { CredentialsRepository } from '@db/repositories/credentials.repository';
import { SettingsRepository } from '@db/repositories/settings.repository';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SettingsRepository } from '@/databases/repositories/settings.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { BaseCommand } from '../base-command';
import { ProjectRepository } from '@/databases/repositories/project.repository';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { badPasswords } from '@test/testData';
import { mockInstance } from '@test/mocking';
import { AuthUserRepository } from '@/databases/repositories/auth-user.repository';
import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { MfaService } from '@/mfa/mfa.service';
import { InvalidMfaCodeError } from '@/errors/response-errors/invalid-mfa-code.error';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import type { AuthService } from '@/auth/auth.service';
import config from '@/config';
import { OwnerController } from '@/controllers/owner.controller';
import type { User } from '@/databases/entities/User';
import type { SettingsRepository } from '@db/repositories/settings.repository';
import type { UserRepository } from '@db/repositories/user.repository';
import type { SettingsRepository } from '@/databases/repositories/settings.repository';
import type { UserRepository } from '@/databases/repositories/user.repository';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { License } from '@/license';
import type { OwnerRequest } from '@/requests';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/controllers/e2e.controller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Request } from 'express';
import { v4 as uuid } from 'uuid';
import config from '@/config';
import { SettingsRepository } from '@db/repositories/settings.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { SettingsRepository } from '@/databases/repositories/settings.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { ActiveWorkflowManager } from '@/active-workflow-manager';
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
import { License } from '@/license';
Expand Down
Loading
Loading