import type { PaginationMetadata } from "../../interfaces/PaginatedResponse"; import type { DbFilter, TableRow } from "../../interfaces/models/Table"; import { type TableViewState } from "../../store/slices/tablesSlice"; export type UseTableOptions = Partial; export interface UseTableValues { rows: T[]; pagination: PaginationMetadata | null; loading: boolean; error: unknown; refetch: () => void; view: TableViewState; setView: (view: Partial) => void; setPage: (page: number) => void; setFilters: (filters: DbFilter[]) => void; setSort: (sortBy: string | undefined, sortDir?: "asc" | "desc") => void; setIncludeDeleted: (includeDeleted: boolean) => void; createRow: (data: Record) => Promise; updateRow: (rowId: string, data: Record) => Promise; deleteRow: (rowId: string, opts?: { force?: boolean; }) => Promise<{ deleted: boolean; soft: boolean; }>; restoreRow: (rowId: string) => Promise; } /** * React hook for a custom table's rows, backed by RTK Query against the `/db` * surface. Returns rows + loading/refetch state plus CRUD actions. The query * knobs (page/limit/sort/filters/includeDeleted) live in the `tables` slice so * multiple consumers of the same table share one view. * * Core is hook-only — `@sublay/core` has no imperative client object (React * hooks + Redux only), so this hook is the custom-table surface. */ export declare function useTable(tableName: string, options?: UseTableOptions): UseTableValues; export default useTable;