diff --git a/frontend/src/hooks/api/actions/useImportApi/useImportApi.ts b/frontend/src/hooks/api/actions/useImportApi/useImportApi.ts index ab76db05a8..383a07eced 100644 --- a/frontend/src/hooks/api/actions/useImportApi/useImportApi.ts +++ b/frontend/src/hooks/api/actions/useImportApi/useImportApi.ts @@ -14,7 +14,7 @@ export const useImportApi = () => { const { trackEvent } = usePlausibleTracker(); const createImport = async (payload: ImportQuerySchema) => { - const path = `api/admin/features-batch/full-import`; + const path = `api/admin/features-batch/import`; const req = createRequest(path, { method: 'POST', body: JSON.stringify(payload), diff --git a/frontend/src/hooks/api/actions/useValidateImportApi/useValidateImportApi.ts b/frontend/src/hooks/api/actions/useValidateImportApi/useValidateImportApi.ts index 09ce8eaf68..d37c5be34a 100644 --- a/frontend/src/hooks/api/actions/useValidateImportApi/useValidateImportApi.ts +++ b/frontend/src/hooks/api/actions/useValidateImportApi/useValidateImportApi.ts @@ -19,7 +19,7 @@ export const useValidateImportApi = () => { const validateImport = async ( payload: ImportQuerySchema ): Promise => { - const path = `api/admin/features-batch/full-validate`; + const path = `api/admin/features-batch/validate`; const req = createRequest(path, { method: 'POST', body: JSON.stringify(payload), diff --git a/src/lib/db/index.ts b/src/lib/db/index.ts index ac7a18be1a..02c2ed1378 100644 --- a/src/lib/db/index.ts +++ b/src/lib/db/index.ts @@ -36,7 +36,7 @@ import { FavoriteProjectsStore } from './favorite-projects-store'; import { AccountStore } from './account-store'; import ProjectStatsStore from './project-stats-store'; import { Db } from './db'; -import { ImportTogglesStore } from '../export-import-toggles/import-toggles-store'; +import { ImportTogglesStore } from '../features/export-import-toggles/import-toggles-store'; export const createStores = ( config: IUnleashConfig, diff --git a/src/lib/access/index.ts b/src/lib/features/access/createAccessService.ts similarity index 65% rename from src/lib/access/index.ts rename to src/lib/features/access/createAccessService.ts index 56b1979be0..1887a57512 100644 --- a/src/lib/access/index.ts +++ b/src/lib/features/access/createAccessService.ts @@ -1,17 +1,17 @@ import { Db, IUnleashConfig } from 'lib/server-impl'; -import EventStore from '../db/event-store'; -import GroupStore from '../db/group-store'; -import { AccountStore } from '../db/account-store'; -import RoleStore from '../db/role-store'; -import EnvironmentStore from '../db/environment-store'; -import { AccessStore } from '../db/access-store'; -import { AccessService, GroupService } from '../services'; -import FakeEventStore from '../../test/fixtures/fake-event-store'; -import FakeGroupStore from '../../test/fixtures/fake-group-store'; -import { FakeAccountStore } from '../../test/fixtures/fake-account-store'; -import FakeRoleStore from '../../test/fixtures/fake-role-store'; -import FakeEnvironmentStore from '../../test/fixtures/fake-environment-store'; -import FakeAccessStore from '../../test/fixtures/fake-access-store'; +import EventStore from '../../db/event-store'; +import GroupStore from '../../db/group-store'; +import { AccountStore } from '../../db/account-store'; +import RoleStore from '../../db/role-store'; +import EnvironmentStore from '../../db/environment-store'; +import { AccessStore } from '../../db/access-store'; +import { AccessService, GroupService } from '../../services'; +import FakeGroupStore from '../../../test/fixtures/fake-group-store'; +import FakeEventStore from '../../../test/fixtures/fake-event-store'; +import { FakeAccountStore } from '../../../test/fixtures/fake-account-store'; +import FakeRoleStore from '../../../test/fixtures/fake-role-store'; +import FakeEnvironmentStore from '../../../test/fixtures/fake-environment-store'; +import FakeAccessStore from '../../../test/fixtures/fake-access-store'; export const createAccessService = ( db: Db, diff --git a/src/lib/export-import-toggles/index.ts b/src/lib/features/export-import-toggles/createExportImportService.ts similarity index 73% rename from src/lib/export-import-toggles/index.ts rename to src/lib/features/export-import-toggles/createExportImportService.ts index f65c3285df..0a58d5cfd6 100644 --- a/src/lib/export-import-toggles/index.ts +++ b/src/lib/features/export-import-toggles/createExportImportService.ts @@ -1,40 +1,43 @@ -import { Db } from '../db/db'; -import { IUnleashConfig } from '../types'; +import { Db } from '../../db/db'; +import { IUnleashConfig } from '../../types'; import ExportImportService from './export-import-service'; import { ImportTogglesStore } from './import-toggles-store'; -import FeatureToggleStore from '../db/feature-toggle-store'; -import TagStore from '../db/tag-store'; -import TagTypeStore from '../db/tag-type-store'; -import ProjectStore from '../db/project-store'; -import FeatureTagStore from '../db/feature-tag-store'; -import StrategyStore from '../db/strategy-store'; -import ContextFieldStore from '../db/context-field-store'; -import EventStore from '../db/event-store'; -import FeatureStrategiesStore from '../db/feature-strategy-store'; +import FeatureToggleStore from '../../db/feature-toggle-store'; +import TagStore from '../../db/tag-store'; +import TagTypeStore from '../../db/tag-type-store'; +import ProjectStore from '../../db/project-store'; +import FeatureTagStore from '../../db/feature-tag-store'; +import StrategyStore from '../../db/strategy-store'; +import ContextFieldStore from '../../db/context-field-store'; +import EventStore from '../../db/event-store'; +import FeatureStrategiesStore from '../../db/feature-strategy-store'; import { ContextService, FeatureTagService, StrategyService, TagTypeService, -} from '../services'; -import { createAccessService, createFakeAccessService } from '../access'; +} from '../../services'; +import { + createAccessService, + createFakeAccessService, +} from '../access/createAccessService'; import { createFakeFeatureToggleService, createFeatureToggleService, -} from '../feature-toggle'; -import SegmentStore from '../db/segment-store'; -import { FeatureEnvironmentStore } from '../db/feature-environment-store'; -import FakeFeatureToggleStore from '../../test/fixtures/fake-feature-toggle-store'; -import FakeTagStore from '../../test/fixtures/fake-tag-store'; -import FakeTagTypeStore from '../../test/fixtures/fake-tag-type-store'; -import FakeSegmentStore from '../../test/fixtures/fake-segment-store'; -import FakeProjectStore from '../../test/fixtures/fake-project-store'; -import FakeFeatureTagStore from '../../test/fixtures/fake-feature-tag-store'; -import FakeContextFieldStore from '../../test/fixtures/fake-context-field-store'; -import FakeEventStore from '../../test/fixtures/fake-event-store'; -import FakeFeatureStrategiesStore from '../../test/fixtures/fake-feature-strategies-store'; -import FakeFeatureEnvironmentStore from '../../test/fixtures/fake-feature-environment-store'; -import FakeStrategiesStore from '../../test/fixtures/fake-strategies-store'; +} from '../feature-toggle/createFeatureToggleService'; +import SegmentStore from '../../db/segment-store'; +import { FeatureEnvironmentStore } from '../../db/feature-environment-store'; +import FakeFeatureToggleStore from '../../../test/fixtures/fake-feature-toggle-store'; +import FakeTagStore from '../../../test/fixtures/fake-tag-store'; +import FakeTagTypeStore from '../../../test/fixtures/fake-tag-type-store'; +import FakeSegmentStore from '../../../test/fixtures/fake-segment-store'; +import FakeProjectStore from '../../../test/fixtures/fake-project-store'; +import FakeFeatureTagStore from '../../../test/fixtures/fake-feature-tag-store'; +import FakeContextFieldStore from '../../../test/fixtures/fake-context-field-store'; +import FakeEventStore from '../../../test/fixtures/fake-event-store'; +import FakeFeatureStrategiesStore from '../../../test/fixtures/fake-feature-strategies-store'; +import FakeFeatureEnvironmentStore from '../../../test/fixtures/fake-feature-environment-store'; +import FakeStrategiesStore from '../../../test/fixtures/fake-strategies-store'; export const createFakeExportImportTogglesService = ( config: IUnleashConfig, diff --git a/src/lib/export-import-toggles/export-import-controller.ts b/src/lib/features/export-import-toggles/export-import-controller.ts similarity index 91% rename from src/lib/export-import-toggles/export-import-controller.ts rename to src/lib/features/export-import-toggles/export-import-controller.ts index 5e1cbb1c97..786c567661 100644 --- a/src/lib/export-import-toggles/export-import-controller.ts +++ b/src/lib/features/export-import-toggles/export-import-controller.ts @@ -1,16 +1,16 @@ import { Response } from 'express'; import { Knex } from 'knex'; -import Controller from '../routes/controller'; -import { Logger } from '../logger'; +import Controller from '../../routes/controller'; +import { Logger } from '../../logger'; import ExportImportService from './export-import-service'; -import { OpenApiService } from '../services'; -import { TransactionCreator, UnleashTransaction } from '../db/transaction'; +import { OpenApiService } from '../../services'; +import { TransactionCreator, UnleashTransaction } from '../../db/transaction'; import { IUnleashConfig, IUnleashServices, NONE, serializeDates, -} from '../types'; +} from '../../types'; import { createRequestSchema, createResponseSchema, @@ -19,10 +19,10 @@ import { exportResultSchema, ImportTogglesSchema, importTogglesValidateSchema, -} from '../openapi'; -import { IAuthRequest } from '../routes/unleash-types'; -import { extractUsername } from '../util'; -import { InvalidOperationError } from '../error'; +} from '../../openapi'; +import { IAuthRequest } from '../../routes/unleash-types'; +import { extractUsername } from '../../util'; +import { InvalidOperationError } from '../../error'; class ExportImportController extends Controller { private logger: Logger; @@ -76,7 +76,7 @@ class ExportImportController extends Controller { }); this.route({ method: 'post', - path: '/full-validate', + path: '/validate', permission: NONE, handler: this.validateImport, middleware: [ @@ -97,7 +97,7 @@ class ExportImportController extends Controller { }); this.route({ method: 'post', - path: '/full-import', + path: '/import', permission: NONE, handler: this.importData, middleware: [ diff --git a/src/lib/export-import-toggles/export-import-permissions.e2e.test.ts b/src/lib/features/export-import-toggles/export-import-permissions.e2e.test.ts similarity index 95% rename from src/lib/export-import-toggles/export-import-permissions.e2e.test.ts rename to src/lib/features/export-import-toggles/export-import-permissions.e2e.test.ts index 79535a3f7a..6c36c6a48c 100644 --- a/src/lib/export-import-toggles/export-import-permissions.e2e.test.ts +++ b/src/lib/features/export-import-toggles/export-import-permissions.e2e.test.ts @@ -1,9 +1,9 @@ import { IUnleashTest, setupAppWithAuth, -} from '../../test/e2e/helpers/test-helper'; -import dbInit, { ITestDb } from '../../test/e2e/helpers/database-init'; -import getLogger from '../../test/fixtures/no-logger'; +} from '../../../test/e2e/helpers/test-helper'; +import dbInit, { ITestDb } from '../../../test/e2e/helpers/database-init'; +import getLogger from '../../../test/fixtures/no-logger'; import { DEFAULT_PROJECT, IContextFieldStore, @@ -13,11 +13,11 @@ import { IProjectStore, IUnleashStores, RoleName, -} from '../types'; -import { ImportTogglesSchema, VariantsSchema } from '../openapi'; -import { IContextFieldDto } from '../types/stores/context-field-store'; -import { AccessService } from '../services'; -import { DEFAULT_ENV } from '../util'; +} from '../../types'; +import { ImportTogglesSchema, VariantsSchema } from '../../openapi'; +import { IContextFieldDto } from '../../types/stores/context-field-store'; +import { AccessService } from '../../services'; +import { DEFAULT_ENV } from '../../util'; let app: IUnleashTest; let db: ITestDb; @@ -35,7 +35,7 @@ const adminUserName = 'admin-user'; const validateImport = (importPayload: ImportTogglesSchema, status = 200) => app.request - .post('/api/admin/features-batch/full-validate') + .post('/api/admin/features-batch/validate') .send(importPayload) .set('Content-Type', 'application/json') .expect(status); diff --git a/src/lib/export-import-toggles/export-import-service.ts b/src/lib/features/export-import-toggles/export-import-service.ts similarity index 95% rename from src/lib/export-import-toggles/export-import-service.ts rename to src/lib/features/export-import-toggles/export-import-service.ts index 080a7bf90f..63deb7b41b 100644 --- a/src/lib/export-import-toggles/export-import-service.ts +++ b/src/lib/features/export-import-toggles/export-import-service.ts @@ -1,37 +1,37 @@ -import { IUnleashConfig } from '../types/option'; +import { IUnleashConfig } from '../../types/option'; import { FeatureToggleDTO, IFeatureStrategy, IFeatureStrategySegment, IVariant, -} from '../types/model'; -import { Logger } from '../logger'; -import { IFeatureTagStore } from '../types/stores/feature-tag-store'; -import { ITagTypeStore } from '../types/stores/tag-type-store'; -import { IEventStore } from '../types/stores/event-store'; -import { IStrategy } from '../types/stores/strategy-store'; -import { IFeatureToggleStore } from '../types/stores/feature-toggle-store'; -import { IFeatureStrategiesStore } from '../types/stores/feature-strategies-store'; -import { IFeatureEnvironmentStore } from '../types/stores/feature-environment-store'; -import { IContextFieldStore, IUnleashStores } from '../types/stores'; -import { ISegmentStore } from '../types/stores/segment-store'; -import { ExportQuerySchema } from '../openapi/spec/export-query-schema'; +} from '../../types/model'; +import { Logger } from '../../logger'; +import { IFeatureTagStore } from '../../types/stores/feature-tag-store'; +import { ITagTypeStore } from '../../types/stores/tag-type-store'; +import { IEventStore } from '../../types/stores/event-store'; +import { IStrategy } from '../../types/stores/strategy-store'; +import { IFeatureToggleStore } from '../../types/stores/feature-toggle-store'; +import { IFeatureStrategiesStore } from '../../types/stores/feature-strategies-store'; +import { IFeatureEnvironmentStore } from '../../types/stores/feature-environment-store'; +import { IContextFieldStore, IUnleashStores } from '../../types/stores'; +import { ISegmentStore } from '../../types/stores/segment-store'; +import { ExportQuerySchema } from '../../openapi/spec/export-query-schema'; import { FEATURES_EXPORTED, FEATURES_IMPORTED, IFlagResolver, IUnleashServices, WithRequired, -} from '../types'; +} from '../../types'; import { ExportResultSchema, FeatureStrategySchema, ImportTogglesValidateSchema, -} from '../openapi'; -import { ImportTogglesSchema } from '../openapi/spec/import-toggles-schema'; -import User from '../types/user'; -import { BadDataError } from '../error'; -import { extractUsernameFromUser } from '../util'; +} from '../../openapi'; +import { ImportTogglesSchema } from '../../openapi/spec/import-toggles-schema'; +import User from '../../types/user'; +import { BadDataError } from '../../error'; +import { extractUsernameFromUser } from '../../util'; import { AccessService, ContextService, @@ -39,7 +39,7 @@ import { FeatureToggleService, StrategyService, TagTypeService, -} from '../services'; +} from '../../services'; import { isValidField } from './import-context-validation'; import { IImportTogglesStore } from './import-toggles-store-type'; import { ImportPermissionsService } from './import-permissions-service'; diff --git a/src/lib/export-import-toggles/export-import.e2e.test.ts b/src/lib/features/export-import-toggles/export-import.e2e.test.ts similarity index 97% rename from src/lib/export-import-toggles/export-import.e2e.test.ts rename to src/lib/features/export-import-toggles/export-import.e2e.test.ts index b7e533906d..684549465e 100644 --- a/src/lib/export-import-toggles/export-import.e2e.test.ts +++ b/src/lib/features/export-import-toggles/export-import.e2e.test.ts @@ -1,9 +1,9 @@ import { IUnleashTest, setupAppWithCustomConfig, -} from '../../test/e2e/helpers/test-helper'; -import dbInit, { ITestDb } from '../../test/e2e/helpers/database-init'; -import getLogger from '../../test/fixtures/no-logger'; +} from '../../../test/e2e/helpers/test-helper'; +import dbInit, { ITestDb } from '../../../test/e2e/helpers/database-init'; +import getLogger from '../../../test/fixtures/no-logger'; import { DEFAULT_PROJECT, FeatureToggleDTO, @@ -15,15 +15,15 @@ import { ISegment, IStrategyConfig, IVariant, -} from '../types'; -import { DEFAULT_ENV } from '../util'; +} from '../../types'; +import { DEFAULT_ENV } from '../../util'; import { ContextFieldSchema, ImportTogglesSchema, VariantsSchema, -} from '../openapi'; -import User from '../types/user'; -import { IContextFieldDto } from '../types/stores/context-field-store'; +} from '../../openapi'; +import User from '../../types/user'; +import { IContextFieldDto } from '../../types/stores/context-field-store'; let app: IUnleashTest; let db: ITestDb; @@ -422,7 +422,7 @@ const importToggles = ( expect: (response) => void = () => {}, ) => app.request - .post('/api/admin/features-batch/full-import') + .post('/api/admin/features-batch/import') .send(importPayload) .set('Content-Type', 'application/json') .expect(status) @@ -543,7 +543,7 @@ const getTags = (feature: string) => const validateImport = (importPayload: ImportTogglesSchema, status = 200) => app.request - .post('/api/admin/features-batch/full-validate') + .post('/api/admin/features-batch/validate') .send(importPayload) .set('Content-Type', 'application/json') .expect(status); diff --git a/src/lib/export-import-toggles/import-context-validation.test.ts b/src/lib/features/export-import-toggles/import-context-validation.test.ts similarity index 100% rename from src/lib/export-import-toggles/import-context-validation.test.ts rename to src/lib/features/export-import-toggles/import-context-validation.test.ts diff --git a/src/lib/export-import-toggles/import-context-validation.ts b/src/lib/features/export-import-toggles/import-context-validation.ts similarity index 85% rename from src/lib/export-import-toggles/import-context-validation.ts rename to src/lib/features/export-import-toggles/import-context-validation.ts index b96e016d5f..04b8460518 100644 --- a/src/lib/export-import-toggles/import-context-validation.ts +++ b/src/lib/features/export-import-toggles/import-context-validation.ts @@ -1,4 +1,4 @@ -import { IContextFieldDto } from '../types/stores/context-field-store'; +import { IContextFieldDto } from '../../types/stores/context-field-store'; export const isValidField = ( importedField: IContextFieldDto, diff --git a/src/lib/export-import-toggles/import-permissions-service.ts b/src/lib/features/export-import-toggles/import-permissions-service.ts similarity index 94% rename from src/lib/export-import-toggles/import-permissions-service.ts rename to src/lib/features/export-import-toggles/import-permissions-service.ts index e1a7358f06..81feb58e9e 100644 --- a/src/lib/export-import-toggles/import-permissions-service.ts +++ b/src/lib/features/export-import-toggles/import-permissions-service.ts @@ -1,8 +1,8 @@ import { IImportTogglesStore } from './import-toggles-store-type'; -import { AccessService, ContextService, TagTypeService } from '../services'; -import { ContextFieldSchema, ImportTogglesSchema } from '../openapi'; -import { ITagType } from '../types/stores/tag-type-store'; -import User from '../types/user'; +import { AccessService, ContextService, TagTypeService } from '../../services'; +import { ContextFieldSchema, ImportTogglesSchema } from '../../openapi'; +import { ITagType } from '../../types/stores/tag-type-store'; +import User from '../../types/user'; import { CREATE_CONTEXT_FIELD, CREATE_FEATURE, @@ -11,8 +11,8 @@ import { UPDATE_FEATURE, UPDATE_FEATURE_ENVIRONMENT_VARIANTS, UPDATE_TAG_TYPE, -} from '../types'; -import { InvalidOperationError } from '../error'; +} from '../../types'; +import { InvalidOperationError } from '../../error'; type Mode = 'regular' | 'change_request'; diff --git a/src/lib/export-import-toggles/import-toggles-store-type.ts b/src/lib/features/export-import-toggles/import-toggles-store-type.ts similarity index 100% rename from src/lib/export-import-toggles/import-toggles-store-type.ts rename to src/lib/features/export-import-toggles/import-toggles-store-type.ts diff --git a/src/lib/export-import-toggles/import-toggles-store.ts b/src/lib/features/export-import-toggles/import-toggles-store.ts similarity index 100% rename from src/lib/export-import-toggles/import-toggles-store.ts rename to src/lib/features/export-import-toggles/import-toggles-store.ts diff --git a/src/lib/export-import-toggles/import-validation-messages.ts b/src/lib/features/export-import-toggles/import-validation-messages.ts similarity index 97% rename from src/lib/export-import-toggles/import-validation-messages.ts rename to src/lib/features/export-import-toggles/import-validation-messages.ts index 7b6642dab7..9017776792 100644 --- a/src/lib/export-import-toggles/import-validation-messages.ts +++ b/src/lib/features/export-import-toggles/import-validation-messages.ts @@ -1,8 +1,8 @@ import { FeatureStrategySchema, ImportTogglesValidateItemSchema, -} from '../openapi'; -import { IContextFieldDto } from '../types/stores/context-field-store'; +} from '../../openapi'; +import { IContextFieldDto } from '../../types/stores/context-field-store'; export class ImportValidationMessages { static compilePermissionErrors( diff --git a/src/lib/feature-toggle/index.ts b/src/lib/features/feature-toggle/createFeatureToggleService.ts similarity index 67% rename from src/lib/feature-toggle/index.ts rename to src/lib/features/feature-toggle/createFeatureToggleService.ts index 5a3769a829..d2195b91c5 100644 --- a/src/lib/feature-toggle/index.ts +++ b/src/lib/features/feature-toggle/createFeatureToggleService.ts @@ -3,37 +3,37 @@ import { FeatureToggleService, GroupService, SegmentService, -} from '../services'; -import EventStore from '../db/event-store'; -import FeatureStrategiesStore from '../db/feature-strategy-store'; -import FeatureToggleStore from '../db/feature-toggle-store'; -import FeatureToggleClientStore from '../db/feature-toggle-client-store'; -import ProjectStore from '../db/project-store'; -import FeatureTagStore from '../db/feature-tag-store'; -import { FeatureEnvironmentStore } from '../db/feature-environment-store'; -import SegmentStore from '../db/segment-store'; -import ContextFieldStore from '../db/context-field-store'; -import GroupStore from '../db/group-store'; -import { AccountStore } from '../db/account-store'; -import { AccessStore } from '../db/access-store'; -import RoleStore from '../db/role-store'; -import EnvironmentStore from '../db/environment-store'; -import { Db } from '../db/db'; -import { IUnleashConfig } from '../types'; -import FakeEventStore from '../../test/fixtures/fake-event-store'; -import FakeFeatureStrategiesStore from '../../test/fixtures/fake-feature-strategies-store'; -import FakeFeatureToggleStore from '../../test/fixtures/fake-feature-toggle-store'; -import FakeFeatureToggleClientStore from '../../test/fixtures/fake-feature-toggle-client-store'; -import FakeProjectStore from '../../test/fixtures/fake-project-store'; -import FakeFeatureTagStore from '../../test/fixtures/fake-feature-tag-store'; -import FakeFeatureEnvironmentStore from '../../test/fixtures/fake-feature-environment-store'; -import FakeSegmentStore from '../../test/fixtures/fake-segment-store'; -import FakeContextFieldStore from '../../test/fixtures/fake-context-field-store'; -import FakeGroupStore from '../../test/fixtures/fake-group-store'; -import { FakeAccountStore } from '../../test/fixtures/fake-account-store'; -import FakeAccessStore from '../../test/fixtures/fake-access-store'; -import FakeRoleStore from '../../test/fixtures/fake-role-store'; -import FakeEnvironmentStore from '../../test/fixtures/fake-environment-store'; +} from '../../services'; +import EventStore from '../../db/event-store'; +import FeatureStrategiesStore from '../../db/feature-strategy-store'; +import FeatureToggleStore from '../../db/feature-toggle-store'; +import FeatureToggleClientStore from '../../db/feature-toggle-client-store'; +import ProjectStore from '../../db/project-store'; +import FeatureTagStore from '../../db/feature-tag-store'; +import { FeatureEnvironmentStore } from '../../db/feature-environment-store'; +import SegmentStore from '../../db/segment-store'; +import ContextFieldStore from '../../db/context-field-store'; +import GroupStore from '../../db/group-store'; +import { AccountStore } from '../../db/account-store'; +import { AccessStore } from '../../db/access-store'; +import RoleStore from '../../db/role-store'; +import EnvironmentStore from '../../db/environment-store'; +import { Db } from '../../db/db'; +import { IUnleashConfig } from '../../types'; +import FakeEventStore from '../../../test/fixtures/fake-event-store'; +import FakeFeatureStrategiesStore from '../../../test/fixtures/fake-feature-strategies-store'; +import FakeFeatureToggleStore from '../../../test/fixtures/fake-feature-toggle-store'; +import FakeFeatureToggleClientStore from '../../../test/fixtures/fake-feature-toggle-client-store'; +import FakeProjectStore from '../../../test/fixtures/fake-project-store'; +import FakeFeatureTagStore from '../../../test/fixtures/fake-feature-tag-store'; +import FakeFeatureEnvironmentStore from '../../../test/fixtures/fake-feature-environment-store'; +import FakeSegmentStore from '../../../test/fixtures/fake-segment-store'; +import FakeContextFieldStore from '../../../test/fixtures/fake-context-field-store'; +import FakeGroupStore from '../../../test/fixtures/fake-group-store'; +import { FakeAccountStore } from '../../../test/fixtures/fake-account-store'; +import FakeAccessStore from '../../../test/fixtures/fake-access-store'; +import FakeRoleStore from '../../../test/fixtures/fake-role-store'; +import FakeEnvironmentStore from '../../../test/fixtures/fake-environment-store'; export const createFeatureToggleService = ( db: Db, diff --git a/src/lib/features/index.ts b/src/lib/features/index.ts new file mode 100644 index 0000000000..aba33e1381 --- /dev/null +++ b/src/lib/features/index.ts @@ -0,0 +1,3 @@ +export * from './access/createAccessService'; +export * from './export-import-toggles/createExportImportService'; +export * from './feature-toggle/createFeatureToggleService'; diff --git a/src/lib/internals.ts b/src/lib/internals.ts index afd3c85967..5cadba2342 100644 --- a/src/lib/internals.ts +++ b/src/lib/internals.ts @@ -13,6 +13,4 @@ export * from './services'; export * from './types'; export * from './util'; export * from './error'; -export * from './access'; -export * from './export-import-toggles'; -export * from './feature-toggle'; +export * from './features'; diff --git a/src/lib/routes/admin-api/index.ts b/src/lib/routes/admin-api/index.ts index 6bffa9c8e3..b6ade77077 100644 --- a/src/lib/routes/admin-api/index.ts +++ b/src/lib/routes/admin-api/index.ts @@ -30,7 +30,7 @@ import FavoritesController from './favorites'; import MaintenanceController from './maintenance'; import { createKnexTransactionStarter } from '../../db/transaction'; import { Db } from '../../db/db'; -import ExportImportController from '../../export-import-toggles/export-import-controller'; +import ExportImportController from '../../features/export-import-toggles/export-import-controller'; class AdminApi extends Controller { constructor(config: IUnleashConfig, services: IUnleashServices, db: Db) { diff --git a/src/lib/services/index.ts b/src/lib/services/index.ts index 90327a6226..b455e190a8 100644 --- a/src/lib/services/index.ts +++ b/src/lib/services/index.ts @@ -46,7 +46,7 @@ import { Knex } from 'knex'; import { createExportImportTogglesService, createFakeExportImportTogglesService, -} from '../export-import-toggles'; +} from '../features/export-import-toggles/createExportImportService'; import { Db } from '../db/db'; // TODO: will be moved to scheduler feature directory diff --git a/src/lib/types/services.ts b/src/lib/types/services.ts index 79944d3fce..e23aaa1f04 100644 --- a/src/lib/types/services.ts +++ b/src/lib/types/services.ts @@ -37,10 +37,10 @@ import { LastSeenService } from '../services/client-metrics/last-seen-service'; import { InstanceStatsService } from '../services/instance-stats-service'; import { FavoritesService } from '../services/favorites-service'; import MaintenanceService from '../services/maintenance-service'; -import ExportImportService from '../export-import-toggles/export-import-service'; import { AccountService } from '../services/account-service'; import { SchedulerService } from '../services/scheduler-service'; import { Knex } from 'knex'; +import ExportImportService from '../features/export-import-toggles/export-import-service'; export interface IUnleashServices { accessService: AccessService; diff --git a/src/lib/types/stores.ts b/src/lib/types/stores.ts index 61b27232fb..547e4e0921 100644 --- a/src/lib/types/stores.ts +++ b/src/lib/types/stores.ts @@ -32,7 +32,7 @@ import { IFavoriteFeaturesStore } from './stores/favorite-features'; import { IFavoriteProjectsStore } from './stores/favorite-projects'; import { IAccountStore } from './stores/account-store'; import { IProjectStatsStore } from './stores/project-stats-store-type'; -import { IImportTogglesStore } from '../export-import-toggles/import-toggles-store-type'; +import { IImportTogglesStore } from '../features/export-import-toggles/import-toggles-store-type'; export interface IUnleashStores { accessStore: IAccessStore; diff --git a/src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap b/src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap index b92f4d63f4..0627af1cdb 100644 --- a/src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap +++ b/src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap @@ -5129,7 +5129,7 @@ If the provided project does not exist, the list of events will be empty.", ], }, }, - "/api/admin/features-batch/full-import": { + "/api/admin/features-batch/import": { "post": { "description": "Unleash toggles exported from a different instance can be imported into a new project and environment", "operationId": "importToggles", @@ -5155,7 +5155,7 @@ If the provided project does not exist, the list of events will be empty.", ], }, }, - "/api/admin/features-batch/full-validate": { + "/api/admin/features-batch/validate": { "post": { "description": "Unleash toggles exported from a different instance can be imported into a new project and environment", "operationId": "validateImport",