import { createServer, type IncomingMessage, type ServerResponse } from "node:http"; import { z } from "zod/v4"; import { HttpReply } from "../apps/http.js"; import type { Registry } from "prom-client"; import type { AnyZodSchema, inferZodSchemaOutput } from "../types/schemas.js"; type RouteHandler = (ctx: { params: inferZodSchemaOutput; queryParams: inferZodSchemaOutput; body: inferZodSchemaOutput; req: IncomingMessage; res: ServerResponse; reply: HttpReply; }) => Promise; interface RouteDefinition { paramsSchema?: TParams; querySchema?: TQuery; bodySchema?: TBody; keepConnectionAlive?: boolean; /** Skip reading + parsing the request body. The handler receives `body: undefined`. * Node drains any unconsumed body before the next keep-alive request. */ skipBodyParsing?: boolean; handler: RouteHandler; } declare const HttpMethod: z.ZodEnum<{ CONNECT: "CONNECT"; DELETE: "DELETE"; GET: "GET"; HEAD: "HEAD"; OPTIONS: "OPTIONS"; PATCH: "PATCH"; POST: "POST"; PUT: "PUT"; TRACE: "TRACE"; }>; type HttpMethod = z.infer; type HttpServerOptions = { port: number; host: string; metrics?: { register?: Registry; expose?: boolean; collect?: boolean; }; }; export declare class HttpServer { private static httpRequestDuration?; private static httpRequestTotal?; private readonly metricsRegister?; private readonly port; private readonly host; private routes; readonly server: ReturnType; constructor(options: HttpServerOptions); route(path: `/${string}`, method: HttpMethod, definition: RouteDefinition): this; start(): Promise; stop(): Promise; private collectMetrics; private optionalSchema; private parseQueryParams; private parseRouteParams; private findRoute; private formatError; } export {};