ui/table_state.svelte.ts view source
import {TableState} from '@fuzdev/fuz_app/ui/table_state.svelte.js'; list
type AsyncSlot<void, string>
table_name
type string
columns
type ColumnInfo[]
rows
type Record<string, unknown>[]
total
type number
offset
type number
limit
type number
primary_key
type string | null
deletable
Whether the server will accept a row DELETE on this table. False for a
table with no single-column primary key *and* for one the server excludes
by policy (the audit trail, singleton bookkeeping rows), which primary_key
alone can't distinguish — it reports the key shape, not the policy.
type boolean
deleting
type string | null
delete_error
type string | null
can_delete
Whether to offer a delete affordance at all. Gate rendering on this rather
than on primary_key, or a policy-excluded table shows a button whose only
outcome is a table_not_deletable refusal.
type boolean
showing_start
type number
showing_end
type number
has_prev
type boolean
has_next
type boolean
fetch
Fetch a page of rows for table_name from GET /api/db/tables/{table_name}.
limit is clamped to [1, DB_TABLE_ROWS_LIMIT_MAX] — the same bounds
the route 400s on, single-sourced so the client guard can't drift into
sending a request the server refuses.
type (table_name: string, offset?: number, limit?: number): Promise<void>
table_name
stringoffset?
number0limit?
number100Promise<void>mutates
this
go_prev
type (): void
voidgo_next
type (): void
voiddelete_row
Delete a row by its primary key via DELETE /api/db/tables/{table_name}/rows/{pk}.
Optimistically drops it from rows and decrements total on success;
surfaces server errors on delete_error.
type (row: Record<string, unknown>): Promise<boolean>
row
Record<string, unknown>Promise<boolean>true when the row was removed; false when the table isn't deletable or the server refused
mutates
this