import type { StandardSchemaV1 } from "@standard-schema/spec"; import { ValidationError } from "./error.js"; import type { Extractor } from "./index.js"; export declare class InvalidQueryDataError extends ValidationError { constructor(issues: readonly StandardSchemaV1.Issue[]); } /** * Extractor that parses the query through a schema. * * The schema can be anything implementing the [Standard Schema](https://standardschema.dev/). * * If the query cannot be parsed, it will reject the request with a * `400 Bad Request` response. * * @example * ```ts * import { query } from "@taxum/core/extract"; * import { m, Router } from "@taxum/core/routing"; * import { z } from "zod"; * * const paginationSchema = z.object({ * page: z.coerce.number().int().nonnegative(), * }); * * const handler = handler([query(paginationSchema)], (pagination) => { * const page = pagination.page; * * // ... * }); * * const router = new Router() * .route("/users", m.get(handler)); * ``` * * @throws {@link InvalidQueryDataError} if the query cannot be parsed. */ export declare const query: (schema: T) => Extractor>;