import type { StandardSchemaV1 } from "@standard-schema/spec"; import { ValidationError } from "./error.js"; import type { Extractor } from "./index.js"; export declare class InvalidPathParamsError extends ValidationError { constructor(issues: readonly StandardSchemaV1.Issue[]); } /** * Extractor that will get a single path param from the URL and parse it. * * The schema can be anything implementing the [Standard Schema](https://standardschema.dev/). * * If your path contains more than one value, you must use {@link pathParams} * instead. * * If the param cannot be parsed, it will reject the request with a * `400 Bad Request` response. * * @example * ```ts * import { pathParam } from "@taxum/core/extract"; * import { m, Router } from "@taxum/core/routing"; * import { z } from "zod"; * * const handler = handler([pathParam(z.uuid())], ({id}) => { * // ... * }); * * const router = new Router() * .route("/users/:id", m.get(handler)); * ``` * * @throws {@link !Error} if path params have more than one value. * @throws {@link InvalidPathParamsError} if the params cannot be parsed. */ export declare const pathParam: (schema: T) => Extractor>; /** * Extractor that will get path params from the URL and parse them. * * The schema can be anything implementing the [Standard Schema](https://standardschema.dev/). * * If the params cannot be parsed, it will reject the request with a * `400 Bad Request` response. * * @example * ```ts * import { pathParams } from "@taxum/core/extract"; * import { m, Router } from "@taxum/core/routing"; * import { z } from "zod"; * * const pathParamsSchema = z.object({ * foo: z.string(), * }); * * const handler = handler([pathParams(pathParamsSchema)], ({foo}) => { * // ... * }); * * const router = new Router() * .route("/users/:foo", m.post(handler)); * ``` * * @throws {@link InvalidPathParamsError} if the params cannot be parsed. */ export declare const pathParams: (schema: T) => Extractor>;