mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-17 13:39:44 +02:00
refactor(core): Move the response errors into @n8n/backend-services (no-changelog)
Move the generic ResponseError classes from cli into the shared package. Feature-specific errors stay in cli. cli now depends on the package. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
5d508ec1e1
commit
175201f8f5
|
|
@ -27,9 +27,13 @@ and infrastructure services that need the persistence layer or that only
|
|||
|
||||
## What lives here
|
||||
|
||||
Nothing yet. The next PRs move the response errors, `UrlService`, `CacheService`,
|
||||
`RedisClientService`, `ProtectedResourceRegistry`, `EventService`, `RoleService`,
|
||||
the finder services and the scope checks here, one area at a time.
|
||||
| Export | Purpose |
|
||||
| --- | --- |
|
||||
| `ResponseError` and its subclasses (`BadRequestError`, `NotFoundError`, `ForbiddenError`, ...) | Errors that map to an HTTP status code in a REST response |
|
||||
|
||||
The next PRs move `UrlService`, `CacheService`, `RedisClientService`,
|
||||
`ProtectedResourceRegistry`, `EventService`, `RoleService`, the finder services
|
||||
and the scope checks here, one area at a time.
|
||||
|
||||
## Compatibility with cli
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,10 @@
|
|||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@n8n/api-types": "workspace:*",
|
||||
"n8n-workflow": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@n8n/eslint-config": "workspace:*",
|
||||
"@n8n/oxlint-config": "workspace:*",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
import { BadRequestError } from '../bad-request.error';
|
||||
import { InternalServerError } from '../internal-server.error';
|
||||
import { NotFoundError } from '../not-found.error';
|
||||
import { ServiceUnavailableError } from '../service-unavailable.error';
|
||||
|
||||
describe('ResponseError', () => {
|
||||
it('should set the error level from the HTTP status code', () => {
|
||||
expect(new BadRequestError('bad').level).toBe('warning');
|
||||
expect(new ServiceUnavailableError('down').level).toBe('info');
|
||||
expect(new InternalServerError('boom').level).toBe('error');
|
||||
});
|
||||
|
||||
it('should default the error code to the HTTP status code', () => {
|
||||
const error = new BadRequestError('bad');
|
||||
|
||||
expect(error.httpStatusCode).toBe(400);
|
||||
expect(error.errorCode).toBe(400);
|
||||
});
|
||||
|
||||
it('should keep the cause', () => {
|
||||
const cause = new Error('root');
|
||||
|
||||
expect(BadRequestError.wrap('bad', cause).cause).toBe(cause);
|
||||
});
|
||||
|
||||
it('should assert a defined value', () => {
|
||||
expect(() => NotFoundError.isDefinedAndNotNull(null, 'missing')).toThrow(NotFoundError);
|
||||
expect(() => NotFoundError.isDefinedAndNotNull('x', 'missing')).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
|
@ -1 +1,18 @@
|
|||
export {};
|
||||
export { ResponseError } from './errors/response-errors/abstract/response.error';
|
||||
export { AuthError } from './errors/response-errors/auth.error';
|
||||
export { BadRequestError } from './errors/response-errors/bad-request.error';
|
||||
export { ConflictError } from './errors/response-errors/conflict.error';
|
||||
export { ContentTooLargeError } from './errors/response-errors/content-too-large.error';
|
||||
export { ForbiddenError } from './errors/response-errors/forbidden.error';
|
||||
export { InternalServerError } from './errors/response-errors/internal-server.error';
|
||||
export { LockedError } from './errors/response-errors/locked.error';
|
||||
export { NotFoundError } from './errors/response-errors/not-found.error';
|
||||
export { NotImplementedError } from './errors/response-errors/not-implemented.error';
|
||||
export { PaymentRequiredError } from './errors/response-errors/payment-required.error';
|
||||
export { ScopeForbiddenError } from './errors/response-errors/scope-forbidden.error';
|
||||
export { ServiceUnavailableError } from './errors/response-errors/service-unavailable.error';
|
||||
export { TooManyRequestsError } from './errors/response-errors/too-many-requests.error';
|
||||
export { UnauthenticatedError } from './errors/response-errors/unauthenticated.error';
|
||||
export { UnprocessableRequestError } from './errors/response-errors/unprocessable.error';
|
||||
export { UnsupportedMediaTypeError } from './errors/response-errors/unsupported-media-type.error';
|
||||
export { WorkflowPublishBlockedError } from './errors/response-errors/workflow-publish-blocked.error';
|
||||
|
|
|
|||
|
|
@ -15,5 +15,9 @@
|
|||
// TODO: remove all options below this line
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
"include": ["src/**/*.ts", "test/**/*.ts"]
|
||||
"include": ["src/**/*.ts", "test/**/*.ts"],
|
||||
"references": [
|
||||
{ "path": "../../workflow/tsconfig.build.cjs.json" },
|
||||
{ "path": "../api-types/tsconfig.build.json" }
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@
|
|||
"@n8n/ai-workflow-builder": "workspace:*",
|
||||
"@n8n/api-types": "workspace:*",
|
||||
"@n8n/backend-common": "workspace:*",
|
||||
"@n8n/backend-services": "workspace:*",
|
||||
"@n8n/backend-network": "workspace:*",
|
||||
"@n8n/blob-storage": "workspace:*",
|
||||
"@n8n/chat-hub": "workspace:*",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { ForbiddenError } from '@n8n/backend-services';
|
||||
vi.mock('@n8n/backend-common', async () => {
|
||||
return {
|
||||
...(await vi.importActual<typeof import('@n8n/backend-common')>('@n8n/backend-common')),
|
||||
|
|
@ -28,7 +29,6 @@ import { z } from 'zod';
|
|||
|
||||
import type { AuthService } from '@/auth/auth.service';
|
||||
import { ControllerRegistry } from '@/controller.registry';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import type { License } from '@/license';
|
||||
import type { LastActiveAtService } from '@/services/last-active-at.service';
|
||||
import { RateLimitService } from '@/services/rate-limit.service';
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
import {
|
||||
ConflictError,
|
||||
ForbiddenError,
|
||||
InternalServerError,
|
||||
NotFoundError,
|
||||
} from '@n8n/backend-services';
|
||||
import { mockInstance } from '@n8n/backend-test-utils';
|
||||
import type { Request, Response } from 'express';
|
||||
import { ErrorReporter } from 'n8n-core';
|
||||
import { UserError } from 'n8n-workflow';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { LicenseEulaRequiredError } from '@/errors/response-errors/license-eula-required.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { PolicyViolationError } from '@/policy/policy-violation.error';
|
||||
import { reportError, sendErrorResponse } from '@/response-helper';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { MAX_PINNED_DATA_SIZE, MAX_WORKFLOW_SIZE, MAX_EXPECTED_REQUEST_SIZE } from '@n8n/api-types';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import { mockInstance } from '@n8n/backend-test-utils';
|
||||
import type { CredentialsEntity, IExecutionResponse, Project, Variables } from '@n8n/db';
|
||||
import { CredentialsRepository } from '@n8n/db';
|
||||
|
|
@ -32,7 +33,6 @@ import {
|
|||
sanitizeNodeGroupDescriptions,
|
||||
WorkflowStructureBadRequestError,
|
||||
} from '@/workflow-helpers';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
describe('workflow-helpers', () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { inDevelopment, inTest, Logger } from '@n8n/backend-common';
|
||||
import { ServiceUnavailableError } from '@n8n/backend-services';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import { DbConnection } from '@n8n/db';
|
||||
import { OnShutdown } from '@n8n/decorators';
|
||||
|
|
@ -12,7 +13,6 @@ import { SLACK_HITL_WEBHOOK_SUFFIX, TELEGRAM_HITL_WEBHOOK_SUFFIX } from 'n8n-cor
|
|||
|
||||
import config from '@/config';
|
||||
import { N8N_VERSION, TEMPLATES_DIR } from '@/constants';
|
||||
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import { bodyParser, corsMiddleware, rawBodyReader } from '@/middlewares';
|
||||
import { sendErrorResponse } from '@/response-helper';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Logger } from '@n8n/backend-common';
|
||||
import { AuthError, ForbiddenError } from '@n8n/backend-services';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import { Time } from '@n8n/constants';
|
||||
import type { AuthenticatedRequest, User } from '@n8n/db';
|
||||
|
|
@ -12,8 +13,6 @@ import escapeRegExp from 'lodash/escapeRegExp';
|
|||
import type { StringValue as TimeUnitValue } from 'ms';
|
||||
|
||||
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import { AuthError } from '@/errors/response-errors/auth.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { License } from '@/license';
|
||||
import { MfaService } from '@/mfa/mfa.service';
|
||||
import { JwtService } from '@/services/jwt.service';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { AuthError } from '@n8n/backend-services';
|
||||
import type { GlobalConfig } from '@n8n/config';
|
||||
import type { AuthIdentity, User, UserRepository } from '@n8n/db';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { AuthError } from '@/errors/response-errors/auth.error';
|
||||
import type { EventService } from '@/events/event.service';
|
||||
import type { PasswordUtility } from '@/services/password.utility';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { AuthError } from '@n8n/backend-services';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import { User, UserRepository } from '@n8n/db';
|
||||
import type { IPasswordAuthHandler } from '@n8n/decorators';
|
||||
import { AuthHandler } from '@n8n/decorators';
|
||||
import { Constructable } from '@n8n/di';
|
||||
|
||||
import { AuthError } from '@/errors/response-errors/auth.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { PasswordUtility } from '@/services/password.utility';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import { ExecutionRepository } from '@n8n/db';
|
||||
import type { IExecutionResponse, Project } from '@n8n/db';
|
||||
import { Service } from '@n8n/di';
|
||||
|
|
@ -17,7 +18,6 @@ import {
|
|||
isHitlToolType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { NotFoundError } from '../errors/response-errors/not-found.error';
|
||||
import { ExecutionPersistence } from '../executions/execution-persistence';
|
||||
import * as WorkflowExecuteAdditionalData from '../workflow-execute-additional-data';
|
||||
import { preserveInputOverride } from '../workflow-helpers';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { PushPayload } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { ConflictError, LockedError, NotFoundError } from '@n8n/backend-services';
|
||||
import { UserRepository } from '@n8n/db';
|
||||
import type { User } from '@n8n/db';
|
||||
import { Service } from '@n8n/di';
|
||||
|
|
@ -22,9 +23,6 @@ import type {
|
|||
} from './collaboration.message';
|
||||
|
||||
import { CollaborationState, type WriteLock } from '@/collaboration/collaboration.state';
|
||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||
import { LockedError } from '@/errors/response-errors/locked.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { AgentRepository } from '@/modules/agents/repositories/agent.repository';
|
||||
import { Push } from '@/push';
|
||||
import type { OnPushMessage } from '@/push/types';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { ZodClass } from '@n8n/api-types';
|
||||
import { inProduction } from '@n8n/backend-common';
|
||||
import { NotFoundError, UnauthenticatedError } from '@n8n/backend-services';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import { type BooleanLicenseFeature } from '@n8n/constants';
|
||||
import { isAuthenticatedRequest } from '@n8n/db';
|
||||
|
|
@ -20,13 +21,11 @@ import assert from 'node:assert';
|
|||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import { UnauthenticatedError } from '@/errors/response-errors/unauthenticated.error';
|
||||
import { License } from '@/license';
|
||||
import { userHasScopes } from '@/permissions.ee/check-access';
|
||||
import { reportError, send, sendErrorResponse } from '@/response-helper';
|
||||
|
||||
import { AbstractServer } from './abstract-server';
|
||||
import { NotFoundError } from './errors/response-errors/not-found.error';
|
||||
import { CorsService } from './services/cors-service';
|
||||
import { LastActiveAtService } from './services/last-active-at.service';
|
||||
import { RateLimitService } from './services/rate-limit.service';
|
||||
|
|
|
|||
|
|
@ -5,14 +5,16 @@ import type {
|
|||
AiBuilderChatRequestDto,
|
||||
AiGatewayUsageQueryDto,
|
||||
} from '@n8n/api-types';
|
||||
import {
|
||||
BadRequestError,
|
||||
InternalServerError,
|
||||
NotFoundError,
|
||||
ServiceUnavailableError,
|
||||
} from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest } from '@n8n/db';
|
||||
import { APIResponseError, NetworkError, type AiAssistantSDK } from '@n8n_io/ai-assistant-sdk';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
|
||||
import type { AiGatewayService } from '@/services/ai-gateway.service';
|
||||
import type { AiUsageService } from '@/services/ai-usage.service';
|
||||
import type { WorkflowBuilderService } from '@/services/ai-workflow-builder.service';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import type { LoginRequestDto } from '@n8n/api-types';
|
||||
import { ResolveSignupTokenQueryDto, SSO_LOGIN_REQUIRED_ERROR_CODE } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { AuthError, BadRequestError, ForbiddenError } from '@n8n/backend-services';
|
||||
import { mockInstance } from '@n8n/backend-test-utils';
|
||||
import type { AuthenticatedRequest, User } from '@n8n/db';
|
||||
import { UserRepository } from '@n8n/db';
|
||||
|
|
@ -14,9 +15,6 @@ import { AuthService } from '@/auth/auth.service';
|
|||
import type { EmailAuthHandler } from '@/auth/handlers/email.auth-handler';
|
||||
import config from '@/config';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import { AuthError } from '@/errors/response-errors/auth.error';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { License } from '@/license';
|
||||
import { MfaService } from '@/mfa/mfa.service';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import { mockInstance } from '@n8n/backend-test-utils';
|
||||
import type { User } from '@n8n/db';
|
||||
import { UserRepository } from '@n8n/db';
|
||||
|
|
@ -8,8 +9,6 @@ import { mock } from 'vitest-mock-extended';
|
|||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { ChangeEmailController } from '@/controllers/change-email.controller';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import type { AuthlessRequest } from '@/requests';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import type { AcceptInvitationRequestDto } from '@n8n/api-types';
|
||||
import { InviteUsersRequestDto } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import { mockInstance } from '@n8n/backend-test-utils';
|
||||
import { UserRepository, GLOBAL_OWNER_ROLE, GLOBAL_MEMBER_ROLE } from '@n8n/db';
|
||||
import type { User, PublicUser, AuthenticatedRequest } from '@n8n/db';
|
||||
|
|
@ -9,7 +10,6 @@ import { v4 as uuidv4 } from 'uuid';
|
|||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { UserUpdateRequestDto } from '@n8n/api-types';
|
||||
import { BadRequestError, ForbiddenError } from '@n8n/backend-services';
|
||||
import { mockInstance } from '@n8n/backend-test-utils';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import type { AuthenticatedRequest, User, PublicUser, AuthIdentity } from '@n8n/db';
|
||||
|
|
@ -11,8 +12,6 @@ import { mock, anyObject } from 'vitest-mock-extended';
|
|||
|
||||
import { AUTH_COOKIE_NAME } from '@/constants';
|
||||
import { MeController } from '@/controllers/me.controller';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { InvalidMfaCodeError } from '@/errors/response-errors/invalid-mfa-code.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import type { DismissBannerRequestDto } from '@n8n/api-types';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import type { AuthService } from '@/auth/auth.service';
|
||||
import { OwnerController } from '@/controllers/owner.controller';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import type { PostHogClient } from '@/posthog';
|
||||
import type { BannerService } from '@/services/banner.service';
|
||||
import type { OwnershipService } from '@/services/ownership.service';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest, Project } from '@n8n/db';
|
||||
import type { Role } from '@n8n/permissions';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { EventService } from '@/events/event.service';
|
||||
import type { ProjectService } from '@/services/project.service.ee';
|
||||
import type { RoleService } from '@/services/role.service';
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import type { UpdateSecuritySettingsDto } from '@n8n/api-types';
|
||||
import type { LicenseState } from '@n8n/backend-common';
|
||||
import { ForbiddenError } from '@n8n/backend-services';
|
||||
import type { InstanceSettingsLoaderConfig } from '@n8n/config';
|
||||
import type { AuthenticatedRequest } from '@n8n/db';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import type { SecuritySettingsService } from '@/services/security-settings.service';
|
||||
import type { WorkflowReviewPolicyService } from '@/services/workflow-review-policy.service';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import type { GlobalConfig } from '@n8n/config';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import type { TranslationRequest } from '@/controllers/translation.controller';
|
||||
import { TranslationController } from '@/controllers/translation.controller';
|
||||
import type { CredentialTypes } from '@/credential-types';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
|
||||
// The controller loads the translation file via `require(<computed path>)`.
|
||||
// Vitest cannot mock a path that doesn't resolve to a real module, so write a
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest, User, UserRepository } from '@n8n/db';
|
||||
import type { Response } from 'express';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { UserRequest } from '@/requests';
|
||||
import type { JwtService } from '@/services/jwt.service';
|
||||
import type { UrlService } from '@/services/url.service';
|
||||
|
|
|
|||
|
|
@ -15,6 +15,14 @@ import {
|
|||
AiClearSessionRequestDto,
|
||||
AiGatewayUsageQueryDto,
|
||||
} from '@n8n/api-types';
|
||||
import {
|
||||
BadRequestError,
|
||||
ContentTooLargeError,
|
||||
InternalServerError,
|
||||
NotFoundError,
|
||||
ServiceUnavailableError,
|
||||
TooManyRequestsError,
|
||||
} from '@n8n/backend-services';
|
||||
import { AuthenticatedRequest } from '@n8n/db';
|
||||
import { Body, Get, Licensed, Post, Query, RestController, GlobalScope } from '@n8n/decorators';
|
||||
import { type AiAssistantSDK, APIResponseError, NetworkError } from '@n8n_io/ai-assistant-sdk';
|
||||
|
|
@ -23,12 +31,6 @@ import { strict as assert } from 'node:assert';
|
|||
import { WritableStream } from 'node:stream/web';
|
||||
|
||||
import { STREAM_SEPARATOR } from '@/constants';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ContentTooLargeError } from '@/errors/response-errors/content-too-large.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { ServiceUnavailableError } from '@/errors/response-errors/service-unavailable.error';
|
||||
import { TooManyRequestsError } from '@/errors/response-errors/too-many-requests.error';
|
||||
import { AiGatewayService } from '@/services/ai-gateway.service';
|
||||
import { AiUsageService } from '@/services/ai-usage.service';
|
||||
import { WorkflowBuilderService } from '@/services/ai-workflow-builder.service';
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {
|
|||
ListApiKeysQueryDto,
|
||||
UpdateApiKeyRequestDto,
|
||||
} from '@n8n/api-types';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import { AuthenticatedRequest } from '@n8n/db';
|
||||
import {
|
||||
Body,
|
||||
|
|
@ -18,7 +19,6 @@ import {
|
|||
import { getApiKeyScopesForRole } from '@n8n/permissions';
|
||||
import type { RequestHandler } from 'express';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { isApiKeyAuthEnabled } from '@/public-api';
|
||||
import { PublicApiKeyService } from '@/services/public-api-key.service';
|
||||
|
|
|
|||
|
|
@ -4,6 +4,12 @@ import {
|
|||
SSO_LOGIN_REQUIRED_ERROR_CODE,
|
||||
} from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import {
|
||||
AuthError,
|
||||
BadRequestError,
|
||||
ForbiddenError,
|
||||
InternalServerError,
|
||||
} from '@n8n/backend-services';
|
||||
import { Time } from '@n8n/constants';
|
||||
import type { User, PublicUser, AuthProviderType } from '@n8n/db';
|
||||
import { UserRepository, AuthenticatedRequest, GLOBAL_OWNER_ROLE } from '@n8n/db';
|
||||
|
|
@ -21,10 +27,6 @@ import { Response } from 'express';
|
|||
import { AuthHandlerRegistry } from '@/auth/auth-handler.registry';
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import { AuthError } from '@/errors/response-errors/auth.error';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { License } from '@/license';
|
||||
import { MfaService } from '@/mfa/mfa.service';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { BinaryDataQueryDto, BinaryDataSignedQueryDto, ViewableMimeTypes } from '@n8n/api-types';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest } from '@n8n/db';
|
||||
import { Get, Query, RestController } from '@n8n/decorators';
|
||||
import { Request, Response } from 'express';
|
||||
|
|
@ -11,7 +12,6 @@ import {
|
|||
} from 'n8n-core';
|
||||
|
||||
import { BinaryDataAccessService } from '@/binary-data/binary-data-access.service';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
|
||||
@RestController('/binary-data')
|
||||
export class BinaryDataController {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
type ChangeEmailResponse,
|
||||
} from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, InternalServerError, NotFoundError } from '@n8n/backend-services';
|
||||
import { AuthenticatedRequest, UserRepository } from '@n8n/db';
|
||||
import {
|
||||
Body,
|
||||
|
|
@ -17,9 +18,6 @@ import {
|
|||
import { Response } from 'express';
|
||||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import { AuthlessRequest } from '@/requests';
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
TransferFolderBodyDto,
|
||||
UpdateFolderDto,
|
||||
} from '@n8n/api-types';
|
||||
import { BadRequestError, InternalServerError, NotFoundError } from '@n8n/backend-services';
|
||||
import { AuthenticatedRequest } from '@n8n/db';
|
||||
import {
|
||||
Post,
|
||||
|
|
@ -24,9 +25,6 @@ import { NextFunction, Response } from 'express';
|
|||
import { UserError } from 'n8n-workflow';
|
||||
|
||||
import { FolderNotFoundError } from '@/errors/folder-not-found.error';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { FolderService } from '@/services/folder.service';
|
||||
import { ProjectService } from '@/services/project.service.ee';
|
||||
import { EnterpriseWorkflowService } from '@/workflows/workflow.service.ee';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { AcceptInvitationRequestDto, InviteUsersRequestDto } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import { Time } from '@n8n/constants';
|
||||
import type { User } from '@n8n/db';
|
||||
import { UserRepository, AuthenticatedRequest } from '@n8n/db';
|
||||
|
|
@ -7,7 +8,6 @@ import { Post, GlobalScope, RestController, Body } from '@n8n/decorators';
|
|||
import { Response } from 'express';
|
||||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
UserUpdateRequestDto,
|
||||
} from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, ForbiddenError } from '@n8n/backend-services';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import type { User, PublicUser, AuthIdentity } from '@n8n/db';
|
||||
import { UserRepository, AuthenticatedRequest } from '@n8n/db';
|
||||
|
|
@ -13,8 +14,6 @@ import { plainToInstance } from 'class-transformer';
|
|||
import { Response } from 'express';
|
||||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { InvalidMfaCodeError } from '@/errors/response-errors/invalid-mfa-code.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { BadRequestError, ForbiddenError } from '@n8n/backend-services';
|
||||
import { InstanceSettingsLoaderConfig } from '@n8n/config';
|
||||
import { AuthenticatedRequest, UserRepository } from '@n8n/db';
|
||||
import {
|
||||
|
|
@ -10,8 +11,6 @@ import {
|
|||
import { Response } from 'express';
|
||||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import { MfaService } from '@/mfa/mfa.service';
|
||||
|
|
|
|||
|
|
@ -4,6 +4,13 @@ import {
|
|||
ResolvePasswordTokenQueryDto,
|
||||
} from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import {
|
||||
BadRequestError,
|
||||
ForbiddenError,
|
||||
InternalServerError,
|
||||
NotFoundError,
|
||||
UnprocessableRequestError,
|
||||
} from '@n8n/backend-services';
|
||||
import { Time } from '@n8n/constants';
|
||||
import { GLOBAL_OWNER_ROLE, UserRepository } from '@n8n/db';
|
||||
import {
|
||||
|
|
@ -20,11 +27,6 @@ import { ErrorReporter } from 'n8n-core';
|
|||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { UnprocessableRequestError } from '@/errors/response-errors/unprocessable.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import { License } from '@/license';
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
ChangeUserRoleInProject,
|
||||
ListProjectsQueryDto,
|
||||
} from '@n8n/api-types';
|
||||
import { BadRequestError, ForbiddenError, NotFoundError } from '@n8n/backend-services';
|
||||
import { AuthenticatedRequest } from '@n8n/db';
|
||||
import {
|
||||
Get,
|
||||
|
|
@ -23,9 +24,6 @@ import {
|
|||
import { combineScopes, getAuthPrincipalScopes } from '@n8n/permissions';
|
||||
import { Response } from 'express';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { ProvisioningService } from '@/modules/provisioning.ee/provisioning.service.ee';
|
||||
import type { ProjectRequest } from '@/requests';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import type {
|
|||
RoleMembersResponse,
|
||||
RoleProjectMembersResponse,
|
||||
} from '@n8n/api-types';
|
||||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import { LICENSE_FEATURES } from '@n8n/constants';
|
||||
import { AuthenticatedRequest } from '@n8n/db';
|
||||
import {
|
||||
|
|
@ -29,7 +30,6 @@ import {
|
|||
} from '@n8n/decorators';
|
||||
import { Role as RoleDTO } from '@n8n/permissions';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ProjectService } from '@/services/project.service.ee';
|
||||
import { assertCanManageRoleType, canReassignUsers } from '@/services/role-authorization';
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { UpdateSecuritySettingsDto } from '@n8n/api-types';
|
||||
import { LicenseState } from '@n8n/backend-common';
|
||||
import { ForbiddenError } from '@n8n/backend-services';
|
||||
import { InstanceSettingsLoaderConfig } from '@n8n/config';
|
||||
import { type AuthenticatedRequest } from '@n8n/db';
|
||||
import { Body, Get, GlobalScope, Licensed, Post, RestController } from '@n8n/decorators';
|
||||
import type { Response } from 'express';
|
||||
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { SecuritySettingsService } from '@/services/security-settings.service';
|
||||
import { WorkflowReviewPolicyService } from '@/services/workflow-review-policy.service';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { safeJoinPath } from '@n8n/backend-common';
|
||||
import { BadRequestError, InternalServerError } from '@n8n/backend-services';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import { Get, RestController } from '@n8n/decorators';
|
||||
import type { Request } from 'express';
|
||||
|
|
@ -6,8 +7,6 @@ import { access } from 'fs/promises';
|
|||
|
||||
import { NODES_BASE_DIR } from '@/constants';
|
||||
import { CredentialTypes } from '@/credential-types';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { InternalServerError } from '@/errors/response-errors/internal-server.error';
|
||||
|
||||
export const CREDENTIAL_TRANSLATIONS_DIR = 'n8n-nodes-base/dist/credentials/translations';
|
||||
export const NODE_HEADERS_PATH = safeJoinPath(NODES_BASE_DIR, 'dist/nodes/headers');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import { Patch, RestController } from '@n8n/decorators';
|
||||
import type { NpsSurveyState } from 'n8n-workflow';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NpsSurveyRequest } from '@/requests';
|
||||
import { UserService } from '@/services/user.service';
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
UsersListFilterDto,
|
||||
usersListSchema,
|
||||
} from '@n8n/api-types';
|
||||
import { ForbiddenError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { PublicUser } from '@n8n/db';
|
||||
import {
|
||||
User,
|
||||
|
|
@ -30,8 +31,6 @@ import { hasGlobalScope } from '@n8n/permissions';
|
|||
import { Response } from 'express';
|
||||
|
||||
import { AuthService } from '@/auth/auth.service';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { UserRequest } from '@/requests';
|
||||
import { JwtService } from '@/services/jwt.service';
|
||||
import { UrlService } from '@/services/url.service';
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Logger } from '@n8n/backend-common';
|
||||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import type { WorkflowStatistics } from '@n8n/db';
|
||||
import { StatisticsNames, WorkflowStatisticsRepository } from '@n8n/db';
|
||||
import { Get, Middleware, RestController } from '@n8n/decorators';
|
||||
import { Response, NextFunction } from 'express';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { IWorkflowStatisticsDataLoaded } from '@/interfaces';
|
||||
import { WorkflowFinderService } from '@/workflows/workflow-finder.service';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { Response } from 'express';
|
||||
import { CredentialDescriptionsService } from '@/credentials/credential-descriptions.service';
|
||||
import type { PostHogClient } from '@/posthog';
|
||||
|
|
@ -20,8 +21,6 @@ import { GLOBAL_OWNER_ROLE, GLOBAL_MEMBER_ROLE } from '@n8n/db';
|
|||
import type { Scope } from '@n8n/permissions';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import * as checkAccess from '@/permissions.ee/check-access';
|
||||
import type { CredentialRequest } from '@/requests';
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { CredentialDescriptionsService } from '@/credentials/credential-descript
|
|||
import type { PostHogClient } from '@/posthog';
|
||||
import { CREDENTIAL_DESCRIPTION_MAX_LENGTH } from '@n8n/api-types';
|
||||
import type { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, ForbiddenError } from '@n8n/backend-services';
|
||||
import type {
|
||||
CredentialsRepository,
|
||||
ICredentialsDb,
|
||||
|
|
@ -51,8 +52,6 @@ import type { CredentialsHelper } from '@/credentials-helper';
|
|||
import type { PolicyEnforcementService } from '@/policy/policy-enforcement.service';
|
||||
import { PolicyViolationError } from '@/policy/policy-violation.error';
|
||||
import { CredentialNotFoundError } from '@/errors/credential-not-found.error';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import type { EventService } from '@/events/event.service';
|
||||
import type { ExternalHooks } from '@/external-hooks';
|
||||
import type { ExternalSecretsConfig } from '@/modules/external-secrets.ee/external-secrets.config';
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
TestCredentialRequestDto,
|
||||
} from '@n8n/api-types';
|
||||
import { LicenseState, Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, ForbiddenError, NotFoundError } from '@n8n/backend-services';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
import {
|
||||
SharedCredentials,
|
||||
|
|
@ -42,9 +43,6 @@ import { getExternalSecretExpressionPaths } from './external-secrets.utils';
|
|||
|
||||
import { CredentialsOverwrites } from '@/credentials-overwrites';
|
||||
import { CredentialNotFoundError } from '@/errors/credential-not-found.error';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { listQueryMiddleware } from '@/middlewares';
|
||||
import { userHasScopes } from '@/permissions.ee/check-access';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { CredentialConnectionStatus } from '@n8n/api-types';
|
||||
import { LicenseState } from '@n8n/backend-common';
|
||||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import type { User } from '@n8n/db';
|
||||
import {
|
||||
CredentialsEntity,
|
||||
|
|
@ -12,7 +13,6 @@ import { hasGlobalScope } from '@n8n/permissions';
|
|||
import { In, type EntityManager } from '@n8n/typeorm';
|
||||
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { TransferCredentialError } from '@/errors/response-errors/transfer-credential.error';
|
||||
import { ExternalSecretsConfig } from '@/modules/external-secrets.ee/external-secrets.config';
|
||||
import { SecretsProviderAccessCheckService } from '@/modules/external-secrets.ee/secret-provider-access-check.service.ee';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
import type { CreateCredentialDto, CredentialConnectionStatus } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import {
|
||||
BadRequestError,
|
||||
ConflictError,
|
||||
ForbiddenError,
|
||||
NotFoundError,
|
||||
} from '@n8n/backend-services';
|
||||
import { Time } from '@n8n/constants';
|
||||
import {
|
||||
Project,
|
||||
|
|
@ -60,10 +66,6 @@ import { isCredSharingEnabled } from '@/constants/credential-sharing';
|
|||
import { CredentialTypes } from '@/credential-types';
|
||||
import { createCredentialsFromCredentialsEntity, CredentialsHelper } from '@/credentials-helper';
|
||||
import { CredentialNotFoundError } from '@/errors/credential-not-found.error';
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
import { ExternalHooks } from '@/external-hooks';
|
||||
import { validateEntity } from '@/generic-helpers';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Logger } from '@n8n/backend-common';
|
||||
import { UnprocessableRequestError } from '@n8n/backend-services';
|
||||
import {
|
||||
CredentialsEntity,
|
||||
InstanceCredentialAssignmentRepository,
|
||||
|
|
@ -7,8 +8,6 @@ import {
|
|||
import { Service } from '@n8n/di';
|
||||
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||
|
||||
import { UnprocessableRequestError } from '@/errors/response-errors/unprocessable.error';
|
||||
|
||||
import { CredentialsService } from './credentials.service';
|
||||
import {
|
||||
InstanceCredentialUseRegistry,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { credentialDescriptionSchema } from '@n8n/api-types';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
import type { User } from '@n8n/db';
|
||||
import get from 'lodash/get';
|
||||
import { type ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import type { SecretsProviderAccessCheckService } from '@/modules/external-secrets.ee/secret-provider-access-check.service.ee';
|
||||
import { userHasScopes } from '@/permissions.ee/check-access';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { Logger } from '@n8n/backend-common';
|
||||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import { mockInstance } from '@n8n/backend-test-utils';
|
||||
import type { DeploymentKey } from '@n8n/db';
|
||||
import { DeploymentKeyRepository } from '@n8n/db';
|
||||
|
|
@ -7,7 +8,6 @@ import { Cipher, type EncryptionKeyProxy, InstanceSettings } from 'n8n-core';
|
|||
import { randomBytes } from 'node:crypto';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { KeyManagerService } from '@/encryption/key-manager.service';
|
||||
|
||||
const makeKey = (overrides: Partial<DeploymentKey> = {}): DeploymentKey =>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { ListEncryptionKeysQueryDto } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import {
|
||||
DeploymentKeyRepository,
|
||||
type DeploymentKey,
|
||||
|
|
@ -16,8 +17,6 @@ import {
|
|||
} from 'n8n-core';
|
||||
import { randomBytes } from 'node:crypto';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
|
||||
import { isKeyRotationEnabled } from './key-rotation-flag';
|
||||
|
||||
/** Raw DEK format: 64 hex chars stored directly as key material (n8n 2.18.x). */
|
||||
|
|
|
|||
|
|
@ -3,12 +3,11 @@ import {
|
|||
UpdateVariableRequestDto,
|
||||
VariableListRequestDto,
|
||||
} from '@n8n/api-types';
|
||||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import { AuthenticatedRequest } from '@n8n/db';
|
||||
import { Body, Delete, Get, Licensed, Patch, Post, Query, RestController } from '@n8n/decorators';
|
||||
import type { Response } from 'express';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { VariableCountLimitReachedError } from '@/errors/variable-count-limit-reached.error';
|
||||
import { VariableValidationError } from '@/errors/variable-validation.error';
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {
|
|||
NEW_VARIABLE_KEY_REGEX,
|
||||
} from '@n8n/api-types';
|
||||
import { LicenseState } from '@n8n/backend-common';
|
||||
import { ForbiddenError, NotFoundError } from '@n8n/backend-services';
|
||||
import { UNLIMITED_LICENSE_QUOTA } from '@n8n/constants';
|
||||
import type { User, Variables } from '@n8n/db';
|
||||
import { generateNanoId, VariablesRepository } from '@n8n/db';
|
||||
|
|
@ -11,8 +12,6 @@ import { Service } from '@n8n/di';
|
|||
import { hasGlobalScope, Scope } from '@n8n/permissions';
|
||||
|
||||
import { FeatureNotLicensedError } from '@/errors/feature-not-licensed.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { VariableCountLimitReachedError } from '@/errors/variable-count-limit-reached.error';
|
||||
import { VariableValidationError } from '@/errors/variable-validation.error';
|
||||
import { EventService } from '@/events/event.service';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import { BadRequest, Unauthorized } from 'express-openapi-validator/dist/framework/types';
|
||||
import { OperationalError, UnexpectedError, UserError } from 'n8n-workflow';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { LicenseEulaRequiredError } from '@/errors/response-errors/license-eula-required.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
|
||||
import { classifyHttpError, HttpErrorKind, isResponseError } from '../http-error-classifier';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import type { SourceControlledFile } from '@n8n/api-types';
|
||||
import { ConflictError, NotFoundError, WorkflowPublishBlockedError } from '@n8n/backend-services';
|
||||
import { UnexpectedError, UserError } from 'n8n-workflow';
|
||||
|
||||
import { classifyHttpError } from '@/errors/http-error-classifier';
|
||||
|
|
@ -6,10 +7,7 @@ import {
|
|||
serializeInternalRestError,
|
||||
serializePublicApiError,
|
||||
} from '@/errors/http-error-serializers';
|
||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||
import { LicenseEulaRequiredError } from '@/errors/response-errors/license-eula-required.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { WorkflowPublishBlockedError } from '@/errors/response-errors/workflow-publish-blocked.error';
|
||||
import { toImportBlockedError } from '@/modules/n8n-packages/engine/import-blocked.error';
|
||||
import { PolicyViolationError } from '@/policy/policy-violation.error';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import { ResponseError } from '@n8n/backend-services';
|
||||
import { HttpError, Unauthorized } from 'express-openapi-validator/dist/framework/types';
|
||||
import { UnexpectedError, UserError } from 'n8n-workflow';
|
||||
|
||||
import { ResponseError } from '@/errors/response-errors/abstract/response.error';
|
||||
|
||||
export const enum HttpErrorKind {
|
||||
responseError = 'responseError',
|
||||
userError = 'userError',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import type { AiPreferenceScope } from '@n8n/api-types';
|
||||
|
||||
import { BadRequestError } from './bad-request.error';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
|
||||
/** The per-scope cap refused a preference write. `meta` stays out of the REST body. */
|
||||
export class AiPreferenceScopeFullError extends BadRequestError {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ResponseError } from './abstract/response.error';
|
||||
import { ResponseError } from '@n8n/backend-services';
|
||||
|
||||
/**
|
||||
* A community package requires a node-authoring API version this runtime does
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ForbiddenError } from './forbidden.error';
|
||||
import { ForbiddenError } from '@n8n/backend-services';
|
||||
|
||||
export class InvalidMfaCodeError extends ForbiddenError {
|
||||
constructor(hint?: string) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ForbiddenError } from './forbidden.error';
|
||||
import { ForbiddenError } from '@n8n/backend-services';
|
||||
|
||||
export class InvalidMfaRecoveryCodeError extends ForbiddenError {
|
||||
constructor(hint?: string) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ResponseError } from './abstract/response.error';
|
||||
import { ResponseError } from '@n8n/backend-services';
|
||||
|
||||
/**
|
||||
* Error thrown when license activation requires EULA acceptance.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ResponseError } from './abstract/response.error';
|
||||
import { ResponseError } from '@n8n/backend-services';
|
||||
|
||||
export class TransferCredentialError extends ResponseError {
|
||||
constructor(message: string) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { ResponseError } from './abstract/response.error';
|
||||
import { ResponseError } from '@n8n/backend-services';
|
||||
|
||||
export class TransferWorkflowError extends ResponseError {
|
||||
constructor(message: string) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { NotFoundError } from './not-found.error';
|
||||
import { NotFoundError } from '@n8n/backend-services';
|
||||
|
||||
export const webhookNotFoundErrorMessage = ({
|
||||
path,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { BadRequestError } from './bad-request.error';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
|
||||
/**
|
||||
* Error thrown when a workflow fails to activate due to a node-level error.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { BadRequestError } from './bad-request.error';
|
||||
import { BadRequestError } from '@n8n/backend-services';
|
||||
|
||||
/**
|
||||
* Error thrown when a workflow fails to deactivate, e.g. because a
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import type {
|
|||
WorkflowPublishForbiddenDetails,
|
||||
WorkflowPublishForbiddenReason,
|
||||
} from '@n8n/api-types';
|
||||
|
||||
import { ForbiddenError } from './forbidden.error';
|
||||
import { ForbiddenError } from '@n8n/backend-services';
|
||||
|
||||
const messages: Record<WorkflowPublishForbiddenReason, string> = {
|
||||
insufficient_api_key_scope:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { CreateEvaluationCollectionPayload } from '@n8n/api-types';
|
||||
import type { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import { DbLock } from '@n8n/db';
|
||||
import type {
|
||||
DbLockService,
|
||||
|
|
@ -20,8 +21,6 @@ import { OperationalError } from 'n8n-workflow';
|
|||
import type { Mocked } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { Telemetry } from '@/telemetry';
|
||||
import type { WorkflowHistoryService } from '@/workflows/workflow-history/workflow-history.service';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
import { EVAL_COLLECTIONS_FLAG } from '@n8n/api-types';
|
||||
import type { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest, User } from '@n8n/db';
|
||||
import { ControllerRegistryMetadata } from '@n8n/decorators';
|
||||
import { Container } from '@n8n/di';
|
||||
import type { Mocked } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { PostHogClient } from '@/posthog';
|
||||
|
||||
import type { EvaluationCollectionService } from '../evaluation-collection.service';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { Mocked } from 'vitest';
|
||||
import type { AuthenticatedRequest, EvaluationConfig, User, WorkflowEntity } from '@n8n/db';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { WorkflowFinderService } from '@/workflows/workflow-finder.service';
|
||||
|
||||
import { EvaluationApiError } from '../evaluation-api-error';
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { BadRequestError, ForbiddenError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { Mocked, MockedFunction } from 'vitest';
|
||||
import type { AddDatasetRowDto } from '@n8n/api-types';
|
||||
import type { EvaluationConfig, IExecutionResponse, User } from '@n8n/db';
|
||||
|
|
@ -5,9 +6,6 @@ import type { EvaluationConfigRepository } from '@n8n/db';
|
|||
import { mock } from 'vitest-mock-extended';
|
||||
import type { IConnections, IRunData } from 'n8n-workflow';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { ExecutionPersistence } from '@/executions/execution-persistence';
|
||||
import type { DataTableColumn } from '@/modules/data-table/data-table-column.entity';
|
||||
import type { DataTableService } from '@/modules/data-table/data-table.service';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import type { LicenseState } from '@n8n/backend-common';
|
||||
import { PaymentRequiredError } from '@n8n/backend-services';
|
||||
import { UNLIMITED_LICENSE_QUOTA } from '@n8n/constants';
|
||||
import type {
|
||||
TestCaseExecution,
|
||||
|
|
@ -10,8 +11,6 @@ import type {
|
|||
import type { Mocked } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { PaymentRequiredError } from '@/errors/response-errors/payment-required.error';
|
||||
|
||||
import { EvaluationTestRunService } from '../evaluation-test-run.service';
|
||||
|
||||
describe('EvaluationTestRunService', () => {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { ConflictError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { Mock, Mocked } from 'vitest';
|
||||
import type {
|
||||
EvaluationConfigRepository,
|
||||
|
|
@ -8,8 +9,6 @@ import type {
|
|||
} from '@n8n/db';
|
||||
import type express from 'express';
|
||||
|
||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { TestRunnerService } from '@/evaluation.ee/test-runner/test-runner.service.ee';
|
||||
import { TestRunsController } from '@/evaluation.ee/test-runs.controller.ee';
|
||||
import type { TestRunsRequest } from '@/evaluation.ee/test-runs.types.ee';
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import type {
|
|||
} from '@n8n/api-types';
|
||||
import { metricScalesFromConfig, normalizeMetricScore } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { EvaluationConfig, TestRun, User } from '@n8n/db';
|
||||
import {
|
||||
DbLock,
|
||||
|
|
@ -25,8 +26,6 @@ import { In } from '@n8n/typeorm';
|
|||
import { OperationalError, type IDataObject } from 'n8n-workflow';
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { TestRunnerService } from '@/evaluation.ee/test-runner/test-runner.service.ee';
|
||||
import { Telemetry } from '@/telemetry';
|
||||
import { WorkflowHistoryService } from '@/workflows/workflow-history/workflow-history.service';
|
||||
|
|
|
|||
|
|
@ -5,11 +5,10 @@ import {
|
|||
UpdateEvaluationCollectionDto,
|
||||
} from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest, User } from '@n8n/db';
|
||||
import { Body, Delete, Get, Patch, Post, ProjectScope, RestController } from '@n8n/decorators';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
|
||||
import { EvaluationCollectionService } from './evaluation-collection.service';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import { addDatasetRowSchema, upsertEvaluationConfigSchema } from '@n8n/api-types';
|
||||
import { BadRequestError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest, User } from '@n8n/db';
|
||||
import { Delete, Get, Post, Put, RestController } from '@n8n/decorators';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { WorkflowFinderService } from '@/workflows/workflow-finder.service';
|
||||
|
||||
import { EvaluationConfigService } from './evaluation-config.service';
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import type {
|
|||
DatasetCandidateResponse,
|
||||
DatasetColumnMapping,
|
||||
} from '@n8n/api-types';
|
||||
import { BadRequestError, ForbiddenError, NotFoundError } from '@n8n/backend-services';
|
||||
import type { EvaluationConfig, User } from '@n8n/db';
|
||||
import { EvaluationConfigRepository } from '@n8n/db';
|
||||
import { Service } from '@n8n/di';
|
||||
|
|
@ -23,9 +24,6 @@ import type {
|
|||
JsonValue,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { ExecutionPersistence } from '@/executions/execution-persistence';
|
||||
import type { DataTableColumn } from '@/modules/data-table/data-table-column.entity';
|
||||
import { DataTableService } from '@/modules/data-table/data-table.service';
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import { LicenseState } from '@n8n/backend-common';
|
||||
import { PaymentRequiredError } from '@n8n/backend-services';
|
||||
import { UNLIMITED_LICENSE_QUOTA } from '@n8n/constants';
|
||||
import type { TestRun } from '@n8n/db';
|
||||
import { TestCaseExecutionRepository, TestRunRepository, WorkflowRepository } from '@n8n/db';
|
||||
import { Service } from '@n8n/di';
|
||||
|
||||
import { PaymentRequiredError } from '@/errors/response-errors/payment-required.error';
|
||||
|
||||
type Pagination = { offset: number; limit: number };
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import type { GenerateInsightsDto } from '@n8n/api-types';
|
||||
import { EVAL_COLLECTIONS_FLAG } from '@n8n/api-types';
|
||||
import type { Logger } from '@n8n/backend-common';
|
||||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest, User } from '@n8n/db';
|
||||
import { ControllerRegistryMetadata } from '@n8n/decorators';
|
||||
import { Container } from '@n8n/di';
|
||||
import type { Mocked } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { PostHogClient } from '@/posthog';
|
||||
|
||||
import { EvalInsightsController } from '../eval-insights.controller.ee';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import type { AiInsightsResponse } from '@n8n/api-types';
|
||||
import type { LicenseState, Logger } from '@n8n/backend-common';
|
||||
import { BadRequestError, ForbiddenError, NotFoundError } from '@n8n/backend-services';
|
||||
import type {
|
||||
EvaluationCollection,
|
||||
EvaluationCollectionRepository,
|
||||
|
|
@ -10,9 +11,6 @@ import type {
|
|||
import type { Mocked } from 'vitest';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
|
||||
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
|
||||
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import type { Telemetry } from '@/telemetry';
|
||||
|
||||
import { DETERMINISTIC_MODEL_TAG, EvalInsightsService } from '../eval-insights.service';
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { EVAL_COLLECTIONS_FLAG, GenerateInsightsDto } from '@n8n/api-types';
|
||||
import { Logger } from '@n8n/backend-common';
|
||||
import { NotFoundError } from '@n8n/backend-services';
|
||||
import type { AuthenticatedRequest, User } from '@n8n/db';
|
||||
import { Body, Post, ProjectScope, RestController } from '@n8n/decorators';
|
||||
|
||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||
import { PostHogClient } from '@/posthog';
|
||||
|
||||
import { EvalInsightsService } from './eval-insights.service';
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user