@bijectionhq/library-automations turns an occurrence into a run of one of
your mutations. Rules are facts editors save; the trigger contracts and the
actions are your code.
bijection/app.ts
- Rules (
ops.tables.rules) hold a trigger kind, typedwhereclauses over the trigger’s payload contract, an action name, an argument mapping, a delay, an optional review requirement and an enabled flag. Editors callops.rules.save,setEnabledandarchive. Each save is a new revision, checked against the revision the editor saw. - Offer. Your code calls
ops.offer(ctx, { kind, key, payload })in the transaction that makes the occurrence true. Each matching enabled rule submits its action as a function task withonce: ["run", rule, revision, occurrence], so offering the same occurrence again answers the original task. The rule’s delay is the task’sdue. Clients holdingofferers(editors by default) offer throughops.occurrences.offer. - Review. A rule with
reviewfirst asks the Approvals app. Its continuation submits the action only when the decision isapprovedand the rule still stands at the reviewed revision. - Runs (
ops.tables.runs) hold one fact per run.ops.runs.stateanswers the run’s task state: the action’s, or the review’s while it waits.
under. It holds no roles, so its authority is its commit label. It
validates its own arguments when it runs.