VesselActionDefinition
Defined in: packages/protocol/src/lib/vessel.ts:272
Author-facing shape for a VesselAction. See VesselDefinition.
Properties
Section titled “Properties”description
Section titled “description”
readonlydescription:string
Defined in: packages/protocol/src/lib/vessel.ts:276
What the Action does, written for the Planner that chooses it.
effect?
Section titled “effect?”
readonlyoptionaleffect?:"any"|"none"|"idempotent"
Defined in: packages/protocol/src/lib/vessel.ts:308
What running this Action does beyond its transitionsTo. Defaults to
'any'.
'none': no application effect. The framework only switches the Variant, so a handler is optional. Declare it only for a view switch that needs nothing from the application, such as showing a week view. It must declaretransitionsToand no parameters, and it is safe to run again. Engine-planned Actions still need a registered runner for the Instance, and an emptyuseActions(id, {})is enough.'idempotent': a handler is required, and running the Action again with the same parameters leaves the Vessel where one run would, such as opening an item that may already be open.'any': a handler is required, and the Action may append, remove or otherwise accumulate, so it is not safe to run again.
An Action without a handler that is not declared 'none' is skipped and
changes no Variant, so a missing handler never reports success. The
client’s ActionRunner type requires those handlers at compile time.
The Engine may re-emit an Action on a turn triggered by nothing but a
chart resize, and it cannot see Vessel contents to tell a first run from
a repeat. Such a turn admits only Actions declared 'none' or
'idempotent' that the model invoked with no parameters, since a
parameter value there could only have come from an earlier turn.
idempotent?
Section titled “idempotent?”
readonlyoptionalidempotent?:undefined
Defined in: packages/protocol/src/lib/vessel.ts:315
Removed. Declare VesselActionDefinition.effect instead:
idempotent: true becomes effect: 'idempotent', and idempotent: false
is the default effect: 'any'. A definition that still sets it fails to
compile and fails validateVessel.
readonlyname:string
Defined in: packages/protocol/src/lib/vessel.ts:274
Action name, unique within its Variant.
parameters?
Section titled “parameters?”
readonlyoptionalparameters?: readonlyobject[]
Defined in: packages/protocol/src/lib/vessel.ts:278
Parameters the Action’s handler receives. Omit for none.
transitionsTo?
Section titled “transitionsTo?”
readonlyoptionaltransitionsTo?:string
Defined in: packages/protocol/src/lib/vessel.ts:280
The Variant the Instance moves to once the Action has run.