sharedb-mongo 4.2.0 → 5.1.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.
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -20,14 +20,15 @@ jobs:
20
20
  fail-fast: false
21
21
  matrix:
22
22
  node:
23
- - 16
24
23
  - 18
25
24
  - 20
25
+ - 22
26
26
  mongodb:
27
27
  - 4.4
28
28
  - 5.0
29
29
  - 6.0
30
30
  - 7.0
31
+ - 8.0
31
32
  services:
32
33
  mongodb:
33
34
  image: mongo:${{ matrix.mongodb }}
@@ -35,8 +36,8 @@ jobs:
35
36
  - 27017:27017
36
37
  timeout-minutes: 10
37
38
  steps:
38
- - uses: actions/checkout@v3
39
- - uses: actions/setup-node@v3
39
+ - uses: actions/checkout@v4
40
+ - uses: actions/setup-node@v4
40
41
  with:
41
42
  node-version: ${{ matrix.node }}
42
43
  - name: Install
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "sharedb-mongo",
3
- "version": "4.2.0",
3
+ "version": "5.1.0",
4
4
  "description": "MongoDB database adapter for ShareDB",
5
5
  "main": "index.js",
6
6
  "dependencies": {
7
- "mongodb": "^3.1.13 || ^4.0.0 || ^5.0.0 || ^6.0.0",
7
+ "mongodb": "^3.1.13 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
8
8
  "sharedb": "^1.9.1 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0"
9
9
  },
10
10
  "devDependencies": {
@@ -18,6 +18,7 @@
18
18
  "mongodb4": "npm:mongodb@^4.0.0",
19
19
  "mongodb5": "npm:mongodb@^5.0.0",
20
20
  "mongodb6": "npm:mongodb@^6.0.0",
21
+ "mongodb7": "npm:mongodb@^7.0.0",
21
22
  "nyc": "^14.1.1",
22
23
  "ot-json1": "^1.0.1",
23
24
  "rich-text": "^4.1.0",
@@ -33,7 +34,8 @@
33
34
  "test:mongodb4": "_SHAREDB_MONGODB_DRIVER=mongodb4 npm test",
34
35
  "test:mongodb5": "_SHAREDB_MONGODB_DRIVER=mongodb5 npm test",
35
36
  "test:mongodb6": "_SHAREDB_MONGODB_DRIVER=mongodb6 npm test",
36
- "test:all": "npm run test:mongodb3 && npm run test:mongodb4 && npm run test:mongodb5 && npm run test:mongodb6",
37
+ "test:mongodb7": "_SHAREDB_MONGODB_DRIVER=mongodb7 npm test",
38
+ "test:all": "npm run test:mongodb3 && npm run test:mongodb4 && npm run test:mongodb5 && npm run test:mongodb6 && npm run test:mongodb7",
37
39
  "test-cover": "nyc --temp-dir=coverage -r text -r lcov npm run test:all"
38
40
  },
39
41
  "repository": "git://github.com/share/sharedb-mongo.git",
@@ -538,7 +538,7 @@ describe('mongo db connection', function() {
538
538
  db.queryPoll('testcollection', {}, null, function(err, results) {
539
539
  if (err) return done(err);
540
540
  expect(results.length).eql(1);
541
- expect((new Date) - timeBeforeQuery).greaterThan(pollDelay);
541
+ expect((new Date) - timeBeforeQuery).greaterThanOrEqual(pollDelay);
542
542
  done();
543
543
  });
544
544
  });
@@ -71,7 +71,10 @@ describe('mongo db middleware', function() {
71
71
 
72
72
  describe(BEFORE_EDIT, function() {
73
73
  it('has the expected properties on the request object', function(done) {
74
+ var middlewareEntranceCount = 0;
75
+
74
76
  db.use(BEFORE_EDIT, function(request, next) {
77
+ middlewareEntranceCount = middlewareEntranceCount + 1;
75
78
  expect(request).to.have.all.keys([
76
79
  'action',
77
80
  'collectionName',
@@ -87,7 +90,6 @@ describe('mongo db middleware', function() {
87
90
  expect(request.options.testOptions).to.equal('yes');
88
91
  expect(request.query._id).to.equal('test1');
89
92
  next();
90
- done();
91
93
  });
92
94
 
93
95
  var snapshot = {type: 'json0', id: 'test1', v: 1, data: {foo: 'bar'}};
@@ -98,6 +100,9 @@ describe('mongo db middleware', function() {
98
100
  if (err) return done(err);
99
101
  db.commit('testcollection', snapshot.id, editOp, newSnapshot, {testOptions: 'yes'}, function(err) {
100
102
  if (err) return done(err);
103
+
104
+ expect(middlewareEntranceCount).to.equal(1);
105
+ done();
101
106
  });
102
107
  });
103
108
  });
@@ -221,7 +226,10 @@ describe('mongo db middleware', function() {
221
226
 
222
227
  describe(BEFORE_SNAPSHOT_LOOKUP, function() {
223
228
  it('has the expected properties on the request object before getting a single snapshot', function(done) {
229
+ var middlewareEntranceCount = 0;
230
+
224
231
  db.use(BEFORE_SNAPSHOT_LOOKUP, function(request, next) {
232
+ middlewareEntranceCount = middlewareEntranceCount + 1;
225
233
  expect(request).to.have.all.keys([
226
234
  'action',
227
235
  'collectionName',
@@ -233,7 +241,6 @@ describe('mongo db middleware', function() {
233
241
  expect(request.options.testOptions).to.equal('yes');
234
242
  expect(request.query._id).to.equal('test1');
235
243
  next();
236
- done();
237
244
  });
238
245
 
239
246
  var snapshot = {type: 'json0', id: 'test1', v: 1, data: {foo: 'bar'}};
@@ -242,6 +249,8 @@ describe('mongo db middleware', function() {
242
249
  db.getSnapshot('testcollection', 'test1', null, {testOptions: 'yes'}, function(err, doc) {
243
250
  if (err) return done(err);
244
251
  expect(doc).to.exist;
252
+ expect(middlewareEntranceCount).to.equal(1);
253
+ done();
245
254
  });
246
255
  });
247
256
  });
@@ -356,7 +365,9 @@ describe('mongo db middleware', function() {
356
365
  });
357
366
 
358
367
  it('has the expected properties on the request object before getting bulk snapshots', function(done) {
368
+ var middlewareEntranceCount = 0;
359
369
  db.use(BEFORE_SNAPSHOT_LOOKUP, function(request, next) {
370
+ middlewareEntranceCount = middlewareEntranceCount + 1;
360
371
  expect(request).to.have.all.keys([
361
372
  'action',
362
373
  'collectionName',
@@ -368,7 +379,6 @@ describe('mongo db middleware', function() {
368
379
  expect(request.options.testOptions).to.equal('yes');
369
380
  expect(request.query._id).to.deep.equal({$in: ['test1']});
370
381
  next();
371
- done();
372
382
  });
373
383
 
374
384
  var snapshot = {type: 'json0', id: 'test1', v: 1, data: {foo: 'bar'}};
@@ -377,6 +387,8 @@ describe('mongo db middleware', function() {
377
387
  db.getSnapshotBulk('testcollection', ['test1'], null, {testOptions: 'yes'}, function(err, doc) {
378
388
  if (err) return done(err);
379
389
  expect(doc).to.exist;
390
+ expect(middlewareEntranceCount).to.equal(1);
391
+ done();
380
392
  });
381
393
  });
382
394
  });