auth.provider API
    Preparing search index...

    Interface BuilderContext

    Builder context passed to every adapter builder. All fields are optional and additions remain additive-only (non-breaking). Builders may ignore fields they do not need.

    Planned future fields:

    • logger?: Logger (startup-time logging — see D-4 Logger interface)
    • abortSignal?: AbortSignal (timeout-aware init, e.g. database connections)
    • tracer?: Tracer (OpenTelemetry context propagation)
    • metrics?: MetricsRecorder (metrics backend injection)
    interface BuilderContext {
        lifecycle?: LifecycleRegistrar;
        logger?: Logger;
        readiness?: ReadinessRegistrar;
    }
    Index
    lifecycle?: LifecycleRegistrar

    Lifecycle registrar provided by the boot planner. Builders that produce a resource requiring cleanup (database client, interval timer, etc.) SHOULD call:

    ctx.lifecycle?.register(async () => { await resource.close(); })
    

    Optional: factories constructed outside the boot planner (e.g. unit tests) receive {} as ctx, so ctx.lifecycle is undefined. Always use optional chaining.

    logger?: Logger

    Structured logger provided by the boot planner from the optional logger ComponentMap slot. Builders that attach an error listener to a connection they open report through it:

    client.on("error", (err) => ctx.logger?.error({ err }, "…_error"))
    

    Same channel as lifecycle and readiness on purpose: a builder that opens a connection owns its cleanup, its probe, and its error listener, and having those three arrive by three different routes is how one of them gets forgotten. Falls back to consoleLogger when absent.

    readiness?: ReadinessRegistrar

    Readiness registrar provided by the boot planner. Builders that open a connection SHOULD register a probe for it:

    ctx.readiness?.register({ name: "redis", check: () => client.ping() })
    

    Registration belongs here for the same reason cleanup does: the builder is the only place holding the connection. The adapter it returns exposes a narrow command surface with no ping, so a composition root cannot build the probe from the outside.

    Optional, and subject to the same optional-chaining rule as BuilderContext.lifecycle.