WorkerTokenCache
Defined in: packages/client/src/worker/token-cache.ts:9
Properties
Section titled “Properties”getToken
Section titled “getToken”getToken: () =>
Promise<string|undefined>
Defined in: packages/client/src/worker/token-cache.ts:15
Resolve the access token for a shape/flush request. Returns the cached token when it is comfortably ahead of expiry; otherwise broadcasts ONE pull (deduped across concurrent callers) and resolves when a tab answers. Falls back to the (stale) cached token if a pull yields nothing.
Returns
Section titled “Returns”Promise<string | undefined>
push: (
token) =>void
Defined in: packages/client/src/worker/token-cache.ts:17
The tab pushed a fresh token (auth state change or the initial attach) — cache it and satisfy any pull.
Parameters
Section titled “Parameters”AuthTokenSnapshot | null
Returns
Section titled “Returns”void
pushIfFresher
Section titled “pushIfFresher”pushIfFresher: (
token) =>void
Defined in: packages/client/src/worker/token-cache.ts:24
Seed the cache from a LATER attach’s token, but only if it is strictly fresher than what is cached
(ADR-0032 FIX 5). Attach seeding must never CLOBBER a fresher cached token with an older/null one —
only the explicit push path (the tab as auth owner saying “this is current”) may overwrite
unconditionally, including null on logout.
Parameters
Section titled “Parameters”AuthTokenSnapshot | null
Returns
Section titled “Returns”void
respond
Section titled “respond”respond: (
requestId,token) =>void
Defined in: packages/client/src/worker/token-cache.ts:26
A tab answered a pull-request. First matching answer wins; later duplicates are ignored.
Parameters
Section titled “Parameters”requestId
Section titled “requestId”string
AuthTokenSnapshot | null
Returns
Section titled “Returns”void