Event Sourced

An Event Sourcing library for Node using ES6, Immutable, NLP and some CQRS.
Combining Event Sourcing and CQRS concepts in one Entity class for node using ES6 Symbols, Proxies, Immutable and Event Emitter. One of the main goals with the Entity class is to create instances that are as clean as possible and allow users to set and get attributes as they normally would in JavaScript while automatically maintaining state, event history, etc.
Warning
Only available for Node 6. We will be adding distributions for older versions but haven't gotten around to it yet. Stay tunned.
This is very much a work in progress and not ready for use. For now, see lib/entity/entity.spec.js to get an idea of what it does.
Installation
npm i eventsourced
Usage
var Entity = require('eventsourced');
class MyEntity extends Entity {
constructor(events, options) {
super(events, options);
this.name = 'Luis';
this.email = 'lgomez@example.com';
}
rename(name) {
this.name = name;
}
save() {
this.foo = 'bar';
return null;
}
touch() {
}
myQuery() {
return {
type: 'query response',
name: this.name,
email: this.email,
};
}
}
const entity = new MyEntity();
a.rename('Daniel');
a.save();
a.touch();
Testing
One-off tests can be run as usual:
npm test
Or you can use npm start
to continuously run tests on every change.
npm start