States · moves · rules
Business processes that know where they are
Declare a node type's process once. Its … menu then offers exactly the moves whose business rules hold, and every move is checked again on the server and recorded.
Process
Business processes as state machines, in a fluent language.
A node type declares its states and its moves. Each move carries the business rules it requires, and its pre- and post-processing:
Process.Of<Deal>("Sales")
.StateOf(d => d.Status, (d, s, today) => d with { Status = s })
.States("Received", "Quoted", "Bound", "Declined").Initial("Received").Terminal("Bound", "Declined")
.Move("quote", "Send the offer", ["Received"], "Quoted")
.Requires("PRICED", "The deal is priced", c => c.Content.Priced)
.After((c, d) => d with { QuotedOn = c.Today })
.Move("decline", "Decline", ["Received", "Quoted"], "Declined").Asks(nameof(ProcessInput.Reason)).Closing()
.Build();
What ships
- The language:
Process.Of<T>withStateOf,States,Initial,Terminal,Move,Requires,RequiresOnTake,RequiresTagged,Before,After,AsksandClosing. - The menu:
AddProcess(definition)puts every move whose rules hold now into the node's … menu. The menu follows the node as it changes. - The move page: each move has its own page. It lists the move's rules as passed or failed, asks for its input and takes the move.
- The server check: when a move is taken, the server applies it to the node's current content and checks every rule again. It requires the Update permission.
- The history: every move writes a
Process/Transitionentry beside its node. - Gates: a related node (an approval form, an intake record) publishes rules it evaluates with its own code, tagged with the moves they guard; a process that declares
.Gates("Approval")requires them, read live as JSON, so neither node type compiles the other. - Tags: rules declare the steps they guard. A move takes every rule with its step's tag, and a rule set filters by tag.
- Checks:
Unreachable()andDeadEnds()find states no move reaches and open states no move leaves.
Contents
Where to start
- The guide — declaring a process, the vocabulary, and how a move is taken.