sharedb 4.0.0 → 4.0.2
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.
- package/CHANGELOG.md +44 -0
- package/package.json +13 -14
- package/test/client/snapshot-timestamp-request.js +1 -2
- package/test/client/subscribe.js +0 -40
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
## v2.0
|
|
2
|
+
|
|
3
|
+
### Breaking changes
|
|
4
|
+
|
|
5
|
+
* Drop Node.js v10 support
|
|
6
|
+
|
|
7
|
+
## v1.0-beta
|
|
8
|
+
|
|
9
|
+
### Breaking changes
|
|
10
|
+
|
|
11
|
+
* Add options argument to all public database adapter methods that read
|
|
12
|
+
or write from snapshots or ops.
|
|
13
|
+
|
|
14
|
+
* DB methods that get snapshots or ops no longer return metadata unless
|
|
15
|
+
`{metadata: true}` option is passed.
|
|
16
|
+
|
|
17
|
+
* Replace `source` argument with `options` in doc methods. Use `options.source`
|
|
18
|
+
instead.
|
|
19
|
+
|
|
20
|
+
* Backend streams now write objects intead of strings.
|
|
21
|
+
|
|
22
|
+
* MemoryDB.prototype._querySync now returns `{snapshots: ..., extra: ...}`
|
|
23
|
+
instead of just an array of snapshots.
|
|
24
|
+
|
|
25
|
+
### Non-breaking changes
|
|
26
|
+
|
|
27
|
+
* Add options argument to backend.submit.
|
|
28
|
+
|
|
29
|
+
* Add error codes to all errors.
|
|
30
|
+
|
|
31
|
+
* Add `'updated'` event on queries which fires on all query result changes.
|
|
32
|
+
|
|
33
|
+
* In clients, wrap errors in Error objects to they get passed through event
|
|
34
|
+
emitters.
|
|
35
|
+
|
|
36
|
+
* Sanitize stack traces when sending errors to client, but log them on the
|
|
37
|
+
server.
|
|
38
|
+
|
|
39
|
+
## v0.11.37
|
|
40
|
+
|
|
41
|
+
Beginning of changelog.
|
|
42
|
+
|
|
43
|
+
If you're upgrading from ShareJS 0.7 or earlier,
|
|
44
|
+
take a look at the [ShareJS upgrade guide](docs/upgrading-from-sharejs.md).
|
package/package.json
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sharedb",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "JSON OT database backend",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"arraydiff": "^0.1.
|
|
8
|
-
"async": "^2.
|
|
9
|
-
"fast-deep-equal": "^
|
|
7
|
+
"arraydiff": "^0.1.3",
|
|
8
|
+
"async": "^3.2.4",
|
|
9
|
+
"fast-deep-equal": "^3.1.3",
|
|
10
10
|
"hat": "0.0.3",
|
|
11
|
-
"ot-json0": "^1.0
|
|
11
|
+
"ot-json0": "^1.1.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"chai": "^4.
|
|
15
|
-
"coveralls": "^3.
|
|
16
|
-
"eslint": "^
|
|
14
|
+
"chai": "^4.3.7",
|
|
15
|
+
"coveralls": "^3.1.1",
|
|
16
|
+
"eslint": "^8.47.0",
|
|
17
17
|
"eslint-config-google": "^0.14.0",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"nyc": "^14.1.1",
|
|
18
|
+
"mocha": "^10.2.0",
|
|
19
|
+
"nyc": "^15.1.0",
|
|
21
20
|
"ot-json0-v2": "https://github.com/ottypes/json0#90a3ae26364c4fa3b19b6df34dad46707a704421",
|
|
22
|
-
"ot-json1": "^0.
|
|
21
|
+
"ot-json1": "^1.0.2",
|
|
23
22
|
"rich-text": "^4.1.0",
|
|
24
|
-
"sharedb-legacy": "npm:sharedb
|
|
25
|
-
"sinon": "^
|
|
23
|
+
"sharedb-legacy": "npm:sharedb@1.1.0",
|
|
24
|
+
"sinon": "^15.2.0",
|
|
26
25
|
"sinon-chai": "^3.7.0"
|
|
27
26
|
},
|
|
28
27
|
"files": [
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
var Backend = require('../../lib/backend');
|
|
2
2
|
var expect = require('chai').expect;
|
|
3
|
-
var lolex = require('lolex');
|
|
4
3
|
var MemoryDb = require('../../lib/db/memory');
|
|
5
4
|
var MemoryMilestoneDb = require('../../lib/milestone-db/memory');
|
|
6
5
|
var sinon = require('sinon');
|
|
@@ -18,7 +17,7 @@ describe('SnapshotTimestampRequest', function() {
|
|
|
18
17
|
var ONE_DAY = 1000 * 60 * 60 * 24;
|
|
19
18
|
|
|
20
19
|
beforeEach(function() {
|
|
21
|
-
clock =
|
|
20
|
+
clock = sinon.useFakeTimers(day1);
|
|
22
21
|
backend = new Backend();
|
|
23
22
|
});
|
|
24
23
|
|
package/test/client/subscribe.js
CHANGED
|
@@ -838,46 +838,6 @@ module.exports = function() {
|
|
|
838
838
|
});
|
|
839
839
|
});
|
|
840
840
|
|
|
841
|
-
it('doc fetches ops to catch up if it receives multiple future ops', function(done) {
|
|
842
|
-
var backend = this.backend;
|
|
843
|
-
var doc = this.backend.connect().get('dogs', 'fido').on('error', done);
|
|
844
|
-
var doc2 = this.backend.connect().get('dogs', 'fido').on('error', done);
|
|
845
|
-
// Delaying op replies will cause multiple future ops to be received
|
|
846
|
-
// before the fetch to catch up completes
|
|
847
|
-
backend.use('op', function(request, next) {
|
|
848
|
-
setTimeout(next, 10 * Math.random());
|
|
849
|
-
});
|
|
850
|
-
doc.create({age: 3}, function(err) {
|
|
851
|
-
if (err) return done(err);
|
|
852
|
-
doc2.subscribe(function(err) {
|
|
853
|
-
if (err) return done(err);
|
|
854
|
-
var wait = 4;
|
|
855
|
-
doc2.on('op', function() {
|
|
856
|
-
if (--wait) return;
|
|
857
|
-
expect(doc2.version).eql(5);
|
|
858
|
-
expect(doc2.data).eql({age: 122});
|
|
859
|
-
// Wait for whenNothingPending, because the doc might have kicked
|
|
860
|
-
// off multiple fetches, and some could be pending still. We want to
|
|
861
|
-
// resolve all inflight requests of the database before closing and
|
|
862
|
-
// proceeding to the next test
|
|
863
|
-
doc2.whenNothingPending(done);
|
|
864
|
-
});
|
|
865
|
-
backend.suppressPublish = true;
|
|
866
|
-
doc.submitOp({p: ['age'], na: 1}, function(err) {
|
|
867
|
-
if (err) return done(err);
|
|
868
|
-
backend.suppressPublish = false;
|
|
869
|
-
doc.submitOp({p: ['age'], na: 5}, function(err) {
|
|
870
|
-
if (err) return done(err);
|
|
871
|
-
doc.submitOp({p: ['age'], na: 13}, function(err) {
|
|
872
|
-
if (err) return done(err);
|
|
873
|
-
doc.submitOp({p: ['age'], na: 100});
|
|
874
|
-
});
|
|
875
|
-
});
|
|
876
|
-
});
|
|
877
|
-
});
|
|
878
|
-
});
|
|
879
|
-
});
|
|
880
|
-
|
|
881
841
|
describe('doc.subscribed', function() {
|
|
882
842
|
it('is set to false initially', function(done) {
|
|
883
843
|
var doc = this.backend.connect().get('dogs', 'fido').on('error', done);
|