/** * Health Check Route Handlers for Next.js * * These route handlers can be re-exported in your Next.js application to provide * a production-ready health check endpoint at /api/health. * * @example * ```typescript * // In your Next.js app: app/api/health/route.ts * export { GET, HEAD } from 'nextly/api/health'; * ``` * * @module api/health */ /** * GET handler for health check endpoint. * * Returns the current database/runtime health as a bare object body via * `respondData`. The body merges the database probe with the package * version and process uptime so monitoring dashboards have a * non-Boolean-only payload to assert against (spec §5.1 rule 3 / §7.7). * When the underlying check reports `ok: false`, the handler throws a 503 * `SERVICE_UNAVAILABLE` `NextlyError` so the route boundary serializes it * as `application/problem+json`. The unhealthy detail (latency, dialect, * error string) is logged via `logContext` rather than echoed to the * public response; anonymous monitoring scrapers should not learn * implementation specifics. * * Response Codes: * - 200 OK: Database is healthy. Body: * `{ ok, version, uptime, timestamp, database }`. * - 503 Service Unavailable: Database is unreachable or unhealthy. Body: * `{ error: { code: "SERVICE_UNAVAILABLE", message, requestId } }`. * * @example * ```bash * curl http://localhost:3000/api/health * # => {"ok":true,"version":"0.0.142","uptime":123,"timestamp":"...","database":{...}} * ``` */ declare const GET: (_request: Request) => Promise; /** * HEAD handler for lightweight health check. * * Returns only the HTTP status code and headers without body content. Useful * for monitoring systems that only need to verify the endpoint is responding. * HEAD is intentionally not wrapped in `withErrorHandler` because the wrapper * always emits a JSON body on the error path, which violates HEAD semantics * (per RFC 9110 HEAD responses must not include a body). Unexpected throws * propagate to Next.js's runtime; in production this surfaces as a 500 with * no body, matching the pre-migration behavior. * * `X-Request-Id` is set so log lines emitted by `healthCheck()` can be * correlated to a probe even though HEAD bypasses the route boundary. * * Response Codes: * - 200 OK: Database is healthy * - 503 Service Unavailable: Database is unhealthy * * @example * ```bash * curl -I http://localhost:3000/api/health * # => HTTP/1.1 200 OK * ``` */ declare function HEAD(request: Request): Promise; export { GET, HEAD };