import { ErrorCode } from './constants.ts'; /** * Default mapping from `ErrorCode` to HTTP status. Adapters apply this and * may layer their own overrides on top. Codes not listed here fall back * to 400 (Bad Request) — which is the right default for "validation / * malformed-request" style errors. * * The mapping mirrors the HTTP statuses produced by the pre-refactor * `@ebec/http`-coupled error classes, with one intentional change: * * - `OAUTH_CLIENT_INVALID`: 400 → **401**, per RFC 6749 §5.2 (`invalid_client` * responses should use 401). Surfaces as a behavior change in HTTP-level * tests asserting `status: 400, code: OAUTH_CLIENT_INVALID`. * - The three `JWT_*` codes: 400 (the unlisted fallback) → **401**, per * RFC 6750 §3.1, which is the status for a resource request carrying an * expired or otherwise unusable bearer. They had never been listed, so a * dead bearer answered 400 while a MISSING one answered 401, and no * client could tell "your credential died" from "your request was * malformed" by status alone. The token endpoint is where RFC 6749 §5.2 * and RFC 7662/7009 want something else, and each of its handlers says so * at its own call site rather than here: the refresh grant re-throws a * verification failure as `invalid_grant`, introspection reports one as * `active: false`, and revocation answers its ordinary success. A new * token-endpoint path that verifies a JWT has to do the same - this map * cannot know which surface it is on. */ export declare const ERROR_CODE_TO_STATUS: Readonly>>; /** * Resolve an HTTP status for a given error code. Unknown codes fall back * to `fallback` (default 400). */ export declare function httpStatusFromCode(code: string, fallback?: number): number; /** * Resolve a semantic `ErrorCode` for a foreign HTTP status. Used at the * boundary where a non-AuthupError (e.g. `@ebec/http` HTTPError thrown by * the framework, or a foreign service response) enters our system and * needs to be normalized into an `AuthupError` with an authup-vocabulary * code. Status is the only stable handshake across the two vocabularies. * * Default mapping covers the common HTTP statuses. Anything 5xx * collapses to `INTERNAL_ERROR`; unknown 4xx collapses to `BAD_REQUEST`. */ export declare function codeFromHttpStatus(status: number): ErrorCode; //# sourceMappingURL=status.d.ts.map