resolve-es
Provides an event store implementation with the capability to use different storage adapters to store and emit events.
Usage
When initializing an event store, pass the following arguments:
storage
Use a reSolve framework adapter
publishEvent
The hook function after calling "eventStore.saveEvent"
Example
// Import and initializtion const storage = const publishEvent = async { console // Send event to subscribers} const eventStore = // Load eventsconst eventHandler = async { console await } const eventFilter = eventTypes: 'EVENT_TYPE_1' 'EVENT_TYPE_2' // Or null to load ALL event types aggregateIds: 'AGGREGATE_ID_1' 'AGGREGATE_ID_2' // Or null to load ALL aggregate ids startTime: Date - 10000 // Or null to load events from beginning of time finishTime: Date + 10000 // Or null to load events to current time await eventStore const latestEvent = await // Save eventconst event = aggregateId: '1' aggregateVersion: 2 type: 'UserCreated' payload: email: 'test@user.com' await eventStore