Skip to main content
Version: Current

PatchHandler

@rotorsoft/act-root


@rotorsoft/act-root / act/src / PatchHandler

Type Alias: PatchHandler<TState, TEvents, TKey>

PatchHandler<TState, TEvents, TKey> = (event, state) => Readonly<Patch<TState>>

Defined in: libs/act/src/types/action.ts:464

Handles patching state in response to an event.

An action folds its events before the commit (the decider rule), so read the event's data and version: id is -1 and created is the commit time until the store assigns them. Loads and replays pass the stored row.

Type Parameters​

TState​

TState extends Schema

State schema.

TEvents​

TEvents extends Schemas

Event schemas.

TKey​

TKey extends keyof TEvents

Event name.

Parameters​

event​

Committed<TEvents, TKey>

state​

Readonly<TState>

Returns​

Readonly<Patch<TState>>