Skip to content

Commit

Permalink
refactor(core): Mark all backend Enterprise Edition files and dirs (#…
Browse files Browse the repository at this point in the history
…12350)
  • Loading branch information
ivov authored Dec 24, 2024
1 parent 471d7b9 commit f754b22
Show file tree
Hide file tree
Showing 194 changed files with 161 additions and 153 deletions.
8 changes: 5 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
Portions of this software are licensed as follows:

- Content of branches other than the main branch (i.e. "master") are not licensed.
- Source code files that contain ".ee." in their filename are NOT licensed under the Sustainable Use License.
To use source code files that contain ".ee." in their filename you must hold a valid n8n Enterprise License
specifically allowing you access to such source code files and as defined in "LICENSE_EE.md".
- Source code files that contain ".ee." in their filename or ".ee" in their dirname are NOT licensed under
the Sustainable Use License.
To use source code files that contain ".ee." in their filename or ".ee" in their dirname you must hold a
valid n8n Enterprise License specifically allowing you access to such source code files and as defined
in "LICENSE_EE.md".
- All third party components incorporated into the n8n Software are licensed under the original license
provided by the owner of the applicable component.
- Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Scope, ScopeLevels, GlobalScopes, MaskLevels } from './types';
import type { Scope, ScopeLevels, GlobalScopes, MaskLevels } from './types.ee';

export function combineScopes(userScopes: GlobalScopes, masks?: MaskLevels): Set<Scope>;
export function combineScopes(userScopes: ScopeLevels, masks?: MaskLevels): Set<Scope>;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { combineScopes } from './combineScopes';
import type { Scope, ScopeLevels, GlobalScopes, ScopeOptions, MaskLevels } from './types';
import { combineScopes } from './combineScopes.ee';
import type { Scope, ScopeLevels, GlobalScopes, ScopeOptions, MaskLevels } from './types.ee';

export function hasScope(
scope: Scope | Scope[],
Expand Down
8 changes: 4 additions & 4 deletions packages/@n8n/permissions/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type * from './types';
export * from './constants';
export * from './hasScope';
export * from './combineScopes';
export type * from './types.ee';
export * from './constants.ee';
export * from './hasScope.ee';
export * from './combineScopes.ee';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RESOURCES } from './constants';
import type { RESOURCES } from './constants.ee';

export type Resource = keyof typeof RESOURCES;

Expand Down
4 changes: 2 additions & 2 deletions packages/@n8n/permissions/test/hasScope.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hasScope } from '@/hasScope';
import type { Scope } from '@/types';
import { hasScope } from '@/hasScope.ee';
import type { Scope } from '@/types.ee';

const ownerPermissions: Scope[] = [
'workflow:create',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { CredentialsHelper } from '@/credentials-helper';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { VariablesService } from '@/environments/variables/variables.service.ee';
import { VariablesService } from '@/environments.ee/variables/variables.service.ee';
import { EventService } from '@/events/event.service';
import { ExternalHooks } from '@/external-hooks';
import { SecretsHelper } from '@/secrets-helpers';
import { SecretsHelper } from '@/secrets-helpers.ee';
import { WorkflowStatisticsService } from '@/services/workflow-statistics.service';
import { SubworkflowPolicyChecker } from '@/subworkflows/subworkflow-policy-checker.service';
import { Telemetry } from '@/telemetry';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/auth/methods/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { User } from '@/databases/entities/user';
import { UserRepository } from '@/databases/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error';
import { EventService } from '@/events/event.service';
import { isLdapLoginEnabled } from '@/ldap/helpers.ee';
import { isLdapLoginEnabled } from '@/ldap.ee/helpers.ee';
import { PasswordUtility } from '@/services/password.utility';

export const handleEmailLogin = async (
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/auth/methods/ldap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
mapLdapAttributesToUser,
createLdapAuthIdentity,
updateLdapUserOnLocalDb,
} from '@/ldap/helpers.ee';
import { LdapService } from '@/ldap/ldap.service.ee';
} from '@/ldap.ee/helpers.ee';
import { LdapService } from '@/ldap.ee/ldap.service.ee';

export const handleLdapLogin = async (
loginId: string,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import { MessageEventBus } from '@/eventbus/message-event-bus/message-event-bus'
import { TelemetryEventRelay } from '@/events/relays/telemetry.event-relay';
import { initExpressionEvaluator } from '@/expression-evaluator';
import { ExternalHooks } from '@/external-hooks';
import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee';
import { ExternalSecretsManager } from '@/external-secrets.ee/external-secrets-manager.ee';
import { License } from '@/license';
import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials';
import { NodeTypes } from '@/node-types';
import { PostHogClient } from '@/posthog';
import { ShutdownService } from '@/shutdown/shutdown.service';
import { WorkflowHistoryManager } from '@/workflows/workflow-history/workflow-history-manager.ee';
import { WorkflowHistoryManager } from '@/workflows/workflow-history.ee/workflow-history-manager.ee';

export abstract class BaseCommand extends Command {
protected logger = Container.get(Logger);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/ldap/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { SettingsRepository } from '@/databases/repositories/settings.repository
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { UserRepository } from '@/databases/repositories/user.repository';
import { LDAP_DEFAULT_CONFIGURATION, LDAP_FEATURE_NAME } from '@/ldap/constants';
import { LDAP_DEFAULT_CONFIGURATION, LDAP_FEATURE_NAME } from '@/ldap.ee/constants';
import { WorkflowService } from '@/workflows/workflow.service';

import { BaseCommand } from '../base-command';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { User } from '@/databases/entities/user';
import type { UserRepository } from '@/databases/repositories/user.repository';
import type { EventService } from '@/events/event.service';
import type { AuthenticatedRequest } from '@/requests';
import type { ProjectService } from '@/services/project.service';
import type { ProjectService } from '@/services/project.service.ee';

import { UsersController } from '../users.controller';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
getCurrentAuthenticationMethod,
isLdapCurrentAuthenticationMethod,
isSamlCurrentAuthenticationMethod,
} from '@/sso/sso-helpers';
} from '@/sso.ee/sso-helpers';

@RestController()
export class AuthController {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/invitation.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { PostHogClient } from '@/posthog';
import { UserRequest } from '@/requests';
import { PasswordUtility } from '@/services/password.utility';
import { UserService } from '@/services/user.service';
import { isSamlLicensedAndEnabled } from '@/sso/saml/saml-helpers';
import { isSamlLicensedAndEnabled } from '@/sso.ee/saml/saml-helpers';

@RestController('/invitations')
export class InvitationController {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/me.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { MfaService } from '@/mfa/mfa.service';
import { AuthenticatedRequest, MeRequest } from '@/requests';
import { PasswordUtility } from '@/services/password.utility';
import { UserService } from '@/services/user.service';
import { isSamlLicensedAndEnabled } from '@/sso/saml/saml-helpers';
import { isSamlLicensedAndEnabled } from '@/sso.ee/saml/saml-helpers';

import { PersonalizationSurveyAnswersV4 } from './survey-answers.dto';
@RestController('/me')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import type { CredentialsEntity } from '@/databases/entities/credentials-entity'
import type { User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { VariablesService } from '@/environments/variables/variables.service.ee';
import { VariablesService } from '@/environments.ee/variables/variables.service.ee';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { ExternalHooks } from '@/external-hooks';
import type { OAuthRequest } from '@/requests';
import { SecretsHelper } from '@/secrets-helpers';
import { SecretsHelper } from '@/secrets-helpers.ee';
import { mockInstance } from '@test/mocking';

describe('OAuth1CredentialController', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import type { CredentialsEntity } from '@/databases/entities/credentials-entity'
import type { User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { VariablesService } from '@/environments/variables/variables.service.ee';
import { VariablesService } from '@/environments.ee/variables/variables.service.ee';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { ExternalHooks } from '@/external-hooks';
import type { OAuthRequest } from '@/requests';
import { SecretsHelper } from '@/secrets-helpers';
import { SecretsHelper } from '@/secrets-helpers.ee';
import { mockInstance } from '@test/mocking';

describe('OAuth2CredentialController', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/password-reset.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { MfaService } from '@/mfa/mfa.service';
import { PasswordResetRequest } from '@/requests';
import { PasswordUtility } from '@/services/password.utility';
import { UserService } from '@/services/user.service';
import { isSamlCurrentAuthenticationMethod } from '@/sso/sso-helpers';
import { isSamlCurrentAuthenticationMethod } from '@/sso.ee/sso-helpers';
import { UserManagementMailer } from '@/user-management/email';

@RestController()
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/project.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
ProjectService,
TeamProjectOverQuotaError,
UnlicensedProjectRoleError,
} from '@/services/project.service';
} from '@/services/project.service.ee';
import { RoleService } from '@/services/role.service';

@RestController('/projects')
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ExternalHooks } from '@/external-hooks';
import type { PublicUser } from '@/interfaces';
import { listQueryMiddleware } from '@/middlewares';
import { AuthenticatedRequest, ListQuery, UserRequest } from '@/requests';
import { ProjectService } from '@/services/project.service';
import { ProjectService } from '@/services/project.service.ee';
import { UserService } from '@/services/user.service';
import { WorkflowService } from '@/workflows/workflow.service';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/credentials/credentials.service.ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { SharedCredentialsRepository } from '@/databases/repositories/shared-cre
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { TransferCredentialError } from '@/errors/response-errors/transfer-credential.error';
import { OwnershipService } from '@/services/ownership.service';
import { ProjectService } from '@/services/project.service';
import { ProjectService } from '@/services/project.service.ee';
import { RoleService } from '@/services/role.service';

import { CredentialsService } from './credentials.service';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/credentials/credentials.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { ExternalHooks } from '@/external-hooks';
import { validateEntity } from '@/generic-helpers';
import type { ICredentialsDb } from '@/interfaces';
import { userHasScopes } from '@/permissions/check-access';
import { userHasScopes } from '@/permissions.ee/check-access';
import type { CredentialRequest, ListQuery } from '@/requests';
import { CredentialsTester } from '@/services/credentials-tester.service';
import { OwnershipService } from '@/services/ownership.service';
import { ProjectService } from '@/services/project.service';
import { ProjectService } from '@/services/project.service.ee';
import { RoleService } from '@/services/role.service';

export type CredentialsGetSharedOptions =
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/databases/entities/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
GLOBAL_OWNER_SCOPES,
GLOBAL_MEMBER_SCOPES,
GLOBAL_ADMIN_SCOPES,
} from '@/permissions/global-roles';
} from '@/permissions.ee/global-roles';
import { NoUrl } from '@/validators/no-url.validator';
import { NoXss } from '@/validators/no-xss.validator';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import { LDAP_DEFAULT_CONFIGURATION, LDAP_FEATURE_NAME } from '@/ldap/constants';
import { LDAP_DEFAULT_CONFIGURATION, LDAP_FEATURE_NAME } from '@/ldap.ee/constants';

export class CreateLdapEntities1674509946020 implements ReversibleMigration {
async up({ escape, dbType, isMysql, runQuery }: MigrationContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { CredentialsEntity } from '@/databases/entities/credentials-entity'
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import type { User } from '@/databases/entities/user';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { GLOBAL_MEMBER_SCOPES, GLOBAL_OWNER_SCOPES } from '@/permissions/global-roles';
import { GLOBAL_MEMBER_SCOPES, GLOBAL_OWNER_SCOPES } from '@/permissions.ee/global-roles';
import { mockEntityManager } from '@test/mocking';

describe('SharedCredentialsRepository', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ErrorReporter } from 'n8n-core';
import { Service } from 'typedi';

import config from '@/config';
import { EXTERNAL_SECRETS_DB_KEY } from '@/external-secrets/constants';
import { EXTERNAL_SECRETS_DB_KEY } from '@/external-secrets.ee/constants';

import { Settings } from '../entities/settings';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/decorators/controller.registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { inProduction, RESPONSE_ERROR_MESSAGES } from '@/constants';
import { UnauthenticatedError } from '@/errors/response-errors/unauthenticated.error';
import type { BooleanLicenseFeature } from '@/interfaces';
import { License } from '@/license';
import { userHasScopes } from '@/permissions/check-access';
import { userHasScopes } from '@/permissions.ee/check-access';
import type { AuthenticatedRequest } from '@/requests';
import { send } from '@/response-helper'; // TODO: move `ResponseHelper.send` to this file

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import Container from 'typedi';
import {
SOURCE_CONTROL_SSH_FOLDER,
SOURCE_CONTROL_GIT_FOLDER,
} from '@/environments/source-control/constants';
} from '@/environments.ee/source-control/constants';
import {
generateSshKeyPair,
getRepoType,
getTrackingInformationFromPostPushResult,
getTrackingInformationFromPrePushResult,
getTrackingInformationFromPullResult,
sourceControlFoldersExistCheck,
} from '@/environments/source-control/source-control-helper.ee';
import { SourceControlPreferencesService } from '@/environments/source-control/source-control-preferences.service.ee';
import type { SourceControlPreferences } from '@/environments/source-control/types/source-control-preferences';
import type { SourceControlledFile } from '@/environments/source-control/types/source-controlled-file';
} from '@/environments.ee/source-control/source-control-helper.ee';
import { SourceControlPreferencesService } from '@/environments.ee/source-control/source-control-preferences.service.ee';
import type { SourceControlPreferences } from '@/environments.ee/source-control/types/source-control-preferences';
import type { SourceControlledFile } from '@/environments.ee/source-control/types/source-controlled-file';
import { License } from '@/license';
import { mockInstance } from '@test/mocking';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { mock } from 'jest-mock-extended';
import { InstanceSettings } from 'n8n-core';
import { Container } from 'typedi';

import { SourceControlPreferencesService } from '@/environments/source-control/source-control-preferences.service.ee';
import { SourceControlService } from '@/environments/source-control/source-control.service.ee';
import { SourceControlPreferencesService } from '@/environments.ee/source-control/source-control-preferences.service.ee';
import { SourceControlService } from '@/environments.ee/source-control/source-control.service.ee';

describe('SourceControlService', () => {
const preferencesService = new SourceControlPreferencesService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NotFoundError } from '@/errors/response-errors/not-found.error';
import {
testMetricCreateRequestBodySchema,
testMetricPatchRequestBodySchema,
} from '@/evaluation/metric.schema';
} from '@/evaluation.ee/metric.schema';
import { getSharedWorkflowIds } from '@/public-api/v1/handlers/workflows/workflows.service';

import { TestDefinitionService } from './test-definition.service.ee';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { NotFoundError } from '@/errors/response-errors/not-found.error';
import {
testDefinitionCreateRequestBodySchema,
testDefinitionPatchRequestBodySchema,
} from '@/evaluation/test-definition.schema';
import { TestRunnerService } from '@/evaluation/test-runner/test-runner.service.ee';
} from '@/evaluation.ee/test-definition.schema';
import { TestRunnerService } from '@/evaluation.ee/test-runner/test-runner.service.ee';
import { listQueryMiddleware } from '@/middlewares';
import { getSharedWorkflowIds } from '@/public-api/v1/handlers/workflows/workflows.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TestRunRepository } from '@/databases/repositories/test-run.repository.ee';
import { Delete, Get, RestController } from '@/decorators';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { TestRunsRequest } from '@/evaluation/test-definitions.types.ee';
import { TestRunsRequest } from '@/evaluation.ee/test-definitions.types.ee';
import { listQueryMiddleware } from '@/middlewares';
import { getSharedWorkflowIds } from '@/public-api/v1/handlers/workflows/workflows.service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
import Container from 'typedi';

import { CredentialsHelper } from '@/credentials-helper';
import * as SecretsHelpers from '@/external-secrets/external-secrets-helper.ee';
import * as SecretsHelpers from '@/external-secrets.ee/external-secrets-helper.ee';

import { MessageEventBusDestination } from './message-event-bus-destination.ee';
import { eventMessageGenericDestinationTestEvent } from '../event-message-classes/event-message-generic';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Cipher } from 'n8n-core';
import { Container } from 'typedi';

import { SettingsRepository } from '@/databases/repositories/settings.repository';
import { ExternalSecretsManager } from '@/external-secrets/external-secrets-manager.ee';
import { ExternalSecretsProviders } from '@/external-secrets/external-secrets-providers.ee';
import { ExternalSecretsManager } from '@/external-secrets.ee/external-secrets-manager.ee';
import { ExternalSecretsProviders } from '@/external-secrets.ee/external-secrets-providers.ee';
import type { ExternalSecretsSettings } from '@/interfaces';
import { License } from '@/license';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { INodeProperties } from 'n8n-workflow';
import Container from 'typedi';

import { UnknownAuthTypeError } from '@/errors/unknown-auth-type.error';
import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets/constants';
import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets.ee/constants';
import type { SecretsProvider, SecretsProviderState } from '@/interfaces';

import { AwsSecretsClient } from './aws-secrets-client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ensureError } from 'n8n-workflow';
import type { INodeProperties } from 'n8n-workflow';
import Container from 'typedi';

import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets/constants';
import { DOCS_HELP_NOTICE, EXTERNAL_SECRETS_NAME_REGEX } from '@/external-secrets.ee/constants';
import type { SecretsProvider, SecretsProviderState } from '@/interfaces';

import type { AzureKeyVaultContext } from './types';
Expand Down
Loading

0 comments on commit f754b22

Please sign in to comment.