Skip to main content
Version: Next

RecoverableStateOptions <TStateModel>

Options for configuring the RecoverableState

Hierarchy

Index

Properties

optionalconfig

config?: Configuration

Configuration instance to use

defaultState

defaultState: TStateModel

The default state used if no persisted state is found. A deep copy is made each time the state is used.

optionaldeserialize

deserialize?: (serializedState) => TStateModel

Optional function to transform a JSON-serialized object back to the state model. If not provided, JSON.parse is used. It is advisable to perform validation in this function and to throw an exception if it fails.


Type declaration

    • (serializedState): TStateModel
    • Parameters

      • serializedState: string

      Returns TStateModel

optionallogger

logger?: Log

A logger instance for logging operations related to state persistence

optionalinheritedpersistenceEnabled

persistenceEnabled?: boolean

Flag to enable or disable state persistence

inheritedpersistStateKey

persistStateKey: string

The key under which the state is stored in the KeyValueStore

optionalinheritedpersistStateKvsId

persistStateKvsId?: string

The identifier of the KeyValueStore to use for persistence. If neither a name nor an id are supplied, the default store will be used.

optionalinheritedpersistStateKvsName

persistStateKvsName?: string

The name of the KeyValueStore to use for persistence. If neither a name nor an id are supplied, the default store will be used.

optionalserialize

serialize?: (state) => string

Optional function to transform the state to a JSON string before persistence. If not provided, JSON.stringify will be used.


Type declaration

    • (state): string
    • Parameters

      • state: TStateModel

      Returns string