Skip to content

SyncRegistryDefinition

Defined in: packages/contracts/src/registry.ts:417

TRegistry extends SyncTableRegistry

optional rowClasses?: readonly string[]

Defined in: packages/contracts/src/registry.ts:440

The registry’s CLOSED row-classification vocabulary (ADR-0052) — the consumer’s own set of SyncTableEntry.rowClass values (pgxsinkit defines none). Declaring it turns classification into a fail-closed obligation: EVERY entry must then carry a rowClass drawn from this exact set, validated at defineSyncRegistry (module eval), so a newly added entry cannot join the registry unclassified and silently escape whatever invariants its class enrols it in. The declared set is carried on the returned registry and read back with getSyncRegistryRowClasses, which assertRegistryInvariant uses to reject a misspelled class in an invariant’s appliesTo.

Omit it and rowClass is unconstrained (the bare-registry-map overload has nowhere to declare a set, so it is always unconstrained). Purely authoring metadata: it never enters the registry fingerprint.


optional schema?: string

Defined in: packages/contracts/src/registry.ts:418


optional storage?: SyncStorageDeclaration

Defined in: packages/contracts/src/registry.ts:427

The storage contract for every store this registry mints (ADR-0049 decision 1, ADR-0047). Part of the DATA contract, not a per-open knob: durability binds every toolkit-minted open (relaxed default), and backend scopes the BROWSER store only (opfs default; Node/file and memory clones unaffected). Validated at defineSyncRegistry (fail-closed at module-eval); carried through on the returned registry and read back with getSyncRegistryStorage. See SyncStorageDeclaration.


optional streams?: EventStreamRegistry

Defined in: packages/contracts/src/registry.ts:457

The registry’s Event streams (ADR-0053 decision 1) — the Event lane’s registration surface, keyed by Event-stream NAME (the record key IS the name; defineEventStream declares the entry). Registration lives here rather than in a parallel artifact so there is ONE contract to lock, diff and thread through createSyncServer and defineSyncWorker.

Validated fail-closed at defineSyncRegistry (module eval, every offender named at once): the name must match [a-z][a-z0-9_]* and fit the pgmq queue-name budget, the payload must be a zod schema, and each identity field must name a non-empty claim path. Carried on the returned registry and read back with getSyncRegistryStreams.

Streams follow the rowClasses precedent: they ride the registry LOCK as a sibling (added → compatible, removed → breaking, payload/identity changed → risky) and stay OUT of the canonical fingerprint — an Event stream touches no synced table, no local schema and no apply function, so registering one must never wipe a store’s read cache. The bare-registry-map overload has nowhere to declare streams.


tables: TRegistry

Defined in: packages/contracts/src/registry.ts:419