tapeworm 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  var _ = require('lodash');
2
2
  var Promise = require('bluebird');
3
- var uuid = require('node-uuid').v4;
3
+ var uuid = require('uuid').v4;
4
4
 
5
5
  var EventStream = require('./event_stream');
6
6
 
@@ -10,20 +10,23 @@ var EventStorePartition = function (partitionId, persistencePartition, dispatchS
10
10
  this._dispatchService = dispatchService;
11
11
 
12
12
  var self = this;
13
- _.forEach(['storeSnapshot', 'loadSnapshot', 'queryStream', 'queryStreamWithSnapshot', 'removeSnapshot', 'getLatestCommit'], function (what) {
14
- if (self._persistencePartition[what]) {
15
- self[what] = function () {
16
- return self._persistencePartition[what].apply(self._persistencePartition, arguments);
17
- };
18
- } else {
19
- if (what === 'queryStreamWithSnapshot') {
20
- // fallback function
13
+ _.forEach(
14
+ ['storeSnapshot', 'loadSnapshot', 'queryStream', 'queryStreamWithSnapshot', 'removeSnapshot', 'getLatestCommit', 'querySnapshotsByMaxDateTime'],
15
+ function (what) {
16
+ if (self._persistencePartition[what]) {
21
17
  self[what] = function () {
22
- return self._queryStreamWithSnapshotFallback.apply(self._persistencePartition, arguments);
18
+ return self._persistencePartition[what].apply(self._persistencePartition, arguments);
23
19
  };
20
+ } else {
21
+ if (what === 'queryStreamWithSnapshot') {
22
+ // fallback function
23
+ self[what] = function () {
24
+ return self._queryStreamWithSnapshotFallback.apply(self._persistencePartition, arguments);
25
+ };
26
+ }
24
27
  }
25
28
  }
26
- });
29
+ );
27
30
  };
28
31
 
29
32
  EventStorePartition.prototype.openStream = function (streamId, writeOnly, callback) {
@@ -82,16 +85,15 @@ EventStorePartition.prototype.delete = function (streamId, deleteEvent) {
82
85
  .then(function (stream) {
83
86
  stream.append(event);
84
87
  return stream.commit(uuid());
85
- }).then(function () {
88
+ })
89
+ .then(function () {
86
90
  // support legacy/unsupported approach
87
91
  if (self._persistencePartition.removeSnapshot) {
88
92
  return self._persistencePartition.removeSnapshot(streamId);
89
93
  } else if (self._persistencePartition.removeSnapshots) {
90
94
  return self._persistencePartition.removeSnapshots([streamId]);
91
- } else {
92
- LOG.warn('No method to remove snapshot available, stream deleted: %s', streamId);
93
95
  }
94
- });;
96
+ });
95
97
  };
96
98
 
97
99
  /*** UNDOCUMENTED API ***/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tapeworm",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "bluebird": "^2.5.2",
43
- "lodash": "^2.4.1",
44
- "node-uuid": "^1.4.2"
43
+ "lodash": "^2.4.2",
44
+ "uuid": "^8.3.2"
45
45
  }
46
46
  }
@@ -1,6 +1,6 @@
1
1
  var should = require('should');
2
2
  var Promise = require('bluebird');
3
- var uuid = require('node-uuid').v4;
3
+ var uuid = require('uuid').v4;
4
4
 
5
5
  var EventStore = require('..');
6
6
  var Commit = EventStore.Commit;
@@ -195,7 +195,7 @@ describe('Partition', function () {
195
195
  });
196
196
  });
197
197
 
198
- it.only('should delete and placeholder commit should have an id', function (done) {
198
+ it('should delete and placeholder commit should have an id', function (done) {
199
199
  var didIGetaDeleteEvent = false;
200
200
  var es = new EventStore(null, (commit) => {
201
201
  console.log(commit.id);
@@ -1,6 +1,6 @@
1
1
  var should = require('should');
2
2
  var Promise = require('bluebird');
3
- var uuid = require('node-uuid').v4;
3
+ var uuid = require('uuid').v4;
4
4
 
5
5
  var EventStore = require('..');
6
6
  var EventStream = require('../lib/event_stream');
@@ -1,5 +1,5 @@
1
1
  var should = require('should');
2
- var uuid = require("node-uuid").v4;
2
+ var uuid = require("uuid").v4;
3
3
  var Promise = require("bluebird");
4
4
 
5
5
  var Store = require('../../lib/persistence/inmemory/inmemory_persistence');