@hyperfrontend/state-machine/models

models

Shared type definitions for state-machine state, actions, and reducers.

This entry point re-exports the cross-cutting types consumed by the runtime modules (store, reducer, selectors, state-change). Consumers writing their own action handlers or reducers import from here to stay aligned with the shapes the rest of the library expects, without having to dig into module-private files.

API Reference§

Interfaces

§interface

Action

Base action with a type discriminator

Properties

§type:string
Action type identifier
§interface

DerivedState

Derived state computed from core state flags

Properties

§cancelled:boolean
Operation was cancelled
§done:boolean
Operation has completed
§failed:boolean
Operation failed
§inProgress:boolean
Operation is in progress
§notStarted:boolean
Operation has not started
§paused:boolean
Operation is paused
§restarting:boolean
Operation is restarting
§retrying:boolean
Operation is retrying
§successful:boolean
Operation completed successfully
§interface

Handlers

Map of action type constants to their handler functions

Properties

§process cancelled:(state: State, action: { payload: unknown; type: string }) => State
Handler for cancel action
§process completed successfully:(state: State, action: { payload: unknown; type: string }) => State
Handler for success action
§process failed:(state: State, action: { error: any; type: string }) => State
Handler for fail action
§process paused:(state: State, action: { payload: unknown; type: string }) => State
Handler for pause action
§process started:(state: State, action: { payload: unknown; type: string }) => State
Handler for start action
§interface

State

Core state machine state flags

Properties

§fail:boolean
Whether the operation failed
§halt:boolean
Whether the operation is halted
§inProgress:boolean
Whether the operation is currently in progress
§success:boolean
Whether the operation completed successfully

Types

§type

Event

Event name type derived from the event constant object
type Event = indexedAccess
§type

StateDeriver

Function that derives full DerivedState from State
type StateDeriver = (state: State) => DerivedState
§type

StateStatusDeriver

Function that derives a single status boolean from state
type StateStatusDeriver = (state: State) => boolean

Variables