1- import type {
2- ClientFramework ,
3- ClientMetadataOptions ,
4- EvaluationContext ,
5- ManageContext ,
6- ServerProviderStatus ,
7- } from '@openfeature/core' ;
1+ import type { EvaluationContext , ManageContext , ServerProviderStatus } from '@openfeature/core' ;
82import { OpenFeatureCommonAPI , ProviderWrapper , objectOrUndefined , stringOrUndefined } from '@openfeature/core' ;
93import type { Client } from './client' ;
104import { OpenFeatureClient } from './client/internal/open-feature-client' ;
@@ -187,19 +181,6 @@ export class OpenFeatureAPI
187181 * @returns {Client } OpenFeature Client
188182 */
189183 getClient ( domain : string , context ?: EvaluationContext ) : Client ;
190- /**
191- * A factory function for creating new domain scoped OpenFeature clients.
192- * Clients can contain their own state (e.g. logger, hook, context).
193- * Multiple clients can be used to segment feature flag configuration.
194- *
195- * If there is already a provider bound to this domain via {@link this.setProvider setProvider}, this provider will be used.
196- * Otherwise, the default provider is used until a provider is assigned to that domain.
197- * @param {string } domain An identifier which logically binds clients with providers
198- * @param {ClientMetadataOptions } options Client metadata options
199- * @param {EvaluationContext } context Evaluation context that should be set on the client to used during flag evaluations
200- * @returns {Client } OpenFeature Client
201- */
202- getClient ( domain : string | undefined , options : ClientMetadataOptions , context ?: EvaluationContext ) : Client ;
203184 /**
204185 * A factory function for creating new domain scoped OpenFeature clients.
205186 * Clients can contain their own state (e.g. logger, hook, context).
@@ -215,28 +196,20 @@ export class OpenFeatureAPI
215196 getClient ( domain : string , version : string , context ?: EvaluationContext ) : Client ;
216197 getClient (
217198 domainOrContext ?: string | EvaluationContext ,
218- versionOrOptionsOrContext ?: string | ClientMetadataOptions | EvaluationContext ,
199+ versionOrContext ?: string | EvaluationContext ,
219200 contextOrUndefined ?: EvaluationContext ,
220201 ) : Client {
221202 const domain = stringOrUndefined ( domainOrContext ) ;
222- const options = clientMetadataOptionsOrUndefined ( versionOrOptionsOrContext ) ;
223- const version = stringOrUndefined ( versionOrOptionsOrContext ) ?? options ?. version ;
224- const context = domain
225- ? ( objectOrUndefined < EvaluationContext > ( options ? contextOrUndefined : versionOrOptionsOrContext ) ??
226- objectOrUndefined < EvaluationContext > ( contextOrUndefined ) )
227- : objectOrUndefined < EvaluationContext > (
228- domainOrContext ?? ( options ? contextOrUndefined : versionOrOptionsOrContext ) ,
229- ) ;
203+ const version = stringOrUndefined ( versionOrContext ) ;
204+ const context =
205+ objectOrUndefined < EvaluationContext > ( domainOrContext ) ??
206+ objectOrUndefined < EvaluationContext > ( versionOrContext ) ??
207+ objectOrUndefined < EvaluationContext > ( contextOrUndefined ) ;
230208
231- return this . _createClient ( domain , version , context , options ?. framework ) ;
209+ return this . _createClient ( domain , version , context ) ;
232210 }
233211
234- private _createClient (
235- domain ?: string ,
236- version ?: string ,
237- context : EvaluationContext = { } ,
238- framework ?: ClientFramework ,
239- ) : Client {
212+ private _createClient ( domain ?: string , version ?: string , context : EvaluationContext = { } ) : Client {
240213 return new OpenFeatureClient (
241214 ( ) => this . getProviderForClient ( domain ) ,
242215 ( ) => this . getProviderStatus ( domain ) ,
@@ -245,7 +218,7 @@ export class OpenFeatureAPI
245218 ( ) => this . getHooks ( ) ,
246219 ( ) => this . getTransactionContext ( ) ,
247220 ( ) => this . _logger ,
248- { domain, version, framework } ,
221+ { domain, version } ,
249222 context ,
250223 ) ;
251224 }
@@ -297,13 +270,3 @@ export class OpenFeatureAPI
297270 * @returns {OpenFeatureAPI } OpenFeature API
298271 */
299272export const OpenFeature = OpenFeatureAPI . getInstance ( ) ;
300-
301- function clientMetadataOptionsOrUndefined (
302- value : string | ClientMetadataOptions | EvaluationContext | undefined ,
303- ) : ClientMetadataOptions | undefined {
304- if ( typeof value === 'object' && value && ( 'version' in value || 'framework' in value ) ) {
305- return value as ClientMetadataOptions ;
306- }
307-
308- return undefined ;
309- }
0 commit comments