/** * Authenticated API clients, one per account per service, plus the scope gate. * * ⚠️ THE SCOPE GATE LIVES HERE, AND ONLY HERE. * * Every Drive and Calendar tool has to go through a client, and every client * comes from this class — so an account missing a scope is refused by * construction rather than by each handler remembering to ask. Putting the * check in the handlers would leave a blind spot the moment someone adds one * more tool and forgets: the boundary has to be defined by what the thing *is* * (a call into an API) and not by where the code happens to sit. */ import { type GoogleOAuthClient } from '../auth/oauth.js'; import type { AccountId } from './errors.js'; export interface ServiceRequirement { /** Human name of the API, used in error messages: "Gmail", "Drive", "Calendar". */ name: string; /** Holding ANY ONE of these is enough. Lets a narrower scope satisfy a service. */ anyOf: readonly string[]; } /** * A per-account client cache for one Google API. * * Caching is not only a speed optimisation: the underlying `OAuth2Client` owns * the `tokens` listener that persists refreshed credentials, so rebuilding it * per call would multiply listeners and re-read the token file for nothing. */ export declare class AccountClientCache { private readonly requirement; private readonly build; private readonly cache; constructor(requirement: ServiceRequirement, build: (auth: GoogleOAuthClient) => T); /** Resolves an account reference (email or alias) and returns a ready client. */ for(reference: AccountId): Promise<{ email: AccountId; api: T; }>; } //# sourceMappingURL=google-client.d.ts.map