@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
19 lines (18 loc) • 1.17 kB
TypeScript
import type { RefreshableAccount, RefreshResult, TokenPersistTarget } from "../types/index.js";
export declare function needsRefresh(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>;