UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

27 lines (26 loc) • 1.63 kB
import type { RefreshableAccount, RefreshResult, TokenPersistTarget } from "../types/index.js"; /** * An upstream refresh error body is logged for diagnosis, never verbatim: a * token endpoint can echo the grant it rejected, and anything that looks like * a credential is masked before the line is written. */ export declare function redactRefreshErrorBody(body: string): string; export declare function needsRefresh(account: RefreshableAccount): boolean; export declare function needsBackgroundRefresh(account: RefreshableAccount): boolean; export declare function needsInlineRefresh(account: RefreshableAccount): boolean; export declare function isPermanentRefreshFailure(result: RefreshResult): boolean; /** * Serialize refreshes by refresh-token value. OAuth refresh tokens may rotate, * so concurrent refreshes with the same old token can make all but the first * request fail with invalid_grant. A short success cache covers callers that * loaded either the old token or the newly rotated token around persistence. */ export declare function refreshToken(account: RefreshableAccount): Promise<RefreshResult>; /** * Refreshes against the latest persisted credential generation. Queued * requests can otherwise reject a rotated refresh token and disable a newer * login that was saved while they were waiting. */ export declare function refreshTokenFromLatest(account: RefreshableAccount, target?: TokenPersistTarget): Promise<RefreshResult>; export declare function clearRefreshStateForTests(): void; export declare function persistTokens(target: TokenPersistTarget, account: RefreshableAccount): Promise<void>;