Interface GlobalApi

Hierarchy

Implemented by

Properties

providerMetadata: ProviderMetadata

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.

    Returns

    The receiver (this object)

    Parameters

    • Rest ...hooks: Hook<FlagValue>[]

      A list of hooks that should always run

    Returns GlobalApi

  • Clears all the hooks that are registered on this receiver.

    Returns

    The receiver (this object)

    Returns GlobalApi

  • A factory function for creating new OpenFeature clients. Clients can contain their own state (e.g. logger, hook, context). Multiple clients can be used to segment feature flag configuration.

    Returns

    OpenFeature Client

    Parameters

    • Optional name: string

      The name of the client

    • Optional version: string

      The version of the client

    • Optional context: EvaluationContext

      Evaluation context that should be set on the client to used during flag evaluations

    Returns Client

  • Access all the hooks that are registered on this receiver.

    Returns

    A list of the client hooks

    Returns Hook<FlagValue>[]

  • Experimental

    EXPERIMENTAL: Transaction context propagation is experimental and subject to change. The OpenFeature Enhancement Proposal regarding transaction context can be found here.

    Returns the currently defined transaction context using the registered transaction context propagator.

    Returns

    The current transaction context

    Returns EvaluationContext

  • 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.

    Returns

    The receiver (this object)

    Parameters

    • logger: Logger

      The logger to be used

    Returns GlobalApi

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

    Returns

    OpenFeature API

    Parameters

    • provider: Provider

      The provider responsible for flag evaluations.

    Returns GlobalApi

  • Experimental

    EXPERIMENTAL: Transaction context propagation is experimental and subject to change. The OpenFeature Enhancement Proposal regarding transaction context can be found here.

    Sets the transaction context using the registered transaction context propagator.

    Type Parameters

    • R

      The return value of the callback

    Parameters

    • transactionContext: EvaluationContext

      The transaction specific context

    • callback: ((...args: unknown[]) => R)

      Callback function used to set the transaction context on the stack

        • (...args: unknown[]): R
        • Parameters

          • Rest ...args: unknown[]

          Returns R

    • Rest ...args: unknown[]

      Optional arguments that are passed to the callback function

    Returns void

  • Experimental

    EXPERIMENTAL: Transaction context propagation is experimental and subject to change. The OpenFeature Enhancement Proposal regarding transaction context can be found here.

    Sets a transaction context propagator on this receiver. The transaction context propagator is responsible for persisting context for the duration of a single transaction.

    Returns

    The receiver (this object)

    Parameters

    Returns GlobalApi

Generated using TypeDoc