
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
eventsourced
Advanced tools
Event sourcing JavaScript entity class
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.
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.
Auto-generated API Documentation.
npm i eventsourced
undefined
or null
.command<->event
mappings.Entity.inspect(<instance>);
.var Entity = require('eventsourced');
class MyEntity extends Entity {
/**
* Commands change state
* and return undefined or null.
*/
rename(name) {
this.name = name;
}
save() {
this.foo = 'bar';
return null;
}
/**
* A command that does not change
* state does not cause an event
* to be emitted. It is considered
* to be a query and not a command.
*/
touch() {
}
/**
* A query method does return
* something but does not change
* state.
*/
myQuery() {
return {
type: 'query response',
name: this.name,
email: this.email,
};
}
}
const entity = new MyEntity();
/**
* Sets name to Daniel,
* changes state, emits
* renamed event.
*/
a.rename('Daniel');
/**
* Sets foo to bar, changes
* state, emits saved event.
*/
a.save();
/**
* Does nothing, does not
* emit event.
*/
a.touch();
npm test
to run one-off tests.npm start
to continuously run tests on every change.npm run cov
to see test coverage report.FAQs
Event sourcing JavaScript entity class
We found that eventsourced demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.