Laws and transitions of a Sync document declared as metakit expressions.
Named apart from foldkit-form/metakit's Declared, so one file can import both.
A law's holds from an expression over the snapshot an operation leaves,
seen as model. It holds only where the expression is true: a snapshot it
is null over, or that metakit refuses to evaluate it over (an integer result
past ±(2^53−1)), breaks the law.
A durable Message's replay from a metakit Transition over { model }.
A Message whose guard is false is refused. make rejects a guard proved
unreachable under the laws written with holds, or a transition proved to
break one. The check, its words and the replay by tag all live here, so a
document that declares no transition carries none of them.
Extracts the durable subset of an application's metakitMachine for
Sync.forApplication(App).make({ transitions }), throwing at definition for
a tag whose transition:
is not a transition of the Machine;
emits a Command (durable transitions are state-only);
declares supplied values (a replay passes none, so every replay would be refused);
has a read it does not bound (an opaque term may read outside the shared slice);
reads or writes a path that is not inside the shared slice (the shared
slice's path must be a prefix of it, so a write to a parent of the slice
is refused).
It does not check the document's laws, or for an unreachable guard: a replay
runs on the shared slice over initial, as forApplication does. Use
SyncDeclared.transition for those checks.