refactor(core): Enforce filename casing in cli package (no-changelog) (#10594)

This commit is contained in:
Iván Ovejero 2024-08-28 17:57:46 +02:00 committed by GitHub
parent dbc10fe9f5
commit 6485ca0a4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
239 changed files with 313 additions and 307 deletions

View file

@ -19,6 +19,8 @@ module.exports = {
],
rules: {
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
'n8n-local-rules/no-dynamic-import-template': 'error',
'n8n-local-rules/misplaced-n8n-typeorm-import': 'error',
'n8n-local-rules/no-type-unsafe-event-emitter': 'error',
@ -39,6 +41,12 @@ module.exports = {
},
overrides: [
{
files: ['./src/databases/migrations/**/*.ts'],
rules: {
'unicorn/filename-case': 'off',
},
},
{
files: ['./src/databases/**/*.ts', './test/**/*.ts', './src/**/__tests__/**/*.ts'],
rules: {

View file

@ -3,7 +3,7 @@ import PCancelable from 'p-cancelable';
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 { IWorkflowExecutionDataProcess } from '@/interfaces';
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { mock } from 'jest-mock-extended';
import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service';

View file

@ -1,7 +1,7 @@
import { WaitTracker } from '@/wait-tracker';
import { mock } from 'jest-mock-extended';
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
import type { IExecutionResponse } from '@/Interfaces';
import type { IExecutionResponse } from '@/interfaces';
import { OrchestrationService } from '@/services/orchestration.service';
import type { MultiMainSetup } from '@/services/orchestration/main/multi-main-setup.ee';

View file

@ -1,6 +1,6 @@
import { type Workflow } from 'n8n-workflow';
import { getExecutionStartNode } from '@/workflow-helpers';
import type { IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { IWorkflowExecutionDataProcess } from '@/interfaces';
describe('WorkflowHelpers', () => {
describe('getExecutionStartNode', () => {

View file

@ -1,6 +1,6 @@
import Container from 'typedi';
import { WorkflowHooks, type ExecutionError, type IWorkflowExecuteHooks } from 'n8n-workflow';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { WorkflowRunner } from '@/workflow-runner';
import config from '@/config';

View file

@ -8,8 +8,8 @@ import isbot from 'isbot';
import config from '@/config';
import { N8N_VERSION, TEMPLATES_DIR, inDevelopment, inTest } from '@/constants';
import * as Db from '@/Db';
import { N8nInstanceType } from '@/Interfaces';
import * as Db from '@/db';
import { N8nInstanceType } from '@/interfaces';
import { ExternalHooks } from '@/external-hooks';
import { send, sendErrorResponse } from '@/response-helper';
import { rawBodyReader, bodyParser, corsMiddleware } from '@/middlewares';

View file

@ -20,7 +20,7 @@ import type {
IExecutionDb,
IExecutionsCurrentSummary,
IWorkflowExecutionDataProcess,
} from '@/Interfaces';
} from '@/interfaces';
import { isWorkflowIdValid } from '@/utils';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { Logger } from '@/logger';

View file

@ -26,7 +26,7 @@ import {
ApplicationError,
} from 'n8n-workflow';
import type { IWorkflowDb } from '@/Interfaces';
import type { IWorkflowDb } from '@/interfaces';
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';

View file

@ -5,7 +5,7 @@ import type { NextFunction, Response } from 'express';
import { AuthService } from '@/auth/auth.service';
import config from '@/config';
import { AUTH_COOKIE_NAME, Time } from '@/constants';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import type { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import type { UserRepository } from '@/databases/repositories/user.repository';
import { JwtService } from '@/services/jwt.service';

View file

@ -5,7 +5,7 @@ import { JsonWebTokenError, TokenExpiredError } from 'jsonwebtoken';
import config from '@/config';
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES, Time } from '@/constants';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error';

View file

@ -1,7 +1,7 @@
import { Container } from 'typedi';
import type { Response } from 'express';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { AuthService } from './auth.service';
// This method is still used by cloud hooks.

View file

@ -1,4 +1,4 @@
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { PasswordUtility } from '@/services/password.utility';
import { Container } from 'typedi';
import { isLdapLoginEnabled } from '@/ldap/helpers.ee';

View file

@ -10,7 +10,7 @@ import {
createLdapAuthIdentity,
updateLdapUserOnLocalDb,
} from '@/ldap/helpers.ee';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { EventService } from '@/events/event.service';
export const handleLdapLogin = async (

View file

@ -7,14 +7,14 @@ import { BinaryDataService, InstanceSettings, ObjectStoreService } from 'n8n-cor
import type { AbstractServer } from '@/abstract-server';
import { Logger } from '@/logger';
import config from '@/config';
import * as Db from '@/Db';
import * as Db from '@/db';
import * as CrashJournal from '@/crash-journal';
import { LICENSE_FEATURES, inDevelopment, inTest } from '@/constants';
import { initErrorHandling } from '@/error-reporting';
import { ExternalHooks } from '@/external-hooks';
import { NodeTypes } from '@/node-types';
import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials';
import type { N8nInstanceType } from '@/Interfaces';
import type { N8nInstanceType } from '@/interfaces';
import { PostHogClient } from '@/posthog';
import { License } from '@/license';
import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee';
@ -116,7 +116,7 @@ export abstract class BaseCommand extends Command {
const { communityPackages } = this.globalConfig.nodes;
if (communityPackages.enabled && this.needsCommunityPackages) {
const { CommunityPackagesService } = await import('@/services/communityPackages.service');
const { CommunityPackagesService } = await import('@/services/community-packages.service');
await Container.get(CommunityPackagesService).checkForMissingPackages();
}

View file

@ -11,8 +11,8 @@ import pick from 'lodash/pick';
import { ActiveExecutions } from '@/active-executions';
import { WorkflowRunner } from '@/workflow-runner';
import type { IWorkflowDb, IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { User } from '@/databases/entities/User';
import type { IWorkflowDb, IWorkflowExecutionDataProcess } from '@/interfaces';
import type { User } from '@/databases/entities/user';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { OwnershipService } from '@/services/ownership.service';
import { findCliWorkflowStart } from '@/utils';
@ -108,6 +108,8 @@ export class ExecuteBatch extends BaseCommand {
}),
};
static aliases = ['executeBatch'];
override needsCommunityPackages = true;
/**

View file

@ -5,7 +5,7 @@ import { ApplicationError, ExecutionBaseError } from 'n8n-workflow';
import { ActiveExecutions } from '@/active-executions';
import { WorkflowRunner } from '@/workflow-runner';
import type { IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { IWorkflowExecutionDataProcess } from '@/interfaces';
import { findCliWorkflowStart, isWorkflowIdValid } from '@/utils';
import { BaseCommand } from './base-command';

View file

@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
import fs from 'fs';
import path from 'path';
import { Credentials } from 'n8n-core';
import type { ICredentialsDb, ICredentialsDecryptedDb } from '@/Interfaces';
import type { ICredentialsDb, ICredentialsDecryptedDb } from '@/interfaces';
import { BaseCommand } from '../base-command';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import Container from 'typedi';

View file

@ -6,7 +6,7 @@ import glob from 'fast-glob';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import type { EntityManager } from '@n8n/typeorm';
import * as Db from '@/Db';
import * as Db from '@/db';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { BaseCommand } from '../base-command';
@ -15,7 +15,7 @@ import { ApplicationError, jsonParse } from 'n8n-workflow';
import { UM_FIX_INSTRUCTION } from '@/constants';
import { ProjectRepository } from '@/databases/repositories/project.repository';
import { Project } from '@/databases/entities/project';
import { User } from '@/databases/entities/User';
import { User } from '@/databases/entities/user';
export class ImportCredentialsCommand extends BaseCommand {
static description = 'Import credentials';

View file

@ -9,7 +9,7 @@ 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 type { IWorkflowToImport } from '@/interfaces';
import { ImportService } from '@/services/import.service';
import { BaseCommand } from '../base-command';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';

View file

@ -26,7 +26,7 @@ import { ExecutionRepository } from '@/databases/repositories/execution.reposito
import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error';
import { WaitTracker } from '@/wait-tracker';
import { BaseCommand } from './base-command';
import type { IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { IWorkflowExecutionDataProcess } from '@/interfaces';
import { ExecutionService } from '@/executions/execution.service';
import { OwnershipService } from '@/services/ownership.service';
import { WorkflowRunner } from '@/workflow-runner';

View file

@ -1,6 +1,6 @@
import { Container } from 'typedi';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { User } from '@/databases/entities/User';
import { User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SettingsRepository } from '@/databases/repositories/settings.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';

View file

@ -4,12 +4,12 @@ import express from 'express';
import http from 'http';
import { ApplicationError } from 'n8n-workflow';
import * as Db from '@/Db';
import * as Db from '@/db';
import * as ResponseHelper from '@/response-helper';
import config from '@/config';
import type { ScalingService } from '@/scaling/scaling.service';
import { N8N_VERSION, inTest } from '@/constants';
import type { ICredentialsOverwrite } from '@/Interfaces';
import type { ICredentialsOverwrite } from '@/interfaces';
import { CredentialsOverwrites } from '@/credentials-overwrites';
import { rawBodyReader, bodyParser } from '@/middlewares';
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';

View file

@ -10,7 +10,7 @@ import { InvalidConcurrencyLimitError } from '@/errors/invalid-concurrency-limit
import { ConcurrencyQueue } from '../concurrency-queue';
import type { WorkflowExecuteMode as ExecutionMode } from 'n8n-workflow';
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
import type { IExecutingWorkflowData } from '@/Interfaces';
import type { IExecutingWorkflowData } from '@/interfaces';
import type { Telemetry } from '@/telemetry';
import type { EventService } from '@/events/event.service';

View file

@ -6,7 +6,7 @@ import { UnknownExecutionModeError } from '@/errors/unknown-execution-mode.error
import { InvalidConcurrencyLimitError } from '@/errors/invalid-concurrency-limit.error';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import type { WorkflowExecuteMode as ExecutionMode } from 'n8n-workflow';
import type { IExecutingWorkflowData } from '@/Interfaces';
import type { IExecutingWorkflowData } from '@/interfaces';
import { Telemetry } from '@/telemetry';
import { EventService } from '@/events/event.service';

View file

@ -1,5 +1,5 @@
import { Service } from 'typedi';
import { TypedEmitter } from '@/TypedEmitter';
import { TypedEmitter } from '@/typed-emitter';
type ConcurrencyEvents = {
'execution-throttled': { executionId: string };

View file

@ -3,8 +3,8 @@ import { Container } from 'typedi';
import jwt from 'jsonwebtoken';
import { mock, anyObject } from 'jest-mock-extended';
import type { PublicUser } from '@/Interfaces';
import type { User } from '@/databases/entities/User';
import type { PublicUser } from '@/interfaces';
import type { User } from '@/databases/entities/user';
import { API_KEY_PREFIX, MeController } from '@/controllers/me.controller';
import { AUTH_COOKIE_NAME } from '@/constants';
import type { AuthenticatedRequest, MeRequest } from '@/requests';

View file

@ -6,7 +6,7 @@ import jwt from 'jsonwebtoken';
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 { User } from '@/databases/entities/user';
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';

View file

@ -2,7 +2,7 @@ import { mock } from 'jest-mock-extended';
import { UsersController } from '../users.controller';
import type { UserRequest } from '@/requests';
import type { EventService } from '@/events/event.service';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import type { UserRepository } from '@/databases/repositories/user.repository';
import type { ProjectService } from '@/services/project.service';

View file

@ -4,9 +4,9 @@ import { Response } from 'express';
import { AuthService } from '@/auth/auth.service';
import { Get, Post, RestController } from '@/decorators';
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { AuthenticatedRequest, LoginRequest, UserRequest } from '@/requests';
import type { PublicUser } from '@/Interfaces';
import type { PublicUser } from '@/interfaces';
import { handleEmailLogin, handleLdapLogin } from '@/auth';
import { PostHogClient } from '@/posthog';
import {

View file

@ -6,9 +6,9 @@ import {
import { Delete, Get, Patch, Post, RestController, GlobalScope } from '@/decorators';
import { NodeRequest } from '@/requests';
import type { InstalledPackages } from '@/databases/entities/installed-packages';
import type { CommunityPackages } from '@/Interfaces';
import type { CommunityPackages } from '@/interfaces';
import { Push } from '@/push';
import { CommunityPackagesService } from '@/services/communityPackages.service';
import { CommunityPackagesService } from '@/services/community-packages.service';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
import { EventService } from '@/events/event.service';

View file

@ -9,7 +9,7 @@ import { License } from '@/license';
import { LICENSE_FEATURES, LICENSE_QUOTAS, UNLIMITED_LICENSE_QUOTA, inE2ETests } from '@/constants';
import { Patch, Post, RestController } from '@/decorators';
import type { UserSetupPayload } from '@/requests';
import type { BooleanLicenseFeature, IPushDataType, NumericLicenseFeature } from '@/Interfaces';
import type { BooleanLicenseFeature, IPushDataType, NumericLicenseFeature } from '@/interfaces';
import { MfaService } from '@/mfa/mfa.service';
import { Push } from '@/push';
import { CacheService } from '@/services/cache/cache.service';

View file

@ -12,7 +12,7 @@ import { Logger } from '@/logger';
import { isSamlLicensedAndEnabled } from '@/sso/saml/saml-helpers';
import { PasswordUtility } from '@/services/password.utility';
import { PostHogClient } from '@/posthog';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { UserRepository } from '@/databases/repositories/user.repository';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';

View file

@ -7,14 +7,14 @@ import { AuthService } from '@/auth/auth.service';
import { Delete, Get, Patch, Post, RestController } from '@/decorators';
import { PasswordUtility } from '@/services/password.utility';
import { validateEntity } from '@/generic-helpers';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import {
AuthenticatedRequest,
MeRequest,
UserSettingsUpdatePayload,
UserUpdatePayload,
} from '@/requests';
import type { PublicUser } from '@/Interfaces';
import type { PublicUser } from '@/interfaces';
import { isSamlLicensedAndEnabled } from '@/sso/saml/saml-helpers';
import { UserService } from '@/services/user.service';
import { Logger } from '@/logger';

View file

@ -7,7 +7,7 @@ import { mock } from 'jest-mock-extended';
import { OAuth1CredentialController } from '@/controllers/oauth/oauth1-credential.controller';
import { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import type { OAuthRequest } from '@/requests';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';

View file

@ -7,7 +7,7 @@ import { mock } from 'jest-mock-extended';
import { OAuth2CredentialController } from '@/controllers/oauth/oauth2-credential.controller';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import type { OAuthRequest } from '@/requests';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';

View file

@ -8,7 +8,7 @@ import { jsonParse, ApplicationError } from 'n8n-workflow';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import type { ICredentialsDb } from '@/Interfaces';
import type { ICredentialsDb } from '@/interfaces';
import type { OAuthRequest } from '@/requests';
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
import { CredentialsHelper } from '@/credentials-helper';

View file

@ -1,7 +1,7 @@
import { plainToInstance } from 'class-transformer';
import { AuthService } from '@/auth/auth.service';
import { User } from '@/databases/entities/User';
import { User } from '@/databases/entities/user';
import { GlobalScope, Delete, Get, RestController, Patch, Licensed } from '@/decorators';
import {
ListQuery,
@ -9,7 +9,7 @@ import {
UserRoleChangePayload,
UserSettingsUpdatePayload,
} from '@/requests';
import type { PublicUser } from '@/Interfaces';
import type { PublicUser } from '@/interfaces';
import { AuthIdentity } from '@/databases/entities/auth-identity';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';

View file

@ -4,7 +4,7 @@ import type { WorkflowStatistics } from '@/databases/entities/workflow-statistic
import { StatisticsNames } from '@/databases/entities/workflow-statistics';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository';
import type { IWorkflowStatisticsDataLoaded } from '@/Interfaces';
import type { IWorkflowStatisticsDataLoaded } from '@/interfaces';
import { Logger } from '@/logger';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { StatisticsRequest } from './workflow-statistics.types';

View file

@ -27,7 +27,7 @@ import type {
} from 'n8n-workflow';
import { ICredentialsHelper, NodeHelpers, Workflow, ApplicationError } from 'n8n-workflow';
import type { ICredentialsDb } from '@/Interfaces';
import type { ICredentialsDb } from '@/interfaces';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { CredentialTypes } from '@/credential-types';

View file

@ -2,7 +2,7 @@ import { Service } from 'typedi';
import { GlobalConfig } from '@n8n/config';
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
import { deepCopy, jsonParse } from 'n8n-workflow';
import type { ICredentialsOverwrite } from '@/Interfaces';
import type { ICredentialsOverwrite } from '@/interfaces';
import { CredentialTypes } from '@/credential-types';
import { Logger } from '@/logger';

View file

@ -23,7 +23,7 @@ import {
} from '@/decorators';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { UserManagementMailer } from '@/user-management/email';
import * as Db from '@/Db';
import * as Db from '@/db';
import * as utils from '@/utils';
import { listQueryMiddleware } from '@/middlewares';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';

View file

@ -1,6 +1,6 @@
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import { In, type EntityManager } from '@n8n/typeorm';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { CredentialsService } from './credentials.service';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';

View file

@ -14,15 +14,15 @@ import {
type FindOptionsWhere,
} from '@n8n/typeorm';
import type { Scope } from '@n8n/permissions';
import * as Db from '@/Db';
import type { ICredentialsDb } from '@/Interfaces';
import * as Db from '@/db';
import type { ICredentialsDb } from '@/interfaces';
import { createCredentialsFromCredentialsEntity } from '@/credentials-helper';
import { CREDENTIAL_BLANKING_VALUE } from '@/constants';
import { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import { validateEntity } from '@/generic-helpers';
import { ExternalHooks } from '@/external-hooks';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import type { CredentialRequest, ListQuery } from '@/requests';
import { CredentialTypes } from '@/credential-types';
import { OwnershipService } from '@/services/ownership.service';

View file

@ -1,5 +1,5 @@
import type { QueryRunner } from '@n8n/typeorm';
import { Column } from './Column';
import { Column } from './column';
import {
AddColumns,
AddForeignKey,
@ -9,8 +9,8 @@ import {
DropForeignKey,
DropNotNull,
DropTable,
} from './Table';
import { CreateIndex, DropIndex } from './Indices';
} from './table';
import { CreateIndex, DropIndex } from './indices';
export const createSchemaBuilder = (tablePrefix: string, queryRunner: QueryRunner) => ({
column: (name: string) => new Column(name),

View file

@ -1,7 +1,7 @@
import type { TableForeignKeyOptions, TableIndexOptions, QueryRunner } from '@n8n/typeorm';
import { Table, TableColumn, TableForeignKey } from '@n8n/typeorm';
import LazyPromise from 'p-lazy';
import { Column } from './Column';
import { Column } from './column';
import { ApplicationError } from 'n8n-workflow';
abstract class TableOperation<R = void> extends LazyPromise<R> {

View file

@ -1,4 +1,4 @@
import { User } from '@/databases/entities/User';
import { User } from '@/databases/entities/user';
describe('User Entity', () => {
describe('JSON.stringify', () => {

View file

@ -1,6 +1,6 @@
import { Column, Entity, ManyToOne, PrimaryColumn, Unique } from '@n8n/typeorm';
import { WithTimestamps } from './abstract-entity';
import { User } from './User';
import { User } from './user';
export type AuthProviderType = 'ldap' | 'email' | 'saml'; // | 'google';

View file

@ -1,5 +1,5 @@
import { Column, Entity } from '@n8n/typeorm';
import { User } from './User';
import { User } from './user';
@Entity({ name: 'user' })
export class AuthUser extends User {

View file

@ -2,7 +2,7 @@ import { Column, Entity, Index, OneToMany } from '@n8n/typeorm';
import { IsObject, IsString, Length } from 'class-validator';
import type { SharedCredentials } from './shared-credentials';
import { WithTimestampsAndStringId } from './abstract-entity';
import type { ICredentialsDb } from '@/Interfaces';
import type { ICredentialsDb } from '@/interfaces';
@Entity()
export class CredentialsEntity extends WithTimestampsAndStringId implements ICredentialsDb {

View file

@ -10,8 +10,8 @@ import { Settings } from './settings';
import { SharedCredentials } from './shared-credentials';
import { SharedWorkflow } from './shared-workflow';
import { TagEntity } from './tag-entity';
import { User } from './User';
import { Variables } from './Variables';
import { User } from './user';
import { Variables } from './variables';
import { WebhookEntity } from './webhook-entity';
import { WorkflowEntity } from './workflow-entity';
import { WorkflowTagMapping } from './workflow-tag-mapping';

View file

@ -1,5 +1,5 @@
import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm';
import { User } from './User';
import { User } from './user';
import { WithTimestamps } from './abstract-entity';
import { Project } from './project';

View file

@ -16,7 +16,7 @@ import type { SharedCredentials } from './shared-credentials';
import { NoXss } from '@/validators/no-xss.validator';
import { objectRetriever, lowerCaser } from '../utils/transformers';
import { WithTimestamps, jsonColumnType } from './abstract-entity';
import type { IPersonalizationSurveyAnswers } from '@/Interfaces';
import type { IPersonalizationSurveyAnswers } from '@/interfaces';
import type { AuthIdentity } from './auth-identity';
import {
GLOBAL_OWNER_SCOPES,

View file

@ -11,7 +11,7 @@ import type { WorkflowStatistics } from './workflow-statistics';
import type { WorkflowTagMapping } from './workflow-tag-mapping';
import { objectRetriever, sqlite } from '../utils/transformers';
import { WithTimestampsAndStringId, dbType, jsonColumnType } from './abstract-entity';
import type { IWorkflowDb } from '@/Interfaces';
import type { IWorkflowDb } from '@/interfaces';
@Entity()
export class WorkflowEntity extends WithTimestampsAndStringId implements IWorkflowDb {

View file

@ -1,6 +1,6 @@
import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import type { ProjectRole } from '@/databases/entities/project-relation';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { generateNanoId } from '@/databases/utils/generators';
import { ApplicationError } from 'n8n-workflow';
import { nanoid } from 'nanoid';

View file

@ -1,5 +1,5 @@
import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import type { UserSettings } from '@/Interfaces';
import type { UserSettings } from '@/interfaces';
export class AddUserActivatedProperty1681134145996 implements ReversibleMigration {
async up({ queryRunner, tablePrefix }: MigrationContext) {

View file

@ -1,5 +1,5 @@
import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import type { UserSettings } from '@/Interfaces';
import type { UserSettings } from '@/interfaces';
export class AddUserActivatedProperty1681134145996 implements ReversibleMigration {
async up({ queryRunner, tablePrefix }: MigrationContext) {

View file

@ -1,5 +1,5 @@
import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import type { UserSettings } from '@/Interfaces';
import type { UserSettings } from '@/interfaces';
export class AddUserActivatedProperty1681134145996 implements ReversibleMigration {
async up({ queryRunner, tablePrefix }: MigrationContext) {

View file

@ -3,7 +3,7 @@ import { In } from '@n8n/typeorm';
import { mock } from 'jest-mock-extended';
import { hasScope } from '@n8n/permissions';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';

View file

@ -3,7 +3,7 @@ import { DataSource, In, Repository, Like } from '@n8n/typeorm';
import type { FindManyOptions, FindOptionsWhere } from '@n8n/typeorm';
import { CredentialsEntity } from '../entities/credentials-entity';
import type { ListQuery } from '@/requests';
import type { User } from '../entities/User';
import type { User } from '../entities/user';
import type { Scope } from '@n8n/permissions';
import { RoleService } from '@/services/role.service';

View file

@ -35,7 +35,7 @@ import type {
IExecutionBase,
IExecutionFlattedDb,
IExecutionResponse,
} from '@/Interfaces';
} from '@/interfaces';
import config from '@/config';
import type { ExecutionData } from '../entities/execution-data';

View file

@ -2,7 +2,7 @@ import { Service } from 'typedi';
import type { EntityManager, FindOptionsRelations, FindOptionsWhere } from '@n8n/typeorm';
import { DataSource, In, Not, Repository } from '@n8n/typeorm';
import { type CredentialSharingRole, SharedCredentials } from '../entities/shared-credentials';
import type { User } from '../entities/User';
import type { User } from '../entities/user';
import { RoleService } from '@/services/role.service';
import type { Scope } from '@n8n/permissions';
import type { Project } from '../entities/project';

View file

@ -2,7 +2,7 @@ import { Service } from 'typedi';
import { DataSource, Repository, In, Not } from '@n8n/typeorm';
import type { EntityManager, FindManyOptions, FindOptionsWhere } from '@n8n/typeorm';
import { SharedWorkflow, type WorkflowSharingRole } from '../entities/shared-workflow';
import { type User } from '../entities/User';
import { type User } from '../entities/user';
import type { Scope } from '@n8n/permissions';
import { RoleService } from '@/services/role.service';
import type { Project } from '../entities/project';

View file

@ -3,7 +3,7 @@ import type { DeepPartial, EntityManager, FindManyOptions } from '@n8n/typeorm';
import { DataSource, In, IsNull, Not, Repository } from '@n8n/typeorm';
import type { ListQuery } from '@/requests';
import { type GlobalRole, User } from '../entities/User';
import { type GlobalRole, User } from '../entities/user';
import { Project } from '../entities/project';
import { ProjectRelation } from '../entities/project-relation';

View file

@ -1,6 +1,6 @@
import { Service } from 'typedi';
import { DataSource, Repository } from '@n8n/typeorm';
import { Variables } from '../entities/Variables';
import { Variables } from '../entities/variables';
@Service()
export class VariablesRepository extends Repository<Variables> {

View file

@ -2,7 +2,7 @@ import { Service } from 'typedi';
import { GlobalConfig } from '@n8n/config';
import { DataSource, MoreThanOrEqual, QueryFailedError, Repository } from '@n8n/typeorm';
import { StatisticsNames, WorkflowStatistics } from '../entities/workflow-statistics';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
type StatisticsInsertResult = 'insert' | 'failed' | 'alreadyExists';
type StatisticsUpsertResult = StatisticsInsertResult | 'update';

View file

@ -5,7 +5,7 @@ import { ApplicationError, ErrorReporterProxy } from 'n8n-workflow';
import { Logger } from '@/logger';
import { Project } from '../entities/project';
import { User } from '../entities/User';
import { User } from '../entities/user';
import { UserRepository } from '../repositories/user.repository';
@EventSubscriber()

View file

@ -1,6 +1,6 @@
import { customAlphabet } from 'nanoid';
import { ALPHABET } from 'n8n-workflow';
import type { N8nInstanceType } from '@/Interfaces';
import type { N8nInstanceType } from '@/interfaces';
const nanoid = customAlphabet(ALPHABET, 16);

View file

@ -6,7 +6,7 @@ import { rateLimit as expressRateLimit } from 'express-rate-limit';
import { AuthService } from '@/auth/auth.service';
import { UnauthenticatedError } from '@/errors/response-errors/unauthenticated.error';
import { inProduction, RESPONSE_ERROR_MESSAGES } from '@/constants';
import type { BooleanLicenseFeature } from '@/Interfaces';
import type { BooleanLicenseFeature } from '@/interfaces';
import { License } from '@/license';
import type { AuthenticatedRequest } from '@/requests';
import { send } from '@/response-helper'; // TODO: move `ResponseHelper.send` to this file

View file

@ -1,4 +1,4 @@
import type { BooleanLicenseFeature } from '@/Interfaces';
import type { BooleanLicenseFeature } from '@/interfaces';
import { getRouteMetadata } from './controller.registry';
import type { Controller } from './types';

View file

@ -1,6 +1,6 @@
import type { RequestHandler } from 'express';
import type { Class } from 'n8n-core';
import type { BooleanLicenseFeature } from '@/Interfaces';
import type { BooleanLicenseFeature } from '@/interfaces';
import type { Scope } from '@n8n/permissions';
export type Method = 'get' | 'post' | 'put' | 'patch' | 'delete';

View file

@ -1,6 +1,9 @@
import { mock } from 'jest-mock-extended';
import { SourceControlGitService } from '../source-control-git.service.ee';
import { simpleGit } from 'simple-git';
import type { SimpleGit } from 'simple-git';
import type { User } from '@/databases/entities/user';
import type { SourceControlPreferences } from '../types/source-control-preferences';
const MOCK_BRANCHES = {
all: ['origin/master', 'origin/feature/branch'],
@ -32,4 +35,36 @@ describe('SourceControlGitService', () => {
expect(branches.branches).toEqual(['master', 'feature/branch']);
});
});
describe('initRepository', () => {
describe('when local repo is set up after remote is ready', () => {
it('should track remote', async () => {
/**
* Arrange
*/
const gitService = new SourceControlGitService(mock(), mock(), mock());
const prefs = mock<SourceControlPreferences>({ branchName: 'main' });
const user = mock<User>();
const git = mock<SimpleGit>();
const checkoutSpy = jest.spyOn(git, 'checkout');
const branchSpy = jest.spyOn(git, 'branch');
gitService.git = git;
jest.spyOn(gitService, 'setGitSshCommand').mockResolvedValue();
jest
.spyOn(gitService, 'getBranches')
.mockResolvedValue({ currentBranch: '', branches: ['main'] });
/**
* Act
*/
await gitService.initRepository(prefs, user);
/**
* Assert
*/
expect(checkoutSpy).toHaveBeenCalledWith('main');
expect(branchSpy).toHaveBeenCalledWith(['--set-upstream-to=origin/main', 'main']);
});
});
});
});

View file

@ -1,39 +0,0 @@
import { SourceControlGitService } from '@/environments/source-control/source-control-git.service.ee';
import { mock } from 'jest-mock-extended';
import type { SourceControlPreferences } from '@/environments/source-control/types/source-control-preferences';
import type { User } from '@/databases/entities/User';
import type { SimpleGit } from 'simple-git';
describe('GitService', () => {
describe('initRepository', () => {
describe('when local repo is set up after remote is ready', () => {
it('should track remote', async () => {
/**
* Arrange
*/
const gitService = new SourceControlGitService(mock(), mock(), mock());
const prefs = mock<SourceControlPreferences>({ branchName: 'main' });
const user = mock<User>();
const git = mock<SimpleGit>();
const checkoutSpy = jest.spyOn(git, 'checkout');
const branchSpy = jest.spyOn(git, 'branch');
gitService.git = git;
jest.spyOn(gitService, 'setGitSshCommand').mockResolvedValue();
jest
.spyOn(gitService, 'getBranches')
.mockResolvedValue({ currentBranch: '', branches: ['main'] });
/**
* Act
*/
await gitService.initRepository(prefs, user);
/**
* Assert
*/
expect(checkoutSpy).toHaveBeenCalledWith('main');
expect(branchSpy).toHaveBeenCalledWith(['--set-upstream-to=origin/main', 'main']);
});
});
});
});

View file

@ -19,7 +19,7 @@ import {
SOURCE_CONTROL_ORIGIN,
} from './constants';
import { sourceControlFoldersExistCheck } from './source-control-helper.ee';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { Logger } from '@/logger';
import { ApplicationError } from 'n8n-workflow';
import { OwnershipService } from '@/services/ownership.service';

View file

@ -11,9 +11,9 @@ import glob from 'fast-glob';
import { ApplicationError, jsonParse, ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';
import { readFile as fsReadFile } from 'fs/promises';
import { Credentials, InstanceSettings } from 'n8n-core';
import type { IWorkflowToImport } from '@/Interfaces';
import type { IWorkflowToImport } from '@/interfaces';
import type { ExportableCredential } from './types/exportable-credential';
import type { Variables } from '@/databases/entities/Variables';
import type { Variables } from '@/databases/entities/variables';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import type { WorkflowTagMapping } from '@/databases/entities/workflow-tag-mapping';
import type { TagEntity } from '@/databases/entities/tag-entity';

View file

@ -24,10 +24,10 @@ import type { SourceControlledFile } from './types/source-controlled-file';
import { SourceControlPreferencesService } from './source-control-preferences.service.ee';
import { writeFileSync } from 'fs';
import { SourceControlImportService } from './source-control-import.service.ee';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import type { SourceControlGetStatus } from './types/source-control-get-status';
import type { TagEntity } from '@/databases/entities/tag-entity';
import type { Variables } from '@/databases/entities/Variables';
import type { Variables } from '@/databases/entities/variables';
import type { SourceControlWorkflowVersionId } from './types/source-control-workflow-version-id';
import type { ExportableCredential } from './types/exportable-credential';
import { EventService } from '@/events/event.service';

View file

@ -1,5 +1,5 @@
import { Container, Service } from 'typedi';
import type { Variables } from '@/databases/entities/Variables';
import type { Variables } from '@/databases/entities/variables';
import { generateNanoId } from '@/databases/utils/generators';
import { canCreateNewVariable } from './environment-helpers';
import { CacheService } from '@/services/cache/cache.service';

View file

@ -1,4 +1,4 @@
import type { IWorkflowDb } from '@/Interfaces';
import type { IWorkflowDb } from '@/interfaces';
import type { Workflow } from 'n8n-workflow';
import { ApplicationError } from 'n8n-workflow';

View file

@ -3,7 +3,7 @@ import type { IWorkflowBase, JsonObject } from 'n8n-workflow';
import { EventMessageTypeNames } from 'n8n-workflow';
import type { AbstractEventMessageOptions } from './abstract-event-message-options';
import type { AbstractEventPayload } from './abstract-event-payload';
import type { IExecutionBase } from '@/Interfaces';
import type { IExecutionBase } from '@/interfaces';
import type { EventNamesWorkflowType } from '.';
// --------------------------------------

View file

@ -2,7 +2,7 @@ import { mock } from 'jest-mock-extended';
import { LogStreamingEventRelay } from '@/events/log-streaming-event-relay';
import { EventService } from '@/events/event.service';
import type { INode, IRun, IWorkflowBase } from 'n8n-workflow';
import type { IWorkflowDb } from '@/Interfaces';
import type { IWorkflowDb } from '@/interfaces';
import type { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
import type { RelayEventMap } from '@/events/relay-event-map';

View file

@ -3,7 +3,7 @@ import { TelemetryEventRelay } from '@/events/telemetry-event-relay';
import { EventService } from '@/events/event.service';
import config from '@/config';
import type { IWorkflowBase } from 'n8n-workflow';
import type { IWorkflowDb } from '@/Interfaces';
import type { IWorkflowDb } from '@/interfaces';
import type { Telemetry } from '@/telemetry';
import type { License } from '@/license';
import type { GlobalConfig } from '@n8n/config';

View file

@ -1,5 +1,5 @@
import { Service } from 'typedi';
import { TypedEmitter } from '@/TypedEmitter';
import { TypedEmitter } from '@/typed-emitter';
import type { RelayEventMap } from './relay-event-map';
import type { QueueMetricsEventMap } from './queue-metrics-event-map';

View file

@ -4,9 +4,9 @@ import type {
IRun,
IWorkflowBase,
} from 'n8n-workflow';
import type { IWorkflowDb, IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { IWorkflowDb, IWorkflowExecutionDataProcess } from '@/interfaces';
import type { ProjectRole } from '@/databases/entities/project-relation';
import type { GlobalRole } from '@/databases/entities/User';
import type { GlobalRole } from '@/databases/entities/user';
import type { AuthProviderType } from '@/databases/entities/auth-identity';
export type UserLike = {

View file

@ -14,7 +14,7 @@ import { TelemetryHelpers } from 'n8n-workflow';
import { NodeTypes } from '@/node-types';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository';
import type { IExecutionTrackProperties } from '@/Interfaces';
import type { IExecutionTrackProperties } from '@/interfaces';
import { determineFinalExecutionStatus } from '@/execution-lifecycle-hooks/shared/shared-hook-functions';
import { EventRelay } from './event-relay';
import { snakeCase } from 'change-case';

View file

@ -9,7 +9,7 @@ import {
type ITaskData,
type IWorkflowBase,
} from 'n8n-workflow';
import type { IExecutionResponse } from '@/Interfaces';
import type { IExecutionResponse } from '@/interfaces';
mockInstance(Logger);

View file

@ -1,6 +1,6 @@
import { Container } from 'typedi';
import type { ExecutionStatus, IRun, IWorkflowBase } from 'n8n-workflow';
import type { ExecutionPayload, IExecutionDb } from '@/Interfaces';
import type { ExecutionPayload, IExecutionDb } from '@/interfaces';
import pick from 'lodash/pick';
import { isWorkflowIdValid } from '@/utils';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';

View file

@ -5,7 +5,7 @@ import { ExecutionService } from '@/executions/execution.service';
import { AbortedExecutionRetryError } from '@/errors/aborted-execution-retry.error';
import { MissingExecutionStopError } from '@/errors/missing-execution-stop.error';
import type { ActiveExecutions } from '@/active-executions';
import type { IExecutionResponse } from '@/Interfaces';
import type { IExecutionResponse } from '@/interfaces';
import { ScalingService } from '@/scaling/scaling.service';
import type { WaitTracker } from '@/wait-tracker';
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';

View file

@ -7,7 +7,7 @@ import type { DateTime } from 'luxon';
import type { IRun, ITaskData } from 'n8n-workflow';
import { InstanceSettings } from 'n8n-core';
import type { EventMessageTypes } from '../eventbus/event-message-classes';
import type { IExecutionResponse } from '@/Interfaces';
import type { IExecutionResponse } from '@/interfaces';
import { NodeCrashedError } from '@/errors/node-crashed.error';
import { WorkflowCrashedError } from '@/errors/workflow-crashed.error';
import { ARTIFICIAL_TASK_DATA } from '@/constants';

View file

@ -1,6 +1,6 @@
import { ExecutionService } from './execution.service';
import type { ExecutionRequest } from './execution.types';
import type { IExecutionResponse, IExecutionFlattedResponse } from '@/Interfaces';
import type { IExecutionResponse, IExecutionFlattedResponse } from '@/interfaces';
import { EnterpriseWorkflowService } from '../workflows/workflow.service.ee';
import type { WorkflowWithSharingsAndCredentials } from '@/workflows/workflows.types';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';

View file

@ -22,7 +22,7 @@ import type {
IExecutionResponse,
IWorkflowDb,
IWorkflowExecutionDataProcess,
} from '@/Interfaces';
} from '@/interfaces';
import { NodeTypes } from '@/node-types';
import type { ExecutionRequest, ExecutionSummaries, StopResult } from './execution.types';
import { WorkflowRunner } from '@/workflow-runner';
@ -39,7 +39,7 @@ import { QueuedExecutionRetryError } from '@/errors/queued-execution-retry.error
import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service';
import { AbortedExecutionRetryError } from '@/errors/aborted-execution-retry.error';
import { License } from '@/license';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import { WorkflowSharingService } from '@/workflows/workflow-sharing.service';
export const schemaGetExecutionsQueryFilter = {

View file

@ -6,7 +6,7 @@ import { License } from '@/license';
import { WorkflowSharingService } from '@/workflows/workflow-sharing.service';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { parseRangeQuery } from './parse-range-query.middleware';
import type { User } from '@/databases/entities/User';
import type { User } from '@/databases/entities/user';
import type { Scope } from '@n8n/permissions';
import { isPositiveInteger } from '@/utils';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';

View file

@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import { Service } from 'typedi';
import type { IExternalHooksFileData, IExternalHooksFunctions } from '@/Interfaces';
import type { IExternalHooksFileData, IExternalHooksFunctions } from '@/interfaces';
import config from '@/config';
import { UserRepository } from '@/databases/repositories/user.repository';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';

View file

@ -1,7 +1,7 @@
import { Container } from 'typedi';
import { Cipher } from 'n8n-core';
import { SettingsRepository } from '@/databases/repositories/settings.repository';
import type { ExternalSecretsSettings } from '@/Interfaces';
import type { ExternalSecretsSettings } from '@/interfaces';
import { License } from '@/license';
import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee';
import { ExternalSecretsProviders } from '@/external-secrets/external-secrets-providers.ee';

View file

@ -3,7 +3,7 @@ import type {
ExternalSecretsSettings,
SecretsProvider,
SecretsProviderSettings,
} from '@/Interfaces';
} from '@/interfaces';
import { Cipher } from 'n8n-core';
import Container, { Service } from 'typedi';

Some files were not shown because too many files have changed in this diff Show more