mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-01 01:18:10 +02:00
chore: stop using feature service v2 (#9500)
Just replacing references as both are interchangeable
143c8a3074/src/lib/types/services.ts (L81-L82)
Depends on
https://github.com/bricks-software/unleash-enterprise/pull/138
This commit is contained in:
parent
6b888abe10
commit
4ffd3e7116
@ -64,13 +64,13 @@ const createFlag = async (
|
|||||||
username: string = 'test',
|
username: string = 'test',
|
||||||
userId: number = -9999,
|
userId: number = -9999,
|
||||||
) => {
|
) => {
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
projectId,
|
projectId,
|
||||||
flag,
|
flag,
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
if (strategy) {
|
if (strategy) {
|
||||||
await app.services.featureToggleServiceV2.createStrategy(
|
await app.services.featureToggleService.createStrategy(
|
||||||
strategy,
|
strategy,
|
||||||
{
|
{
|
||||||
projectId,
|
projectId,
|
||||||
|
@ -37,18 +37,18 @@ export default class ArchiveController extends Controller {
|
|||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
{
|
{
|
||||||
transactionalFeatureToggleService,
|
transactionalFeatureToggleService,
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
openApiService,
|
openApiService,
|
||||||
}: Pick<
|
}: Pick<
|
||||||
IUnleashServices,
|
IUnleashServices,
|
||||||
| 'transactionalFeatureToggleService'
|
| 'transactionalFeatureToggleService'
|
||||||
| 'featureToggleServiceV2'
|
| 'featureToggleService'
|
||||||
| 'openApiService'
|
| 'openApiService'
|
||||||
>,
|
>,
|
||||||
startTransaction: TransactionCreator<UnleashTransaction>,
|
startTransaction: TransactionCreator<UnleashTransaction>,
|
||||||
) {
|
) {
|
||||||
super(config);
|
super(config);
|
||||||
this.featureService = featureToggleServiceV2;
|
this.featureService = featureToggleService;
|
||||||
this.openApiService = openApiService;
|
this.openApiService = openApiService;
|
||||||
this.transactionalFeatureToggleService =
|
this.transactionalFeatureToggleService =
|
||||||
transactionalFeatureToggleService;
|
transactionalFeatureToggleService;
|
||||||
|
@ -248,12 +248,13 @@ export default class FakeFeatureToggleStore implements IFeatureToggleStore {
|
|||||||
return Promise.resolve(variants);
|
return Promise.resolve(variants);
|
||||||
}
|
}
|
||||||
|
|
||||||
getVariantsForEnv(
|
async getVariantsForEnv(
|
||||||
featureName: string,
|
featureName: string,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
environment_name: string,
|
environment_name: string,
|
||||||
): Promise<IVariant[]> {
|
): Promise<IVariant[]> {
|
||||||
return this.getVariants(featureName);
|
const feature = await this.get(featureName);
|
||||||
|
// there's no way to filter by environment in the fake store
|
||||||
|
return feature.variants as IVariant[];
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveVariants(
|
async saveVariants(
|
||||||
|
@ -104,7 +104,7 @@ const PATH_STRATEGY = `${PATH_STRATEGIES}/:strategyId`;
|
|||||||
|
|
||||||
type ProjectFeaturesServices = Pick<
|
type ProjectFeaturesServices = Pick<
|
||||||
IUnleashServices,
|
IUnleashServices,
|
||||||
| 'featureToggleServiceV2'
|
| 'featureToggleService'
|
||||||
| 'projectHealthService'
|
| 'projectHealthService'
|
||||||
| 'openApiService'
|
| 'openApiService'
|
||||||
| 'transactionalFeatureToggleService'
|
| 'transactionalFeatureToggleService'
|
||||||
@ -131,7 +131,7 @@ export default class ProjectFeaturesController extends Controller {
|
|||||||
constructor(
|
constructor(
|
||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
{
|
{
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
openApiService,
|
openApiService,
|
||||||
transactionalFeatureToggleService,
|
transactionalFeatureToggleService,
|
||||||
featureTagService,
|
featureTagService,
|
||||||
@ -139,7 +139,7 @@ export default class ProjectFeaturesController extends Controller {
|
|||||||
startTransaction: TransactionCreator<UnleashTransaction>,
|
startTransaction: TransactionCreator<UnleashTransaction>,
|
||||||
) {
|
) {
|
||||||
super(config);
|
super(config);
|
||||||
this.featureService = featureToggleServiceV2;
|
this.featureService = featureToggleService;
|
||||||
this.transactionalFeatureToggleService =
|
this.transactionalFeatureToggleService =
|
||||||
transactionalFeatureToggleService;
|
transactionalFeatureToggleService;
|
||||||
this.startTransaction = startTransaction;
|
this.startTransaction = startTransaction;
|
||||||
|
@ -37,17 +37,17 @@ class FeatureController extends Controller {
|
|||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
{
|
{
|
||||||
featureTagService,
|
featureTagService,
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
openApiService,
|
openApiService,
|
||||||
}: Pick<
|
}: Pick<
|
||||||
IUnleashServices,
|
IUnleashServices,
|
||||||
'featureTagService' | 'featureToggleServiceV2' | 'openApiService'
|
'featureTagService' | 'featureToggleService' | 'openApiService'
|
||||||
>,
|
>,
|
||||||
) {
|
) {
|
||||||
super(config);
|
super(config);
|
||||||
this.tagService = featureTagService;
|
this.tagService = featureTagService;
|
||||||
this.openApiService = openApiService;
|
this.openApiService = openApiService;
|
||||||
this.service = featureToggleServiceV2;
|
this.service = featureToggleService;
|
||||||
|
|
||||||
this.route({
|
this.route({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
|
@ -115,7 +115,7 @@ test('Should not be possible auto-enable feature flag without CREATE_FEATURE_STR
|
|||||||
const url = '/api/admin/projects/default/features';
|
const url = '/api/admin/projects/default/features';
|
||||||
const name = 'auth.flag.enable';
|
const name = 'auth.flag.enable';
|
||||||
|
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{ name },
|
{ name },
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
|
@ -34,7 +34,7 @@ export const createFrontendApiService = (
|
|||||||
eventService,
|
eventService,
|
||||||
);
|
);
|
||||||
// TODO: remove this dependency after we migrate frontend API
|
// TODO: remove this dependency after we migrate frontend API
|
||||||
const featureToggleServiceV2 = createFeatureToggleService(db, config);
|
const featureToggleService = createFeatureToggleService(db, config);
|
||||||
const clientFeatureToggleReadModel = new ClientFeatureToggleReadModel(
|
const clientFeatureToggleReadModel = new ClientFeatureToggleReadModel(
|
||||||
db,
|
db,
|
||||||
config.eventBus,
|
config.eventBus,
|
||||||
@ -49,7 +49,7 @@ export const createFrontendApiService = (
|
|||||||
config,
|
config,
|
||||||
{ segmentReadModel },
|
{ segmentReadModel },
|
||||||
{
|
{
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
clientMetricsServiceV2,
|
clientMetricsServiceV2,
|
||||||
settingService,
|
settingService,
|
||||||
configurationRevisionService,
|
configurationRevisionService,
|
||||||
@ -72,7 +72,7 @@ export const createFakeFrontendApiService = (
|
|||||||
eventService,
|
eventService,
|
||||||
);
|
);
|
||||||
// TODO: remove this dependency after we migrate frontend API
|
// TODO: remove this dependency after we migrate frontend API
|
||||||
const featureToggleServiceV2 =
|
const featureToggleService =
|
||||||
createFakeFeatureToggleService(config).featureToggleService;
|
createFakeFeatureToggleService(config).featureToggleService;
|
||||||
const clientFeatureToggleReadModel = new FakeClientFeatureToggleReadModel();
|
const clientFeatureToggleReadModel = new FakeClientFeatureToggleReadModel();
|
||||||
const globalFrontendApiCache = new GlobalFrontendApiCache(
|
const globalFrontendApiCache = new GlobalFrontendApiCache(
|
||||||
@ -85,7 +85,7 @@ export const createFakeFrontendApiService = (
|
|||||||
config,
|
config,
|
||||||
{ segmentReadModel },
|
{ segmentReadModel },
|
||||||
{
|
{
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
clientMetricsServiceV2,
|
clientMetricsServiceV2,
|
||||||
settingService,
|
settingService,
|
||||||
configurationRevisionService,
|
configurationRevisionService,
|
||||||
|
@ -38,7 +38,7 @@ export type Stores = Pick<IUnleashStores, 'segmentReadModel'>;
|
|||||||
|
|
||||||
export type Services = Pick<
|
export type Services = Pick<
|
||||||
IUnleashServices,
|
IUnleashServices,
|
||||||
| 'featureToggleServiceV2'
|
| 'featureToggleService'
|
||||||
| 'clientMetricsServiceV2'
|
| 'clientMetricsServiceV2'
|
||||||
| 'settingService'
|
| 'settingService'
|
||||||
| 'configurationRevisionService'
|
| 'configurationRevisionService'
|
||||||
|
@ -32,7 +32,7 @@ type Stores = Pick<IUnleashStores, 'segmentReadModel'>;
|
|||||||
|
|
||||||
type Services = Pick<
|
type Services = Pick<
|
||||||
IUnleashServices,
|
IUnleashServices,
|
||||||
'featureToggleServiceV2' | 'configurationRevisionService'
|
'featureToggleService' | 'configurationRevisionService'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
// TODO: remove after finished migration to global frontend api cache
|
// TODO: remove after finished migration to global frontend api cache
|
||||||
@ -170,7 +170,7 @@ export class ProxyRepository
|
|||||||
private async featuresForToken(): Promise<FeatureInterface[]> {
|
private async featuresForToken(): Promise<FeatureInterface[]> {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
const mappedFeatures = await mapFeaturesForClient(
|
const mappedFeatures = await mapFeaturesForClient(
|
||||||
await this.services.featureToggleServiceV2.getClientFeatures({
|
await this.services.featureToggleService.getClientFeatures({
|
||||||
project: this.token.projects,
|
project: this.token.projects,
|
||||||
environment: this.environmentNameForToken(),
|
environment: this.environmentNameForToken(),
|
||||||
}),
|
}),
|
||||||
|
@ -17,12 +17,12 @@ export const createPlaygroundService = (
|
|||||||
): PlaygroundService => {
|
): PlaygroundService => {
|
||||||
const segmentReadModel = new SegmentReadModel(db);
|
const segmentReadModel = new SegmentReadModel(db);
|
||||||
const privateProjectChecker = createPrivateProjectChecker(db, config);
|
const privateProjectChecker = createPrivateProjectChecker(db, config);
|
||||||
const featureToggleServiceV2 = createFeatureToggleService(db, config);
|
const featureToggleService = createFeatureToggleService(db, config);
|
||||||
|
|
||||||
const playgroundService = new PlaygroundService(
|
const playgroundService = new PlaygroundService(
|
||||||
config,
|
config,
|
||||||
{
|
{
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
privateProjectChecker,
|
privateProjectChecker,
|
||||||
},
|
},
|
||||||
segmentReadModel,
|
segmentReadModel,
|
||||||
@ -34,13 +34,13 @@ export const createPlaygroundService = (
|
|||||||
export const createFakePlaygroundService = (config: IUnleashConfig) => {
|
export const createFakePlaygroundService = (config: IUnleashConfig) => {
|
||||||
const segmentReadModel = new FakeSegmentReadModel();
|
const segmentReadModel = new FakeSegmentReadModel();
|
||||||
const privateProjectChecker = createFakePrivateProjectChecker();
|
const privateProjectChecker = createFakePrivateProjectChecker();
|
||||||
const featureToggleServiceV2 =
|
const featureToggleService =
|
||||||
createFakeFeatureToggleService(config).featureToggleService;
|
createFakeFeatureToggleService(config).featureToggleService;
|
||||||
|
|
||||||
const playgroundService = new PlaygroundService(
|
const playgroundService = new PlaygroundService(
|
||||||
config,
|
config,
|
||||||
{
|
{
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
privateProjectChecker,
|
privateProjectChecker,
|
||||||
},
|
},
|
||||||
segmentReadModel,
|
segmentReadModel,
|
||||||
|
@ -82,17 +82,17 @@ export class PlaygroundService {
|
|||||||
constructor(
|
constructor(
|
||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
{
|
{
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
privateProjectChecker,
|
privateProjectChecker,
|
||||||
}: Pick<
|
}: Pick<
|
||||||
IUnleashServices,
|
IUnleashServices,
|
||||||
'featureToggleServiceV2' | 'privateProjectChecker'
|
'featureToggleService' | 'privateProjectChecker'
|
||||||
>,
|
>,
|
||||||
segmentReadModel: ISegmentReadModel,
|
segmentReadModel: ISegmentReadModel,
|
||||||
) {
|
) {
|
||||||
this.logger = config.getLogger('services/playground-service.ts');
|
this.logger = config.getLogger('services/playground-service.ts');
|
||||||
this.flagResolver = config.flagResolver;
|
this.flagResolver = config.flagResolver;
|
||||||
this.featureToggleService = featureToggleServiceV2;
|
this.featureToggleService = featureToggleService;
|
||||||
this.privateProjectChecker = privateProjectChecker;
|
this.privateProjectChecker = privateProjectChecker;
|
||||||
this.segmentReadModel = segmentReadModel;
|
this.segmentReadModel = segmentReadModel;
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,12 @@ export default class ConstraintController extends Controller {
|
|||||||
constructor(
|
constructor(
|
||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
{
|
{
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
openApiService,
|
openApiService,
|
||||||
}: Pick<IUnleashServices, 'featureToggleServiceV2' | 'openApiService'>,
|
}: Pick<IUnleashServices, 'featureToggleService' | 'openApiService'>,
|
||||||
) {
|
) {
|
||||||
super(config);
|
super(config);
|
||||||
this.featureService = featureToggleServiceV2;
|
this.featureService = featureToggleService;
|
||||||
this.openApiService = openApiService;
|
this.openApiService = openApiService;
|
||||||
this.logger = config.getLogger('/admin-api/validation.ts');
|
this.logger = config.getLogger('/admin-api/validation.ts');
|
||||||
|
|
||||||
|
@ -50,19 +50,19 @@ export default class ProjectArchiveController extends Controller {
|
|||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
{
|
{
|
||||||
transactionalFeatureToggleService,
|
transactionalFeatureToggleService,
|
||||||
featureToggleServiceV2,
|
featureToggleService,
|
||||||
openApiService,
|
openApiService,
|
||||||
}: Pick<
|
}: Pick<
|
||||||
IUnleashServices,
|
IUnleashServices,
|
||||||
| 'transactionalFeatureToggleService'
|
| 'transactionalFeatureToggleService'
|
||||||
| 'featureToggleServiceV2'
|
| 'featureToggleService'
|
||||||
| 'openApiService'
|
| 'openApiService'
|
||||||
>,
|
>,
|
||||||
startTransaction: TransactionCreator<UnleashTransaction>,
|
startTransaction: TransactionCreator<UnleashTransaction>,
|
||||||
) {
|
) {
|
||||||
super(config);
|
super(config);
|
||||||
this.logger = config.getLogger('/admin-api/archive.js');
|
this.logger = config.getLogger('/admin-api/archive.js');
|
||||||
this.featureService = featureToggleServiceV2;
|
this.featureService = featureToggleService;
|
||||||
this.openApiService = openApiService;
|
this.openApiService = openApiService;
|
||||||
this.flagResolver = config.flagResolver;
|
this.flagResolver = config.flagResolver;
|
||||||
this.transactionalFeatureToggleService =
|
this.transactionalFeatureToggleService =
|
||||||
|
@ -282,7 +282,7 @@ export const createServices = (
|
|||||||
? new FeatureCollaboratorsReadModel(db)
|
? new FeatureCollaboratorsReadModel(db)
|
||||||
: new FakeFeatureCollaboratorsReadModel();
|
: new FakeFeatureCollaboratorsReadModel();
|
||||||
|
|
||||||
const featureToggleServiceV2 = new FeatureToggleService(
|
const featureToggleService = new FeatureToggleService(
|
||||||
stores,
|
stores,
|
||||||
config,
|
config,
|
||||||
segmentService,
|
segmentService,
|
||||||
@ -426,8 +426,7 @@ export const createServices = (
|
|||||||
accountService,
|
accountService,
|
||||||
addonService,
|
addonService,
|
||||||
eventAnnouncerService,
|
eventAnnouncerService,
|
||||||
featureToggleService: featureToggleServiceV2,
|
featureToggleService,
|
||||||
featureToggleServiceV2,
|
|
||||||
featureTypeService,
|
featureTypeService,
|
||||||
healthService,
|
healthService,
|
||||||
projectService,
|
projectService,
|
||||||
|
@ -78,8 +78,6 @@ export interface IUnleashServices {
|
|||||||
edgeService: EdgeService;
|
edgeService: EdgeService;
|
||||||
featureTagService: FeatureTagService;
|
featureTagService: FeatureTagService;
|
||||||
featureToggleService: FeatureToggleService;
|
featureToggleService: FeatureToggleService;
|
||||||
/** @deprecated use featureToggleService instead, both are interchangeable */
|
|
||||||
featureToggleServiceV2: FeatureToggleService;
|
|
||||||
featureTypeService: FeatureTypeService;
|
featureTypeService: FeatureTypeService;
|
||||||
groupService: GroupService;
|
groupService: GroupService;
|
||||||
healthService: HealthService;
|
healthService: HealthService;
|
||||||
|
@ -25,7 +25,7 @@ beforeAll(async () => {
|
|||||||
},
|
},
|
||||||
db.rawDatabase,
|
db.rawDatabase,
|
||||||
);
|
);
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{
|
{
|
||||||
name: 'featureX',
|
name: 'featureX',
|
||||||
@ -34,7 +34,7 @@ beforeAll(async () => {
|
|||||||
},
|
},
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{
|
{
|
||||||
name: 'featureY',
|
name: 'featureY',
|
||||||
@ -43,7 +43,7 @@ beforeAll(async () => {
|
|||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{
|
{
|
||||||
name: 'featureZ',
|
name: 'featureZ',
|
||||||
@ -51,7 +51,7 @@ beforeAll(async () => {
|
|||||||
},
|
},
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{
|
{
|
||||||
name: 'featureArchivedX',
|
name: 'featureArchivedX',
|
||||||
@ -66,13 +66,13 @@ beforeAll(async () => {
|
|||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await app.services.featureToggleServiceV2.archiveToggle(
|
await app.services.featureToggleService.archiveToggle(
|
||||||
'featureArchivedX',
|
'featureArchivedX',
|
||||||
testUser,
|
testUser,
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{
|
{
|
||||||
name: 'featureArchivedY',
|
name: 'featureArchivedY',
|
||||||
@ -81,12 +81,12 @@ beforeAll(async () => {
|
|||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await app.services.featureToggleServiceV2.archiveToggle(
|
await app.services.featureToggleService.archiveToggle(
|
||||||
'featureArchivedY',
|
'featureArchivedY',
|
||||||
testUser,
|
testUser,
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{
|
{
|
||||||
name: 'featureArchivedZ',
|
name: 'featureArchivedZ',
|
||||||
@ -94,12 +94,12 @@ beforeAll(async () => {
|
|||||||
},
|
},
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await app.services.featureToggleServiceV2.archiveToggle(
|
await app.services.featureToggleService.archiveToggle(
|
||||||
'featureArchivedZ',
|
'featureArchivedZ',
|
||||||
testUser,
|
testUser,
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{
|
{
|
||||||
name: 'feature.with.variants',
|
name: 'feature.with.variants',
|
||||||
@ -107,7 +107,7 @@ beforeAll(async () => {
|
|||||||
},
|
},
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await app.services.featureToggleServiceV2.saveVariants(
|
await app.services.featureToggleService.saveVariants(
|
||||||
'feature.with.variants',
|
'feature.with.variants',
|
||||||
'default',
|
'default',
|
||||||
[
|
[
|
||||||
|
@ -20,7 +20,7 @@ beforeAll(async () => {
|
|||||||
});
|
});
|
||||||
app = await setupAppWithCustomConfig(db.stores, {}, db.rawDatabase);
|
app = await setupAppWithCustomConfig(db.stores, {}, db.rawDatabase);
|
||||||
|
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
projectId,
|
projectId,
|
||||||
{
|
{
|
||||||
name: featureName,
|
name: featureName,
|
||||||
@ -29,7 +29,7 @@ beforeAll(async () => {
|
|||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await app.services.featureToggleServiceV2.createStrategy(
|
await app.services.featureToggleService.createStrategy(
|
||||||
{ name: 'default', constraints: [], parameters: {} },
|
{ name: 'default', constraints: [], parameters: {} },
|
||||||
{ projectId, featureName, environment: DEFAULT_ENV },
|
{ projectId, featureName, environment: DEFAULT_ENV },
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
@ -43,7 +43,7 @@ afterAll(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('returns feature flag for default env', async () => {
|
test('returns feature flag for default env', async () => {
|
||||||
await app.services.featureToggleServiceV2.updateEnabled(
|
await app.services.featureToggleService.updateEnabled(
|
||||||
'default',
|
'default',
|
||||||
'feature.default.1',
|
'feature.default.1',
|
||||||
'default',
|
'default',
|
||||||
|
@ -25,7 +25,7 @@ beforeAll(async () => {
|
|||||||
app = await setupAppWithAuth(db.stores, {}, db.rawDatabase);
|
app = await setupAppWithAuth(db.stores, {}, db.rawDatabase);
|
||||||
apiTokenService = app.services.apiTokenService;
|
apiTokenService = app.services.apiTokenService;
|
||||||
|
|
||||||
const { featureToggleServiceV2, environmentService } = app.services;
|
const { featureToggleService, environmentService } = app.services;
|
||||||
const { environmentStore, projectStore } = db.stores;
|
const { environmentStore, projectStore } = db.stores;
|
||||||
|
|
||||||
await environmentStore.create({
|
await environmentStore.create({
|
||||||
@ -51,7 +51,7 @@ beforeAll(async () => {
|
|||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await featureToggleServiceV2.createFeatureToggle(
|
await featureToggleService.createFeatureToggle(
|
||||||
project,
|
project,
|
||||||
{
|
{
|
||||||
name: feature1,
|
name: feature1,
|
||||||
@ -60,7 +60,7 @@ beforeAll(async () => {
|
|||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await featureToggleServiceV2.createStrategy(
|
await featureToggleService.createStrategy(
|
||||||
{
|
{
|
||||||
name: 'default',
|
name: 'default',
|
||||||
constraints: [],
|
constraints: [],
|
||||||
@ -69,7 +69,7 @@ beforeAll(async () => {
|
|||||||
{ projectId: project, featureName: feature1, environment: DEFAULT_ENV },
|
{ projectId: project, featureName: feature1, environment: DEFAULT_ENV },
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await featureToggleServiceV2.createStrategy(
|
await featureToggleService.createStrategy(
|
||||||
{
|
{
|
||||||
name: 'flexibleRollout',
|
name: 'flexibleRollout',
|
||||||
constraints: [],
|
constraints: [],
|
||||||
@ -80,14 +80,14 @@ beforeAll(async () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// create feature 2
|
// create feature 2
|
||||||
await featureToggleServiceV2.createFeatureToggle(
|
await featureToggleService.createFeatureToggle(
|
||||||
project,
|
project,
|
||||||
{
|
{
|
||||||
name: feature2,
|
name: feature2,
|
||||||
},
|
},
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await featureToggleServiceV2.createStrategy(
|
await featureToggleService.createStrategy(
|
||||||
{
|
{
|
||||||
name: 'default',
|
name: 'default',
|
||||||
constraints: [],
|
constraints: [],
|
||||||
@ -98,14 +98,14 @@ beforeAll(async () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// create feature 3
|
// create feature 3
|
||||||
await featureToggleServiceV2.createFeatureToggle(
|
await featureToggleService.createFeatureToggle(
|
||||||
project2,
|
project2,
|
||||||
{
|
{
|
||||||
name: feature3,
|
name: feature3,
|
||||||
},
|
},
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await featureToggleServiceV2.createStrategy(
|
await featureToggleService.createStrategy(
|
||||||
{
|
{
|
||||||
name: 'default',
|
name: 'default',
|
||||||
constraints: [],
|
constraints: [],
|
||||||
|
@ -26,7 +26,7 @@ beforeAll(async () => {
|
|||||||
app = await setupAppWithAuth(db.stores, {}, db.rawDatabase);
|
app = await setupAppWithAuth(db.stores, {}, db.rawDatabase);
|
||||||
apiTokenService = app.services.apiTokenService;
|
apiTokenService = app.services.apiTokenService;
|
||||||
|
|
||||||
const { featureToggleServiceV2, environmentService } = app.services;
|
const { featureToggleService, environmentService } = app.services;
|
||||||
const { environmentStore, projectStore } = db.stores;
|
const { environmentStore, projectStore } = db.stores;
|
||||||
|
|
||||||
await environmentStore.create({
|
await environmentStore.create({
|
||||||
@ -59,7 +59,7 @@ beforeAll(async () => {
|
|||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await featureToggleServiceV2.createFeatureToggle(
|
await featureToggleService.createFeatureToggle(
|
||||||
project,
|
project,
|
||||||
{
|
{
|
||||||
name: feature1,
|
name: feature1,
|
||||||
@ -68,7 +68,7 @@ beforeAll(async () => {
|
|||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
|
|
||||||
await featureToggleServiceV2.createStrategy(
|
await featureToggleService.createStrategy(
|
||||||
{
|
{
|
||||||
name: 'default',
|
name: 'default',
|
||||||
constraints: [],
|
constraints: [],
|
||||||
@ -77,7 +77,7 @@ beforeAll(async () => {
|
|||||||
{ projectId: project, featureName: feature1, environment: DEFAULT_ENV },
|
{ projectId: project, featureName: feature1, environment: DEFAULT_ENV },
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await featureToggleServiceV2.createStrategy(
|
await featureToggleService.createStrategy(
|
||||||
{
|
{
|
||||||
name: 'default',
|
name: 'default',
|
||||||
constraints: [],
|
constraints: [],
|
||||||
@ -88,14 +88,14 @@ beforeAll(async () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// create feature 2
|
// create feature 2
|
||||||
await featureToggleServiceV2.createFeatureToggle(
|
await featureToggleService.createFeatureToggle(
|
||||||
project,
|
project,
|
||||||
{
|
{
|
||||||
name: feature2,
|
name: feature2,
|
||||||
},
|
},
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await featureToggleServiceV2.createStrategy(
|
await featureToggleService.createStrategy(
|
||||||
{
|
{
|
||||||
name: 'default',
|
name: 'default',
|
||||||
constraints: [],
|
constraints: [],
|
||||||
@ -106,14 +106,14 @@ beforeAll(async () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// create feature 3
|
// create feature 3
|
||||||
await featureToggleServiceV2.createFeatureToggle(
|
await featureToggleService.createFeatureToggle(
|
||||||
project2,
|
project2,
|
||||||
{
|
{
|
||||||
name: feature3,
|
name: feature3,
|
||||||
},
|
},
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await featureToggleServiceV2.createStrategy(
|
await featureToggleService.createStrategy(
|
||||||
{
|
{
|
||||||
name: 'default',
|
name: 'default',
|
||||||
constraints: [],
|
constraints: [],
|
||||||
|
@ -106,12 +106,12 @@ test('should pick up environment from token', async () => {
|
|||||||
|
|
||||||
test('should set lastSeen for toggles with metrics both for toggle and toggle env', async () => {
|
test('should set lastSeen for toggles with metrics both for toggle and toggle env', async () => {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{ name: 't1' },
|
{ name: 't1' },
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
);
|
);
|
||||||
await app.services.featureToggleServiceV2.createFeatureToggle(
|
await app.services.featureToggleService.createFeatureToggle(
|
||||||
'default',
|
'default',
|
||||||
{ name: 't2' },
|
{ name: 't2' },
|
||||||
TEST_AUDIT_USER,
|
TEST_AUDIT_USER,
|
||||||
@ -149,13 +149,13 @@ test('should set lastSeen for toggles with metrics both for toggle and toggle en
|
|||||||
|
|
||||||
await app.services.clientMetricsServiceV2.bulkAdd();
|
await app.services.clientMetricsServiceV2.bulkAdd();
|
||||||
await app.services.lastSeenService.store();
|
await app.services.lastSeenService.store();
|
||||||
const t1 = await app.services.featureToggleServiceV2.getFeature({
|
const t1 = await app.services.featureToggleService.getFeature({
|
||||||
featureName: 't1',
|
featureName: 't1',
|
||||||
archived: false,
|
archived: false,
|
||||||
environmentVariants: true,
|
environmentVariants: true,
|
||||||
projectId: 'default',
|
projectId: 'default',
|
||||||
});
|
});
|
||||||
const t2 = await app.services.featureToggleServiceV2.getFeature({
|
const t2 = await app.services.featureToggleService.getFeature({
|
||||||
featureName: 't2',
|
featureName: 't2',
|
||||||
archived: false,
|
archived: false,
|
||||||
environmentVariants: true,
|
environmentVariants: true,
|
||||||
|
@ -47,7 +47,7 @@ beforeAll(async () => {
|
|||||||
service = new PlaygroundService(
|
service = new PlaygroundService(
|
||||||
config,
|
config,
|
||||||
{
|
{
|
||||||
featureToggleServiceV2: featureToggleService,
|
featureToggleService: featureToggleService,
|
||||||
privateProjectChecker,
|
privateProjectChecker,
|
||||||
},
|
},
|
||||||
segmentReadModel,
|
segmentReadModel,
|
||||||
|
Loading…
Reference in New Issue
Block a user