replay 2.0.0
replay: ^2.0.0 copied to clipboard
Event Sourcing framework for Dart to build auditable apps with immutable events.
2.0.0 #
- update dart SDK constraint to
^3.13.5 - rename
AggregateFullyGenerictoAggregate; it no longer has a fourth type parameterTOption, soAggregateFullyGeneric<C, E, S, O>becomesAggregate<C, E, S> - remove
Aggregate.findOptions()and theoptionFinderparameter; useoptionFinder.find(aggregate.currentState) - remove the
Mapconstructor parameters ofComposableCommandDecider,ComposableEventReducerandComposableOptionFinder; useregister - dispatch composable deciders and reducers by subtype (
is T); the first matching registration wins - throw
StateErrorinstead ofArgumentErrorwhen no registration matches a command or event EventStorageis asynchronous:readAll()returns aStreamandappendAll(List)replacesiterableandappend;appendAllis all-or-nothingAggregate.processreturns aFutureand commits all events of a command with a singleappendAll- create aggregates with the async
Aggregate.load; the constructor is private - remove
replayStoredEventsandreplay();loadalways replays stored events - add
Aggregate.resumeto start from a given state without replaying stored events Aggregate.processqueues commands and processes them one at a time, in arrival order- replace
onEventReducedwith the broadcast streamAggregate.eventsofReduction; replayed events are not emitted and throwing listeners cannot affect a commit - add
Aggregate.close()to finish queued commands, closeeventsand reject later commands with aStateError
Migrating from 1.x #
Aggregate(...)/AggregateFullyGeneric(...)→await Aggregate.load(...); useAggregate.resume(...)to start from a known state without replaying.- Remove
replayStoredEventsandreplay()calls;loadreplays automatically. aggregate.process(command)→await aggregate.process(command); it returns the new state.- Implement
EventStoragewithStream<E> readAll()andFuture<void> appendAll(List<E>)instead ofiterableandappend. onEventReducedcallback → listen toaggregate.events.aggregate.findOptions()→optionFinder.find(aggregate.currentState).- Replace
Mapconstructor arguments of the composable classes withregister<T>(...). - Catch
StateErrorinstead ofArgumentErrorfor unregistered types. - Call
await aggregate.close()when done.
1.1.0 #
- add
OptionFinder - add
ComposableOptionFinder
1.0.0 #
- export
InvalidCommandException
0.0.1 #
- initial version