import type { FastifyReply, FastifyRequest } from "fastify"; export interface PageQuery { limit?: number; offset?: number; } /** The highest `limit` a client may ask for. Beyond this the request is answered with the maximum * rather than rejected: a caller asking for everything wants everything, and a 400 would send them * to write the same loop with a smaller number. */ export declare const MAX_LIMIT = 1000; /** The querystring fragment every paginated route declares, so the OpenAPI page documents the two * parameters identically everywhere rather than once per route with three different descriptions. */ export declare const pageQuerySchema: { readonly limit: { readonly type: "integer"; readonly minimum: 1; readonly maximum: 1000; readonly description: "Maximum items to return (max 1000). Omitted returns everything."; }; readonly offset: { readonly type: "integer"; readonly minimum: 0; readonly description: "Items to skip. Requires nothing else; defaults to 0."; }; }; /** * Slices a collection and describes the slice in headers. * * Headers rather than an envelope, and deliberately. Wrapping every list in * `{ items, total, next }` would break every existing consumer of this API — the dashboard, the * generators, anyone's script — on the day pagination shipped, in exchange for information that * `X-Total-Count` and RFC 8288 `Link` already convey. The body stays an array; a client that never * passes `limit` sees exactly what it saw before. * * Unpaginated by default for the same reason: a default page size is a silent truncation, and a * caller who wrote `GET /teams` last month and reads 100 of their 400 teams this month has no way * to notice. Asking for a page is how you get a page. */ export declare function paginate(items: T[], query: PageQuery, request: FastifyRequest, reply: FastifyReply): T[]; //# sourceMappingURL=pagination.d.ts.map