import type { QueryClient } from '@tanstack/react-query'; import { type Collection, type StandardSchema } from '@tanstack/db'; type TableListResult = { items: TRow[]; hasMore: boolean; nextCursor?: string; total?: number; limit?: number; offset?: number; }; type TableProcedures = { list: { call(input?: Record): Promise>; }; get: { call(input: { id: string; }): Promise; }; create: { call(input: TCreate): Promise; }; update: { call(input: { params: { id: string; }; query: {}; headers: {}; body: TUpdate; }): Promise; }; delete: { call(input: { id: string; }): Promise; }; }; export type DirectTableApi = { list(input?: Record): Promise>; get(id: string | number): Promise; create(input: TCreate): Promise; update(id: string | number, input: TUpdate): Promise; delete(id: string | number): Promise; }; export type TableCollectionConfig = { tableName: string; procedures: TableProcedures; queryClient: QueryClient; /** Rows the default `.collection` syncs per fetch. Defaults to 100. For * feed-shaped tables that need real pagination use `scopedCollection`. */ limit?: number; }; export type ScopedFilterValue = string | number | boolean | null | readonly (string | number)[]; export type ScopedCollectionOptions = { /** Equality filters, e.g. `{ replyToId: null }` — columns must be in the * table's `filterableColumns` server-side. Same name and shape as the * `filters` accepted by the list procedure. */ filters?: Record; sort?: string; order?: 'asc' | 'desc'; /** Rows per underlying request; clamped to the server cap (200). */ pageSize?: number; /** Window size on first load and default `loadMore` step. Defaults to 20. */ initialCount?: number; }; export declare function createTableCollection, TUpdate = Partial>(config: TableCollectionConfig): { collection: import("@tanstack/db").Collection, never, TRow> & import("@tanstack/db").NonSingleResult; table: DirectTableApi; scopedCollection: (options?: ScopedCollectionOptions) => { collection: import("@tanstack/db").Collection, never, TRow> & import("@tanstack/db").NonSingleResult; /** Grow the window by `count` (default initialCount) and refetch in place. */ loadMore: (count?: number) => Promise; /** Whether the server reported rows beyond the window (as of last fetch). */ hasMore: () => boolean; /** Current desired window size. */ size: () => number; }; collectionByIds: (ids: readonly TRow["id"][], options?: { column?: string; }) => import("@tanstack/db").Collection, never, TRow> & import("@tanstack/db").NonSingleResult; applyRealtimeEvent: (action: "create" | "update" | "delete", record: Record) => void; refetchAll: () => Promise; }; export type ScopedCollection = { collection: Collection, StandardSchema>; loadMore: (count?: number) => Promise; hasMore: () => boolean; size: () => number; }; export type TableCollection, TUpdate = Partial> = { collection: Collection, StandardSchema>; table: DirectTableApi; scopedCollection: (options?: ScopedCollectionOptions) => ScopedCollection; collectionByIds: (ids: readonly (string | number)[], column?: string) => Collection, StandardSchema>; applyRealtimeEvent: (action: 'create' | 'update' | 'delete', record: Record) => void; refetchAll: () => Promise; }; export {}; //# sourceMappingURL=collection.d.ts.map