@nebius/js-sdk - v0.2.54
    Preparing search index...

    Keeps an access token in memory and renews it through another bearer.

    Concurrent callers share one in-flight renewal. A successful fetch schedules background renewal before expiration. A failed background renewal uses jittered exponential backoff, while a still-valid cached token can continue to serve requests.

    The timer does not keep Node.js running. Call RenewableBearer.close during orderly shutdown to reject waiters and close the wrapped source.

    Hierarchy (View Summary)

    Indexable

    • [key: symbol]: () => unknown

      Keeps an access token in memory and renews it through another bearer.

      Concurrent callers share one in-flight renewal. A successful fetch schedules background renewal before expiration. A failed background renewal uses jittered exponential backoff, while a still-valid cached token can continue to serve requests.

      The timer does not keep Node.js running. Call RenewableBearer.close during orderly shutdown to reject waiters and close the wrapped source.

        • (): unknown
        • Returns a JSON-safe value for logs.

          Returns unknown

    Index
    • Creates an in-memory renewal layer around source.

      lifetimeSafeFraction selects the fraction of remaining lifetime to wait before renewal. Retry delays use exponential backoff and bounded jitter.

      Parameters

      • source: Bearer
      • Optionalopts: {
            initialRetryTimeoutMs?: number;
            jitterFraction?: number;
            lifetimeSafeFraction?: number;
            logger?: Logger;
            maxRetries?: number;
            maxRetryTimeoutMs?: number;
            metrics?: AuthMetricsInput;
            provider?: string;
            refreshRequestTimeoutMs?: number;
            retryTimeoutExponent?: number;
            safetyMinRemainingMs?: number;
        }
        • OptionalinitialRetryTimeoutMs?: number

          Initial renewal retry delay, in milliseconds. Defaults to one second.

        • OptionaljitterFraction?: number

          Random retry-delay variation from 0 to 1.

          Defaults to 0.2. Values outside the range are clamped.

        • OptionallifetimeSafeFraction?: number

          Fraction of remaining token lifetime to wait before renewal.

          Defaults to 0.9, which renews with about 10% left.

        • Optionallogger?: Logger

          Optional destination for diagnostic events.

        • OptionalmaxRetries?: number

          Maximum total authentication attempts for one receiver. Defaults to 2.

        • OptionalmaxRetryTimeoutMs?: number

          Maximum renewal retry delay, in milliseconds. Defaults to 60 seconds.

        • Optionalmetrics?: AuthMetricsInput

          Optional authentication metrics destination.

        • Optionalprovider?: string

          Provider label for metrics. Defaults to the wrapped bearer name.

        • OptionalrefreshRequestTimeoutMs?: number

          Default budget for a renewal request, in milliseconds.

          Defaults to five seconds. It applies to foreground and background renewal when the caller does not supply a synchronous override. The source decides how it enforces the budget.

        • OptionalretryTimeoutExponent?: number

          Multiplier for exponential retry delays. Defaults to 1.5.

        • OptionalsafetyMinRemainingMs?: number

          Accepted for compatibility but not used by this implementation.

      Returns RenewableBearer

    $type: "nebius.sdk.RenewableBearer" = 'nebius.sdk.RenewableBearer'

    Contains the fully qualified runtime type name.

    • get metricProvider(): string

      Returns the provider name for authorization metrics.

      Returns string

    • get name(): string | undefined

      Returns the stable credential name used by file-backed token caches.

      Most bearers do not have a name. Wrappers can add one with NamedBearer.

      Returns string | undefined

    • Stops renewal, rejects pending waiters, and closes the wrapped bearer.

      Parameters

      • OptionalgraceMs: number

      Returns Promise<void>

    • Reports whether the cached token is absent, invalidated, expired, or due for renewal.

      Returns boolean

    • Schedules renewal as soon as possible.

      Set invalidate after an authentication rejection. This method does not wait for renewal.

      Parameters

      • invalidate: boolean = false

      Returns void