Machine.stateSchema
property · packages/metakit/src/machineTypes.ts:92
readonly stateSchema: Schema.Codec<State, unknown, unknown, unknown>Metakit / @doeixd/metakit/machine
interface · packages/metakit/src/machineTypes.ts:90
interface Machine<State, Transitions extends Readonly<Record<string, unknown>>>
extends Pipeable.Pipeable {
readonly stateSchema: Schema.Codec<State, unknown, unknown, unknown>
readonly start: Option.Option<State>
readonly transitions: Transitions
readonly dispatch: (
state: State,
message: MessageOf<Transitions>,
options?: Expr.ReaderOptions,
) => Result.Result<
{
readonly state: State
readonly emitted: ReadonlyArray<EmitOf<Transitions>>
},
Transition.Refused
>
readonly update: (
state: State,
message: MessageOf<Transitions>,
options?: Expr.ReaderOptions,
) => readonly [State, ReadonlyArray<EmitOf<Transitions>>]
readonly footprints: {
readonly [K in keyof Transitions & string]: {
readonly reads: Option.Option<ReadonlyArray<ReadonlyArray<string>>>
readonly writes: ReadonlyArray<ReadonlyArray<string>>
}
}
}Machine.stateSchemaproperty · packages/metakit/src/machineTypes.ts:92
readonly stateSchema: Schema.Codec<State, unknown, unknown, unknown>Machine.startproperty · packages/metakit/src/machineTypes.ts:97
readonly start: Option.Option<State>The state a run begins in, checked against stateSchema where the machine
is defined; none where Machine.make was not given one.
Machine.transitionsproperty · packages/metakit/src/machineTypes.ts:103
readonly transitions: TransitionsThe arms: each transition the machine was given, copied and carrying
its tag as name. Hand one to intent, Pairs.walkPair or
Prove.machine's pin to name that transition.
Machine.dispatchproperty · packages/metakit/src/machineTypes.ts:111
readonly dispatch: (
state: State,
message: MessageOf<Transitions>,
options?: Expr.ReaderOptions,
) => Result.Result<
{
readonly state: State
readonly emitted: ReadonlyArray<EmitOf<Transitions>>
},
Transition.Refused
>Dispatch a tagged message { _tag, input } against state: the next
state and the records the step emits, or Result.fail(Refused) if the
message is unknown or the transition refuses. A no-op keeps state's identity.
options.foreign holds the implementations of the foreign operations
the transitions call.
Machine.updateproperty · packages/metakit/src/machineTypes.ts:123
readonly update: (
state: State,
message: MessageOf<Transitions>,
options?: Expr.ReaderOptions,
) => readonly [State, ReadonlyArray<EmitOf<Transitions>>]TEA-style update: [nextState, emitted], with state itself and
nothing emitted where the step is refused.
Machine.footprintsproperty · packages/metakit/src/machineTypes.ts:129
readonly footprints: {
readonly [K in keyof Transitions & string]: {
readonly reads: Option.Option<ReadonlyArray<ReadonlyArray<string>>>
readonly writes: ReadonlyArray<ReadonlyArray<string>>
}
}Exact static read/write footprints for every declared transition.