diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 7376e61a39..d29036dbcb 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -114,7 +114,6 @@ exports[`should create default config 1`] = ` "responseTimeWithAppNameKillSwitch": false, "separateAdminClientApi": false, "strictSchemaValidation": false, - "transactionalDecorator": false, "useLastSeenRefactor": false, "variantTypeNumber": false, }, @@ -160,7 +159,6 @@ exports[`should create default config 1`] = ` "responseTimeWithAppNameKillSwitch": false, "separateAdminClientApi": false, "strictSchemaValidation": false, - "transactionalDecorator": false, "useLastSeenRefactor": false, "variantTypeNumber": false, }, diff --git a/src/lib/features/export-import-toggles/export-import-controller.ts b/src/lib/features/export-import-toggles/export-import-controller.ts index 02e6f94136..1bf097d6e3 100644 --- a/src/lib/features/export-import-toggles/export-import-controller.ts +++ b/src/lib/features/export-import-toggles/export-import-controller.ts @@ -1,16 +1,9 @@ import { Response } from 'express'; import Controller from '../../routes/controller'; import { Logger } from '../../logger'; -import ExportImportService, { - IExportService, - IImportService, -} from './export-import-service'; +import { IExportService, IImportService } from './export-import-service'; import { OpenApiService } from '../../services'; -import { - TransactionCreator, - UnleashTransaction, - WithTransactional, -} from '../../db/transaction'; +import { WithTransactional } from '../../db/transaction'; import { IUnleashConfig, IUnleashServices, @@ -37,41 +30,25 @@ class ExportImportController extends Controller { private exportService: IExportService; - /** @deprecated gradually rolling out importService */ - private transactionalExportImportService: ( - db: UnleashTransaction, - ) => IImportService; - private importService: WithTransactional; private openApiService: OpenApiService; - /** @deprecated gradually rolling out importService */ - private readonly startTransaction: TransactionCreator; - constructor( config: IUnleashConfig, { exportService, - transactionalExportImportService, importService, openApiService, }: Pick< IUnleashServices, - | 'exportService' - | 'importService' - | 'openApiService' - | 'transactionalExportImportService' + 'exportService' | 'importService' | 'openApiService' >, - startTransaction: TransactionCreator, ) { super(config); this.logger = config.getLogger('/admin-api/export-import.ts'); this.exportService = exportService; - this.transactionalExportImportService = - transactionalExportImportService; this.importService = importService; - this.startTransaction = startTransaction; this.openApiService = openApiService; this.route({ method: 'post', @@ -161,16 +138,9 @@ class ExportImportController extends Controller { const dto = req.body; const { user } = req; - const useTransactionalDecorator = this.config.flagResolver.isEnabled( - 'transactionalDecorator', + const validation = await this.importService.transactional((service) => + service.validate(dto, user), ); - const validation = useTransactionalDecorator - ? await this.importService.transactional((service) => - service.validate(dto, user), - ) - : await this.startTransaction(async (tx) => - this.transactionalExportImportService(tx).validate(dto, user), - ); this.openApiService.respondWithValidation( 200, @@ -195,20 +165,10 @@ class ExportImportController extends Controller { const dto = req.body; - const useTransactionalDecorator = this.config.flagResolver.isEnabled( - 'transactionalDecorator', + await this.importService.transactional((service) => + service.import(dto, user), ); - if (useTransactionalDecorator) { - await this.importService.transactional((service) => - service.import(dto, user), - ); - } else { - await this.startTransaction(async (tx) => - this.transactionalExportImportService(tx).import(dto, user), - ); - } - res.status(200).end(); } diff --git a/src/lib/features/export-import-toggles/export-import.e2e.test.ts b/src/lib/features/export-import-toggles/export-import.e2e.test.ts index 516c8d5906..9095b48ac1 100644 --- a/src/lib/features/export-import-toggles/export-import.e2e.test.ts +++ b/src/lib/features/export-import-toggles/export-import.e2e.test.ts @@ -161,7 +161,6 @@ beforeAll(async () => { featuresExportImport: true, featureNamingPattern: true, dependentFeatures: true, - transactionalDecorator: true, }, }, }, diff --git a/src/lib/routes/admin-api/index.ts b/src/lib/routes/admin-api/index.ts index 75ca0f8825..f3fde9e99a 100644 --- a/src/lib/routes/admin-api/index.ts +++ b/src/lib/routes/admin-api/index.ts @@ -88,11 +88,7 @@ class AdminApi extends Controller { this.app.use('/state', new StateController(config, services).router); this.app.use( '/features-batch', - new ExportImportController( - config, - services, - createKnexTransactionStarter(db), - ).router, + new ExportImportController(config, services).router, ); this.app.use('/tags', new TagController(config, services).router); this.app.use( diff --git a/src/lib/services/index.ts b/src/lib/services/index.ts index 303401a9f7..2d91b96426 100644 --- a/src/lib/services/index.ts +++ b/src/lib/services/index.ts @@ -307,8 +307,6 @@ export const createServices = ( const importService = db ? withTransactional(deferredExportImportTogglesService(config), db) : withFakeTransactional(createFakeExportImportTogglesService(config)); - const transactionalExportImportService = (txDb: Knex.Transaction) => - createExportImportTogglesService(txDb, config); const transactionalFeatureToggleService = (txDb: Knex.Transaction) => createFeatureToggleService(txDb, config); const transactionalGroupService = (txDb: Knex.Transaction) => @@ -413,7 +411,6 @@ export const createServices = ( favoritesService, maintenanceService, exportService: exportImportService, - transactionalExportImportService, importService, schedulerService, configurationRevisionService, diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 2d1b6ecf5a..e663acb270 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -33,7 +33,6 @@ export type IFlagKey = | 'dependentFeatures' | 'datadogJsonTemplate' | 'disableMetrics' - | 'transactionalDecorator' | 'useLastSeenRefactor' | 'internalMessageBanners' | 'internalMessageBanner' @@ -159,10 +158,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_DISABLE_METRICS, false, ), - transactionalDecorator: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_TRANSACTIONAL_DECORATOR, - false, - ), useLastSeenRefactor: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_USE_LAST_SEEN_REFACTOR, false, diff --git a/src/lib/types/services.ts b/src/lib/types/services.ts index 45d11ba996..9aa05a8930 100644 --- a/src/lib/types/services.ts +++ b/src/lib/types/services.ts @@ -65,7 +65,8 @@ export interface IUnleashServices { edgeService: EdgeService; featureTagService: FeatureTagService; featureToggleService: FeatureToggleService; - featureToggleServiceV2: FeatureToggleService; // deprecated + /** @deprecated use featureToggleService instead, both are interchangeable */ + featureToggleServiceV2: FeatureToggleService; featureTypeService: FeatureTypeService; groupService: GroupService; healthService: HealthService; @@ -98,8 +99,6 @@ export interface IUnleashServices { configurationRevisionService: ConfigurationRevisionService; schedulerService: SchedulerService; eventAnnouncerService: EventAnnouncerService; - /** @deprecated prefer exportImportServiceV2, we're doing a gradual rollout */ - transactionalExportImportService: (db: Knex.Transaction) => IImportService; transactionalFeatureToggleService: ( db: Knex.Transaction, ) => FeatureToggleService; diff --git a/src/server-dev.ts b/src/server-dev.ts index b286e01217..8a8ab7d902 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -46,7 +46,6 @@ process.nextTick(async () => { accessOverview: true, datadogJsonTemplate: true, dependentFeatures: true, - transactionalDecorator: true, useLastSeenRefactor: true, separateAdminClientApi: true, },