import type { Context } from 'hono'; import type * as z from 'zod/mini'; /** Creates a JSON error response. */ export declare function error(c: Context, options: error.Options): Response & import("hono").TypedResponse<{ error: string | code | readonly error.Detail[] | undefined extends bigint | readonly bigint[] ? never : { [K in keyof { code: code; details?: readonly error.Detail[] | undefined; message: string; } as ({ /** Stable machine-readable error code. */ code: code; /** Detailed validation or upstream error information. */ details?: readonly error.Detail[] | undefined; /** Human-readable error message. */ message: string; }[K] extends infer T ? T extends { /** Stable machine-readable error code. */ code: code; /** Detailed validation or upstream error information. */ details?: readonly error.Detail[] | undefined; /** Human-readable error message. */ message: string; }[K] ? T extends import("hono/utils/types").InvalidJSONValue ? true : false : never : never) extends true ? never : K]: boolean extends ({ /** Stable machine-readable error code. */ code: code; /** Detailed validation or upstream error information. */ details?: readonly error.Detail[] | undefined; /** Human-readable error message. */ message: string; }[K] extends infer T ? T extends { /** Stable machine-readable error code. */ code: code; /** Detailed validation or upstream error information. */ details?: readonly error.Detail[] | undefined; /** Human-readable error message. */ message: string; }[K] ? T extends import("hono/utils/types").InvalidJSONValue ? true : false : never : never) ? import("hono/utils/types").JSONParsed<{ /** Stable machine-readable error code. */ code: code; /** Detailed validation or upstream error information. */ details?: readonly error.Detail[] | undefined; /** Human-readable error message. */ message: string; }[K], bigint | readonly bigint[]> | undefined : import("hono/utils/types").JSONParsed<{ /** Stable machine-readable error code. */ code: code; /** Detailed validation or upstream error information. */ details?: readonly error.Detail[] | undefined; /** Human-readable error message. */ message: string; }[K], bigint | readonly bigint[]>; }; requestId: string; }, status, "json">; /** * Rejects a well-formed but unsupported chain id with a clear 400, listing the * chain ids this deployment serves. Used to short-circuit before an unknown * chain reaches an upstream (which would surface as an opaque `upstream_error`). */ export declare function unsupportedChainId(c: Context, chainId: number, supported: Iterable): Response & import("hono").TypedResponse<{ error: { code: "chain_id_unsupported"; details?: readonly error.Detail[] | undefined; message: string; }; requestId: string; }, 400, "json">; /** * Maps upstream failures to 502, except TIDX query failures after the first positional page return 400. * Preserves `Error` causes for reporting and rethrows non-`Error` causes. */ export declare function upstream(c: Context, cause: unknown): upstream.Response; export declare function upstream(c: Context, cause: unknown, options: upstream.Options): upstream.PageResponse; export declare namespace upstream { /** Pagination context for classifying a deep-page query failure. */ type Options = { /** Validated positional page number, when requested. */ page: number | undefined; }; /** Upstream response for routes that support positional pagination. */ type PageResponse = ReturnType> | ReturnType>; /** Default upstream error response. */ type Response = ReturnType>; } /** * Validates `value` against `schema`. Returns the parsed value on success or * throws a generic upstream error so the public response body never leaks Zod * internals. */ export declare function validated(schema: schema, value: unknown): z.output; /** Converts standard validation issues into API error details. */ export declare function validationDetails(issues: readonly validationDetails.Issue[]): error.Detail[]; export declare namespace error { /** Public API error response body. */ type Body = { /** Public error envelope. */ error: { /** Stable machine-readable error code. */ code: code; /** Detailed validation or upstream error information. */ details?: readonly Detail[] | undefined; /** Human-readable error message. */ message: string; }; /** Request id for support/debugging. */ requestId: string; }; /** One public API error detail. */ type Detail = { /** Human-readable detail message. */ message: string; /** Path to the invalid value. */ path?: readonly (number | string)[] | undefined; }; /** HTTP status code accepted by the public error helper. */ type Status = 400 | 401 | 403 | 404 | 409 | 412 | 413 | 415 | 429 | 500 | 501 | 502 | 503 | 504; /** Options for creating a JSON error response. */ type Options = { /** Stable machine-readable error code. */ code: code; /** Detailed validation or upstream error information. */ details?: readonly Detail[] | undefined; /** Human-readable error message. */ message: string; /** HTTP status code. */ status: status; }; } export declare namespace validationDetails { /** Standard-schema validation issue shape used by Hono validators. */ type Issue = { /** Human-readable validation message. */ message: string; /** Path to the invalid value. */ path?: readonly unknown[] | undefined; }; } //# sourceMappingURL=Response.d.ts.map