import type { CursorPaginator, Paginator, SimplePaginator } from './paginator'; /** * Resolve `[perPage, page]` for `Model.paginate(...)`. Precedence: * * 1. Explicit positional arg from the caller (`Model.paginate(20, 3)`). * 2. `?per_page=` / `?page=` from the active request (auto-magic). * 3. Defaults: `perPage = 15`, `page = 1`. * * `perPage` from the query string is clamped to `[1, DEFAULT_MAX_PER_PAGE]`. * Explicit positional `perPage` is trusted as-is (the caller is the app, * not an untrusted client). * * `page` is clamped to `>= 1` from both sources to avoid `OFFSET -X`-style * negatives reaching the driver. */ export declare function resolvePageArgs(perPageArg?: number, pageArg?: number): ResolvedPageArgs; /** * Resolve cursor args for `Model.cursorPaginate(...)`. Precedence * mirrors {@link resolvePageArgs} — explicit > `?cursor=` > null. * * Cursor values that arrive via the query string (always strings) are * fed through {@link parseCursor} so a composite cursor encoded as * `JSON.stringify([val1, val2])` reaches bqb as a real array — bqb's * `sql(cursor)` interpolation expects an array when the `column` arg * is an array (composite-key pagination). Without this parse, the * cursor round-trip breaks: serialize → string → wire → string → * bqb thinks it's a primitive → wrong query. */ export declare function resolveCursorArgs(perPageArg?: number, cursorArg?: string | number | unknown[] | null): { perPage: number, cursor: unknown }; /** * Parse a cursor value into the shape bqb's `cursorPaginate` expects. * * - `null` / `undefined` → `null` (first page, no WHERE clause) * - Already an array → returned as-is (composite cursor, native form) * - String starting with `[` → JSON-parsed back into an array * (composite cursor that was serialized for the wire format) * - All other strings / primitives → returned as-is (single-column * cursor) * * This is the missing piece in the wire-format round-trip: * {@link toCursorPaginator} encodes composite cursors with * `JSON.stringify` so they survive a URL query param round-trip, and * this function decodes them on the way back in. */ export declare function parseCursor(value: string | number | unknown[] | null | undefined): unknown; /** * Fill in `path`, `prev_page_url`, `next_page_url` (and `first_page_url` * / `last_page_url` for the full {@link Paginator}) from the active * request URL. Mutates the paginator in place and returns it for chaining. * * No-op when no request is in scope — keeps CLI / queue / cron callers * unaffected. Preserves all OTHER query params on the request so search * filters survive across page navigations (`?status=active&page=2` → * `next_page_url` includes `status=active`). */ export declare function enrichPaginatorUrls(paginator: Paginator): Paginator; export declare function enrichPaginatorUrls(paginator: SimplePaginator): SimplePaginator; export declare function enrichPaginatorUrls(paginator: CursorPaginator): CursorPaginator; /** Test helper — reset the lazy-import cache (for tests that mock the * router module after first access). */ export declare function __resetRequestContextCache(): void; /** * Resolved pagination args ready to pass to bqb's `paginate(perPage, page)`. */ export declare interface ResolvedPageArgs { perPage: number page: number }