/** * Relay REST request handler (CLI side). * * Translates an inbound `RestRequestFrame` into a `dispatchRoute` call and * maps handler errors to status codes (400/404/409/500). Errors thrown by * handlers are returned in the body, never re-thrown — the backend has a * 30 s pending-request timeout and we want every request to terminate with * a wire response so the browser doesn't sit on a stale spinner. * * Extracted from `relay/dispatcher.ts` — the dispatcher re-exports * `handleRestRequest` so existing imports keep working. */ import type { RestRequestFrame, RestResponseFrame } from "@aexol/relay-protocol"; import { type RestRequestDeps } from "./routing.js"; /** * Dispatch a `rest_request` frame. Always resolves with a * `RestResponseFrame` — handler exceptions are caught and translated. * * Status mapping: * - 200: handler returned successfully (body is the handler's return value * or `{ ok: true }` for void returns) * - 400: `BadRequestError` thrown by handler, OR malformed body for a * route that requires one, OR unknown route * - 404: `NotFoundError` thrown by handler * - 409: `ConflictError` thrown by handler (e.g. mkdir on an existing path) * - 405: route matches but method doesn't (returned as 404 since we don't * distinguish — the matcher treats it as "no route", consistent * with the original Hono router which also 404'd) * - 500: anything else; `error` field carries a sanitized message */ export declare function handleRestRequest(frame: RestRequestFrame, deps: RestRequestDeps): Promise; //# sourceMappingURL=rest.d.ts.map