One row of an Entity, by id, from an operation's input: updated, inserted
with an id the client chose, or deleted. Kind is the one its constructor
made, so what it may be refused with can follow it.
Sets, on the row whose id is the input's id key, every field the input
maps a key to. expect names the key holding the revision the row was
read at: an interpreter writes only a row still at that revision.
A key mapped to a one relation (Relation.input) points the row at the
id it holds. Refused where it is written: an id that is not the Entity's
id field, a many relation or a nested key (not written by an update
yet), or nothing to set.
when is what the row must hold for the update to land, checked where it
commits (({ input }) => Expr.eq(Post.fields.status, 'draft')); a row it
does not hold of is refused as unmet. from: Draft (an Entity.refine
state) joins that state's predicate to it.
becomes: Published says every row it can start from is in that state
once it lands. It is proved where the write is declared, by enumerating
those rows over finite fields: one it leaves outside throws, naming it.
One enumeration cannot decide (becomes: InStock over an increment) is
the write's postcondition, ensures: each writer judges it where the
write commits and refuses a row it leaves outside as Invalid.
increment: { stock: 'quantity' } adds an unmapped number input to a
field where it commits, and decrement: { balance: 'amount' } takes one
away; neither is idempotent, so a retry needs expect or a ledger. A field
moved by both, or also set or computed, is refused.
compute sets a field to what an expression comes to over the row before
the write and the input, run where it commits
({ label: ({ row }) => concat(row.title, ' draft') }). It is refused for
a field another key writes, an expression over the row after the write or
another Entity, or one of a kind the field does not store.
Inserts the row whose id is the input's id key, an id the client chose,
with every field and one relation the input maps a key to. An insert
expects no revision: there is no row to have read. A row already there
under that id (a retry) is left as it is.
What its Entity sets from the write's context (Entity.sets: who asks,
when) it writes too, never from the input: a server fills them, a client
predicts them. An update writes those set on: 'write'. becomes, as an
update's, is proved over what the insert sets, or else ensured.
Deletes the row whose id is the input's id key, only while it is still at
the revision expect names, when it names one. It sets nothing, so a key
mapped to a member is refused where it is written. A row already gone (a
retry) is gone. when, as an update's, is what the row must hold.
The revision this input says the row was read at, encoded, with its field:
what an interpreter writes only a row still at. None for a write that
expects none.
The postcondition a write's becomes holds it to where it commits, as
the invariant a refusal names (Refusal.isInvalidBy(refusal,
Write.ensured(Sell.write))). Throws for a write with none: one with no
becomes, or one whose becomes was proved where it was declared.
What the context sets come to, encoded as the store holds them: each
field's value and each relation's link. A path from the viewer is read
through read, one row at a time. unfilled names each member there is
no value for: none to read (no reading of the time, a row or field
read does not hold), or a null where the member holds none (a visitor,
a viewer of another Entity, a path reaching no row). A server refuses such
a write; a client predicts nothing for the member.
What a write reads and writes of its row, by field key (Write.reads,
and Write.writes with the revision it expects, which it moves on): what
Laws.check judges it by.
The fields a write reads from the row it writes: those its when reads,
each it increments, each its assignments read, and the revision it
expects. What an interpreter must read, and what a startup check judges
it could disclose.
The row this input writes and its new values, encoded as the store holds
them: the patch a client shows before the server answers. keys, when
given, narrows it to those input keys (what an author changed); the rest of
the input is still the whole, validated value.
The row a bound write leaves over row, the row before it: its values
set, each amount added (a null stays null, as in SQL), and each
assignment computed by operators over the row before, all by metakit's
evaluator. unknown names each field it could not work out: one row
lacks, or holds as no number for an amount, or an assignment calling an
operator the table lacks. That field keeps what row holds. The one
computation of this row: a guard judges it, a writer explains a miss with
it, a client predicts it.
A value the evaluator refuses (a sum past the safe integer range, text
holding a NUL) is a failure, never a write: it throws a
QueryEvaluateError carrying the Refusal, as evaluate does.