//#region src/oauth/errors.d.ts /** * Typed error classes for the outbound OAuth subsystem. Each error * carries a stable `kind` discriminator so callers can branch on * structured causes instead of message-string sniffing. * * @packageDocumentation */ /** * Base class for every OAuth subsystem error. The framework follows * the project-wide convention of typed `kind` discriminators. * * @stable */ declare class GraphorinOAuthError extends Error { readonly kind: string; readonly hint?: string; constructor(kind: string, message: string, options?: { cause?: unknown; hint?: string; }); } /** * Thrown when the discovery pipeline cannot resolve a usable * authorization-server metadata document for the configured server URL. * * @stable */ declare class OAuthDiscoveryError extends GraphorinOAuthError { readonly serverUrl: string; constructor(serverUrl: string, message: string, options?: { cause?: unknown; }); } /** * Thrown when Dynamic Client Registration is requested against an * authorization server that does not advertise a registration * endpoint. * * @stable */ declare class OAuthRegistrationUnsupportedError extends GraphorinOAuthError { constructor(serverUrl: string); } /** * Thrown when the Dynamic Client Registration endpoint returns a non-2xx * response. Carries the RFC 7591 `error` / `error_description` * body fields so callers see the spec-defined cause (e.g. * `invalid_client_metadata`) instead of only the bare HTTP status. * * @stable */ declare class OAuthRegistrationError extends GraphorinOAuthError { readonly status: number; readonly oauthError?: string; readonly oauthErrorDescription?: string; constructor(status: number, statusText: string | undefined, fields: { error?: string; error_description?: string; }); } /** * Best-effort read of the RFC 6749/7591 `error` / `error_description` fields * from a non-2xx OAuth JSON response. Never throws (a malformed or empty body * yields `{}`), so the caller can still surface the HTTP status when the server * returns no spec body. * * @stable */ declare function readOAuthErrorFields(json: () => Promise): Promise<{ error?: string; error_description?: string; }>; /** * Thrown by `OAuthClient.refresh(...)` when the refresh attempt is * rejected by the authorization server. * * @stable */ declare class OAuthRefreshError extends GraphorinOAuthError { readonly serverId: string; readonly providerError?: string; constructor(serverId: string, providerError: string | undefined, message: string, options?: { cause?: unknown; }); } /** * Thrown when the authorization server reports the token is no longer * valid (`invalid_grant` family). * * @stable */ declare class OAuthRevokedError extends GraphorinOAuthError { readonly serverId: string; constructor(serverId: string, reason: string); } /** * Thrown when the localhost callback handler receives a request that * does not match the original PKCE verifier / state parameter. * * @stable */ declare class OAuthCallbackError extends GraphorinOAuthError { constructor(message: string, options?: { cause?: unknown; }); } /** * Thrown when the authorization request itself returns an error * response (the `error=` query parameter is set on the callback). * * @stable */ declare class OAuthAuthorizationError extends GraphorinOAuthError { readonly oauthError: string; readonly oauthErrorDescription?: string; constructor(oauthError: string, oauthErrorDescription: string | undefined); } /** * Thrown when the OAuth flow is aborted via an `AbortSignal`. * * @stable */ declare class OAuthFlowAbortedError extends GraphorinOAuthError { constructor(stage: 'browser' | 'callback' | 'device-poll' | 'discovery' | 'registration'); } /** * Thrown when no localhost port in the configured range can accept a * binding (e.g. another process has every port in the range open). * * @stable */ declare class OAuthCallbackPortError extends GraphorinOAuthError { constructor(low: number, high: number, attempts: number); } /** * Thrown when the optional `openid-client` peer is not installed. * * @stable */ declare class OAuthPeerDependencyMissingError extends GraphorinOAuthError { readonly packageName: string; constructor(packageName?: string); } //#endregion export { GraphorinOAuthError, OAuthAuthorizationError, OAuthCallbackError, OAuthCallbackPortError, OAuthDiscoveryError, OAuthFlowAbortedError, OAuthPeerDependencyMissingError, OAuthRefreshError, OAuthRegistrationError, OAuthRegistrationUnsupportedError, OAuthRevokedError, readOAuthErrorFields }; //# sourceMappingURL=errors.d.ts.map