Setu-TS
    Preparing search index...

    A FlagProvider backed by LaunchDarkly.

    The synchronous/asynchronous bridge. LaunchDarkly's server SDK evaluates flags locally against a ruleset it streams into the process, but every evaluation method it exposes is asynchronous, so it cannot directly satisfy the committed synchronous IFeatureFlags.isEnabled. This provider bridges the two using the one synchronous read the SDK does offer: LDFlagsState.getFlagValue.

    • LaunchDarklyProvider.isEnabled answers from a per-context snapshot cache. On a cache miss — the first evaluation for a given userId — it returns the configured fallbackValue and schedules a background refill, so every subsequent call for that user is answered from real LaunchDarkly state. start() prewarms the anonymous context, and an SDK update event drops the whole cache.
    • LaunchDarklyProvider.isEnabledAsync has no such caveat: it awaits boolVariation directly and is always correct.

    Choose the async method wherever a wrong answer on a cold context would matter.

    app.register(FeatureFlagsPlugin({
    provider: 'launchdarkly',
    options: { sdkKey: runtime.env.LD_SDK_KEY ?? '', fallbackValue: false },
    }));

    0.2.0

    Implements

    Index
    type: "launchdarkly" = ...

    Provider type identifier.

    • Builds the client (unless one was injected), waits for its initial connection, subscribes to flag updates, and prewarms the anonymous snapshot.

      A connection that does not complete within initTimeoutSeconds is logged and tolerated rather than thrown: a flag backend being briefly unreachable should leave the application serving with fallback values, not refuse to boot. The condition is reported through LaunchDarklyProvider.status.

      Returns Promise<void>

      When neither a client nor an sdkKey was configured, or when the SDK module cannot be loaded