An OpenFeature provider for the LaunchDarkly SDK for node.

Implements

  • Provider

Constructors

Properties

client: LDClient
clientConstructionError: any
events: OpenFeatureEventEmitter = ...
initTimeoutSeconds: number = 10

The default amount of time to wait for initialization in seconds. Defaults to 10 seconds.

logger: LDLogger
metadata: ProviderMetadata = ...
runsOn?: Paradigm = 'server'

Accessors

Methods

  • Get the LDClient instance used by this provider.

    Returns LDClient

    The client for this provider.

  • Parameters

    • Optional context: EvaluationContext

    Returns Promise<void>

  • Called by OpenFeature when it needs to close the provider. This will flush events from the LDClient and then close it.

    Returns Promise<void>

  • Determines the boolean variation of a feature flag for a context, along with information about how it was calculated.

    If the flag does not evaluate to a boolean value, then the defaultValue will be returned.

    Parameters

    • flagKey: string

      The unique key of the feature flag.

    • defaultValue: boolean

      The default value of the flag, to be used if the value is not available from LaunchDarkly.

    • context: EvaluationContext

      The context requesting the flag. The client will generate an analytics event to register this context with LaunchDarkly if the context does not already exist.

    Returns Promise<ResolutionDetails<boolean>>

    A promise which will resolve to a ResolutionDetails.

  • Determines the numeric variation of a feature flag for a context, along with information about how it was calculated.

    If the flag does not evaluate to a numeric value, then the defaultValue will be returned.

    Parameters

    • flagKey: string

      The unique key of the feature flag.

    • defaultValue: number

      The default value of the flag, to be used if the value is not available from LaunchDarkly.

    • context: EvaluationContext

      The context requesting the flag. The client will generate an analytics event to register this context with LaunchDarkly if the context does not already exist.

    Returns Promise<ResolutionDetails<number>>

    A promise which will resolve to a ResolutionDetails.

  • Determines the object variation of a feature flag for a context, along with information about how it was calculated.

    Type Parameters

    • U extends JsonValue

    Parameters

    • flagKey: string

      The unique key of the feature flag.

    • defaultValue: U

      The default value of the flag, to be used if the value is not available from LaunchDarkly.

    • context: EvaluationContext

      The context requesting the flag. The client will generate an analytics event to register this context with LaunchDarkly if the context does not already exist.

    Returns Promise<ResolutionDetails<U>>

    A promise which will resolve to a ResolutionDetails.

  • Determines the string variation of a feature flag for a context, along with information about how it was calculated.

    If the flag does not evaluate to a string value, then the defaultValue will be returned.

    Parameters

    • flagKey: string

      The unique key of the feature flag.

    • defaultValue: string

      The default value of the flag, to be used if the value is not available from LaunchDarkly.

    • context: EvaluationContext

      The context requesting the flag. The client will generate an analytics event to register this context with LaunchDarkly if the context does not already exist.

    Returns Promise<ResolutionDetails<string>>

    A promise which will resolve to a ResolutionDetails.