@launchdarkly/openfeature-node-server - v2.1.8
    Preparing search index...

    Class LaunchDarklyProvider

    An OpenFeature provider for the LaunchDarkly Server-Side SDK for Node.js.

    Hierarchy

    • BaseOpenFeatureProvider<LDClient>
      • LaunchDarklyProvider
    Index
    • Construct a LaunchDarklyProvider.

      Parameters

      • sdkKey: string

        The SDK key.

      • options: LDOptions = {}

        Any options for the SDK.

      • initTimeoutSeconds: number | "forever" = 10

        The maximum amount of time to wait for initialization in seconds. Defaults to 10 seconds. Zero does not wait, and 'forever' waits indefinitely.

      Returns LaunchDarklyProvider

    events: OpenFeatureEventEmitter

    An event emitter for ProviderEvents.

    ProviderEvents

    metadata: ProviderMetadata
    runsOn: Paradigm

    Represents where the provider is intended to be run. If defined, the SDK will enforce that the defined paradigm at runtime.

    • get hooks(): Hook[]

      Returns the OpenFeature hooks registered for this provider. The LaunchDarkly provider does not currently register any provider-level hooks, so this always returns an empty array.

      Returns Hook[]

    • Emit an OpenFeature ConfigurationChanged event for the given flag key. Per-SDK providers call this from their event wiring.

      Parameters

      • flagKey: string

      Returns void

    • Get the LDClient instance used by this provider.

      Returns LDClient

      The client for this provider.

    • A function used to setup the provider. Called by the SDK after the provider is set if the provider's status is NOT_READY. When the returned promise resolves, the SDK fires the ProviderEvents.Ready event. If the returned promise rejects, the SDK fires the ProviderEvents.Error event. Use this function to perform any context-dependent setup within the provider.

      Parameters

      • Optionalcontext: EvaluationContext

        the global evaluation context

      Returns Promise<void>

    • A function used to shut down the provider. Called when this provider is replaced with a new one, or when the OpenFeature is shut down.

      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.

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

      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.

    • Called by subclass constructors to register the LDClient instance.

      Parameters

      • client: LDClient

      Returns void

    • Called by subclass constructors when client construction throws. The error will be re-thrown from initialize.

      Parameters

      • error: unknown

      Returns void

    • Track a user action or application state, usually representing a business objective or outcome.

      Parameters

      • trackingEventName: string
      • context: EvaluationContext
      • OptionaltrackingEventDetails: TrackingEventDetails

      Returns void