orders in the module mounted at
shop is shop.orders.
bijection/shop.ts
Options
Durations are
Temporal.Duration values or duration literals such as
{ days: 30 }. See History and lifetime.
Keys
Withoutkey, the host mints each fact’s key. ctx.insert(table, fact) returns
it, and a read fact carries it in its id field. Store it in another fact with
t.key(table).
key, the named fields identify the fact. A one-field key is passed
alone, and a longer key as an object. The fact a write supplies leaves the key
fields out, because the point already holds them.
Labels
A table’slabel is the audience of its facts. A frame reads a labelled fact
only when its roles clear the label, and a function writes into it only when
its under flows to the label. A field declared label.seal(type) is sealed
above the fact’s label: a read returns it as a Sealed<V>, and ctx.open
shows the value within the frame’s clearance. A label family puts each fact in
the frame’s member: see Family tables. Label rules
are in Read rules and Write rules.
A labelled, erasable or expiring table is
protected: its indexes keep tokens of their
fields at the store, so a selection that does not fix every field of an index
is read with ctx.list(selection.atMost(n)).
Constraints are reads
unique, a capacity, a pin quota and a t.shared field are constraints
checked where the write lands. An erasure owner reference
(erasable: { subject: "<field>" }) is also a constraint. A write of an owned
image checks it at the owner’s fixed place, even if the image lands at
another place. Each check must read at or below the function’s under,
including in a blind insert, put or retract. A table’s own lifetime
starts at the write’s commit. A referenced owner’s lifetime bounds the
commit of an owned image.
bijection check reports such a write at its call site, and the host refuses
it with ConstraintAboveWriter. Use a function whose under clears the
place where the constraint is checked. An erased owner refuses
Erased/OwnerClosed. A past-due owner refuses Expired/OwnerExpired,
including before the lifetime sweep records its closure. Deploy
also refuses a constraint on a table the host itself writes across labels,
such as a marks table.
Here the post and comment both sit at finance. The mutation runs under
finance so it can check whether the post’s erasure unit is still open.
Declared covers (across)
A fact lives once, at its own label’s partition. When a wide frame reads across
a family stem (under: tenant.all) or a disjunctive share
(label.principals), declare across on the table or on the specific index,
search field, vector field, total or .changes feed it reads:
- Table-level
acrosscovers every path (including by-id points), totals and.changes:across: tenant.allservesunder: tenant.all;across: label.principalsserves each member of a disjunctive share at its own place. - Path-level
acrosscovers only that path (index: [{ fields: ["state", "placed"], across: tenant.all }],t.text({ across: tenant.all }),t.vector(1536, { across: tenant.all }),total: [{ group: ["state"], across: tenant.all }], orchangesAcross). On a strict update, only changed covered values write to the cover. bijection.lockprints each member-placed table’s witness count and declared covers per fact (for example,orders: 1 cover (tenant.all)).- Keyed and by-id points. A minted id such as
orders(id)identifies one fact across the admitted roots. A point by a Place-local key such asusers.of(member)({ email })needs one Place. A selection under the family stem can return every matching email through a declared read cover. To serve a shared handle point, declare a family-stem unique scope and a separate read cover for the handle index. Shared claims
Series and timelines
series and timeline declare tables with valid time. Both require key.
Acceptance time
t.accepted() is a Temporal.Instant the store fills with the commit’s own
time when it accepts the write. A write omits it, a table declares at most
one, and it is never a key, sealed or in a unique set (the store fills it
after every unique claim is planned, so nothing could hold it unique). An
index on it sorts every later
commit’s facts after every fact any frame has seen, so a full page read oldest
first never conflicts with later arrivals
(Reading a queue).
Fact types
FactOf<typeof orders> is a read fact, and KeyOf<typeof orders> its key.
As value types, t.fact(orders) and t.key(orders) declare a function’s
arguments or return value. t.key(() => orders) names a table declared later
in the module, and t.key.self the key of the table the field belongs to.
Writers and synced tables
Synced tables (from connector apps and@bijectionhq/library-replicas)
are ordinary keyed tables declared with writers: () => [landing] and exposed
to callers through table.readOnly(...). writers compiles into a host write
guard on act.write(table) that permits only the named mutations or subtrees
to write from application code, while table.readOnly(...) rejects writes at
compile time. Direct operator writes to these tables refuse Forbidden. See Writers.