domain library

Stable functional domain modeling primitives.

Exports the core Decider, Saga, and View types and their composition helpers.

Classes

Decider<C, S, E>
Decides which events should happen for a command and state.
DeciderContract<C, S, E>
Contract for computing events from commands and evolving state from events.
Saga<AR, A>
Reacts to action results by emitting follow-up actions.
SagaContract<AR, A>
Contract for reacting to action results with follow-up actions.
View<S, E>
Projects events into denormalized or query-ready state.
ViewCombineExt<S, E, SSuper, ESuper>
Combines two Views into one tuple-state View.
ViewContract<S, E>
Contract for folding events into query-side state.

Extensions

DeciderCombineExt on Decider<C, S, E>
Combine operations for Decider.
DeciderMapExt on Decider<C, S, E>
Mapping operations for Decider.
SagaCombineExt on Saga<AR?, A>
Combination operations for Saga.
SagaMapExt on Saga<AR, A>
Mapping operations for Saga.
ViewDimapOnStateExt on View<S, E>
Di-map over state for View.
ViewMapLeftOnEventExt on View<S, E>
Mapping operations for View.

Functions

saga<AR, A>(React<AR, A> react) Saga<AR, A>
Creates a Saga from a reaction function.

Typedefs

Decide<C, S, E> = Stream<E> Function(C command, S state)
A decision function from a command and current state to emitted events.
Evolve<S, E> = S Function(S state, E event)
A state transition function from a current state and event to a new state.
React<AR, A> = Stream<A> Function(AR actionResult)
A reaction function from an action result to emitted follow-up actions.