Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eventstore

Package Overview
Dependencies
Maintainers
2
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eventstore - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

8

lib/databases/inmemory.js

@@ -282,6 +282,10 @@ 'use strict';

// all = _.sortBy(all, function (s) {
// return [(-s.revision), (-s.version)].join('_');
// });
all = _.sortBy(all, function (s) {
return s.commitStamp.getTime();
return (-s.commitStamp.getTime());
});
if (!_.isEmpty(query)) {

@@ -288,0 +292,0 @@ all = _.filter(all, function(a) {

@@ -216,8 +216,8 @@ 'use strict';

}
if (limit === -1) {
return this.events.find(findStatement, { sort:[[ 'commitStamp','asc' ], [ 'streamRevision','asc' ], [ 'commitSequence','asc' ]] }).skip(skip).toArray(callback);
return this.events.find(findStatement, { sort: { commitStamp: 1, streamRevision: 1, commitSequence: 1 } }).skip(skip).toArray(callback);
}
this.events.find(findStatement, { sort:[[ 'commitStamp','asc' ], [ 'streamRevision','asc' ], [ 'commitSequence','asc' ]] }).skip(skip).limit(limit).toArray(callback);
this.events.find(findStatement, { sort: { commitStamp: 1, streamRevision: 1, commitSequence: 1 } }).skip(skip).limit(limit).toArray(callback);
},

@@ -256,3 +256,3 @@

this.events.find(findStatement, { sort:[[ 'commitStamp','asc' ], [ 'streamRevision','asc' ], [ 'commitSequence','asc' ]] }).toArray(function (err, res) {
this.events.find(findStatement, { sort: { commitStamp: 1, streamRevision: 1, commitSequence: 1 } }).toArray(function (err, res) {
if (err) {

@@ -310,3 +310,3 @@ debug(err);

getUndispatchedEvents: function (callback) {
this.events.find({ 'dispatched' : false }, { sort:[[ 'commitStamp','asc' ], [ 'streamRevision','asc' ], [ 'commitSequence','asc' ]] }).toArray(callback);
this.events.find({ 'dispatched' : false }, { sort: { commitStamp: 1, streamRevision: 1, commitSequence: 1 } }).toArray(callback);
},

@@ -358,3 +358,3 @@

this.snapshots.findOne(findStatement, { sort:[[ 'commitStamp','asc' ], ['revision','asc']] }, callback);
this.snapshots.findOne(findStatement, { sort: { revision: -1, version: -1, commitStamp: -1 } }, callback);
}

@@ -361,0 +361,0 @@

@@ -366,3 +366,3 @@ 'use strict';

return s;
});
}).reverse();

@@ -369,0 +369,0 @@ if (revMax > -1) {

@@ -161,6 +161,6 @@ 'use strict';

if (limit === -1) {
return this.events.find(findStatement, { sort:[[ 'commitStamp','asc' ], [ 'streamRevision','asc' ], [ 'commitSequence','asc' ]] }).skip(skip).toArray(callback);
return this.events.find(findStatement, { sort: { commitStamp: 1, streamRevision: 1, commitSequence: 1 } }).skip(skip).toArray(callback);
}
this.events.find(findStatement, { sort:[[ 'commitStamp','asc' ], [ 'streamRevision','asc' ], [ 'commitSequence','asc' ]] }).skip(skip).limit(limit).toArray(callback);
this.events.find(findStatement, { sort: { commitStamp: 1, streamRevision: 1, commitSequence: 1 } }).skip(skip).limit(limit).toArray(callback);
},

@@ -199,3 +199,3 @@

this.events.find(findStatement, { sort:[[ 'commitStamp','asc' ], [ 'streamRevision','asc' ], [ 'commitSequence','asc' ]] }).toArray(function (err, res) {
this.events.find(findStatement, { sort: { commitStamp: 1, streamRevision: 1, commitSequence: 1 } }).toArray(function (err, res) {
if (err) {

@@ -253,3 +253,3 @@ debug(err);

getUndispatchedEvents: function (callback) {
this.events.find({ 'dispatched' : false }, { sort:[[ 'commitStamp','asc' ], [ 'streamRevision','asc' ], [ 'commitSequence','asc' ]] }).toArray(callback);
this.events.find({ 'dispatched' : false }, { sort: { commitStamp: 1, streamRevision: 1, commitSequence: 1 } }).toArray(callback);
},

@@ -301,3 +301,3 @@

this.snapshots.findOne(findStatement, { sort:[[ 'commitStamp','asc' ], ['revision','asc']] }, callback);
this.snapshots.findOne(findStatement, { sort: { revision: -1, version: -1, commitStamp: -1 } }, callback);
}

@@ -304,0 +304,0 @@

{
"author": "adrai",
"name": "eventstore",
"version": "1.0.0",
"version": "1.0.1",
"contributors": [

@@ -6,0 +6,0 @@ {

@@ -139,2 +139,7 @@ # Introduction

'streamId' and 'aggregateId' are the same...
In ddd terms aggregate and context are just to be more precise in language.
For example you can have a 'person' aggregate in the context 'human ressources' and a 'person' aggregate in the context of 'business contracts'...
So you can have 2 complete different aggregate instances of 2 complete different aggregates (but perhaps with same name) in 2 complete different contexts
you can request an eventstream even by limit the query with a 'minimum revision number' and a 'maximum revision number'

@@ -308,3 +313,32 @@

by revision
revMin, revMax always optional
var revMin = 5,
revMax = 8; // if you omit revMax or you define it as -1 it will retrieve until the end
es.getEventsByRevision('streamId', revMin, revMax, function(err, evts) {});
// or
es.getEventsByRevision({
aggregateId: 'myAggregateId',
aggregate: 'person', // optional
context: 'hr' // optional
}, revMin, revMax, function(err, evts) {});
## obtain a new id
es.getNewId(function(err, newId) {
if(err) {
console.log('ohhh :-(');
return;
}
console.log('the new id is: ' + newId);
});
# Sample Integration

@@ -311,0 +345,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc