import type { Table } from 'drizzle-orm'; import type * as v from 'valibot'; import type { ListParamsInput, ListResult } from '../list-query.js'; export type ListSpecOptions = { /** Columns a caller may filter on. Others are rejected by the schema. */ filterable?: readonly string[]; /** Columns a caller may sort on. Defaults to the default sort column. */ sortable?: readonly string[]; defaultSort?: { column: string; order: 'asc' | 'desc'; }; /** Columns the `q` parameter searches. */ searchable?: readonly string[]; }; /** * The input schema and handler of a list endpoint, with the same filter, sort, * cursor, and count contract that the generated CRUD list uses. * * The caller applies both to its own base procedure: * * ```ts * const logsList = listSpec(appLogs, { filterable: ['level'] }) * getLogs: adminProcedure.input(logsList.input).handler(logsList.handler) * ``` * * The two parts are returned separately rather than as a finished procedure, * because a procedure built here would have to receive the builder as a * generic parameter. TypeScript resolves a method call on a generic parameter * through its constraint, which erases the input schema and the row type. With * this shape the builder stays concrete at the call site and keeps both. * * It reads no `access` configuration: the base procedure carries the policy. */ export declare function listSpec(table: TTable, options?: ListSpecOptions): { input: v.GenericSchema; handler: (handlerOptions: { context: { db: unknown; }; input: ListParamsInput | undefined; }) => Promise>; }; //# sourceMappingURL=list-spec.d.ts.map