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): Standardize filename casing for services and Public API (no-changelog) #10579

Merged
merged 3 commits into from
Aug 28, 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
8 changes: 4 additions & 4 deletions packages/cli/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const __dirname = path.dirname(__filename);

const ROOT_DIR = path.resolve(__dirname, '..');
const SPEC_FILENAME = 'openapi.yml';
const SPEC_THEME_FILENAME = 'swaggerTheme.css';
const SPEC_THEME_FILENAME = 'swagger-theme.css';

const publicApiEnabled = process.env.N8N_PUBLIC_API_DISABLED !== 'true';

Expand All @@ -32,15 +32,15 @@ function copyUserManagementEmailTemplates() {

function copySwaggerTheme() {
const swaggerTheme = {
source: path.resolve(ROOT_DIR, 'src', 'PublicApi', SPEC_THEME_FILENAME),
destination: path.resolve(ROOT_DIR, 'dist', 'PublicApi'),
source: path.resolve(ROOT_DIR, 'src', 'public-api', SPEC_THEME_FILENAME),
destination: path.resolve(ROOT_DIR, 'dist', 'public-api'),
};

shell.cp('-r', swaggerTheme.source, swaggerTheme.destination);
}

function bundleOpenApiSpecs() {
const publicApiDir = path.resolve(ROOT_DIR, 'src', 'PublicApi');
const publicApiDir = path.resolve(ROOT_DIR, 'src', 'public-api');

shell
.find(publicApiDir)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/wait-tracker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { mock } from 'jest-mock-extended';
import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
import type { IExecutionResponse } from '@/Interfaces';
import { OrchestrationService } from '@/services/orchestration.service';
import type { MultiMainSetup } from '@/services/orchestration/main/MultiMainSetup.ee';
import type { MultiMainSetup } from '@/services/orchestration/main/multi-main-setup.ee';

jest.useFakeTimers();

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/workflow-runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { User } from '@/databases/entities/User';
import { WorkflowRunner } from '@/workflow-runner';
import config from '@/config';

import * as testDb from '@test-integration/testDb';
import * as testDb from '@test-integration/test-db';
import { setupTestServer } from '@test-integration/utils';
import { createUser } from '@test-integration/db/users';
import { createWorkflow } from '@test-integration/db/workflows';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/active-workflow-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import { Logger } from './logger';
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';
import { ActiveWorkflowsService } from '@/services/active-workflows.service';
import { WorkflowExecutionService } from '@/workflows/workflow-execution.service';
import { WorkflowStaticDataService } from '@/workflows/workflow-static-data.service';
import { OnShutdown } from '@/decorators/on-shutdown';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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';
import type { RedisServicePubSubSubscriber } from '@/services/redis/RedisServicePubSubSubscriber';
import type { RedisServicePubSubSubscriber } from '@/services/redis/redis-service-pub-sub-subscriber';
import { EventMessageGeneric } from '@/eventbus/event-message-classes/event-message-generic';
import { OrchestrationHandlerWorkerService } from '@/services/orchestration/worker/orchestration.handler.worker.service';
import { OrchestrationWorkerService } from '@/services/orchestration/worker/orchestration.worker.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DynamicNodeParametersController } from '@/controllers/dynamic-node-parameters.controller';
import type { DynamicNodeParametersRequest } from '@/requests';
import type { DynamicNodeParametersService } from '@/services/dynamicNodeParameters.service';
import type { DynamicNodeParametersService } from '@/services/dynamic-node-parameters.service';
import { mock } from 'jest-mock-extended';
import * as AdditionalData from '@/workflow-execute-additional-data';
import type { ILoadOptions, IWorkflowExecuteAdditionalData } from 'n8n-workflow';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ExternalHooks } from '@/external-hooks';
import { License } from '@/license';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { EventService } from '@/events/event.service';
import { badPasswords } from '@test/testData';
import { badPasswords } from '@test/test-data';
import { mockInstance } from '@test/mocking';
import { AuthUserRepository } from '@/databases/repositories/auth-user.repository';
import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { UserService } from '@/services/user.service';
import { PasswordUtility } from '@/services/password.utility';

import { mockInstance } from '@test/mocking';
import { badPasswords } from '@test/testData';
import { badPasswords } from '@test/test-data';

describe('OwnerController', () => {
const configGetSpy = jest.spyOn(config, 'getEnv');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Get, RestController } from '@/decorators';
import { ActiveWorkflowRequest } from '@/requests';
import { ActiveWorkflowsService } from '@/services/activeWorkflows.service';
import { ActiveWorkflowsService } from '@/services/active-workflows.service';

@RestController('/active-workflows')
export class ActiveWorkflowsController {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/ai-assistant.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Post, RestController } from '@/decorators';
import { AiAssistantService } from '@/services/aiAsisstant.service';
import { AiAssistantService } from '@/services/ai-assistant.service';
import { AiAssistantRequest } from '@/requests';
import { Response } from 'express';
import type { AiAssistantSDK } from '@n8n_io/ai-assistant-sdk';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { INodePropertyOptions, NodeParameterValueType } from 'n8n-workflow'

import { Post, RestController } from '@/decorators';
import { getBase } from '@/workflow-execute-additional-data';
import { DynamicNodeParametersService } from '@/services/dynamicNodeParameters.service';
import { DynamicNodeParametersService } from '@/services/dynamic-node-parameters.service';
import { DynamicNodeParametersRequest } from '@/requests';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/me.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { Logger } from '@/logger';
import { ExternalHooks } from '@/external-hooks';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { UserRepository } from '@/databases/repositories/user.repository';
import { isApiEnabled } from '@/PublicApi';
import { isApiEnabled } from '@/public-api';
import { EventService } from '@/events/event.service';
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 @@ -4,7 +4,7 @@ import type { ExecutionPayload, IExecutionDb } from '@/Interfaces';
import pick from 'lodash/pick';
import { isWorkflowIdValid } from '@/utils';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { ExecutionMetadataService } from '@/services/executionMetadata.service';
import { ExecutionMetadataService } from '@/services/execution-metadata.service';
import { Logger } from '@/logger';

export function determineFinalExecutionStatus(runData: IRun): ExecutionStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { InstanceSettings } from 'n8n-core';
import { mockInstance } from '@test/mocking';
import { createWorkflow } from '@test-integration/db/workflows';
import { createExecution } from '@test-integration/db/executions';
import * as testDb from '@test-integration/testDb';
import * as testDb from '@test-integration/test-db';

import { mock } from 'jest-mock-extended';
import { ExecutionRecoveryService } from '@/executions/execution-recovery.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ErrorProvider,
FailedProvider,
MockProviders,
} from '@test/ExternalSecrets/utils';
} from '@test/external-secrets/utils';
import { mock } from 'jest-mock-extended';

describe('External Secrets Manager', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from './constants';
import { SettingsRepository } from '@/databases/repositories/settings.repository';
import type { BooleanLicenseFeature, N8nInstanceType, NumericLicenseFeature } from './Interfaces';
import type { RedisServicePubSubPublisher } from './services/redis/RedisServicePubSubPublisher';
import type { RedisServicePubSubPublisher } from './services/redis/redis-service-pub-sub-publisher';
import { RedisService } from './services/redis.service';
import { OrchestrationService } from '@/services/orchestration.service';
import { OnShutdown } from '@/decorators/on-shutdown';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function createApiRouter(

if (!Container.get(GlobalConfig).publicApi.swaggerUiDisabled) {
const { serveFiles, setup } = await import('swagger-ui-express');
const swaggerThemePath = path.join(__dirname, 'swaggerTheme.css');
const swaggerThemePath = path.join(__dirname, 'swagger-theme.css');
const swaggerThemeCss = await fs.readFile(swaggerThemePath, { encoding: 'utf-8' });

apiController.use(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { globalScope } from '@/PublicApi/v1/shared/middlewares/global.middleware';
import { globalScope } from '@/public-api/v1/shared/middlewares/global.middleware';
import type { Response } from 'express';
import type { AuditRequest } from '@/PublicApi/types';
import type { AuditRequest } from '@/public-api/types';
import Container from 'typedi';

export = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { globalScope, isLicensed, validCursor } from '../../shared/middlewares/global.middleware';
import type { Response } from 'express';
import type { ProjectRequest } from '@/requests';
import type { PaginatedRequest } from '@/PublicApi/types';
import type { PaginatedRequest } from '@/public-api/types';
import Container from 'typedi';
import { ProjectController } from '@/controllers/project.controller';
import { ProjectRepository } from '@/databases/repositories/project.repository';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
post:
x-eov-operation-id: pull
x-eov-operation-handler: v1/handlers/sourceControl/sourceControl.handler
x-eov-operation-handler: v1/handlers/source-control/source-control.handler
tags:
- SourceControl
summary: Pull changes from the remote repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { globalScope, isLicensed, validCursor } from '../../shared/middlewares/g
import { encodeNextCursor } from '../../shared/services/pagination.service';
import type { Response } from 'express';
import type { VariablesRequest } from '@/requests';
import type { PaginatedRequest } from '@/PublicApi/types';
import type { PaginatedRequest } from '@/public-api/types';

type Create = VariablesRequest.Create;
type Delete = VariablesRequest.Delete;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ paths:
/users/{id}/role:
$ref: './handlers/users/spec/paths/users.id.role.yml'
/source-control/pull:
$ref: './handlers/sourceControl/spec/paths/sourceControl.yml'
$ref: './handlers/source-control/spec/paths/sourceControl.yml'
/variables:
$ref: './handlers/variables/spec/paths/variables.yml'
/variables/{id}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ CredentialType:
Audit:
$ref: './../../../handlers/audit/spec/schemas/audit.yml'
Pull:
$ref: './../../../handlers/sourceControl/spec/schemas/pull.yml'
$ref: './../../../handlers/source-control/spec/schemas/pull.yml'
ImportResult:
$ref: './../../../handlers/sourceControl/spec/schemas/importResult.yml'
$ref: './../../../handlers/source-control/spec/schemas/importResult.yml'
UserList:
$ref: './../../../handlers/users/spec/schemas/userList.yml'
User:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { getN8nPackageJson, inDevelopment } from '@/constants';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import type { RiskReporter, Risk, n8n } from '@/security-audit/types';
import { isApiEnabled } from '@/PublicApi';
import { isApiEnabled } from '@/public-api';
import { Logger } from '@/logger';
import { GlobalConfig } from '@n8n/config';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '@/constants';
import type { APIRequest } from '@/requests';
import { ControllerRegistry } from '@/decorators';
import { isApiEnabled, loadPublicApiVersions } from '@/PublicApi';
import { isApiEnabled, loadPublicApiVersions } from '@/public-api';
import type { ICredentialsOverwrite } from '@/Interfaces';
import { CredentialsOverwrites } from '@/credentials-overwrites';
import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ActivationErrorsService } from '@/activation-errors.service';
import type { User } from '@/databases/entities/User';
import type { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import type { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { ActiveWorkflowsService } from '@/services/activeWorkflows.service';
import { ActiveWorkflowsService } from '@/services/active-workflows.service';
import { mock } from 'jest-mock-extended';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { WorkflowEntity } from '@/databases/entities/workflow-entity';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Container } from 'typedi';
import { ExecutionMetadataRepository } from '@/databases/repositories/execution-metadata.repository';
import { ExecutionMetadataService } from '@/services/executionMetadata.service';
import { ExecutionMetadataService } from '@/services/execution-metadata.service';
import { mockInstance } from '@test/mocking';

describe('ExecutionMetadataService', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import type { WorkflowActivateMode } from 'n8n-workflow';

import config from '@/config';
import { OrchestrationService } from '@/services/orchestration.service';
import type { RedisServiceWorkerResponseObject } from '@/services/redis/RedisServiceCommands';
import type { RedisServiceWorkerResponseObject } from '@/services/redis/redis-service-commands';
import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus';
import { RedisService } from '@/services/redis.service';
import { handleWorkerResponseMessageMain } from '@/services/orchestration/main/handleWorkerResponseMessageMain';
import { handleCommandMessageMain } from '@/services/orchestration/main/handleCommandMessageMain';
import { handleWorkerResponseMessageMain } from '@/services/orchestration/main/handle-worker-response-message-main';
import { handleCommandMessageMain } from '@/services/orchestration/main/handle-command-message-main';
import { OrchestrationHandlerMainService } from '@/services/orchestration/main/orchestration.handler.main.service';
import * as helpers from '@/services/orchestration/helpers';
import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee';
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('Orchestration Service', () => {
const eventBus = mockInstance(MessageEventBus);

beforeAll(async () => {
jest.mock('@/services/redis/RedisServicePubSubPublisher', () => {
jest.mock('@/services/redis/redis-service-pub-sub-publisher', () => {
return jest.fn().mockImplementation(() => {
return {
init: jest.fn(),
Expand All @@ -64,7 +64,7 @@ describe('Orchestration Service', () => {
};
});
});
jest.mock('@/services/redis/RedisServicePubSubSubscriber', () => {
jest.mock('@/services/redis/redis-service-pub-sub-subscriber', () => {
return jest.fn().mockImplementation(() => {
return {
subscribeToCommandChannel: jest.fn(),
Expand All @@ -81,8 +81,8 @@ describe('Orchestration Service', () => {
});

afterAll(async () => {
jest.mock('@/services/redis/RedisServicePubSubPublisher').restoreAllMocks();
jest.mock('@/services/redis/RedisServicePubSubSubscriber').restoreAllMocks();
jest.mock('@/services/redis/redis-service-pub-sub-publisher').restoreAllMocks();
jest.mock('@/services/redis/redis-service-pub-sub-subscriber').restoreAllMocks();
await os.shutdown();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { mock } from 'jest-mock-extended';
import { Project } from '@/databases/entities/project';
import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository';
import { ProjectRelation } from '@/databases/entities/project-relation';
import { mockCredential, mockProject } from '@test/mockObjects';
import { mockCredential, mockProject } from '@test/mock-objects';

describe('OwnershipService', () => {
const userRepository = mockInstance(UserRepository);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/services/frontend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import type { CommunityPackagesService } from '@/services/communityPackages.serv
import { Logger } from '@/logger';
import { UrlService } from './url.service';
import { EventService } from '@/events/event.service';
import { isApiEnabled } from '@/PublicApi';
import { isApiEnabled } from '@/public-api';

@Service()
export class FrontendService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Container from 'typedi';
import { RedisService } from './redis.service';
import type { RedisServicePubSubSubscriber } from './redis/RedisServicePubSubSubscriber';
import type { RedisServicePubSubSubscriber } from './redis/redis-service-pub-sub-subscriber';
import type { WorkerCommandReceivedHandlerOptions } from './orchestration/worker/types';
import type { MainResponseReceivedHandlerOptions } from './orchestration/main/types';

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/services/orchestration.service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Service } from 'typedi';
import { Logger } from '@/logger';
import config from '@/config';
import type { RedisServicePubSubPublisher } from './redis/RedisServicePubSubPublisher';
import type { RedisServiceBaseCommand, RedisServiceCommand } from './redis/RedisServiceCommands';
import type { RedisServicePubSubPublisher } from './redis/redis-service-pub-sub-publisher';
import type { RedisServiceBaseCommand, RedisServiceCommand } from './redis/redis-service-commands';

import { RedisService } from './redis.service';
import { MultiMainSetup } from './orchestration/main/MultiMainSetup.ee';
import { MultiMainSetup } from './orchestration/main/multi-main-setup.ee';
import type { WorkflowActivateMode } from 'n8n-workflow';
import { InstanceSettings } from 'n8n-core';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/services/orchestration/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Container } from 'typedi';
import { jsonParse } from 'n8n-workflow';
import { Logger } from '@/logger';
import type { RedisServiceCommandObject } from '../redis/RedisServiceCommands';
import { COMMAND_REDIS_CHANNEL } from '../redis/RedisConstants';
import type { RedisServiceCommandObject } from '../redis/redis-service-commands';
import { COMMAND_REDIS_CHANNEL } from '../redis/redis-constants';
import * as os from 'os';

export interface RedisServiceCommandLastReceived {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { jsonParse } from 'n8n-workflow';
import Container from 'typedi';
import { Logger } from '@/logger';
import { Push } from '../../../push';
import type { RedisServiceWorkerResponseObject } from '../../redis/RedisServiceCommands';
import { WORKER_RESPONSE_REDIS_CHANNEL } from '@/services/redis/RedisConstants';
import type { RedisServiceWorkerResponseObject } from '../../redis/redis-service-commands';
import { WORKER_RESPONSE_REDIS_CHANNEL } from '@/services/redis/redis-constants';
import type { MainResponseReceivedHandlerOptions } from './types';

export async function handleWorkerResponseMessageMain(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TIME } from '@/constants';
import { InstanceSettings } from 'n8n-core';
import { ErrorReporterProxy as EventReporter } from 'n8n-workflow';
import { Logger } from '@/logger';
import { RedisServicePubSubPublisher } from '@/services/redis/RedisServicePubSubPublisher';
import { RedisServicePubSubPublisher } from '@/services/redis/redis-service-pub-sub-publisher';
import { RedisClientService } from '@/services/redis/redis-client.service';
import { TypedEmitter } from '@/TypedEmitter';

Expand Down
Loading
Loading