Metakit / @doeixd/metakit/temporal

obligations

function · packages/metakit/src/temporalObligations.ts:135

function obligations<
  State,
  Transitions extends Readonly<Record<string, unknown>>,
>(
  machine: Machine<State, Transitions>,
): ReadonlyArray<
  WalkObligation<
    `${keyof Transitions & string}/${keyof Transitions & string}`,
    keyof Transitions & string
  >
>

One walk obligation for each pair of machine's transitions whose order matters: one writes what the other reads or writes (a transition that writes pairs with itself). Each step is proved alone, so every order keeps the state's rules; what no step proves is that answers arriving in another order than the steps were sent leave the same state. Transitions that touch disjoint state commute and get none.