3.0.3 • Published 6 years ago

@rheactorjs/event-store v3.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

event-store

npm version Build Status Greenkeeper badge js-standard-style semantic-release Test Coverage Code Climate

Implementation of an event store based on redis.

Contains helper methods to manage secondary indices.

Versioning

Storing events per aggregate is done in a list per individual aggregate, the order of the insertion is guaranteed by using Redis lists. This gives use an version number per event for free.

Lets assume we want to create a user 17, we store a UserCreatedEvent for this aggregate id:

eventStore.persist(new ModelEvent('UserCreatedEvent', '17', {name: 'John'}))

If we add another event later:

eventStore.persist(new ModelEvent('UserNameUpdatedEvent', '17', {name: 'Mike'}))

this event will be appended to the list.

When aggregating the events, we can increase the version of the aggregate per event.

Mutable Aggregates have been deprecated

The initial implementation of the event store modified models in place. More recently we decied to use immutable models instead.

The ImmutableAggregateRepository changes how Models are instantiated. It moves the responsibility of creating the model instance to the repository, where the applyEvent() method is invoked as a reducer. The method will return an instance of ImmutableAggregateRoot which can no longer be manipulated directly.

This also changes how meta information is stored in the Aggregates, it is now encapsuled in a separate object called AggregateMeta.

See the tests for details.

3.0.3

6 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.0

7 years ago