Classes

c
ConfigProvider(flags: Readonly<Record<string, FlagDefinition>>)

Immutable config-backed flag provider.

c
DatabaseProvider(
options: { readonly store: IFlagStore; readonly refreshIntervalMs?: number; },
runtime: IRuntimeServices,
logger?: ILogger
)

Database-backed flag provider that polls an injected IFlagStore.

c
FeatureFlagService(provider: FlagProvider)

Feature flag service that delegates to a single FlagProvider.

c
LaunchDarklyModuleError(message: string)

Thrown when a supplied module does not look like the LaunchDarkly SDK.

c
LaunchDarklyProvider(
config: LaunchDarklyProviderConfig,
logger?: ILogger
)

A FlagProvider backed by LaunchDarkly.

c
MemoryProvider(initialFlags?: Readonly<Record<string, FlagDefinition>>)

Mutable in-memory flag provider.

Functions

f
createFlagGuard(
flag: string,
options?: FlagGuardOptions
): MiddlewareFunction

Creates a middleware function that guards a route based on a feature flag.

f
loadLaunchDarklyModule(): Promise<ILaunchDarklyModule>

Lazily imports the LaunchDarkly Node server SDK.

f
toLaunchDarklyContext(context?: FlagContext): LaunchDarklyContext

Builds the LaunchDarkly evaluation context for a framework FlagContext.

Interfaces

I
ConfigProviderOptions

Options for the 'config' provider arm.

I
CustomProviderOptions

Options for the 'custom' provider arm.

I
DatabaseProviderOptions

Options for the 'database' provider arm.

I
FlagContext

Evaluation context for targeting rules.

I
FlagDefinition

Definition of a single feature flag.

  • enabled: boolean

    Whether the flag is enabled by default.

  • percentage: number

    Optional percentage rollout (0-100).

  • tenants: readonly string[]

    Optional tenant restriction. When present and non-empty, the flag is false for any context whose tenantId is not in this list — including a context with no tenant — and this restriction is evaluated ahead of every other rule (it is not an allowlist: it cannot be overridden by users). When absent, evaluation is unchanged.

  • users: readonly string[]

    Optional user allowlist — overrides enabled: false.

I
FlagGuardOptions

Options for the createFlagGuard factory.

I
FlagProvider

Port that all flag providers implement.

I
FlagProviderStatus

Status reported by a flag provider.

I
IFeatureFlags

Feature flag evaluator. Evaluation is synchronous against the provider's cached state; providers refresh their state out of band.

I
IFlagStore

Structural facade injected into DatabaseProvider.

I
ILaunchDarklyClient

The subset of LaunchDarkly's LDClient this provider uses.

I
ILaunchDarklyFlagsState

The subset of LaunchDarkly's LDFlagsState this provider reads.

I
ILaunchDarklyModule

The subset of the SDK module surface this provider uses.

I
LaunchDarklyContext

The LaunchDarkly evaluation context.

I
LaunchDarklyProviderConfig

Configuration for the 'launchdarkly' provider arm.

  • client: ILaunchDarklyClient

    A prebuilt client. When present the SDK module is never loaded and sdkKey is not read.

  • fallbackValue: boolean

    Value returned by the synchronous isEnabled for a context whose snapshot has not loaded yet, and used as the SDK default in isEnabledAsync. Defaults to false.

  • initTimeoutSeconds: number

    Seconds to wait for the client's initial connection. Defaults to 5. A timeout is logged and tolerated, leaving the provider degraded rather than failing application startup.

  • ldOptions: Readonly<Record<string, unknown>>

    Options forwarded verbatim as the SDK init() second argument.

  • module: unknown

    The SDK module, adapted rather than imported. Lets a test drive the whole construction path without the real package installed.

  • sdkKey: string

    The LaunchDarkly SDK key. Required unless client is injected; a missing key with no client throws during register().

I
LaunchDarklyProviderOptions

Options for the 'launchdarkly' provider arm.

I
MemoryProviderOptions

Options for the 'memory' provider arm.

Type Aliases