import type { Context } from "hono"; import type { ContentfulStatusCode } from "hono/utils/http-status"; import type { FetchResult } from "../../types/index.js"; /** * Maps a KatanaKit Safe Result to a Hono JSON response. * * On success returns the whole Safe Result (`{ ok: true, data, error: null }`) * with a 200. On failure it echoes the upstream HTTP status when the error * carries one between 400 and 599 (proxy-style endpoints keep 404/429/503 * semantics); network and config errors (`status: 0`) fall back to * `fallbackStatus` (500 by default). * * @param context - The Hono context. * @param result - The Safe Result from any KatanaKit fetch method. * @param fallbackStatus - Status used when the error has none (default 500). * @returns A Hono JSON response. * * @example * ```ts * import { useSafeJson } from "katanakit-js/adapters/hono"; * import { useGetApi } from "katanakit-js"; * * app.get("/products/:id", async (c) => { * const result = await useGetApi("shop", "productById", { * params: { id: c.req.param("id") }, * }); * return useSafeJson(c, result); // 200, upstream 4xx/5xx, or 500 * }); * ``` */ export declare function useSafeJson(context: Context, result: FetchResult, fallbackStatus?: ContentfulStatusCode): Response; //# sourceMappingURL=result.d.ts.map