diff --git a/.github/workflows/benchmark-destroy-nightly.yml b/.github/workflows/benchmark-destroy-nightly.yml index 446801fd98bda..f77e305571a30 100644 --- a/.github/workflows/benchmark-destroy-nightly.yml +++ b/.github/workflows/benchmark-destroy-nightly.yml @@ -12,7 +12,7 @@ permissions: jobs: build: runs-on: ubuntu-latest - environment: benchmark + environment: benchmarking steps: - name: Checkout diff --git a/.github/workflows/docker-images-benchmark.yml b/.github/workflows/docker-images-benchmark.yml index cf9d7359a5fe2..b0aa6e997decc 100644 --- a/.github/workflows/docker-images-benchmark.yml +++ b/.github/workflows/docker-images-benchmark.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: branches: - - main + - master paths: - 'packages/@n8n/benchmark/**' - 'pnpm-lock.yaml' diff --git a/packages/@n8n/benchmark/scripts/runInCloud.mjs b/packages/@n8n/benchmark/scripts/runInCloud.mjs index c567ec04759f9..9d6f2b9556da3 100755 --- a/packages/@n8n/benchmark/scripts/runInCloud.mjs +++ b/packages/@n8n/benchmark/scripts/runInCloud.mjs @@ -88,13 +88,22 @@ async function runBenchmarksOnVm(config, benchmarkEnv) { console.log('Running benchmarks...'); const runScriptPath = path.join(scriptsDir, 'runOnVm.mjs'); - await sshClient.ssh( - `npx zx ${runScriptPath} --n8nDockerTag=${config.n8nTag} --benchmarkDockerTag=${config.benchmarkTag} ${config.n8nSetupToUse}`, - { - // Test run should always log its output - verbose: true, - }, - ); + + const flags = { + n8nDockerTag: config.n8nTag, + benchmarkDockerTag: config.benchmarkTag, + k6ApiToken: config.k6ApiToken, + }; + + const flagsString = Object.entries(flags) + .filter(([, value]) => value !== undefined) + .map(([key, value]) => `--${key}=${value}`) + .join(' '); + + await sshClient.ssh(`npx zx ${runScriptPath} ${flagsString} ${config.n8nSetupToUse}`, { + // Test run should always log its output + verbose: true, + }); } async function ensureVmIsReachable(sshClient) { diff --git a/packages/@n8n_io/eslint-config/frontend.js b/packages/@n8n_io/eslint-config/frontend.js index c801a6007cf9f..cd62a6059a352 100644 --- a/packages/@n8n_io/eslint-config/frontend.js +++ b/packages/@n8n_io/eslint-config/frontend.js @@ -66,6 +66,12 @@ module.exports = { useAttrs: 'attrs', }, ], + 'vue/block-order': [ + 'error', + { + order: ['script', 'template', 'style'], + }, + ], // TODO: fix these '@typescript-eslint/no-unsafe-call': 'off', diff --git a/packages/cli/src/Interfaces.ts b/packages/cli/src/Interfaces.ts index f6c3f4670fb74..18102f8f4ca72 100644 --- a/packages/cli/src/Interfaces.ts +++ b/packages/cli/src/Interfaces.ts @@ -42,7 +42,7 @@ import type { WorkflowRepository } from '@db/repositories/workflow.repository'; import type { ExternalHooks } from './external-hooks'; import type { LICENSE_FEATURES, LICENSE_QUOTAS } from './constants'; import type { WorkflowWithSharingsAndCredentials } from './workflows/workflows.types'; -import type { RunningJobSummary } from './scaling/types'; +import type { RunningJobSummary } from './scaling/scaling.types'; import type { Scope } from '@n8n/permissions'; export interface ICredentialsTypeData { diff --git a/packages/cli/src/PublicApi/v1/handlers/sourceControl/sourceControl.handler.ts b/packages/cli/src/PublicApi/v1/handlers/sourceControl/sourceControl.handler.ts index 7a3cf08ec0eb5..330701f59cad0 100644 --- a/packages/cli/src/PublicApi/v1/handlers/sourceControl/sourceControl.handler.ts +++ b/packages/cli/src/PublicApi/v1/handlers/sourceControl/sourceControl.handler.ts @@ -3,13 +3,13 @@ import { Container } from 'typedi'; import type { StatusResult } from 'simple-git'; import type { PublicSourceControlRequest } from '../../../types'; import { globalScope } from '../../shared/middlewares/global.middleware'; -import type { ImportResult } from '@/environments/sourceControl/types/importResult'; -import { SourceControlService } from '@/environments/sourceControl/sourceControl.service.ee'; -import { SourceControlPreferencesService } from '@/environments/sourceControl/sourceControlPreferences.service.ee'; +import type { ImportResult } from '@/environments/source-control/types/import-result'; +import { SourceControlService } from '@/environments/source-control/source-control.service.ee'; +import { SourceControlPreferencesService } from '@/environments/source-control/source-control-preferences.service.ee'; import { getTrackingInformationFromPullResult, isSourceControlLicensed, -} from '@/environments/sourceControl/sourceControlHelper.ee'; +} from '@/environments/source-control/source-control-helper.ee'; import { EventService } from '@/events/event.service'; export = { diff --git a/packages/cli/src/__tests__/workflow-execute-additional-data.test.ts b/packages/cli/src/__tests__/workflow-execute-additional-data.test.ts index f51d994493cc4..5bd84bf88ff84 100644 --- a/packages/cli/src/__tests__/workflow-execute-additional-data.test.ts +++ b/packages/cli/src/__tests__/workflow-execute-additional-data.test.ts @@ -1,6 +1,6 @@ import { VariablesService } from '@/environments/variables/variables.service.ee'; import { mockInstance } from '@test/mocking'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { getBase } from '@/workflow-execute-additional-data'; import Container from 'typedi'; import { CredentialsHelper } from '@/credentials-helper'; diff --git a/packages/cli/src/commands/start.ts b/packages/cli/src/commands/start.ts index 96e3849860c1f..cc8ea6fa93df2 100644 --- a/packages/cli/src/commands/start.ts +++ b/packages/cli/src/commands/start.ts @@ -15,7 +15,7 @@ import { ActiveExecutions } from '@/active-executions'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import { Server } from '@/server'; import { EDITOR_UI_DIST_DIR, LICENSE_FEATURES } from '@/constants'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { License } from '@/license'; import { OrchestrationService } from '@/services/orchestration.service'; import { OrchestrationHandlerMainService } from '@/services/orchestration/main/orchestration.handler.main.service'; diff --git a/packages/cli/src/commands/worker.ts b/packages/cli/src/commands/worker.ts index 594b2f56683a5..05062ac78a1c3 100644 --- a/packages/cli/src/commands/worker.ts +++ b/packages/cli/src/commands/worker.ts @@ -12,9 +12,9 @@ import { N8N_VERSION, inTest } from '@/constants'; import type { ICredentialsOverwrite } from '@/Interfaces'; import { CredentialsOverwrites } from '@/credentials-overwrites'; import { rawBodyReader, bodyParser } from '@/middlewares'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import type { RedisServicePubSubSubscriber } from '@/services/redis/RedisServicePubSubSubscriber'; -import { EventMessageGeneric } from '@/eventbus/EventMessageClasses/EventMessageGeneric'; +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'; import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error'; diff --git a/packages/cli/src/controllers/e2e.controller.ts b/packages/cli/src/controllers/e2e.controller.ts index 6d8eb88fedeca..966221021b51b 100644 --- a/packages/cli/src/controllers/e2e.controller.ts +++ b/packages/cli/src/controllers/e2e.controller.ts @@ -4,7 +4,7 @@ import config from '@/config'; import { SettingsRepository } from '@db/repositories/settings.repository'; import { UserRepository } from '@db/repositories/user.repository'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { License } from '@/license'; import { LICENSE_FEATURES, LICENSE_QUOTAS, UNLIMITED_LICENSE_QUOTA, inE2ETests } from '@/constants'; import { Patch, Post, RestController } from '@/decorators'; diff --git a/packages/cli/src/environments/sourceControl/__tests__/source-control-export.service.test.ts b/packages/cli/src/environments/source-control/__tests__/source-control-export.service.test.ts similarity index 93% rename from packages/cli/src/environments/sourceControl/__tests__/source-control-export.service.test.ts rename to packages/cli/src/environments/source-control/__tests__/source-control-export.service.test.ts index 7746875f6386e..77f56d4d964e4 100644 --- a/packages/cli/src/environments/sourceControl/__tests__/source-control-export.service.test.ts +++ b/packages/cli/src/environments/source-control/__tests__/source-control-export.service.test.ts @@ -1,6 +1,6 @@ import mock from 'jest-mock-extended/lib/Mock'; -import { SourceControlExportService } from '../sourceControlExport.service.ee'; -import type { SourceControlledFile } from '../types/sourceControlledFile'; +import { SourceControlExportService } from '../source-control-export.service.ee'; +import type { SourceControlledFile } from '../types/source-controlled-file'; import { Cipher, type InstanceSettings } from 'n8n-core'; import { SharedCredentialsRepository } from '@/databases/repositories/sharedCredentials.repository'; import { mockInstance } from '@test/mocking'; diff --git a/packages/cli/src/environments/sourceControl/__tests__/source-control-git.service.test.ts b/packages/cli/src/environments/source-control/__tests__/source-control-git.service.test.ts similarity index 91% rename from packages/cli/src/environments/sourceControl/__tests__/source-control-git.service.test.ts rename to packages/cli/src/environments/source-control/__tests__/source-control-git.service.test.ts index 145ebe40c048d..dc5ddfbedb97c 100644 --- a/packages/cli/src/environments/sourceControl/__tests__/source-control-git.service.test.ts +++ b/packages/cli/src/environments/source-control/__tests__/source-control-git.service.test.ts @@ -1,5 +1,5 @@ import { mock } from 'jest-mock-extended'; -import { SourceControlGitService } from '../sourceControlGit.service.ee'; +import { SourceControlGitService } from '../source-control-git.service.ee'; import { simpleGit } from 'simple-git'; const MOCK_BRANCHES = { diff --git a/packages/cli/src/environments/sourceControl/__tests__/sourceControlHelper.ee.test.ts b/packages/cli/src/environments/source-control/__tests__/source-control-helper.ee.test.ts similarity index 96% rename from packages/cli/src/environments/sourceControl/__tests__/sourceControlHelper.ee.test.ts rename to packages/cli/src/environments/source-control/__tests__/source-control-helper.ee.test.ts index 8b81bec7b2fde..3009101b5c3b0 100644 --- a/packages/cli/src/environments/sourceControl/__tests__/sourceControlHelper.ee.test.ts +++ b/packages/cli/src/environments/source-control/__tests__/source-control-helper.ee.test.ts @@ -6,18 +6,18 @@ import { getTrackingInformationFromPrePushResult, getTrackingInformationFromPullResult, sourceControlFoldersExistCheck, -} from '@/environments/sourceControl/sourceControlHelper.ee'; +} from '@/environments/source-control/source-control-helper.ee'; import { License } from '@/license'; -import { SourceControlPreferencesService } from '@/environments/sourceControl/sourceControlPreferences.service.ee'; +import { SourceControlPreferencesService } from '@/environments/source-control/source-control-preferences.service.ee'; import { InstanceSettings } from 'n8n-core'; import path from 'path'; import { SOURCE_CONTROL_SSH_FOLDER, SOURCE_CONTROL_GIT_FOLDER, -} from '@/environments/sourceControl/constants'; +} from '@/environments/source-control/constants'; import { constants as fsConstants, accessSync } from 'fs'; -import type { SourceControlledFile } from '@/environments/sourceControl/types/sourceControlledFile'; -import type { SourceControlPreferences } from '@/environments/sourceControl/types/sourceControlPreferences'; +import type { SourceControlledFile } from '@/environments/source-control/types/source-controlled-file'; +import type { SourceControlPreferences } from '@/environments/source-control/types/source-control-preferences'; import { mockInstance } from '@test/mocking'; const pushResult: SourceControlledFile[] = [ diff --git a/packages/cli/src/environments/sourceControl/__tests__/sourceControlGit.service.test.ts b/packages/cli/src/environments/source-control/__tests__/sourceControlGit.service.test.ts similarity index 88% rename from packages/cli/src/environments/sourceControl/__tests__/sourceControlGit.service.test.ts rename to packages/cli/src/environments/source-control/__tests__/sourceControlGit.service.test.ts index f4a458ac3583b..519aef188b4cb 100644 --- a/packages/cli/src/environments/sourceControl/__tests__/sourceControlGit.service.test.ts +++ b/packages/cli/src/environments/source-control/__tests__/sourceControlGit.service.test.ts @@ -1,6 +1,6 @@ -import { SourceControlGitService } from '@/environments/sourceControl/sourceControlGit.service.ee'; +import { SourceControlGitService } from '@/environments/source-control/source-control-git.service.ee'; import { mock } from 'jest-mock-extended'; -import type { SourceControlPreferences } from '@/environments/sourceControl/types/sourceControlPreferences'; +import type { SourceControlPreferences } from '@/environments/source-control/types/source-control-preferences'; import type { User } from '@/databases/entities/User'; import type { SimpleGit } from 'simple-git'; diff --git a/packages/cli/src/environments/sourceControl/constants.ts b/packages/cli/src/environments/source-control/constants.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/constants.ts rename to packages/cli/src/environments/source-control/constants.ts diff --git a/packages/cli/src/environments/sourceControl/middleware/sourceControlEnabledMiddleware.ee.ts b/packages/cli/src/environments/source-control/middleware/source-control-enabled-middleware.ee.ts similarity index 83% rename from packages/cli/src/environments/sourceControl/middleware/sourceControlEnabledMiddleware.ee.ts rename to packages/cli/src/environments/source-control/middleware/source-control-enabled-middleware.ee.ts index cc0debe3a59fc..24317ecbe16bd 100644 --- a/packages/cli/src/environments/sourceControl/middleware/sourceControlEnabledMiddleware.ee.ts +++ b/packages/cli/src/environments/source-control/middleware/source-control-enabled-middleware.ee.ts @@ -1,7 +1,7 @@ import type { RequestHandler } from 'express'; import { Container } from 'typedi'; -import { isSourceControlLicensed } from '../sourceControlHelper.ee'; -import { SourceControlPreferencesService } from '../sourceControlPreferences.service.ee'; +import { isSourceControlLicensed } from '../source-control-helper.ee'; +import { SourceControlPreferencesService } from '../source-control-preferences.service.ee'; export const sourceControlLicensedAndEnabledMiddleware: RequestHandler = (_req, res, next) => { const sourceControlPreferencesService = Container.get(SourceControlPreferencesService); diff --git a/packages/cli/src/environments/sourceControl/sourceControlExport.service.ee.ts b/packages/cli/src/environments/source-control/source-control-export.service.ee.ts similarity index 96% rename from packages/cli/src/environments/sourceControl/sourceControlExport.service.ee.ts rename to packages/cli/src/environments/source-control/source-control-export.service.ee.ts index 6d2d468e30b46..728b44c5dcce7 100644 --- a/packages/cli/src/environments/sourceControl/sourceControlExport.service.ee.ts +++ b/packages/cli/src/environments/source-control/source-control-export.service.ee.ts @@ -10,18 +10,18 @@ import { ApplicationError, type ICredentialDataDecryptedObject } from 'n8n-workf import { writeFile as fsWriteFile, rm as fsRm } from 'fs/promises'; import { rmSync } from 'fs'; import { Credentials, InstanceSettings } from 'n8n-core'; -import type { ExportableWorkflow } from './types/exportableWorkflow'; -import type { ExportableCredential } from './types/exportableCredential'; -import type { ExportResult } from './types/exportResult'; +import type { ExportableWorkflow } from './types/exportable-workflow'; +import type { ExportableCredential } from './types/exportable-credential'; +import type { ExportResult } from './types/export-result'; import { getCredentialExportPath, getVariablesPath, getWorkflowExportPath, sourceControlFoldersExistCheck, stringContainsExpression, -} from './sourceControlHelper.ee'; +} from './source-control-helper.ee'; import type { WorkflowEntity } from '@db/entities/WorkflowEntity'; -import type { SourceControlledFile } from './types/sourceControlledFile'; +import type { SourceControlledFile } from './types/source-controlled-file'; import { VariablesService } from '../variables/variables.service.ee'; import { TagRepository } from '@db/repositories/tag.repository'; import { WorkflowRepository } from '@db/repositories/workflow.repository'; @@ -29,7 +29,7 @@ import { Logger } from '@/logger'; import { SharedCredentialsRepository } from '@db/repositories/sharedCredentials.repository'; import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository'; import { WorkflowTagMappingRepository } from '@db/repositories/workflowTagMapping.repository'; -import type { ResourceOwner } from './types/resourceOwner'; +import type { ResourceOwner } from './types/resource-owner'; @Service() export class SourceControlExportService { diff --git a/packages/cli/src/environments/sourceControl/sourceControlGit.service.ee.ts b/packages/cli/src/environments/source-control/source-control-git.service.ee.ts similarity index 97% rename from packages/cli/src/environments/sourceControl/sourceControlGit.service.ee.ts rename to packages/cli/src/environments/source-control/source-control-git.service.ee.ts index 91220340b7a15..134aab9fd69c7 100644 --- a/packages/cli/src/environments/sourceControl/sourceControlGit.service.ee.ts +++ b/packages/cli/src/environments/source-control/source-control-git.service.ee.ts @@ -11,19 +11,19 @@ import type { SimpleGitOptions, StatusResult, } from 'simple-git'; -import type { SourceControlPreferences } from './types/sourceControlPreferences'; +import type { SourceControlPreferences } from './types/source-control-preferences'; import { SOURCE_CONTROL_DEFAULT_BRANCH, SOURCE_CONTROL_DEFAULT_EMAIL, SOURCE_CONTROL_DEFAULT_NAME, SOURCE_CONTROL_ORIGIN, } from './constants'; -import { sourceControlFoldersExistCheck } from './sourceControlHelper.ee'; +import { sourceControlFoldersExistCheck } from './source-control-helper.ee'; import type { User } from '@db/entities/User'; import { Logger } from '@/logger'; import { ApplicationError } from 'n8n-workflow'; import { OwnershipService } from '@/services/ownership.service'; -import { SourceControlPreferencesService } from './sourceControlPreferences.service.ee'; +import { SourceControlPreferencesService } from './source-control-preferences.service.ee'; @Service() export class SourceControlGitService { diff --git a/packages/cli/src/environments/sourceControl/sourceControlHelper.ee.ts b/packages/cli/src/environments/source-control/source-control-helper.ee.ts similarity index 96% rename from packages/cli/src/environments/sourceControl/sourceControlHelper.ee.ts rename to packages/cli/src/environments/source-control/source-control-helper.ee.ts index 65cd88bfa57ba..738f4212f50e6 100644 --- a/packages/cli/src/environments/sourceControl/sourceControlHelper.ee.ts +++ b/packages/cli/src/environments/source-control/source-control-helper.ee.ts @@ -1,16 +1,16 @@ import { Container } from 'typedi'; import { License } from '@/license'; import { generateKeyPairSync } from 'crypto'; -import type { KeyPair } from './types/keyPair'; +import type { KeyPair } from './types/key-pair'; import { constants as fsConstants, mkdirSync, accessSync } from 'fs'; import { SOURCE_CONTROL_GIT_KEY_COMMENT, SOURCE_CONTROL_TAGS_EXPORT_FILE, SOURCE_CONTROL_VARIABLES_EXPORT_FILE, } from './constants'; -import type { SourceControlledFile } from './types/sourceControlledFile'; +import type { SourceControlledFile } from './types/source-controlled-file'; import path from 'path'; -import type { KeyPairType } from './types/keyPairType'; +import type { KeyPairType } from './types/key-pair-type'; import { Logger } from '@/logger'; export function stringContainsExpression(testString: string): boolean { diff --git a/packages/cli/src/environments/sourceControl/sourceControlImport.service.ee.ts b/packages/cli/src/environments/source-control/source-control-import.service.ee.ts similarity index 98% rename from packages/cli/src/environments/sourceControl/sourceControlImport.service.ee.ts rename to packages/cli/src/environments/source-control/source-control-import.service.ee.ts index bd04937bc1737..05ce8a0687af0 100644 --- a/packages/cli/src/environments/sourceControl/sourceControlImport.service.ee.ts +++ b/packages/cli/src/environments/source-control/source-control-import.service.ee.ts @@ -12,7 +12,7 @@ import { ApplicationError, jsonParse, ErrorReporterProxy as ErrorReporter } from import { readFile as fsReadFile } from 'fs/promises'; import { Credentials, InstanceSettings } from 'n8n-core'; import type { IWorkflowToImport } from '@/Interfaces'; -import type { ExportableCredential } from './types/exportableCredential'; +import type { ExportableCredential } from './types/exportable-credential'; import type { Variables } from '@db/entities/Variables'; import { SharedCredentials } from '@db/entities/SharedCredentials'; import type { WorkflowTagMapping } from '@db/entities/WorkflowTagMapping'; @@ -21,9 +21,9 @@ import { ActiveWorkflowManager } from '@/active-workflow-manager'; // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import import { In } from '@n8n/typeorm'; import { isUniqueConstraintError } from '@/response-helper'; -import type { SourceControlWorkflowVersionId } from './types/sourceControlWorkflowVersionId'; -import { getCredentialExportPath, getWorkflowExportPath } from './sourceControlHelper.ee'; -import type { SourceControlledFile } from './types/sourceControlledFile'; +import type { SourceControlWorkflowVersionId } from './types/source-control-workflow-version-id'; +import { getCredentialExportPath, getWorkflowExportPath } from './source-control-helper.ee'; +import type { SourceControlledFile } from './types/source-controlled-file'; import { VariablesService } from '../variables/variables.service.ee'; import { TagRepository } from '@db/repositories/tag.repository'; import { WorkflowRepository } from '@db/repositories/workflow.repository'; @@ -35,7 +35,7 @@ import { WorkflowTagMappingRepository } from '@db/repositories/workflowTagMappin import { VariablesRepository } from '@db/repositories/variables.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository'; import type { Project } from '@/databases/entities/Project'; -import type { ResourceOwner } from './types/resourceOwner'; +import type { ResourceOwner } from './types/resource-owner'; import { assertNever } from '@/utils'; import { UserRepository } from '@/databases/repositories/user.repository'; diff --git a/packages/cli/src/environments/sourceControl/sourceControlPreferences.service.ee.ts b/packages/cli/src/environments/source-control/source-control-preferences.service.ee.ts similarity index 97% rename from packages/cli/src/environments/sourceControl/sourceControlPreferences.service.ee.ts rename to packages/cli/src/environments/source-control/source-control-preferences.service.ee.ts index 52a2f6192d84e..4e417704416f0 100644 --- a/packages/cli/src/environments/sourceControl/sourceControlPreferences.service.ee.ts +++ b/packages/cli/src/environments/source-control/source-control-preferences.service.ee.ts @@ -1,10 +1,10 @@ import { writeFile, chmod, readFile } from 'node:fs/promises'; import Container, { Service } from 'typedi'; -import { SourceControlPreferences } from './types/sourceControlPreferences'; +import { SourceControlPreferences } from './types/source-control-preferences'; import type { ValidationError } from 'class-validator'; import { validate } from 'class-validator'; import { rm as fsRm } from 'fs/promises'; -import { generateSshKeyPair, isSourceControlLicensed } from './sourceControlHelper.ee'; +import { generateSshKeyPair, isSourceControlLicensed } from './source-control-helper.ee'; import { Cipher, InstanceSettings } from 'n8n-core'; import { ApplicationError, jsonParse } from 'n8n-workflow'; import { @@ -14,7 +14,7 @@ import { SOURCE_CONTROL_PREFERENCES_DB_KEY, } from './constants'; import path from 'path'; -import type { KeyPairType } from './types/keyPairType'; +import type { KeyPairType } from './types/key-pair-type'; import config from '@/config'; import { Logger } from '@/logger'; import { SettingsRepository } from '@db/repositories/settings.repository'; diff --git a/packages/cli/src/environments/sourceControl/sourceControl.controller.ee.ts b/packages/cli/src/environments/source-control/source-control.controller.ee.ts similarity index 93% rename from packages/cli/src/environments/sourceControl/sourceControl.controller.ee.ts rename to packages/cli/src/environments/source-control/source-control.controller.ee.ts index f92b0bfb1f02f..d927ee2a9bd00 100644 --- a/packages/cli/src/environments/sourceControl/sourceControl.controller.ee.ts +++ b/packages/cli/src/environments/source-control/source-control.controller.ee.ts @@ -4,17 +4,17 @@ import { Get, Post, Patch, RestController, GlobalScope } from '@/decorators'; import { sourceControlLicensedMiddleware, sourceControlLicensedAndEnabledMiddleware, -} from './middleware/sourceControlEnabledMiddleware.ee'; -import { SourceControlService } from './sourceControl.service.ee'; +} from './middleware/source-control-enabled-middleware.ee'; +import { SourceControlService } from './source-control.service.ee'; import { SourceControlRequest } from './types/requests'; -import { SourceControlPreferencesService } from './sourceControlPreferences.service.ee'; -import type { SourceControlPreferences } from './types/sourceControlPreferences'; -import type { SourceControlledFile } from './types/sourceControlledFile'; +import { SourceControlPreferencesService } from './source-control-preferences.service.ee'; +import type { SourceControlPreferences } from './types/source-control-preferences'; +import type { SourceControlledFile } from './types/source-controlled-file'; import { SOURCE_CONTROL_DEFAULT_BRANCH } from './constants'; -import type { ImportResult } from './types/importResult'; +import type { ImportResult } from './types/import-result'; import { EventService } from '@/events/event.service'; -import { getRepoType } from './sourceControlHelper.ee'; -import { SourceControlGetStatus } from './types/sourceControlGetStatus'; +import { getRepoType } from './source-control-helper.ee'; +import { SourceControlGetStatus } from './types/source-control-get-status'; import { BadRequestError } from '@/errors/response-errors/bad-request.error'; @RestController('/source-control') diff --git a/packages/cli/src/environments/sourceControl/sourceControl.service.ee.ts b/packages/cli/src/environments/source-control/source-control.service.ee.ts similarity index 96% rename from packages/cli/src/environments/sourceControl/sourceControl.service.ee.ts rename to packages/cli/src/environments/source-control/source-control.service.ee.ts index 375352e4cc78f..d264e1f75a6ed 100644 --- a/packages/cli/src/environments/sourceControl/sourceControl.service.ee.ts +++ b/packages/cli/src/environments/source-control/source-control.service.ee.ts @@ -7,29 +7,29 @@ import { getTrackingInformationFromPullResult, getVariablesPath, sourceControlFoldersExistCheck, -} from './sourceControlHelper.ee'; -import type { SourceControlPreferences } from './types/sourceControlPreferences'; +} from './source-control-helper.ee'; +import type { SourceControlPreferences } from './types/source-control-preferences'; import { SOURCE_CONTROL_DEFAULT_EMAIL, SOURCE_CONTROL_DEFAULT_NAME, SOURCE_CONTROL_README, } from './constants'; -import { SourceControlGitService } from './sourceControlGit.service.ee'; +import { SourceControlGitService } from './source-control-git.service.ee'; import type { PushResult } from 'simple-git'; -import { SourceControlExportService } from './sourceControlExport.service.ee'; -import type { ImportResult } from './types/importResult'; -import type { SourceControlPushWorkFolder } from './types/sourceControlPushWorkFolder'; -import type { SourceControllPullOptions } from './types/sourceControlPullWorkFolder'; -import type { SourceControlledFile } from './types/sourceControlledFile'; -import { SourceControlPreferencesService } from './sourceControlPreferences.service.ee'; +import { SourceControlExportService } from './source-control-export.service.ee'; +import type { ImportResult } from './types/import-result'; +import type { SourceControlPushWorkFolder } from './types/source-control-push-work-folder'; +import type { SourceControllPullOptions } from './types/source-control-pull-work-folder'; +import type { SourceControlledFile } from './types/source-controlled-file'; +import { SourceControlPreferencesService } from './source-control-preferences.service.ee'; import { writeFileSync } from 'fs'; -import { SourceControlImportService } from './sourceControlImport.service.ee'; +import { SourceControlImportService } from './source-control-import.service.ee'; import type { User } from '@db/entities/User'; -import type { SourceControlGetStatus } from './types/sourceControlGetStatus'; +import type { SourceControlGetStatus } from './types/source-control-get-status'; import type { TagEntity } from '@db/entities/TagEntity'; import type { Variables } from '@db/entities/Variables'; -import type { SourceControlWorkflowVersionId } from './types/sourceControlWorkflowVersionId'; -import type { ExportableCredential } from './types/exportableCredential'; +import type { SourceControlWorkflowVersionId } from './types/source-control-workflow-version-id'; +import type { ExportableCredential } from './types/exportable-credential'; import { EventService } from '@/events/event.service'; import { TagRepository } from '@db/repositories/tag.repository'; import { Logger } from '@/logger'; diff --git a/packages/cli/src/environments/sourceControl/types/exportResult.ts b/packages/cli/src/environments/source-control/types/export-result.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/exportResult.ts rename to packages/cli/src/environments/source-control/types/export-result.ts diff --git a/packages/cli/src/environments/sourceControl/types/exportableCredential.ts b/packages/cli/src/environments/source-control/types/exportable-credential.ts similarity index 87% rename from packages/cli/src/environments/sourceControl/types/exportableCredential.ts rename to packages/cli/src/environments/source-control/types/exportable-credential.ts index 7ef071117f49b..a15f5b4890ec2 100644 --- a/packages/cli/src/environments/sourceControl/types/exportableCredential.ts +++ b/packages/cli/src/environments/source-control/types/exportable-credential.ts @@ -1,5 +1,5 @@ import type { ICredentialDataDecryptedObject } from 'n8n-workflow'; -import type { ResourceOwner } from './resourceOwner'; +import type { ResourceOwner } from './resource-owner'; export interface ExportableCredential { id: string; diff --git a/packages/cli/src/environments/sourceControl/types/exportableWorkflow.ts b/packages/cli/src/environments/source-control/types/exportable-workflow.ts similarity index 83% rename from packages/cli/src/environments/sourceControl/types/exportableWorkflow.ts rename to packages/cli/src/environments/source-control/types/exportable-workflow.ts index a0803bce87e27..56cec13537d0f 100644 --- a/packages/cli/src/environments/sourceControl/types/exportableWorkflow.ts +++ b/packages/cli/src/environments/source-control/types/exportable-workflow.ts @@ -1,5 +1,5 @@ import type { INode, IConnections, IWorkflowSettings } from 'n8n-workflow'; -import type { ResourceOwner } from './resourceOwner'; +import type { ResourceOwner } from './resource-owner'; export interface ExportableWorkflow { id: string; diff --git a/packages/cli/src/environments/sourceControl/types/importResult.ts b/packages/cli/src/environments/source-control/types/import-result.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/importResult.ts rename to packages/cli/src/environments/source-control/types/import-result.ts diff --git a/packages/cli/src/environments/sourceControl/types/keyPairType.ts b/packages/cli/src/environments/source-control/types/key-pair-type.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/keyPairType.ts rename to packages/cli/src/environments/source-control/types/key-pair-type.ts diff --git a/packages/cli/src/environments/sourceControl/types/keyPair.ts b/packages/cli/src/environments/source-control/types/key-pair.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/keyPair.ts rename to packages/cli/src/environments/source-control/types/key-pair.ts diff --git a/packages/cli/src/environments/sourceControl/types/requests.ts b/packages/cli/src/environments/source-control/types/requests.ts similarity index 53% rename from packages/cli/src/environments/sourceControl/types/requests.ts rename to packages/cli/src/environments/source-control/types/requests.ts index e48cf94681622..5855b0af4ba04 100644 --- a/packages/cli/src/environments/sourceControl/types/requests.ts +++ b/packages/cli/src/environments/source-control/types/requests.ts @@ -1,15 +1,15 @@ import type { AuthenticatedRequest } from '@/requests'; -import type { SourceControlPreferences } from './sourceControlPreferences'; -import type { SourceControlSetBranch } from './sourceControlSetBranch'; -import type { SourceControlCommit } from './sourceControlCommit'; -import type { SourceControlStage } from './sourceControlStage'; -import type { SourceControlPush } from './sourceControlPush'; -import type { SourceControlPushWorkFolder } from './sourceControlPushWorkFolder'; -import type { SourceControlPullWorkFolder } from './sourceControlPullWorkFolder'; -import type { SourceControlDisconnect } from './sourceControlDisconnect'; -import type { SourceControlSetReadOnly } from './sourceControlSetReadOnly'; -import type { SourceControlGetStatus } from './sourceControlGetStatus'; -import type { SourceControlGenerateKeyPair } from './sourceControlGenerateKeyPair'; +import type { SourceControlPreferences } from './source-control-preferences'; +import type { SourceControlSetBranch } from './source-control-set-branch'; +import type { SourceControlCommit } from './source-control-commit'; +import type { SourceControlStage } from './source-control-stage'; +import type { SourceControlPush } from './source-control-push'; +import type { SourceControlPushWorkFolder } from './source-control-push-work-folder'; +import type { SourceControlPullWorkFolder } from './source-control-pull-work-folder'; +import type { SourceControlDisconnect } from './source-control-disconnect'; +import type { SourceControlSetReadOnly } from './source-control-set-read-only'; +import type { SourceControlGetStatus } from './source-control-get-status'; +import type { SourceControlGenerateKeyPair } from './source-control-generate-key-pair'; export declare namespace SourceControlRequest { type UpdatePreferences = AuthenticatedRequest<{}, {}, Partial, {}>; diff --git a/packages/cli/src/environments/sourceControl/types/resourceOwner.ts b/packages/cli/src/environments/source-control/types/resource-owner.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/resourceOwner.ts rename to packages/cli/src/environments/source-control/types/resource-owner.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlCommit.ts b/packages/cli/src/environments/source-control/types/source-control-commit.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlCommit.ts rename to packages/cli/src/environments/source-control/types/source-control-commit.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlDisconnect.ts b/packages/cli/src/environments/source-control/types/source-control-disconnect.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlDisconnect.ts rename to packages/cli/src/environments/source-control/types/source-control-disconnect.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlGenerateKeyPair.ts b/packages/cli/src/environments/source-control/types/source-control-generate-key-pair.ts similarity index 78% rename from packages/cli/src/environments/sourceControl/types/sourceControlGenerateKeyPair.ts rename to packages/cli/src/environments/source-control/types/source-control-generate-key-pair.ts index c625b1eb2bc52..9f9093b432ba5 100644 --- a/packages/cli/src/environments/sourceControl/types/sourceControlGenerateKeyPair.ts +++ b/packages/cli/src/environments/source-control/types/source-control-generate-key-pair.ts @@ -1,5 +1,5 @@ import { IsOptional, IsString } from 'class-validator'; -import { KeyPairType } from './keyPairType'; +import { KeyPairType } from './key-pair-type'; export class SourceControlGenerateKeyPair { @IsOptional() diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlGetStatus.ts b/packages/cli/src/environments/source-control/types/source-control-get-status.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlGetStatus.ts rename to packages/cli/src/environments/source-control/types/source-control-get-status.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlPreferences.ts b/packages/cli/src/environments/source-control/types/source-control-preferences.ts similarity index 96% rename from packages/cli/src/environments/sourceControl/types/sourceControlPreferences.ts rename to packages/cli/src/environments/source-control/types/source-control-preferences.ts index 9b5c3a25ca1dc..ecda479ef6cda 100644 --- a/packages/cli/src/environments/sourceControl/types/sourceControlPreferences.ts +++ b/packages/cli/src/environments/source-control/types/source-control-preferences.ts @@ -1,5 +1,5 @@ import { IsBoolean, IsHexColor, IsOptional, IsString } from 'class-validator'; -import { KeyPairType } from './keyPairType'; +import { KeyPairType } from './key-pair-type'; export class SourceControlPreferences { constructor(preferences: Partial | undefined = undefined) { diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlPullWorkFolder.ts b/packages/cli/src/environments/source-control/types/source-control-pull-work-folder.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlPullWorkFolder.ts rename to packages/cli/src/environments/source-control/types/source-control-pull-work-folder.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlPushWorkFolder.ts b/packages/cli/src/environments/source-control/types/source-control-push-work-folder.ts similarity index 82% rename from packages/cli/src/environments/sourceControl/types/sourceControlPushWorkFolder.ts rename to packages/cli/src/environments/source-control/types/source-control-push-work-folder.ts index a6b23025d87aa..20299a013913d 100644 --- a/packages/cli/src/environments/sourceControl/types/sourceControlPushWorkFolder.ts +++ b/packages/cli/src/environments/source-control/types/source-control-push-work-folder.ts @@ -1,5 +1,5 @@ import { IsBoolean, IsOptional, IsString } from 'class-validator'; -import type { SourceControlledFile } from './sourceControlledFile'; +import type { SourceControlledFile } from './source-controlled-file'; export class SourceControlPushWorkFolder { @IsBoolean() diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlPush.ts b/packages/cli/src/environments/source-control/types/source-control-push.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlPush.ts rename to packages/cli/src/environments/source-control/types/source-control-push.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlSetBranch.ts b/packages/cli/src/environments/source-control/types/source-control-set-branch.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlSetBranch.ts rename to packages/cli/src/environments/source-control/types/source-control-set-branch.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlSetReadOnly.ts b/packages/cli/src/environments/source-control/types/source-control-set-read-only.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlSetReadOnly.ts rename to packages/cli/src/environments/source-control/types/source-control-set-read-only.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlStage.ts b/packages/cli/src/environments/source-control/types/source-control-stage.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlStage.ts rename to packages/cli/src/environments/source-control/types/source-control-stage.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlWorkflowVersionId.ts b/packages/cli/src/environments/source-control/types/source-control-workflow-version-id.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlWorkflowVersionId.ts rename to packages/cli/src/environments/source-control/types/source-control-workflow-version-id.ts diff --git a/packages/cli/src/environments/sourceControl/types/sourceControlledFile.ts b/packages/cli/src/environments/source-control/types/source-controlled-file.ts similarity index 100% rename from packages/cli/src/environments/sourceControl/types/sourceControlledFile.ts rename to packages/cli/src/environments/source-control/types/source-controlled-file.ts diff --git a/packages/cli/src/environments/variables/environmentHelpers.ts b/packages/cli/src/environments/variables/environment-helpers.ts similarity index 100% rename from packages/cli/src/environments/variables/environmentHelpers.ts rename to packages/cli/src/environments/variables/environment-helpers.ts diff --git a/packages/cli/src/environments/variables/variables.service.ee.ts b/packages/cli/src/environments/variables/variables.service.ee.ts index 78a3d23fbe55d..768a9fa4565e7 100644 --- a/packages/cli/src/environments/variables/variables.service.ee.ts +++ b/packages/cli/src/environments/variables/variables.service.ee.ts @@ -1,7 +1,7 @@ import { Container, Service } from 'typedi'; import type { Variables } from '@db/entities/Variables'; import { generateNanoId } from '@db/utils/generators'; -import { canCreateNewVariable } from './environmentHelpers'; +import { canCreateNewVariable } from './environment-helpers'; import { CacheService } from '@/services/cache/cache.service'; import { VariablesRepository } from '@db/repositories/variables.repository'; import { VariableCountLimitReachedError } from '@/errors/variable-count-limit-reached.error'; diff --git a/packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessageOptions.ts b/packages/cli/src/eventbus/event-message-classes/abstract-event-message-options.ts similarity index 83% rename from packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessageOptions.ts rename to packages/cli/src/eventbus/event-message-classes/abstract-event-message-options.ts index 95f3ef6432a2e..7c70aa9ee5ad3 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessageOptions.ts +++ b/packages/cli/src/eventbus/event-message-classes/abstract-event-message-options.ts @@ -1,7 +1,7 @@ import type { DateTime } from 'luxon'; import type { EventMessageTypeNames } from 'n8n-workflow'; import type { EventNamesTypes } from '.'; -import type { AbstractEventPayload } from './AbstractEventPayload'; +import type { AbstractEventPayload } from './abstract-event-payload'; export interface AbstractEventMessageOptions { __type?: EventMessageTypeNames; diff --git a/packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessage.ts b/packages/cli/src/eventbus/event-message-classes/abstract-event-message.ts similarity index 96% rename from packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessage.ts rename to packages/cli/src/eventbus/event-message-classes/abstract-event-message.ts index f71b03a413755..e74ba8c06a40a 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/AbstractEventMessage.ts +++ b/packages/cli/src/eventbus/event-message-classes/abstract-event-message.ts @@ -2,8 +2,8 @@ import { DateTime } from 'luxon'; import type { EventMessageTypeNames, JsonObject } from 'n8n-workflow'; import { v4 as uuid } from 'uuid'; -import type { AbstractEventPayload } from './AbstractEventPayload'; -import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; +import type { AbstractEventPayload } from './abstract-event-payload'; +import type { AbstractEventMessageOptions } from './abstract-event-message-options'; import type { EventNamesTypes } from '.'; function modifyUnderscoredKeys( diff --git a/packages/cli/src/eventbus/EventMessageClasses/AbstractEventPayload.ts b/packages/cli/src/eventbus/event-message-classes/abstract-event-payload.ts similarity index 100% rename from packages/cli/src/eventbus/EventMessageClasses/AbstractEventPayload.ts rename to packages/cli/src/eventbus/event-message-classes/abstract-event-payload.ts diff --git a/packages/cli/src/eventbus/EventMessageClasses/EventMessageAiNode.ts b/packages/cli/src/eventbus/event-message-classes/event-message-ai-node.ts similarity index 87% rename from packages/cli/src/eventbus/EventMessageClasses/EventMessageAiNode.ts rename to packages/cli/src/eventbus/event-message-classes/event-message-ai-node.ts index 44d9feafbde14..b1ee96099373c 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/EventMessageAiNode.ts +++ b/packages/cli/src/eventbus/event-message-classes/event-message-ai-node.ts @@ -1,8 +1,8 @@ -import { AbstractEventMessage, isEventMessageOptionsWithType } from './AbstractEventMessage'; +import { AbstractEventMessage, isEventMessageOptionsWithType } from './abstract-event-message'; import type { EventNamesAiNodesType, JsonObject } from 'n8n-workflow'; import { EventMessageTypeNames } from 'n8n-workflow'; -import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; -import type { AbstractEventPayload } from './AbstractEventPayload'; +import type { AbstractEventMessageOptions } from './abstract-event-message-options'; +import type { AbstractEventPayload } from './abstract-event-payload'; // -------------------------------------- // EventMessage class for Node events diff --git a/packages/cli/src/eventbus/EventMessageClasses/EventMessageAudit.ts b/packages/cli/src/eventbus/event-message-classes/event-message-audit.ts similarity index 88% rename from packages/cli/src/eventbus/EventMessageClasses/EventMessageAudit.ts rename to packages/cli/src/eventbus/event-message-classes/event-message-audit.ts index 737a1ebf0a2e1..4ae0fa485d85b 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/EventMessageAudit.ts +++ b/packages/cli/src/eventbus/event-message-classes/event-message-audit.ts @@ -1,8 +1,8 @@ -import { AbstractEventMessage, isEventMessageOptionsWithType } from './AbstractEventMessage'; +import { AbstractEventMessage, isEventMessageOptionsWithType } from './abstract-event-message'; import { EventMessageTypeNames } from 'n8n-workflow'; import type { JsonObject, JsonValue } from 'n8n-workflow'; -import type { AbstractEventPayload } from './AbstractEventPayload'; -import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; +import type { AbstractEventPayload } from './abstract-event-payload'; +import type { AbstractEventMessageOptions } from './abstract-event-message-options'; import type { EventNamesAuditType } from '.'; // -------------------------------------- diff --git a/packages/cli/src/eventbus/EventMessageClasses/EventMessageConfirm.ts b/packages/cli/src/eventbus/event-message-classes/event-message-confirm.ts similarity index 100% rename from packages/cli/src/eventbus/EventMessageClasses/EventMessageConfirm.ts rename to packages/cli/src/eventbus/event-message-classes/event-message-confirm.ts diff --git a/packages/cli/src/eventbus/EventMessageClasses/EventMessageExecution.ts b/packages/cli/src/eventbus/event-message-classes/event-message-execution.ts similarity index 86% rename from packages/cli/src/eventbus/EventMessageClasses/EventMessageExecution.ts rename to packages/cli/src/eventbus/event-message-classes/event-message-execution.ts index 9a8864c7f0b76..e311e5354fce7 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/EventMessageExecution.ts +++ b/packages/cli/src/eventbus/event-message-classes/event-message-execution.ts @@ -1,8 +1,8 @@ -import { AbstractEventMessage, isEventMessageOptionsWithType } from './AbstractEventMessage'; +import { AbstractEventMessage, isEventMessageOptionsWithType } from './abstract-event-message'; import type { JsonObject } from 'n8n-workflow'; import { EventMessageTypeNames } from 'n8n-workflow'; -import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; -import type { AbstractEventPayload } from './AbstractEventPayload'; +import type { AbstractEventMessageOptions } from './abstract-event-message-options'; +import type { AbstractEventPayload } from './abstract-event-payload'; import type { EventNamesExecutionType } from '.'; export interface EventPayloadExecution extends AbstractEventPayload { diff --git a/packages/cli/src/eventbus/EventMessageClasses/EventMessageGeneric.ts b/packages/cli/src/eventbus/event-message-classes/event-message-generic.ts similarity index 85% rename from packages/cli/src/eventbus/EventMessageClasses/EventMessageGeneric.ts rename to packages/cli/src/eventbus/event-message-classes/event-message-generic.ts index 0e49b33b4fd58..14d8bfb345e23 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/EventMessageGeneric.ts +++ b/packages/cli/src/eventbus/event-message-classes/event-message-generic.ts @@ -1,8 +1,8 @@ import type { JsonObject } from 'n8n-workflow'; import { EventMessageTypeNames } from 'n8n-workflow'; -import { AbstractEventMessage, isEventMessageOptionsWithType } from './AbstractEventMessage'; -import type { AbstractEventPayload } from './AbstractEventPayload'; -import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; +import { AbstractEventMessage, isEventMessageOptionsWithType } from './abstract-event-message'; +import type { AbstractEventPayload } from './abstract-event-payload'; +import type { AbstractEventMessageOptions } from './abstract-event-message-options'; export const eventMessageGenericDestinationTestEvent = 'n8n.destination.test'; diff --git a/packages/cli/src/eventbus/EventMessageClasses/EventMessageNode.ts b/packages/cli/src/eventbus/event-message-classes/event-message-node.ts similarity index 87% rename from packages/cli/src/eventbus/EventMessageClasses/EventMessageNode.ts rename to packages/cli/src/eventbus/event-message-classes/event-message-node.ts index d9dda95e27b89..da36c2456cd78 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/EventMessageNode.ts +++ b/packages/cli/src/eventbus/event-message-classes/event-message-node.ts @@ -1,8 +1,8 @@ -import { AbstractEventMessage, isEventMessageOptionsWithType } from './AbstractEventMessage'; +import { AbstractEventMessage, isEventMessageOptionsWithType } from './abstract-event-message'; import type { JsonObject } from 'n8n-workflow'; import { EventMessageTypeNames } from 'n8n-workflow'; -import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; -import type { AbstractEventPayload } from './AbstractEventPayload'; +import type { AbstractEventMessageOptions } from './abstract-event-message-options'; +import type { AbstractEventPayload } from './abstract-event-payload'; import type { EventNamesNodeType } from '.'; // -------------------------------------- diff --git a/packages/cli/src/eventbus/EventMessageClasses/EventMessageWorkflow.ts b/packages/cli/src/eventbus/event-message-classes/event-message-workflow.ts similarity index 88% rename from packages/cli/src/eventbus/EventMessageClasses/EventMessageWorkflow.ts rename to packages/cli/src/eventbus/event-message-classes/event-message-workflow.ts index 146e0ffcd3229..22c0fc6b5171a 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/EventMessageWorkflow.ts +++ b/packages/cli/src/eventbus/event-message-classes/event-message-workflow.ts @@ -1,8 +1,8 @@ -import { AbstractEventMessage, isEventMessageOptionsWithType } from './AbstractEventMessage'; +import { AbstractEventMessage, isEventMessageOptionsWithType } from './abstract-event-message'; import type { IWorkflowBase, JsonObject } from 'n8n-workflow'; import { EventMessageTypeNames } from 'n8n-workflow'; -import type { AbstractEventMessageOptions } from './AbstractEventMessageOptions'; -import type { AbstractEventPayload } from './AbstractEventPayload'; +import type { AbstractEventMessageOptions } from './abstract-event-message-options'; +import type { AbstractEventPayload } from './abstract-event-payload'; import type { IExecutionBase } from '@/Interfaces'; import type { EventNamesWorkflowType } from '.'; diff --git a/packages/cli/src/eventbus/EventMessageClasses/index.ts b/packages/cli/src/eventbus/event-message-classes/index.ts similarity index 84% rename from packages/cli/src/eventbus/EventMessageClasses/index.ts rename to packages/cli/src/eventbus/event-message-classes/index.ts index 2e4d78560d9da..8e0f367571819 100644 --- a/packages/cli/src/eventbus/EventMessageClasses/index.ts +++ b/packages/cli/src/eventbus/event-message-classes/index.ts @@ -1,9 +1,9 @@ -import type { EventMessageAiNode } from './EventMessageAiNode'; -import type { EventMessageAudit } from './EventMessageAudit'; -import type { EventMessageExecution } from './EventMessageExecution'; -import type { EventMessageGeneric } from './EventMessageGeneric'; -import type { EventMessageNode } from './EventMessageNode'; -import type { EventMessageWorkflow } from './EventMessageWorkflow'; +import type { EventMessageAiNode } from './event-message-ai-node'; +import type { EventMessageAudit } from './event-message-audit'; +import type { EventMessageExecution } from './event-message-execution'; +import type { EventMessageGeneric } from './event-message-generic'; +import type { EventMessageNode } from './event-message-node'; +import type { EventMessageWorkflow } from './event-message-workflow'; import { eventNamesAiNodes, type EventNamesAiNodesType } from 'n8n-workflow'; export const eventNamesWorkflow = [ diff --git a/packages/cli/src/eventbus/eventBus.controller.ts b/packages/cli/src/eventbus/eventBus.controller.ts index 419c4055aa264..d9922b482e80f 100644 --- a/packages/cli/src/eventbus/eventBus.controller.ts +++ b/packages/cli/src/eventbus/eventBus.controller.ts @@ -1,4 +1,4 @@ -import { eventNamesAll } from './EventMessageClasses'; +import { eventNamesAll } from './event-message-classes'; import express from 'express'; import type { MessageEventBusDestinationWebhookOptions, @@ -10,17 +10,17 @@ import { RestController, Get, Post, Delete, GlobalScope, Licensed } from '@/deco import { AuthenticatedRequest } from '@/requests'; import { BadRequestError } from '@/errors/response-errors/bad-request.error'; -import { MessageEventBus } from './MessageEventBus/MessageEventBus'; +import { MessageEventBus } from './message-event-bus/message-event-bus'; import { isMessageEventBusDestinationSentryOptions, MessageEventBusDestinationSentry, -} from './MessageEventBusDestination/MessageEventBusDestinationSentry.ee'; +} from './message-event-bus-destination/message-event-bus-destination-sentry.ee'; import { isMessageEventBusDestinationSyslogOptions, MessageEventBusDestinationSyslog, -} from './MessageEventBusDestination/MessageEventBusDestinationSyslog.ee'; -import { MessageEventBusDestinationWebhook } from './MessageEventBusDestination/MessageEventBusDestinationWebhook.ee'; -import type { MessageEventBusDestination } from './MessageEventBusDestination/MessageEventBusDestination.ee'; +} from './message-event-bus-destination/message-event-bus-destination-syslog.ee'; +import { MessageEventBusDestinationWebhook } from './message-event-bus-destination/message-event-bus-destination-webhook.ee'; +import type { MessageEventBusDestination } from './message-event-bus-destination/message-event-bus-destination.ee'; const isWithIdString = (candidate: unknown): candidate is { id: string } => { const o = candidate as { id: string }; diff --git a/packages/cli/src/eventbus/index.ts b/packages/cli/src/eventbus/index.ts index fd3658c0a4a13..8f73005ba5d65 100644 --- a/packages/cli/src/eventbus/index.ts +++ b/packages/cli/src/eventbus/index.ts @@ -1,2 +1,2 @@ -export { EventMessageTypes } from './EventMessageClasses'; -export { EventPayloadWorkflow } from './EventMessageClasses/EventMessageWorkflow'; +export { EventMessageTypes } from './event-message-classes'; +export { EventPayloadWorkflow } from './event-message-classes/event-message-workflow'; diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationFromDb.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-from-db.ts similarity index 69% rename from packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationFromDb.ts rename to packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-from-db.ts index 886d1e35dd9ba..ebc5ec7a4bc08 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationFromDb.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-from-db.ts @@ -1,10 +1,10 @@ import { MessageEventBusDestinationTypeNames } from 'n8n-workflow'; import type { EventDestinations } from '@db/entities/EventDestinations'; -import type { MessageEventBus } from '../MessageEventBus/MessageEventBus'; -import type { MessageEventBusDestination } from './MessageEventBusDestination.ee'; -import { MessageEventBusDestinationSentry } from './MessageEventBusDestinationSentry.ee'; -import { MessageEventBusDestinationSyslog } from './MessageEventBusDestinationSyslog.ee'; -import { MessageEventBusDestinationWebhook } from './MessageEventBusDestinationWebhook.ee'; +import type { MessageEventBus } from '../message-event-bus/message-event-bus'; +import type { MessageEventBusDestination } from './message-event-bus-destination.ee'; +import { MessageEventBusDestinationSentry } from './message-event-bus-destination-sentry.ee'; +import { MessageEventBusDestinationSyslog } from './message-event-bus-destination-syslog.ee'; +import { MessageEventBusDestinationWebhook } from './message-event-bus-destination-webhook.ee'; import { Container } from 'typedi'; import { Logger } from '@/logger'; diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-sentry.ee.ts similarity index 92% rename from packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts rename to packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-sentry.ee.ts index 25633c3ac628a..d376d116102cf 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-sentry.ee.ts @@ -1,15 +1,15 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -import { MessageEventBusDestination } from './MessageEventBusDestination.ee'; +import { MessageEventBusDestination } from './message-event-bus-destination.ee'; import * as Sentry from '@sentry/node'; import { MessageEventBusDestinationTypeNames } from 'n8n-workflow'; import type { MessageEventBusDestinationOptions, MessageEventBusDestinationSentryOptions, } from 'n8n-workflow'; -import { eventMessageGenericDestinationTestEvent } from '../EventMessageClasses/EventMessageGeneric'; +import { eventMessageGenericDestinationTestEvent } from '../event-message-classes/event-message-generic'; import { N8N_VERSION } from '@/constants'; -import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus'; +import type { MessageEventBus, MessageWithCallback } from '../message-event-bus/message-event-bus'; export const isMessageEventBusDestinationSentryOptions = ( candidate: unknown, diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee.ts similarity index 93% rename from packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts rename to packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee.ts index 8d9b7438293e3..a16718086d1b2 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee.ts @@ -6,9 +6,9 @@ import type { MessageEventBusDestinationSyslogOptions, } from 'n8n-workflow'; import { MessageEventBusDestinationTypeNames } from 'n8n-workflow'; -import { MessageEventBusDestination } from './MessageEventBusDestination.ee'; -import { eventMessageGenericDestinationTestEvent } from '../EventMessageClasses/EventMessageGeneric'; -import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus'; +import { MessageEventBusDestination } from './message-event-bus-destination.ee'; +import { eventMessageGenericDestinationTestEvent } from '../event-message-classes/event-message-generic'; +import type { MessageEventBus, MessageWithCallback } from '../message-event-bus/message-event-bus'; import Container from 'typedi'; import { Logger } from '@/logger'; export const isMessageEventBusDestinationSyslogOptions = ( diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationWebhook.ee.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee.ts similarity index 97% rename from packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationWebhook.ee.ts rename to packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee.ts index 552185495254c..01cffac93ae2a 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestinationWebhook.ee.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ -import { MessageEventBusDestination } from './MessageEventBusDestination.ee'; +import { MessageEventBusDestination } from './message-event-bus-destination.ee'; import axios from 'axios'; import type { AxiosRequestConfig, Method } from 'axios'; import { jsonParse, MessageEventBusDestinationTypeNames } from 'n8n-workflow'; @@ -13,8 +13,8 @@ import type { } from 'n8n-workflow'; import { CredentialsHelper } from '@/credentials-helper'; import { Agent as HTTPSAgent } from 'https'; -import { eventMessageGenericDestinationTestEvent } from '../EventMessageClasses/EventMessageGeneric'; -import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus'; +import { eventMessageGenericDestinationTestEvent } from '../event-message-classes/event-message-generic'; +import type { MessageEventBus, MessageWithCallback } from '../message-event-bus/message-event-bus'; import * as SecretsHelpers from '@/external-secrets/external-secrets-helper.ee'; import Container from 'typedi'; diff --git a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestination.ee.ts b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination.ee.ts similarity index 91% rename from packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestination.ee.ts rename to packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination.ee.ts index 3cd86f4368aff..1b9085e9d007a 100644 --- a/packages/cli/src/eventbus/MessageEventBusDestination/MessageEventBusDestination.ee.ts +++ b/packages/cli/src/eventbus/message-event-bus-destination/message-event-bus-destination.ee.ts @@ -3,10 +3,10 @@ import { Container } from 'typedi'; import type { INodeCredentials, MessageEventBusDestinationOptions } from 'n8n-workflow'; import { MessageEventBusDestinationTypeNames } from 'n8n-workflow'; import { Logger } from '@/logger'; -import type { AbstractEventMessage } from '../EventMessageClasses/AbstractEventMessage'; -import type { EventMessageTypes } from '../EventMessageClasses'; -import type { EventMessageConfirmSource } from '../EventMessageClasses/EventMessageConfirm'; -import type { MessageEventBus, MessageWithCallback } from '../MessageEventBus/MessageEventBus'; +import type { AbstractEventMessage } from '../event-message-classes/abstract-event-message'; +import type { EventMessageTypes } from '../event-message-classes'; +import type { EventMessageConfirmSource } from '../event-message-classes/event-message-confirm'; +import type { MessageEventBus, MessageWithCallback } from '../message-event-bus/message-event-bus'; import { EventDestinationsRepository } from '@db/repositories/eventDestinations.repository'; import { License } from '@/license'; diff --git a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriterWorker.ts b/packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer-worker.ts similarity index 97% rename from packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriterWorker.ts rename to packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer-worker.ts index 69d2e8ce26f73..308d4508c1c5c 100644 --- a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriterWorker.ts +++ b/packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer-worker.ts @@ -1,7 +1,7 @@ import { appendFileSync, existsSync, rmSync, renameSync, openSync, closeSync } from 'fs'; import { stat } from 'fs/promises'; import { isMainThread, parentPort } from 'worker_threads'; -import type { MessageEventBusLogWriterOptions } from './MessageEventBusLogWriter'; +import type { MessageEventBusLogWriterOptions } from './message-event-bus-log-writer'; let logFileBasePath = ''; let loggingPaused = true; diff --git a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts b/packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer.ts similarity index 89% rename from packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts rename to packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer.ts index 617dacd2830ce..fd6eb1db38598 100644 --- a/packages/cli/src/eventbus/MessageEventBusWriter/MessageEventBusLogWriter.ts +++ b/packages/cli/src/eventbus/message-event-bus-writer/message-event-bus-log-writer.ts @@ -1,29 +1,29 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ -import { isEventMessageOptions } from '../EventMessageClasses/AbstractEventMessage'; +import { isEventMessageOptions } from '../event-message-classes/abstract-event-message'; import { InstanceSettings } from 'n8n-core'; import path, { parse } from 'path'; import { Worker } from 'worker_threads'; import { createReadStream, existsSync, rmSync } from 'fs'; import readline from 'readline'; import remove from 'lodash/remove'; -import type { EventMessageGenericOptions } from '../EventMessageClasses/EventMessageGeneric'; -import { EventMessageGeneric } from '../EventMessageClasses/EventMessageGeneric'; -import type { AbstractEventMessageOptions } from '../EventMessageClasses/AbstractEventMessageOptions'; -import type { EventMessageWorkflowOptions } from '../EventMessageClasses/EventMessageWorkflow'; -import { EventMessageWorkflow } from '../EventMessageClasses/EventMessageWorkflow'; +import type { EventMessageGenericOptions } from '../event-message-classes/event-message-generic'; +import { EventMessageGeneric } from '../event-message-classes/event-message-generic'; +import type { AbstractEventMessageOptions } from '../event-message-classes/abstract-event-message-options'; +import type { EventMessageWorkflowOptions } from '../event-message-classes/event-message-workflow'; +import { EventMessageWorkflow } from '../event-message-classes/event-message-workflow'; import { EventMessageTypeNames, jsonParse } from 'n8n-workflow'; -import type { EventMessageAuditOptions } from '../EventMessageClasses/EventMessageAudit'; -import { EventMessageAudit } from '../EventMessageClasses/EventMessageAudit'; -import type { EventMessageNodeOptions } from '../EventMessageClasses/EventMessageNode'; -import { EventMessageNode } from '../EventMessageClasses/EventMessageNode'; -import type { EventMessageReturnMode } from '../MessageEventBus/MessageEventBus'; -import type { EventMessageTypes } from '../EventMessageClasses'; -import type { EventMessageConfirmSource } from '../EventMessageClasses/EventMessageConfirm'; +import type { EventMessageAuditOptions } from '../event-message-classes/event-message-audit'; +import { EventMessageAudit } from '../event-message-classes/event-message-audit'; +import type { EventMessageNodeOptions } from '../event-message-classes/event-message-node'; +import { EventMessageNode } from '../event-message-classes/event-message-node'; +import type { EventMessageReturnMode } from '../message-event-bus/message-event-bus'; +import type { EventMessageTypes } from '../event-message-classes'; +import type { EventMessageConfirmSource } from '../event-message-classes/event-message-confirm'; import { EventMessageConfirm, isEventMessageConfirm, -} from '../EventMessageClasses/EventMessageConfirm'; +} from '../event-message-classes/event-message-confirm'; import { once as eventOnce } from 'events'; import { inTest } from '@/constants'; import { Logger } from '@/logger'; @@ -139,9 +139,10 @@ export class MessageEventBusLogWriter { const parsedName = parse(__filename); let workerFileName; if (inTest) { - workerFileName = './dist/eventbus/MessageEventBusWriter/MessageEventBusLogWriterWorker.js'; + workerFileName = + './dist/eventbus/message-event-bus-writer/message-event-bus-log-writer-worker.js'; } else { - workerFileName = path.join(parsedName.dir, `${parsedName.name}Worker${parsedName.ext}`); + workerFileName = path.join(parsedName.dir, `${parsedName.name}-worker${parsedName.ext}`); } this._worker = new Worker(workerFileName); if (this.worker) { diff --git a/packages/cli/src/eventbus/MessageEventBus/MessageEventBus.ts b/packages/cli/src/eventbus/message-event-bus/message-event-bus.ts similarity index 91% rename from packages/cli/src/eventbus/MessageEventBus/MessageEventBus.ts rename to packages/cli/src/eventbus/message-event-bus/message-event-bus.ts index 38ec4e8dc72c7..47d4d327d46f4 100644 --- a/packages/cli/src/eventbus/MessageEventBus/MessageEventBus.ts +++ b/packages/cli/src/eventbus/message-event-bus/message-event-bus.ts @@ -14,29 +14,29 @@ import { WorkflowRepository } from '@db/repositories/workflow.repository'; import { OrchestrationService } from '@/services/orchestration.service'; import { Logger } from '@/logger'; -import type { EventMessageTypes } from '../EventMessageClasses/'; -import type { MessageEventBusDestination } from '../MessageEventBusDestination/MessageEventBusDestination.ee'; -import { MessageEventBusLogWriter } from '../MessageEventBusWriter/MessageEventBusLogWriter'; -import { messageEventBusDestinationFromDb } from '../MessageEventBusDestination/MessageEventBusDestinationFromDb'; -import type { EventMessageConfirmSource } from '../EventMessageClasses/EventMessageConfirm'; -import type { EventMessageAuditOptions } from '../EventMessageClasses/EventMessageAudit'; -import { EventMessageAudit } from '../EventMessageClasses/EventMessageAudit'; -import type { EventMessageWorkflowOptions } from '../EventMessageClasses/EventMessageWorkflow'; -import { EventMessageWorkflow } from '../EventMessageClasses/EventMessageWorkflow'; -import type { EventMessageNodeOptions } from '../EventMessageClasses/EventMessageNode'; -import { EventMessageNode } from '../EventMessageClasses/EventMessageNode'; +import type { EventMessageTypes } from '../event-message-classes/'; +import type { MessageEventBusDestination } from '../message-event-bus-destination/message-event-bus-destination.ee'; +import { MessageEventBusLogWriter } from '../message-event-bus-writer/message-event-bus-log-writer'; +import { messageEventBusDestinationFromDb } from '../message-event-bus-destination/message-event-bus-destination-from-db'; +import type { EventMessageConfirmSource } from '../event-message-classes/event-message-confirm'; +import type { EventMessageAuditOptions } from '../event-message-classes/event-message-audit'; +import { EventMessageAudit } from '../event-message-classes/event-message-audit'; +import type { EventMessageWorkflowOptions } from '../event-message-classes/event-message-workflow'; +import { EventMessageWorkflow } from '../event-message-classes/event-message-workflow'; +import type { EventMessageNodeOptions } from '../event-message-classes/event-message-node'; +import { EventMessageNode } from '../event-message-classes/event-message-node'; import { EventMessageGeneric, eventMessageGenericDestinationTestEvent, -} from '../EventMessageClasses/EventMessageGeneric'; +} from '../event-message-classes/event-message-generic'; import { ExecutionRecoveryService } from '../../executions/execution-recovery.service'; import { EventMessageAiNode, type EventMessageAiNodeOptions, -} from '../EventMessageClasses/EventMessageAiNode'; +} from '../event-message-classes/event-message-ai-node'; import { License } from '@/license'; -import type { EventMessageExecutionOptions } from '../EventMessageClasses/EventMessageExecution'; -import { EventMessageExecution } from '../EventMessageClasses/EventMessageExecution'; +import type { EventMessageExecutionOptions } from '../event-message-classes/event-message-execution'; +import { EventMessageExecution } from '../event-message-classes/event-message-execution'; import { GlobalConfig } from '@n8n/config'; export type EventMessageReturnMode = 'sent' | 'unsent' | 'all' | 'unfinished'; diff --git a/packages/cli/src/events/__tests__/log-streaming-event-relay.test.ts b/packages/cli/src/events/__tests__/log-streaming-event-relay.test.ts index 720e2d494c332..3a30738e63bc3 100644 --- a/packages/cli/src/events/__tests__/log-streaming-event-relay.test.ts +++ b/packages/cli/src/events/__tests__/log-streaming-event-relay.test.ts @@ -3,7 +3,7 @@ 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 { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import type { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import type { RelayEventMap } from '@/events/relay-event-map'; describe('LogStreamingEventRelay', () => { diff --git a/packages/cli/src/events/log-streaming-event-relay.ts b/packages/cli/src/events/log-streaming-event-relay.ts index 2012775d91977..db704128eace2 100644 --- a/packages/cli/src/events/log-streaming-event-relay.ts +++ b/packages/cli/src/events/log-streaming-event-relay.ts @@ -1,5 +1,5 @@ import { Service } from 'typedi'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { Redactable } from '@/decorators/redactable'; import { EventRelay } from '@/events/event-relay'; import type { RelayEventMap } from '@/events/relay-event-map'; diff --git a/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts b/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts index f72c81a3cad53..a6e8a01aaa262 100644 --- a/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts +++ b/packages/cli/src/executions/__tests__/execution-recovery.service.test.ts @@ -15,11 +15,11 @@ import { Push } from '@/push'; import { ARTIFICIAL_TASK_DATA } from '@/constants'; import { NodeCrashedError } from '@/errors/node-crashed.error'; import { WorkflowCrashedError } from '@/errors/workflow-crashed.error'; -import { EventMessageNode } from '@/eventbus/EventMessageClasses/EventMessageNode'; +import { EventMessageNode } from '@/eventbus/event-message-classes/event-message-node'; import { IN_PROGRESS_EXECUTION_DATA, OOM_WORKFLOW } from './constants'; import { setupMessages } from './utils'; -import type { EventMessageTypes as EventMessage } from '@/eventbus/EventMessageClasses'; +import type { EventMessageTypes as EventMessage } from '@/eventbus/event-message-classes'; describe('ExecutionRecoveryService', () => { const push = mockInstance(Push); diff --git a/packages/cli/src/executions/__tests__/execution.service.test.ts b/packages/cli/src/executions/__tests__/execution.service.test.ts index 99370c1e1b77e..dfdb4099bd90e 100644 --- a/packages/cli/src/executions/__tests__/execution.service.test.ts +++ b/packages/cli/src/executions/__tests__/execution.service.test.ts @@ -11,7 +11,7 @@ import type { WaitTracker } from '@/wait-tracker'; import type { ExecutionRepository } from '@/databases/repositories/execution.repository'; import type { ExecutionRequest } from '@/executions/execution.types'; import type { ConcurrencyControlService } from '@/concurrency/concurrency-control.service'; -import type { Job } from '@/scaling/types'; +import type { Job } from '@/scaling/scaling.types'; import { mockInstance } from '@test/mocking'; describe('ExecutionService', () => { diff --git a/packages/cli/src/executions/__tests__/utils.ts b/packages/cli/src/executions/__tests__/utils.ts index 6ffb9109ecb40..7c5ee85b3e5d8 100644 --- a/packages/cli/src/executions/__tests__/utils.ts +++ b/packages/cli/src/executions/__tests__/utils.ts @@ -1,6 +1,6 @@ -import type { EventMessageTypes as EventMessage } from '@/eventbus/EventMessageClasses'; -import { EventMessageNode } from '@/eventbus/EventMessageClasses/EventMessageNode'; -import { EventMessageWorkflow } from '@/eventbus/EventMessageClasses/EventMessageWorkflow'; +import type { EventMessageTypes as EventMessage } from '@/eventbus/event-message-classes'; +import { EventMessageNode } from '@/eventbus/event-message-classes/event-message-node'; +import { EventMessageWorkflow } from '@/eventbus/event-message-classes/event-message-workflow'; export const setupMessages = (executionId: string, workflowName: string): EventMessage[] => { return [ diff --git a/packages/cli/src/executions/execution-recovery.service.ts b/packages/cli/src/executions/execution-recovery.service.ts index ffe4e04a4513d..1c8fe7d639035 100644 --- a/packages/cli/src/executions/execution-recovery.service.ts +++ b/packages/cli/src/executions/execution-recovery.service.ts @@ -6,7 +6,7 @@ import { getWorkflowHooksMain } from '@/workflow-execute-additional-data'; // @T import type { DateTime } from 'luxon'; import type { IRun, ITaskData } from 'n8n-workflow'; import { InstanceSettings } from 'n8n-core'; -import type { EventMessageTypes } from '../eventbus/EventMessageClasses'; +import type { EventMessageTypes } from '../eventbus/event-message-classes'; import type { IExecutionResponse } from '@/Interfaces'; import { NodeCrashedError } from '@/errors/node-crashed.error'; import { WorkflowCrashedError } from '@/errors/workflow-crashed.error'; diff --git a/packages/cli/src/internal-hooks.ts b/packages/cli/src/internal-hooks.ts index b3d45b67c0acd..378a01ecaa9ba 100644 --- a/packages/cli/src/internal-hooks.ts +++ b/packages/cli/src/internal-hooks.ts @@ -1,6 +1,6 @@ import { Service } from 'typedi'; import { Telemetry } from '@/telemetry'; -import { MessageEventBus } from './eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from './eventbus/message-event-bus/message-event-bus'; /** * @deprecated Do not add to this class. It will be removed once we remove diff --git a/packages/cli/src/metrics/__tests__/prometheus-metrics.service.test.ts b/packages/cli/src/metrics/__tests__/prometheus-metrics.service.test.ts index 219170ac085a8..91f99f91b041a 100644 --- a/packages/cli/src/metrics/__tests__/prometheus-metrics.service.test.ts +++ b/packages/cli/src/metrics/__tests__/prometheus-metrics.service.test.ts @@ -4,7 +4,7 @@ import promBundle from 'express-prom-bundle'; import { mock } from 'jest-mock-extended'; import { PrometheusMetricsService } from '../prometheus-metrics.service'; import type express from 'express'; -import type { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import type { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { mockInstance } from '@test/mocking'; import { GlobalConfig } from '@n8n/config'; diff --git a/packages/cli/src/metrics/prometheus-metrics.service.ts b/packages/cli/src/metrics/prometheus-metrics.service.ts index 1444f6f694bbd..32522808fc243 100644 --- a/packages/cli/src/metrics/prometheus-metrics.service.ts +++ b/packages/cli/src/metrics/prometheus-metrics.service.ts @@ -6,7 +6,7 @@ import semverParse from 'semver/functions/parse'; import { Service } from 'typedi'; import { CacheService } from '@/services/cache/cache.service'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { EventMessageTypeNames } from 'n8n-workflow'; import type { EventMessageTypes } from '@/eventbus'; import type { Includes, MetricCategory, MetricLabel } from './types'; diff --git a/packages/cli/src/scaling/__tests__/scaling.service.test.ts b/packages/cli/src/scaling/__tests__/scaling.service.test.ts index adbf5ebde2f0e..f87d02b33d0d4 100644 --- a/packages/cli/src/scaling/__tests__/scaling.service.test.ts +++ b/packages/cli/src/scaling/__tests__/scaling.service.test.ts @@ -3,7 +3,7 @@ import { ScalingService } from '../scaling.service'; import { JOB_TYPE_NAME, QUEUE_NAME } from '../constants'; import config from '@/config'; import * as BullModule from 'bull'; -import type { Job, JobData, JobOptions, JobQueue } from '../types'; +import type { Job, JobData, JobOptions, JobQueue } from '../scaling.types'; import { ApplicationError } from 'n8n-workflow'; import { mockInstance } from '@test/mocking'; import { GlobalConfig } from '@n8n/config'; @@ -22,6 +22,8 @@ jest.mock('bull', () => ({ })); describe('ScalingService', () => { + const Bull = jest.mocked(BullModule.default); + const globalConfig = mockInstance(GlobalConfig, { queue: { bull: { @@ -40,11 +42,29 @@ describe('ScalingService', () => { const instanceSettings = Container.get(InstanceSettings); const orchestrationService = mock({ isMultiMainSetupEnabled: false }); const jobProcessor = mock(); + let scalingService: ScalingService; + let registerMainListenersSpy: jest.SpyInstance; + let registerWorkerListenersSpy: jest.SpyInstance; + let scheduleQueueRecoverySpy: jest.SpyInstance; + let stopQueueRecoverySpy: jest.SpyInstance; + let getRunningJobsCountSpy: jest.SpyInstance; + + const bullConstructorArgs = [ + QUEUE_NAME, + { + prefix: globalConfig.queue.bull.prefix, + settings: globalConfig.queue.bull.settings, + createClient: expect.any(Function), + }, + ]; + beforeEach(() => { jest.clearAllMocks(); config.set('generic.instanceType', 'main'); + instanceSettings.markAsLeader(); + scalingService = new ScalingService( mock(), mock(), @@ -54,98 +74,93 @@ describe('ScalingService', () => { instanceSettings, orchestrationService, ); - }); - afterEach(() => { - scalingService.stopQueueRecovery(); + getRunningJobsCountSpy = jest.spyOn(scalingService, 'getRunningJobsCount'); + + // @ts-expect-error Private method + ScalingService.prototype.scheduleQueueRecovery = jest.fn(); + // @ts-expect-error Private method + registerMainListenersSpy = jest.spyOn(scalingService, 'registerMainListeners'); + // @ts-expect-error Private method + registerWorkerListenersSpy = jest.spyOn(scalingService, 'registerWorkerListeners'); + // @ts-expect-error Private method + scheduleQueueRecoverySpy = jest.spyOn(scalingService, 'scheduleQueueRecovery'); + // @ts-expect-error Private method + stopQueueRecoverySpy = jest.spyOn(scalingService, 'stopQueueRecovery'); }); describe('setupQueue', () => { - it('should set up the queue', async () => { - /** - * Arrange - */ - const { prefix, settings } = globalConfig.queue.bull; - const Bull = jest.mocked(BullModule.default); - - /** - * Act - */ - await scalingService.setupQueue(); + describe('if leader main', () => { + it('should set up queue + listeners + queue recovery', async () => { + await scalingService.setupQueue(); + + expect(Bull).toHaveBeenCalledWith(...bullConstructorArgs); + expect(registerMainListenersSpy).toHaveBeenCalled(); + expect(registerWorkerListenersSpy).not.toHaveBeenCalled(); + expect(scheduleQueueRecoverySpy).toHaveBeenCalled(); + }); + }); + + describe('if follower main', () => { + it('should set up queue + listeners', async () => { + instanceSettings.markAsFollower(); + + await scalingService.setupQueue(); + + expect(Bull).toHaveBeenCalledWith(...bullConstructorArgs); + expect(registerMainListenersSpy).toHaveBeenCalled(); + expect(registerWorkerListenersSpy).not.toHaveBeenCalled(); + expect(scheduleQueueRecoverySpy).not.toHaveBeenCalled(); + }); + }); + + describe('if worker', () => { + it('should set up queue + listeners', async () => { + // @ts-expect-error Private field + scalingService.instanceType = 'worker'; - /** - * Assert - */ - expect(Bull).toHaveBeenCalledWith(QUEUE_NAME, { - prefix, - settings, - createClient: expect.any(Function), + await scalingService.setupQueue(); + + expect(Bull).toHaveBeenCalledWith(...bullConstructorArgs); + expect(registerWorkerListenersSpy).toHaveBeenCalled(); + expect(registerMainListenersSpy).not.toHaveBeenCalled(); }); - expect(queue.on).toHaveBeenCalledWith('global:progress', expect.any(Function)); - expect(queue.on).toHaveBeenCalledWith('error', expect.any(Function)); }); }); describe('setupWorker', () => { it('should set up a worker with concurrency', async () => { - /** - * Arrange - */ - config.set('generic.instanceType', 'worker'); - const scalingService = new ScalingService( - mock(), - mock(), - mock(), - globalConfig, - mock(), - instanceSettings, - orchestrationService, - ); + // @ts-expect-error Private field + scalingService.instanceType = 'worker'; await scalingService.setupQueue(); const concurrency = 5; - /** - * Act - */ scalingService.setupWorker(concurrency); - /** - * Assert - */ expect(queue.process).toHaveBeenCalledWith(JOB_TYPE_NAME, concurrency, expect.any(Function)); }); it('should throw if called on a non-worker instance', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); - /** - * Act and Assert - */ + expect(() => scalingService.setupWorker(5)).toThrow(); + }); + + it('should throw if called before queue is ready', async () => { + // @ts-expect-error Private field + scalingService.instanceType = 'worker'; + expect(() => scalingService.setupWorker(5)).toThrow(); }); }); describe('stop', () => { - it('should pause the queue, check for running jobs, and stop queue recovery', async () => { - /** - * Arrange - */ + it('should pause queue, wait for running jobs, stop queue recovery', async () => { await scalingService.setupQueue(); jobProcessor.getRunningJobIds.mockReturnValue([]); - const stopQueueRecoverySpy = jest.spyOn(scalingService, 'stopQueueRecovery'); - const getRunningJobsCountSpy = jest.spyOn(scalingService, 'getRunningJobsCount'); - /** - * Act - */ await scalingService.stop(); - /** - * Assert - */ expect(queue.pause).toHaveBeenCalledWith(true, true); expect(stopQueueRecoverySpy).toHaveBeenCalled(); expect(getRunningJobsCountSpy).toHaveBeenCalled(); @@ -154,62 +169,35 @@ describe('ScalingService', () => { describe('pingQueue', () => { it('should ping the queue', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); - /** - * Act - */ await scalingService.pingQueue(); - /** - * Assert - */ expect(queue.client.ping).toHaveBeenCalled(); }); }); describe('addJob', () => { it('should add a job', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); queue.add.mockResolvedValue(mock({ id: '456' })); - /** - * Act - */ const jobData = mock({ executionId: '123' }); const jobOptions = mock(); await scalingService.addJob(jobData, jobOptions); - /** - * Assert - */ expect(queue.add).toHaveBeenCalledWith(JOB_TYPE_NAME, jobData, jobOptions); }); }); describe('getJob', () => { it('should get a job', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); const jobId = '123'; queue.getJob.mockResolvedValue(mock({ id: jobId })); - /** - * Act - */ const job = await scalingService.getJob(jobId); - /** - * Assert - */ expect(queue.getJob).toHaveBeenCalledWith(jobId); expect(job?.id).toBe(jobId); }); @@ -217,88 +205,49 @@ describe('ScalingService', () => { describe('findJobsByStatus', () => { it('should find jobs by status', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); queue.getJobs.mockResolvedValue([mock({ id: '123' })]); - /** - * Act - */ const jobs = await scalingService.findJobsByStatus(['active']); - /** - * Assert - */ expect(queue.getJobs).toHaveBeenCalledWith(['active']); expect(jobs).toHaveLength(1); expect(jobs.at(0)?.id).toBe('123'); }); it('should filter out `null` in Redis response', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); // @ts-expect-error - Untyped but possible Redis response queue.getJobs.mockResolvedValue([mock(), null]); - /** - * Act - */ const jobs = await scalingService.findJobsByStatus(['waiting']); - /** - * Assert - */ expect(jobs).toHaveLength(1); }); }); describe('stopJob', () => { it('should stop an active job', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); const job = mock({ isActive: jest.fn().mockResolvedValue(true) }); - /** - * Act - */ const result = await scalingService.stopJob(job); - /** - * Assert - */ expect(job.progress).toHaveBeenCalledWith({ kind: 'abort-job' }); expect(result).toBe(true); }); it('should stop an inactive job', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); const job = mock({ isActive: jest.fn().mockResolvedValue(false) }); - /** - * Act - */ const result = await scalingService.stopJob(job); - /** - * Assert - */ expect(job.remove).toHaveBeenCalled(); expect(result).toBe(true); }); it('should report failure to stop a job', async () => { - /** - * Arrange - */ await scalingService.setupQueue(); const job = mock({ isActive: jest.fn().mockImplementation(() => { @@ -306,53 +255,9 @@ describe('ScalingService', () => { }), }); - /** - * Act - */ const result = await scalingService.stopJob(job); - /** - * Assert - */ expect(result).toBe(false); }); }); - - describe('scheduleQueueRecovery', () => { - it('if leader, should schedule queue recovery', async () => { - /** - * Arrange - */ - const scheduleSpy = jest.spyOn(scalingService, 'scheduleQueueRecovery'); - instanceSettings.markAsLeader(); - - /** - * Act - */ - await scalingService.setupQueue(); - - /** - * Assert - */ - expect(scheduleSpy).toHaveBeenCalled(); - }); - - it('if follower, should not schedule queue recovery', async () => { - /** - * Arrange - */ - const scheduleSpy = jest.spyOn(scalingService, 'scheduleQueueRecovery'); - instanceSettings.markAsFollower(); - - /** - * Act - */ - await scalingService.setupQueue(); - - /** - * Assert - */ - expect(scheduleSpy).not.toHaveBeenCalled(); - }); - }); }); diff --git a/packages/cli/src/scaling/job-processor.ts b/packages/cli/src/scaling/job-processor.ts index 8618424e3562c..7804a6d6c85fe 100644 --- a/packages/cli/src/scaling/job-processor.ts +++ b/packages/cli/src/scaling/job-processor.ts @@ -8,7 +8,7 @@ import { WorkflowRepository } from '@/databases/repositories/workflow.repository import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data'; import { NodeTypes } from '@/node-types'; import type { ExecutionStatus, IExecuteResponsePromiseData, IRun } from 'n8n-workflow'; -import type { Job, JobId, JobResult, RunningJob, RunningJobSummary } from './types'; +import type { Job, JobId, JobResult, RunningJob, RunningJobSummary } from './scaling.types'; import type PCancelable from 'p-cancelable'; /** diff --git a/packages/cli/src/scaling/scaling.service.ts b/packages/cli/src/scaling/scaling.service.ts index 4dbdce1aac837..37436cdb4361e 100644 --- a/packages/cli/src/scaling/scaling.service.ts +++ b/packages/cli/src/scaling/scaling.service.ts @@ -13,11 +13,11 @@ import type { Job, JobData, JobOptions, - JobMessage, JobStatus, JobId, QueueRecoveryContext, -} from './types'; + PubSubMessage, +} from './scaling.types'; import type { IExecuteResponsePromiseData } from 'n8n-workflow'; import { GlobalConfig } from '@n8n/config'; import { ExecutionRepository } from '@/databases/repositories/execution.repository'; @@ -71,6 +71,7 @@ export class ScalingService { setupWorker(concurrency: number) { this.assertWorker(); + this.assertQueue(); void this.queue.process( JOB_TYPE_NAME, @@ -161,22 +162,6 @@ export class ScalingService { // #region Listeners private registerListeners() { - this.queue.on('global:progress', (_jobId: JobId, msg: JobMessage) => { - if (msg.kind === 'respond-to-webhook') { - const { executionId, response } = msg; - this.activeExecutions.resolveResponsePromise( - executionId, - this.decodeWebhookResponse(response), - ); - } - }); - - this.queue.on('global:progress', (jobId: JobId, msg: JobMessage) => { - if (msg.kind === 'abort-job') { - this.jobProcessor.stopJob(jobId); - } - }); - let latestAttemptTs = 0; let cumulativeTimeoutMs = 0; @@ -210,10 +195,28 @@ export class ScalingService { return; } - if ( - this.instanceType === 'worker' && - error.message.includes('job stalled more than maxStalledCount') - ) { + throw error; + }); + + if (this.instanceType === 'main') { + this.registerMainListeners(); + } else if (this.instanceType === 'worker') { + this.registerWorkerListeners(); + } + } + + /** + * Register listeners on a `worker` process for Bull queue events. + */ + private registerWorkerListeners() { + this.queue.on('global:progress', (jobId: JobId, msg: unknown) => { + if (!this.isPubSubMessage(msg)) return; + + if (msg.kind === 'abort-job') this.jobProcessor.stopJob(jobId); + }); + + this.queue.on('error', (error: Error) => { + if (error.message.includes('job stalled more than maxStalledCount')) { throw new MaxStalledCountError(error); } @@ -221,10 +224,7 @@ export class ScalingService { * Non-recoverable error on worker start with Redis unavailable. * Even if Redis recovers, worker will remain unable to process jobs. */ - if ( - this.instanceType === 'worker' && - error.message.includes('Error initializing Lua scripts') - ) { + if (error.message.includes('Error initializing Lua scripts')) { this.logger.error('[ScalingService] Fatal error initializing worker', { error }); this.logger.error('[ScalingService] Exiting process...'); process.exit(1); @@ -234,6 +234,24 @@ export class ScalingService { }); } + /** + * Register listeners on a `main` process for Bull queue events. + */ + private registerMainListeners() { + this.queue.on('global:progress', (_jobId: JobId, msg: unknown) => { + if (!this.isPubSubMessage(msg)) return; + + if (msg.kind === 'respond-to-webhook') { + const decodedResponse = this.decodeWebhookResponse(msg.response); + this.activeExecutions.resolveResponsePromise(msg.executionId, decodedResponse); + } + }); + } + + private isPubSubMessage(candidate: unknown): candidate is PubSubMessage { + return typeof candidate === 'object' && candidate !== null && 'kind' in candidate; + } + // #endregion private decodeWebhookResponse( @@ -252,6 +270,12 @@ export class ScalingService { return response; } + private assertQueue() { + if (this.queue) return; + + throw new ApplicationError('This method must be called after `setupQueue`'); + } + private assertWorker() { if (this.instanceType === 'worker') return; @@ -265,7 +289,7 @@ export class ScalingService { waitMs: config.getEnv('executions.queueRecovery.interval') * 60 * 1000, }; - scheduleQueueRecovery(waitMs = this.queueRecoveryContext.waitMs) { + private scheduleQueueRecovery(waitMs = this.queueRecoveryContext.waitMs) { this.queueRecoveryContext.timeout = setTimeout(async () => { try { const nextWaitMs = await this.recoverFromQueue(); @@ -285,7 +309,7 @@ export class ScalingService { this.logger.debug(`[ScalingService] Scheduled queue recovery check for next ${wait}`); } - stopQueueRecovery() { + private stopQueueRecovery() { clearTimeout(this.queueRecoveryContext.timeout); } diff --git a/packages/cli/src/scaling/types.ts b/packages/cli/src/scaling/scaling.types.ts similarity index 85% rename from packages/cli/src/scaling/types.ts rename to packages/cli/src/scaling/scaling.types.ts index b35d1d109d7c4..2599cf594bd1e 100644 --- a/packages/cli/src/scaling/types.ts +++ b/packages/cli/src/scaling/scaling.types.ts @@ -28,16 +28,19 @@ export type JobStatus = Bull.JobStatus; export type JobOptions = Bull.JobOptions; -/** Message sent by worker to queue or by queue to worker. */ -export type JobMessage = RepondToWebhookMessage | AbortJobMessage; +export type PubSubMessage = MessageToMain | MessageToWorker; -export type RepondToWebhookMessage = { +type MessageToMain = RepondToWebhookMessage; + +type MessageToWorker = AbortJobMessage; + +type RepondToWebhookMessage = { kind: 'respond-to-webhook'; executionId: string; response: IExecuteResponsePromiseData; }; -export type AbortJobMessage = { +type AbortJobMessage = { kind: 'abort-job'; }; diff --git a/packages/cli/src/server.ts b/packages/cli/src/server.ts index 30de80295ab6b..04faa431fe185 100644 --- a/packages/cli/src/server.ts +++ b/packages/cli/src/server.ts @@ -31,7 +31,7 @@ import { setupPushServer, setupPushHandler } from '@/push'; import { isLdapEnabled } from '@/ldap/helpers.ee'; import { AbstractServer } from '@/abstract-server'; import { PostHogClient } from '@/posthog'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { handleMfaDisable, isMfaFeatureEnabled } from '@/mfa/helpers'; import type { FrontendService } from '@/services/frontend.service'; import { OrchestrationService } from '@/services/orchestration.service'; @@ -155,10 +155,10 @@ export class Server extends AbstractServer { // ---------------------------------------- try { const { SourceControlService } = await import( - '@/environments/sourceControl/sourceControl.service.ee' + '@/environments/source-control/source-control.service.ee' ); await Container.get(SourceControlService).init(); - await import('@/environments/sourceControl/sourceControl.controller.ee'); + await import('@/environments/source-control/source-control.controller.ee'); await import('@/environments/variables/variables.controller.ee'); } catch (error) { this.logger.warn(`Source Control initialization failed: ${(error as Error).message}`); diff --git a/packages/cli/src/services/__tests__/orchestration.service.test.ts b/packages/cli/src/services/__tests__/orchestration.service.test.ts index 99c92ad0700e8..811643b9671ea 100644 --- a/packages/cli/src/services/__tests__/orchestration.service.test.ts +++ b/packages/cli/src/services/__tests__/orchestration.service.test.ts @@ -7,7 +7,7 @@ import type { WorkflowActivateMode } from 'n8n-workflow'; import config from '@/config'; import { OrchestrationService } from '@/services/orchestration.service'; import type { RedisServiceWorkerResponseObject } from '@/services/redis/RedisServiceCommands'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +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'; diff --git a/packages/cli/src/services/frontend.service.ts b/packages/cli/src/services/frontend.service.ts index 24f8a3505b0de..1e70c972a05ab 100644 --- a/packages/cli/src/services/frontend.service.ts +++ b/packages/cli/src/services/frontend.service.ts @@ -22,7 +22,7 @@ import { License } from '@/license'; import { getCurrentAuthenticationMethod } from '@/sso/sso-helpers'; import { getLdapLoginLabel } from '@/ldap/helpers.ee'; import { getSamlLoginLabel } from '@/sso/saml/saml-helpers'; -import { getVariablesLimit } from '@/environments/variables/environmentHelpers'; +import { getVariablesLimit } from '@/environments/variables/environment-helpers'; import { getWorkflowHistoryLicensePruneTime, getWorkflowHistoryPruneTime, diff --git a/packages/cli/src/services/orchestration/main/handleCommandMessageMain.ts b/packages/cli/src/services/orchestration/main/handleCommandMessageMain.ts index 1cdb3cf7f1cef..266304ff30929 100644 --- a/packages/cli/src/services/orchestration/main/handleCommandMessageMain.ts +++ b/packages/cli/src/services/orchestration/main/handleCommandMessageMain.ts @@ -1,7 +1,7 @@ import { Container } from 'typedi'; import { debounceMessageReceiver, messageToRedisServiceCommandObject } from '../helpers'; import config from '@/config'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee'; import { License } from '@/license'; import { Logger } from '@/logger'; diff --git a/packages/cli/src/services/orchestration/webhook/handleCommandMessageWebhook.ts b/packages/cli/src/services/orchestration/webhook/handleCommandMessageWebhook.ts index c6f746db639b1..7f01017e72b94 100644 --- a/packages/cli/src/services/orchestration/webhook/handleCommandMessageWebhook.ts +++ b/packages/cli/src/services/orchestration/webhook/handleCommandMessageWebhook.ts @@ -1,6 +1,6 @@ import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee'; import { License } from '@/license'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import Container from 'typedi'; import { Logger } from 'winston'; import { messageToRedisServiceCommandObject, debounceMessageReceiver } from '../helpers'; diff --git a/packages/cli/src/services/orchestration/worker/handleCommandMessageWorker.ts b/packages/cli/src/services/orchestration/worker/handleCommandMessageWorker.ts index 52727c37e199e..f3a991fb1681d 100644 --- a/packages/cli/src/services/orchestration/worker/handleCommandMessageWorker.ts +++ b/packages/cli/src/services/orchestration/worker/handleCommandMessageWorker.ts @@ -4,7 +4,7 @@ import type { RedisServiceCommandObject } from '@/services/redis/RedisServiceCom import { COMMAND_REDIS_CHANNEL } from '@/services/redis/RedisConstants'; import * as os from 'os'; import { License } from '@/license'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee'; import { debounceMessageReceiver, getOsCpuString } from '../helpers'; import type { WorkerCommandReceivedHandlerOptions } from './types'; diff --git a/packages/cli/src/services/orchestration/worker/types.ts b/packages/cli/src/services/orchestration/worker/types.ts index 84c515466e2c2..957a6106badf8 100644 --- a/packages/cli/src/services/orchestration/worker/types.ts +++ b/packages/cli/src/services/orchestration/worker/types.ts @@ -1,6 +1,6 @@ import type { ExecutionStatus, WorkflowExecuteMode } from 'n8n-workflow'; import type { RedisServicePubSubPublisher } from '../../redis/RedisServicePubSubPublisher'; -import type { RunningJobSummary } from '@/scaling/types'; +import type { RunningJobSummary } from '@/scaling/scaling.types'; export interface WorkerCommandReceivedHandlerOptions { queueModeId: string; diff --git a/packages/cli/src/services/redis/redis-client.service.ts b/packages/cli/src/services/redis/redis-client.service.ts index bf70d8114d37e..822392708631b 100644 --- a/packages/cli/src/services/redis/redis-client.service.ts +++ b/packages/cli/src/services/redis/redis-client.service.ts @@ -2,12 +2,10 @@ import { Service } from 'typedi'; import { Logger } from '@/logger'; import ioRedis from 'ioredis'; import type { Cluster, RedisOptions } from 'ioredis'; -import type { RedisClientType } from './redis.types'; - -import { OnShutdown } from '@/decorators/on-shutdown'; -import { LOWEST_SHUTDOWN_PRIORITY } from '@/constants'; import { GlobalConfig } from '@n8n/config'; +import type { RedisClientType } from './redis.types'; + @Service() export class RedisClientService { private readonly clients = new Set(); @@ -28,13 +26,6 @@ export class RedisClientService { return client; } - @OnShutdown(LOWEST_SHUTDOWN_PRIORITY) - disconnectClients() { - for (const client of this.clients) { - client.disconnect(); - } - } - /** * Ensure prefix is wrapped in curly braces for Redis cluster. * See: https://github.com/OptimalBits/bull/blob/develop/PATTERNS.md diff --git a/packages/cli/src/telemetry/index.ts b/packages/cli/src/telemetry/index.ts index 2aec0f07d2cfb..15ed348fa9fbd 100644 --- a/packages/cli/src/telemetry/index.ts +++ b/packages/cli/src/telemetry/index.ts @@ -11,7 +11,7 @@ import { Logger } from '@/logger'; import { License } from '@/license'; import { LOWEST_SHUTDOWN_PRIORITY, N8N_VERSION } from '@/constants'; import { WorkflowRepository } from '@db/repositories/workflow.repository'; -import { SourceControlPreferencesService } from '../environments/sourceControl/sourceControlPreferences.service.ee'; +import { SourceControlPreferencesService } from '../environments/source-control/source-control-preferences.service.ee'; import { UserRepository } from '@db/repositories/user.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository'; import { ProjectRelationRepository } from '@/databases/repositories/projectRelation.repository'; diff --git a/packages/cli/src/workflow-execute-additional-data.ts b/packages/cli/src/workflow-execute-additional-data.ts index 459c94692666d..2e0bda061eda9 100644 --- a/packages/cli/src/workflow-execute-additional-data.ts +++ b/packages/cli/src/workflow-execute-additional-data.ts @@ -69,7 +69,7 @@ import { WorkflowStaticDataService } from './workflows/workflow-static-data.serv import { WorkflowRepository } from './databases/repositories/workflow.repository'; import { UrlService } from './services/url.service'; import { WorkflowExecutionService } from './workflows/workflow-execution.service'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { EventService } from './events/event.service'; import { GlobalConfig } from '@n8n/config'; import { SubworkflowPolicyChecker } from './subworkflows/subworkflow-policy-checker.service'; diff --git a/packages/cli/src/workflow-runner.ts b/packages/cli/src/workflow-runner.ts index b8012b3d4f25a..acfbdafd0135e 100644 --- a/packages/cli/src/workflow-runner.ts +++ b/packages/cli/src/workflow-runner.ts @@ -28,7 +28,7 @@ import { ExecutionRepository } from '@db/repositories/execution.repository'; import { ExternalHooks } from '@/external-hooks'; import type { IExecutionResponse, IWorkflowExecutionDataProcess } from '@/Interfaces'; import { NodeTypes } from '@/node-types'; -import type { Job, JobData, JobResult } from '@/scaling/types'; +import type { Job, JobData, JobResult } from '@/scaling/scaling.types'; import type { ScalingService } from '@/scaling/scaling.service'; import * as WorkflowHelpers from '@/workflow-helpers'; import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data'; diff --git a/packages/cli/test/integration/commands/worker.cmd.test.ts b/packages/cli/test/integration/commands/worker.cmd.test.ts index aad419d23b177..3bfac6a07c669 100644 --- a/packages/cli/test/integration/commands/worker.cmd.test.ts +++ b/packages/cli/test/integration/commands/worker.cmd.test.ts @@ -3,7 +3,7 @@ import { BinaryDataService } from 'n8n-core'; import { Worker } from '@/commands/worker'; import config from '@/config'; import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials'; import { OrchestrationHandlerWorkerService } from '@/services/orchestration/worker/orchestration.handler.worker.service'; import { OrchestrationWorkerService } from '@/services/orchestration/worker/orchestration.worker.service'; diff --git a/packages/cli/test/integration/environments/SourceControl.test.ts b/packages/cli/test/integration/environments/SourceControl.test.ts index cac369422b772..5bb5d8089b597 100644 --- a/packages/cli/test/integration/environments/SourceControl.test.ts +++ b/packages/cli/test/integration/environments/SourceControl.test.ts @@ -2,9 +2,9 @@ import { Container } from 'typedi'; import type { User } from '@db/entities/User'; import config from '@/config'; -import { SourceControlPreferencesService } from '@/environments/sourceControl/sourceControlPreferences.service.ee'; -import { SourceControlService } from '@/environments/sourceControl/sourceControl.service.ee'; -import type { SourceControlledFile } from '@/environments/sourceControl/types/sourceControlledFile'; +import { SourceControlPreferencesService } from '@/environments/source-control/source-control-preferences.service.ee'; +import { SourceControlService } from '@/environments/source-control/source-control.service.ee'; +import type { SourceControlledFile } from '@/environments/source-control/types/source-controlled-file'; import * as utils from '../shared/utils/'; import { createUser } from '../shared/db/users'; diff --git a/packages/cli/test/integration/environments/source-control-import.service.test.ts b/packages/cli/test/integration/environments/source-control-import.service.test.ts index 4665178a3fb11..56ba90cddc1d5 100644 --- a/packages/cli/test/integration/environments/source-control-import.service.test.ts +++ b/packages/cli/test/integration/environments/source-control-import.service.test.ts @@ -7,12 +7,12 @@ import { nanoid } from 'nanoid'; import type { InstanceSettings } from 'n8n-core'; import * as testDb from '../shared/testDb'; -import { SourceControlImportService } from '@/environments/sourceControl/sourceControlImport.service.ee'; +import { SourceControlImportService } from '@/environments/source-control/source-control-import.service.ee'; import { createMember, getGlobalOwner } from '../shared/db/users'; import { SharedCredentialsRepository } from '@/databases/repositories/sharedCredentials.repository'; import { mockInstance } from '../../shared/mocking'; -import type { SourceControlledFile } from '@/environments/sourceControl/types/sourceControlledFile'; -import type { ExportableCredential } from '@/environments/sourceControl/types/exportableCredential'; +import type { SourceControlledFile } from '@/environments/source-control/types/source-controlled-file'; +import type { ExportableCredential } from '@/environments/source-control/types/exportable-credential'; import { createTeamProject, getPersonalProject } from '../shared/db/projects'; import { ProjectRepository } from '@/databases/repositories/project.repository'; import { saveCredential } from '../shared/db/credentials'; diff --git a/packages/cli/test/integration/eventbus.ee.test.ts b/packages/cli/test/integration/eventbus.ee.test.ts index f21822683b854..9146b8b87c392 100644 --- a/packages/cli/test/integration/eventbus.ee.test.ts +++ b/packages/cli/test/integration/eventbus.ee.test.ts @@ -14,13 +14,13 @@ import { } from 'n8n-workflow'; import type { User } from '@db/entities/User'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; -import { EventMessageGeneric } from '@/eventbus/EventMessageClasses/EventMessageGeneric'; -import type { MessageEventBusDestinationSyslog } from '@/eventbus/MessageEventBusDestination/MessageEventBusDestinationSyslog.ee'; -import type { MessageEventBusDestinationWebhook } from '@/eventbus/MessageEventBusDestination/MessageEventBusDestinationWebhook.ee'; -import type { MessageEventBusDestinationSentry } from '@/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee'; -import { EventMessageAudit } from '@/eventbus/EventMessageClasses/EventMessageAudit'; -import type { EventNamesTypes } from '@/eventbus/EventMessageClasses'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; +import { EventMessageGeneric } from '@/eventbus/event-message-classes/event-message-generic'; +import type { MessageEventBusDestinationSyslog } from '@/eventbus/message-event-bus-destination/message-event-bus-destination-syslog.ee'; +import type { MessageEventBusDestinationWebhook } from '@/eventbus/message-event-bus-destination/message-event-bus-destination-webhook.ee'; +import type { MessageEventBusDestinationSentry } from '@/eventbus/message-event-bus-destination/message-event-bus-destination-sentry.ee'; +import { EventMessageAudit } from '@/eventbus/event-message-classes/event-message-audit'; +import type { EventNamesTypes } from '@/eventbus/event-message-classes'; import { ExecutionRecoveryService } from '@/executions/execution-recovery.service'; import * as utils from './shared/utils'; @@ -28,7 +28,7 @@ import { createUser } from './shared/db/users'; import { mockInstance } from '../shared/mocking'; import type { SuperAgentTest } from './shared/types'; -jest.unmock('@/eventbus/MessageEventBus/MessageEventBus'); +jest.unmock('@/eventbus/message-event-bus/message-event-bus'); jest.mock('axios'); const mockedAxios = axios as jest.Mocked; jest.mock('syslog-client'); @@ -96,7 +96,7 @@ beforeAll(async () => { }); afterAll(async () => { - jest.mock('@/eventbus/MessageEventBus/MessageEventBus'); + jest.mock('@/eventbus/message-event-bus/message-event-bus'); await eventBus?.close(); }); diff --git a/packages/cli/test/integration/eventbus.test.ts b/packages/cli/test/integration/eventbus.test.ts index e4e58f96fa330..3b36222ec2cd1 100644 --- a/packages/cli/test/integration/eventbus.test.ts +++ b/packages/cli/test/integration/eventbus.test.ts @@ -1,5 +1,5 @@ import type { User } from '@db/entities/User'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { ExecutionRecoveryService } from '@/executions/execution-recovery.service'; import * as utils from './shared/utils/'; diff --git a/packages/cli/test/integration/prometheus-metrics.test.ts b/packages/cli/test/integration/prometheus-metrics.test.ts index 1eccb9b7d0ce2..f6710ba3a5ec4 100644 --- a/packages/cli/test/integration/prometheus-metrics.test.ts +++ b/packages/cli/test/integration/prometheus-metrics.test.ts @@ -7,7 +7,7 @@ import { PrometheusMetricsService } from '@/metrics/prometheus-metrics.service'; import { setupTestServer } from './shared/utils'; import { GlobalConfig } from '@n8n/config'; -jest.unmock('@/eventbus/MessageEventBus/MessageEventBus'); +jest.unmock('@/eventbus/message-event-bus/message-event-bus'); const toLines = (response: Response) => response.text.trim().split('\n'); diff --git a/packages/cli/test/integration/shared/utils/testServer.ts b/packages/cli/test/integration/shared/utils/testServer.ts index c40285829e805..b75a7804b74d8 100644 --- a/packages/cli/test/integration/shared/utils/testServer.ts +++ b/packages/cli/test/integration/shared/utils/testServer.ts @@ -179,7 +179,7 @@ export const setupTestServer = ({ break; case 'sourceControl': - await import('@/environments/sourceControl/sourceControl.controller.ee'); + await import('@/environments/source-control/source-control.controller.ee'); break; case 'community-packages': diff --git a/packages/cli/test/integration/workflows/workflow.service.test.ts b/packages/cli/test/integration/workflows/workflow.service.test.ts index 1853c17839288..084b41d212214 100644 --- a/packages/cli/test/integration/workflows/workflow.service.test.ts +++ b/packages/cli/test/integration/workflows/workflow.service.test.ts @@ -3,7 +3,7 @@ import { mock } from 'jest-mock-extended'; import { ActiveWorkflowManager } from '@/active-workflow-manager'; import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository'; import { WorkflowRepository } from '@db/repositories/workflow.repository'; -import { MessageEventBus } from '@/eventbus/MessageEventBus/MessageEventBus'; +import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'; import { Telemetry } from '@/telemetry'; import { OrchestrationService } from '@/services/orchestration.service'; import { WorkflowService } from '@/workflows/workflow.service'; diff --git a/packages/cli/test/setup-mocks.ts b/packages/cli/test/setup-mocks.ts index c6db2d147cdc8..63d60cd5224ee 100644 --- a/packages/cli/test/setup-mocks.ts +++ b/packages/cli/test/setup-mocks.ts @@ -3,5 +3,5 @@ import 'reflect-metadata'; jest.mock('@sentry/node'); jest.mock('@n8n_io/license-sdk'); jest.mock('@/telemetry'); -jest.mock('@/eventbus/MessageEventBus/MessageEventBus'); +jest.mock('@/eventbus/message-event-bus/message-event-bus'); jest.mock('@/push'); diff --git a/packages/core/src/InstanceSettings.ts b/packages/core/src/InstanceSettings.ts index f75e1df712108..fb57cbc36b7c4 100644 --- a/packages/core/src/InstanceSettings.ts +++ b/packages/core/src/InstanceSettings.ts @@ -40,8 +40,15 @@ export class InstanceSettings { readonly instanceId = this.generateInstanceId(); - /** Always `leader` in single-main setup. `leader` or `follower` in multi-main setup. */ - private instanceRole: InstanceRole = 'unset'; + /** + * A main is: + * - `unset` during bootup, + * - `leader` after bootup in single-main setup, + * - `leader` or `follower` after bootup in multi-main setup. + * + * A non-main instance type (e.g. `worker`) is always `unset`. + */ + instanceRole: InstanceRole = 'unset'; get isLeader() { return this.instanceRole === 'leader'; diff --git a/packages/design-system/src/components/N8nActionBox/ActionBox.vue b/packages/design-system/src/components/N8nActionBox/ActionBox.vue index 575895ab1585b..c048c3f6438c5 100644 --- a/packages/design-system/src/components/N8nActionBox/ActionBox.vue +++ b/packages/design-system/src/components/N8nActionBox/ActionBox.vue @@ -1,3 +1,29 @@ + + - - diff --git a/packages/editor-ui/src/components/FeatureComingSoon.vue b/packages/editor-ui/src/components/FeatureComingSoon.vue index 3dcf1e58b13df..a96b3d0ec31f8 100644 --- a/packages/editor-ui/src/components/FeatureComingSoon.vue +++ b/packages/editor-ui/src/components/FeatureComingSoon.vue @@ -1,31 +1,3 @@ - - + + diff --git a/packages/editor-ui/src/components/NodeList.vue b/packages/editor-ui/src/components/NodeList.vue index 53d710ad15932..8e93ecbe5ae49 100644 --- a/packages/editor-ui/src/components/NodeList.vue +++ b/packages/editor-ui/src/components/NodeList.vue @@ -1,17 +1,3 @@ - - + + diff --git a/packages/editor-ui/src/components/ResourceLocator/ResourceLocatorDropdown.vue b/packages/editor-ui/src/components/ResourceLocator/ResourceLocatorDropdown.vue index ddadd763f9b0e..658f2da9d59d3 100644 --- a/packages/editor-ui/src/components/ResourceLocator/ResourceLocatorDropdown.vue +++ b/packages/editor-ui/src/components/ResourceLocator/ResourceLocatorDropdown.vue @@ -1,82 +1,3 @@ - - + + diff --git a/packages/editor-ui/src/components/TemplatesInfoCarousel.vue b/packages/editor-ui/src/components/TemplatesInfoCarousel.vue index 377f6c81373a8..6810443b26d32 100644 --- a/packages/editor-ui/src/components/TemplatesInfoCarousel.vue +++ b/packages/editor-ui/src/components/TemplatesInfoCarousel.vue @@ -1,41 +1,3 @@ - - + + diff --git a/packages/editor-ui/src/components/WorkflowLMChat/WorkflowLMChat.vue b/packages/editor-ui/src/components/WorkflowLMChat/WorkflowLMChat.vue index 333a16cc3661e..9d032f5fa1bb4 100644 --- a/packages/editor-ui/src/components/WorkflowLMChat/WorkflowLMChat.vue +++ b/packages/editor-ui/src/components/WorkflowLMChat/WorkflowLMChat.vue @@ -1,80 +1,3 @@ - - + + diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainInput.spec.ts b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainInput.spec.ts new file mode 100644 index 0000000000000..78d7f073e01c2 --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainInput.spec.ts @@ -0,0 +1,21 @@ +import CanvasHandleMainInput from '@/components/canvas/elements/handles/render-types/CanvasHandleMainInput.vue'; +import { createComponentRenderer } from '@/__tests__/render'; +import { createCanvasHandleProvide } from '@/__tests__/data'; + +const renderComponent = createComponentRenderer(CanvasHandleMainInput); + +describe('CanvasHandleMainInput', () => { + it('should render correctly', async () => { + const label = 'Test Label'; + const { container, getByText } = renderComponent({ + global: { + provide: { + ...createCanvasHandleProvide({ label }), + }, + }, + }); + + expect(container.querySelector('.canvas-node-handle-main-input')).toBeInTheDocument(); + expect(getByText(label)).toBeInTheDocument(); + }); +}); diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainInput.vue b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainInput.vue new file mode 100644 index 0000000000000..f34cc077890ff --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainInput.vue @@ -0,0 +1,34 @@ + + + + diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainOutput.vue b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainOutput.vue index ba9e32ade4e40..9a37a3aff7743 100644 --- a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainOutput.vue +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleMainOutput.vue @@ -1,12 +1,25 @@ + + diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainInput.spec.ts b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainInput.spec.ts index 9e9dab81e009d..19fb1214e0fe2 100644 --- a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainInput.spec.ts +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainInput.spec.ts @@ -15,7 +15,7 @@ describe('CanvasHandleNonMainInput', () => { }, }); - expect(container.querySelector('.canvas-node-handle-non-main')).toBeInTheDocument(); + expect(container.querySelector('.canvas-node-handle-non-main-input')).toBeInTheDocument(); expect(getByText(label)).toBeInTheDocument(); }); }); diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainInput.vue b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainInput.vue index 44f9f09f980f3..384eaeecaf6ea 100644 --- a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainInput.vue +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainInput.vue @@ -2,48 +2,89 @@ import CanvasHandlePlus from '@/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.vue'; import { useCanvasNodeHandle } from '@/composables/useCanvasNodeHandle'; import { NodeConnectionType } from 'n8n-workflow'; -import { computed } from 'vue'; +import { computed, ref } from 'vue'; const emit = defineEmits<{ add: []; }>(); -const { label, connected, type } = useCanvasNodeHandle(); +const { label, isConnected, isConnecting, type } = useCanvasNodeHandle(); -const isAddButtonVisible = computed( - () => !connected.value || type.value === NodeConnectionType.AiTool, +const handleClasses = 'target'; + +const supportsMultipleConnections = computed(() => type.value === NodeConnectionType.AiTool); + +const isHandlePlusAvailable = computed( + () => !isConnected.value || supportsMultipleConnections.value, +); +const isHandlePlusVisible = computed( + () => !isConnecting.value || isHovered.value || supportsMultipleConnections.value, ); +const isHovered = ref(false); + +function onMouseEnter() { + isHovered.value = true; +} + +function onMouseLeave() { + isHovered.value = false; +} function onClickAdd() { emit('add'); } + + diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainOutput.spec.ts b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainOutput.spec.ts new file mode 100644 index 0000000000000..69094e4a904ae --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainOutput.spec.ts @@ -0,0 +1,21 @@ +import CanvasHandleNonMainOutput from '@/components/canvas/elements/handles/render-types/CanvasHandleNonMainOutput.vue'; +import { createComponentRenderer } from '@/__tests__/render'; +import { createCanvasHandleProvide } from '@/__tests__/data'; + +const renderComponent = createComponentRenderer(CanvasHandleNonMainOutput); + +describe('CanvasHandleNonMainOutput', () => { + it('should render correctly', async () => { + const label = 'Test Label'; + const { container, getByText } = renderComponent({ + global: { + provide: { + ...createCanvasHandleProvide({ label }), + }, + }, + }); + + expect(container.querySelector('.canvas-node-handle-non-main-output')).toBeInTheDocument(); + expect(getByText(label)).toBeInTheDocument(); + }); +}); diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainOutput.vue b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainOutput.vue new file mode 100644 index 0000000000000..6d62bfc23d68d --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/CanvasHandleNonMainOutput.vue @@ -0,0 +1,38 @@ + + + + diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDiamond.spec.ts b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDiamond.spec.ts new file mode 100644 index 0000000000000..cc6267034cd79 --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDiamond.spec.ts @@ -0,0 +1,21 @@ +import CanvasHandlePlus from './CanvasHandlePlus.vue'; +import { createComponentRenderer } from '@/__tests__/render'; + +const renderComponent = createComponentRenderer(CanvasHandlePlus, {}); + +describe('CanvasHandleDiamond', () => { + it('should render with default props', () => { + const { html } = renderComponent(); + + expect(html()).toMatchSnapshot(); + }); + + it('should apply `handleClasses` prop correctly', () => { + const customClass = 'custom-handle-class'; + const wrapper = renderComponent({ + props: { handleClasses: customClass }, + }); + + expect(wrapper.container.querySelector(`.${customClass}`)).toBeTruthy(); + }); +}); diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDiamond.vue b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDiamond.vue new file mode 100644 index 0000000000000..a21f8d84d2542 --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDiamond.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDot.spec.ts b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDot.spec.ts new file mode 100644 index 0000000000000..e3451c92d9be4 --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDot.spec.ts @@ -0,0 +1,21 @@ +import CanvasHandleDot from './CanvasHandleDot.vue'; +import { createComponentRenderer } from '@/__tests__/render'; + +const renderComponent = createComponentRenderer(CanvasHandleDot, {}); + +describe('CanvasHandleDot', () => { + it('should render with default props', () => { + const { html } = renderComponent(); + + expect(html()).toMatchSnapshot(); + }); + + it('should apply `handleClasses` prop correctly', () => { + const customClass = 'custom-handle-class'; + const wrapper = renderComponent({ + props: { handleClasses: customClass }, + }); + + expect(wrapper.container.querySelector(`.${customClass}`)).toBeTruthy(); + }); +}); diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDot.vue b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDot.vue new file mode 100644 index 0000000000000..691ee755cf206 --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandleDot.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.spec.ts b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.spec.ts index 841d11a44edda..fca5297c72987 100644 --- a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.spec.ts +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.spec.ts @@ -18,9 +18,9 @@ describe('CanvasHandlePlus', () => { expect(html()).toMatchSnapshot(); }); - it('emits click:plus event when plus icon is clicked', async () => { + it('should emit click:plus event when plus icon is clicked', async () => { const { container, emitted } = renderComponent(); - const plusIcon = container.querySelector('svg.plus'); + const plusIcon = container.querySelector('.plus'); if (!plusIcon) throw new Error('Plus icon not found'); @@ -29,7 +29,7 @@ describe('CanvasHandlePlus', () => { expect(emitted()).toHaveProperty('click:plus'); }); - it('applies correct classes based on position prop', () => { + it('should apply correct classes based on position prop', () => { const positions = ['top', 'right', 'bottom', 'left']; positions.forEach((position) => { @@ -40,15 +40,17 @@ describe('CanvasHandlePlus', () => { }); }); - it('renders SVG elements correctly', () => { + it('should render SVG elements correctly', () => { const { container } = renderComponent(); - const lineSvg = container.querySelector('svg.line'); + const svg = container.querySelector('svg'); + expect(svg).toBeTruthy(); + expect(svg?.getAttribute('viewBox')).toBe('0 0 70 24'); + + const lineSvg = container.querySelector('line'); expect(lineSvg).toBeTruthy(); - expect(lineSvg?.getAttribute('viewBox')).toBe('0 0 46 24'); - const plusSvg = container.querySelector('svg.plus'); + const plusSvg = container.querySelector('.plus'); expect(plusSvg).toBeTruthy(); - expect(plusSvg?.getAttribute('viewBox')).toBe('0 0 24 24'); }); }); diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.vue b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.vue index eb88dfb3a5b06..8d0776e4a1672 100644 --- a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.vue +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/CanvasHandlePlus.vue @@ -4,9 +4,11 @@ import { computed, useCssModule } from 'vue'; const props = withDefaults( defineProps<{ position?: 'top' | 'right' | 'bottom' | 'left'; + handleClasses?: string; }>(), { position: 'right', + handleClasses: undefined, }, ); @@ -16,7 +18,64 @@ const emit = defineEmits<{ const style = useCssModule(); -const classes = computed(() => [style.wrapper, style[props.position]]); +const classes = computed(() => [style.wrapper, style[props.position], props.handleClasses]); + +const plusSize = 24; +const lineSize = 46; + +const viewBox = computed(() => { + switch (props.position) { + case 'bottom': + case 'top': + return { + width: plusSize, + height: lineSize + plusSize, + }; + default: + return { + width: lineSize + plusSize, + height: plusSize, + }; + } +}); + +const linePosition = computed(() => { + switch (props.position) { + case 'top': + return [ + [viewBox.value.width / 2, viewBox.value.height - lineSize + 1], + [viewBox.value.width / 2, viewBox.value.height], + ]; + case 'bottom': + return [ + [viewBox.value.width / 2, 0], + [viewBox.value.width / 2, lineSize + 1], + ]; + case 'left': + return [ + [viewBox.value.width - lineSize - 1, viewBox.value.height / 2], + [viewBox.value.width, viewBox.value.height / 2], + ]; + default: + return [ + [0, viewBox.value.height / 2], + [lineSize + 1, viewBox.value.height / 2], + ]; + } +}); + +const plusPosition = computed(() => { + switch (props.position) { + case 'bottom': + return [0, viewBox.value.height - plusSize]; + case 'top': + return [0, 0]; + case 'left': + return [0, 0]; + default: + return [viewBox.value.width - plusSize, 0]; + } +}); function onClick(event: MouseEvent) { emit('click:plus', event); @@ -24,19 +83,23 @@ function onClick(event: MouseEvent) { diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleDiamond.spec.ts.snap b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleDiamond.spec.ts.snap new file mode 100644 index 0000000000000..8a04f4a9d44a6 --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleDiamond.spec.ts.snap @@ -0,0 +1,11 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`CanvasHandleDiamond > should render with default props 1`] = ` +" + + + + + +" +`; diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleDot.spec.ts.snap b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleDot.spec.ts.snap new file mode 100644 index 0000000000000..a902ea6fe9b3c --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleDot.spec.ts.snap @@ -0,0 +1,3 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`CanvasHandleDot > should render with default props 1`] = `"
"`; diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandlePlus.spec.ts.snap b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandlePlus.spec.ts.snap index 585581dfaeacc..4e18c15613277 100644 --- a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandlePlus.spec.ts.snap +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandlePlus.spec.ts.snap @@ -1,12 +1,11 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`CanvasHandlePlus > should render with default props 1`] = ` -"
- - - - - - -
" +" + + + + + +" `; diff --git a/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleRectangle.spec.ts.snap b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleRectangle.spec.ts.snap new file mode 100644 index 0000000000000..7ceb9283702f9 --- /dev/null +++ b/packages/editor-ui/src/components/canvas/elements/handles/render-types/parts/__snapshots__/CanvasHandleRectangle.spec.ts.snap @@ -0,0 +1,3 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`CanvasHandleRectangle > should render with default props 1`] = `"
"`; diff --git a/packages/editor-ui/src/components/canvas/elements/nodes/CanvasNode.vue b/packages/editor-ui/src/components/canvas/elements/nodes/CanvasNode.vue index c3b399462251f..34c4bd7bff54a 100644 --- a/packages/editor-ui/src/components/canvas/elements/nodes/CanvasNode.vue +++ b/packages/editor-ui/src/components/canvas/elements/nodes/CanvasNode.vue @@ -1,9 +1,9 @@ + +