Skip to content

ShapeSpec

Defined in: packages/contracts/src/config.ts:405

optional physicalTable?: string

Defined in: packages/contracts/src/config.ts:420

INTERNAL / resolved — the physical Postgres table this shape reads, when it differs from the shape’s own tableName. A read PROJECTION (defineReadProjection) sets it to the OWNING table’s name so several shapes can read one physical table under distinct shapeKeys; the control plane resolves an incoming subscription by shapeKey and consults this only when it creates the shape, as the source table it hands the engine. attachSyncRegistrySchema also fills/qualifies it for schema-bound registries.

Not a consumer input — there is no valid reason to hand-set it (it can only be redundant with, or wrong about, the table you are reading), so it is omitted from ShapeSpecInput. The combinator derives it from the owner; defineSyncTable never sets it from input.


optional rowFilter?: RowFilterSpec

Defined in: packages/contracts/src/config.ts:421


optional scope?: readonly string[]

Defined in: packages/contracts/src/config.ts:437

SHARED TIER (ADR-0055) — the scope columns, resolved to column names, whose values key this shape family. The predicate is generated as an AND of equalities over them, so disjointness is a property of the construction rather than something a checker has to enforce: a row carries exactly one value per scope column, so it falls in exactly one shape of the family, and an overlapping pair is not expressible at all.

NULL is a legal scope value and compiles to IS NULL — which is how an offering-wide row gets its own scope (O, null) rather than appearing in every group’s shape. The tempting group_id IS NULL OR group_id = $G form is not merely disallowed here; it is wrong, because it places one row in every group shape at once.

Its presence is what makes this a shared-tier shape. Declaring it alongside rowFilter is refused at definition time — see readShapeTier.


shapeKey: string

Defined in: packages/contracts/src/config.ts:407


tableName: string

Defined in: packages/contracts/src/config.ts:406


optional where?: Predicate

Defined in: packages/contracts/src/config.ts:445

The static half of the shape’s predicate: subscriber-independent, identical for every reader, and therefore safe in either tier. On the shared tier it is conjoined with the generated scope equalities; on the private tier, with whatever rowFilter resolves to for the subject.

Native AST, not SQL text — see Predicate.