diff --git a/src/lib/features/client-feature-toggles/client-feature-toggle-store.ts b/src/lib/features/client-feature-toggles/client-feature-toggle-store.ts index d9caf205bb..77bc396cc3 100644 --- a/src/lib/features/client-feature-toggles/client-feature-toggle-store.ts +++ b/src/lib/features/client-feature-toggles/client-feature-toggle-store.ts @@ -25,7 +25,7 @@ import Raw = Knex.Raw; export interface IGetAllFeatures { featureQuery?: IFeatureToggleQuery; archived: boolean; - requestType: 'client' | 'admin' | 'playground'; + requestType: 'client' | 'admin' | 'playground' | 'frontend'; userId?: number; } @@ -71,7 +71,7 @@ export default class FeatureToggleClientStore const isAdmin = requestType === 'admin'; const isPlayground = requestType === 'playground'; const environment = featureQuery?.environment || DEFAULT_ENV; - const stopTimer = this.timer(`getFeatureAdmin${requestType}`); + const stopTimer = this.timer(`getAllBy${requestType}`); let selectColumns = [ 'features.name as name', @@ -354,6 +354,16 @@ export default class FeatureToggleClientStore }); } + async getFrontendApiClient( + featureQuery?: IFeatureToggleQuery, + ): Promise { + return this.getAll({ + featureQuery, + archived: false, + requestType: 'frontend', + }); + } + async getPlayground( featureQuery?: IFeatureToggleQuery, ): Promise { diff --git a/src/lib/features/client-feature-toggles/fakes/fake-client-feature-toggle-store.ts b/src/lib/features/client-feature-toggles/fakes/fake-client-feature-toggle-store.ts index cb347dfa33..f7cf3d2da0 100644 --- a/src/lib/features/client-feature-toggles/fakes/fake-client-feature-toggle-store.ts +++ b/src/lib/features/client-feature-toggles/fakes/fake-client-feature-toggle-store.ts @@ -54,6 +54,12 @@ export default class FakeClientFeatureToggleStore return this.getFeatures(query); } + async getFrontendApiClient( + query?: IFeatureToggleQuery, + ): Promise { + return this.getFeatures(query); + } + async getPlayground( query?: IFeatureToggleQuery, ): Promise { diff --git a/src/lib/features/client-feature-toggles/types/client-feature-toggle-store-type.ts b/src/lib/features/client-feature-toggles/types/client-feature-toggle-store-type.ts index 0dbb56795f..02b3ee11fc 100644 --- a/src/lib/features/client-feature-toggles/types/client-feature-toggle-store-type.ts +++ b/src/lib/features/client-feature-toggles/types/client-feature-toggle-store-type.ts @@ -9,6 +9,10 @@ export interface IFeatureToggleClientStore { featureQuery: Partial, ): Promise; + getFrontendApiClient( + featureQuery: Partial, + ): Promise; + getPlayground( featureQuery: Partial, ): Promise; diff --git a/src/lib/features/feature-toggle/feature-toggle-service.ts b/src/lib/features/feature-toggle/feature-toggle-service.ts index c5b6f0a750..bc557f1acb 100644 --- a/src/lib/features/feature-toggle/feature-toggle-service.ts +++ b/src/lib/features/feature-toggle/feature-toggle-service.ts @@ -1064,7 +1064,7 @@ class FeatureToggleService { async getClientFeatures( query?: IFeatureToggleQuery, ): Promise { - const result = await this.clientFeatureToggleStore.getClient( + const result = await this.clientFeatureToggleStore.getFrontendApiClient( query || {}, ); return result.map(