UNPKG

@intuitionrobotics/thunderstorm

Version:
17 lines 887 B
import { type ValidatorTypeResolver } from "@intuitionrobotics/ts-common"; import { type RequestHandler } from "express"; /** * Body-validation middleware. Runs the same ts-common `validate()` the legacy * `ServerApi` used (server-api.ts:164), forwarding a `ValidationException` to * the app-level `terminalErrorHandler` (which maps it to 400 via * `composeApiError`, identical to today) through `next(err)`. * * Compose it at the route site: `router.post("/x", validateBody(V), handler(fn))`. */ export declare function validateBody<B = any>(validator: ValidatorTypeResolver<B>): RequestHandler; /** * Query-validation middleware. Uses Express-parsed `req.query` (the raw model * drops the old manual `parse(req.url, true).query`). */ export declare function validateQuery<P = any>(validator: ValidatorTypeResolver<P>): RequestHandler; //# sourceMappingURL=validators.d.ts.map