VariantTransitions
Defined in: packages/client/src/lib/command-processor/action-manager.ts:113
Lets ActionManager.executeActions resolve each Action against the
Instance’s current Variant and apply the Action’s transitionsTo.
CommandProcessor builds one from its store and Vessel registry.
Methods
Section titled “Methods”apply()
Section titled “apply()”apply(
instanceId,expected,next):boolean
Defined in: packages/client/src/lib/command-processor/action-manager.ts:135
Compare-and-set: moves the Instance to next only while its Variant is
still expected.
Parameters
Section titled “Parameters”instanceId
Section titled “instanceId”InstanceId
The Instance to transition.
expected
Section titled “expected”VariantName
The Variant the Action started from.
VariantName
The Variant the Action transitions to.
Returns
Section titled “Returns”boolean
Whether the transition applied. false means a newer write won.
resolve()
Section titled “resolve()”resolve(
instanceId,action):ActionVariantResolution
Defined in: packages/client/src/lib/command-processor/action-manager.ts:125
Reads the Instance’s current Variant and the named Action’s declaration on it. Called at the Action’s turn, and again once its handler succeeds when the Action declares a transition, since the Vessel can be redefined while the handler runs.
Parameters
Section titled “Parameters”instanceId
Section titled “instanceId”InstanceId
The Instance the Action targets.
action
Section titled “action”ActionName
The Action about to run.
Returns
Section titled “Returns”The Variant and declared transition, or why the Action is unavailable.