Class OpenFeatureCommonAPI<S, P, H>Abstract

Type Parameters

Hierarchy (view full)

Implements

Constructors

Properties

_apiEmitter: GenericEventEmitter<AnyProviderEvent, Record<string, unknown>>
_clientEventHandlers: Map<undefined | string, [AnyProviderEvent, EventHandler<ServerProviderEvents | ProviderEvents>][]> = ...
_clientEvents: Map<undefined | string, GenericEventEmitter<AnyProviderEvent, Record<string, unknown>>> = ...
_context: EvaluationContext = {}
_defaultProvider: ProviderWrapper<P, AnyProviderStatus>
_domainScopedContext: Map<string, EvaluationContext> = ...
_domainScopedProviders: Map<string, ProviderWrapper<P, AnyProviderStatus>>
_hooks: H[] = []
_logger: Logger = ...
_runsOn: Paradigm
_statusEnumType: typeof ProviderStatus | typeof ServerProviderStatus

Accessors

Methods

  • Adds hooks that will run during flag evaluations on this receiver. Hooks are executed in the order they were registered. Adding additional hooks will not remove existing hooks. Hooks registered on the global API object run with all evaluations. Hooks registered on the client run with all evaluations on that client.

    Parameters

    • Rest ...hooks: H[]

      A list of hooks that should always run

    Returns this

    The receiver (this object)

  • Get metadata about a registered provider using the client name. An unbound or empty client name will return metadata from the default provider.

    Parameters

    • Optional domain: string

      An identifier which logically binds clients with providers

    Returns ProviderMetadata

    Provider Metadata

  • Parameters

    • Optional domainOrProvider: string | P
    • Optional providerOrUndefined: P

    Returns void | Promise<void>

  • Sets a logger on this receiver. This logger supersedes to the global logger and is passed to various components in the SDK. The logger configured on the global API object will be used for all evaluations, unless overridden in a particular client.

    Parameters

    • logger: Logger

      The logger to be used

    Returns this

    The receiver (this object)

  • Sets the default provider for flag evaluations. The default provider will be used by domainless clients and clients associated with domains to which no provider is bound. Setting a provider supersedes the current provider used in new and existing unbound clients.

    Parameters

    • provider: P

      The provider responsible for flag evaluations.

    Returns this

    OpenFeature API

  • Sets the provider that OpenFeature will use for flag evaluations on clients bound to the same domain. Setting a provider supersedes the current provider used in new and existing clients in the same domain.

    Parameters

    • domain: string

      An identifier which logically binds clients with providers

    • provider: P

      The provider responsible for flag evaluations.

    Returns this

    OpenFeature API

  • Sets the default provider for flag evaluations and returns a promise that resolves when the provider is ready. The default provider will be used by domainless clients and clients associated with domains to which no provider is bound. Setting a provider supersedes the current provider used in new and existing unbound clients.

    Parameters

    • provider: P

      The provider responsible for flag evaluations.

    Returns Promise<void>

    Throws

    Uncaught exceptions thrown by the provider during initialization.

  • Sets the provider that OpenFeature will use for flag evaluations on clients bound to the same domain. A promise is returned that resolves when the provider is ready. Setting a provider supersedes the current provider used in new and existing clients in the same domain.

    Parameters

    • domain: string

      An identifier which logically binds clients with providers

    • provider: P

      The provider responsible for flag evaluations.

    Returns Promise<void>

    Throws

    Uncaught exceptions thrown by the provider during initialization.

Generated using TypeDoc