asReadonly
asReadonly<
TTable,TLocalTable>(entry):SyncTableEntry<TTable,TLocalTable>
Defined in: packages/contracts/src/projection.ts:36
Per-client mode projection (ADR-0025). The authoritative (server) registry defines a table once with
its full write contract; a client that must only read that table consumes the same entry through
asReadonly. The read/identity contract — table, columns, primary key, synced-table name, column
omission, the shape/row filter, the row classification (rowClass), AND the column-builder factory
(makeColumns) — is preserved verbatim; the write-capability metadata is dropped:
modeflips toreadonly;- the overlay-merged read-model
viewand the overlay/journal client projection (the local write machinery@pgxsinkit/clientprovisions for a writable table) are removed — a readonly client reads the synced base table directly; conflictPolicy,governance(managed fields), andwriteModeare removed — a readonly table has no write path, anddefineSyncRegistrywould otherwise still treat them as a writable declaration.
The result is the same entry defineSyncTable would have produced for this table with
mode: "readonly", so defineSyncRegistry accepts it without the writable-table requirements
(server-version field + conflictPolicy).
Lifecycle axes (consistencyGroup, subscription, retention) are preserved — a projection may keep
the authoritative grouping/timing/durability; change them on the projected entry if a client needs to.
makeColumns (the column-builder factory defineSyncTable stashes) is carried too: since ADR-0029 P1
the client derives EVERY synced-table object from it (getSyncedLocalTable → projectedColumnBuilders),
so a readonly projection that dropped it could not build its own local synced read cache — the member-boot
failure this keep-list’s NOTE below predicted. It is read-derivation machinery, not a write handle.
NOTE: if a new read-relevant field is added to SyncTableEntry, carry it here too (this builds the readonly entry by listing what to keep, so a new field is otherwise silently dropped).
Type Parameters
Section titled “Type Parameters”TTable
Section titled “TTable”TTable extends AnyPgTable
TLocalTable
Section titled “TLocalTable”TLocalTable extends AnyPgTable
Parameters
Section titled “Parameters”SyncTableEntry<TTable, TLocalTable>
Returns
Section titled “Returns”SyncTableEntry<TTable, TLocalTable>