-
Notifications
You must be signed in to change notification settings - Fork 4
Latest Changes
ApplicationService.Instance.replayEventsUpTo(domainEvent, msInterval, inclusive)
and
ApplicationService.Instance.hardReplayEventsUpTo(domainEvent, msInterval, inclusive)
now allow you to replay your events up to, or just before a particular domain event.
ApplicationService.Instance.onCommandValidated(callback)
allows a callback that can be fired between command validation and command handling when ApplicationService.Instance.handleCommand(command)
is triggered
IAmAValueObject
interface now exists, forcing you to implement equals(other: T)
Replay of navigations completed with Link
components can now be replayed
React components (and therefore also cqrs-react-router pages) require subscription on mounting and should unsubscribe when unmounted.
ApplicationService.Instance.subscribePage(page, viewName, callback)
is a new method that means you no longer have to worry about the mounting-unmounting process.
Please be aware that you probably might want to still manually write the mounting/unmounting code if you have custom code you need run there.
ApplicationService.Instance.validateHypotheticalCommand(command, onError)
now available for when you want to run all your business logic without changing the current state.
Events can now be replayed slowly by calling replayEvents with two arguments:
ApplicationService.Instance.replayEvents(Clock.now(), 1000);
Breaking changes:
IAmAnAction
renamed to IAmADomainEvent
ActionStore
renamed to EventStore
DatedAction
renamed to DatedEvent
AuditedAction
renamed to AuditedEvent
All other functions and properties with "action" in them have been renamed with "event"
This is due to the fact that "actions" are usually associated with commands, whereas in this project, they clearly correspond to events.
onActionStored
can now be called on an ApplicationService instance.
ApplicationService.Instance.onActionStored(callback: (action: IAmAnAction) => {
// do something with this action
})
hardReplayActions
in ApplicationService that will allow you to also reset aggregate roots (replayActions
only resets views).
Introduction of AuditedAction
abstract class that will enforce use of createdBy string property.
Small fix to ClockDate object - adding of time now returns a new object and doesn't mutate the original ClockDate.
DatedAction
now comes as part of the package - it is an abstract class that implements IAmAnAction.
It will automatically set the "Created" property on creation and therefore is more useful to users who want to use their actions for auditing purposes.
Breaking change: the use of 'id' in IAmAnAction was a bit ambiguous, so IAmAnAction now has a property 'aggregateID' instead.
CommandValidator
abstract class now available and can be registered to your ApplicationService
.
You can now also get a report of your state from your application service with:
var report = ApplicationService.Instance.getStateReport();
You can now handle domain errors neatly by subscribe a domain error event for your application service:
ApplicationService.Instance.onDomainError((error: DomainError) => {
alert(error.message);
});
Please not that this will not handle any generic errors - only errors specified as DomainErrors.
cqrs-react-router - bringing Domain-Driven Design patterns to the front end