@hydranium/protocol 1.0.0-next.17 → 1.0.0-next.174
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/README.md +35 -1
- package/lib/client/data-connection.d.ts +157 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +236 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +13 -1
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +21 -0
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +25 -23
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +440 -78
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +697 -106
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +13 -8
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +13 -8
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +9 -3
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +11 -5
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/post-message-transport.d.ts +64 -3
- package/lib/client/post-message-transport.d.ts.map +1 -1
- package/lib/client/post-message-transport.js +175 -1
- package/lib/client/post-message-transport.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +149 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +202 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client-ids.d.ts +45 -0
- package/lib/client-ids.d.ts.map +1 -0
- package/lib/client-ids.js +48 -0
- package/lib/client-ids.js.map +1 -0
- package/lib/clock.d.ts +38 -0
- package/lib/clock.d.ts.map +1 -1
- package/lib/clock.js +36 -1
- package/lib/clock.js.map +1 -1
- package/lib/data/data-protocol-methods.d.ts +4 -4
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +11 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +111 -31
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +103 -14
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +67 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/errors.d.ts +163 -17
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +219 -22
- package/lib/errors.js.map +1 -1
- package/lib/glsp-save-model-actions.d.ts +50 -0
- package/lib/glsp-save-model-actions.d.ts.map +1 -0
- package/lib/glsp-save-model-actions.js +28 -0
- package/lib/glsp-save-model-actions.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/lib/latency-collector.d.ts +8 -4
- package/lib/latency-collector.d.ts.map +1 -1
- package/lib/latency-collector.js.map +1 -1
- package/lib/messages/index.d.ts +29 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +58 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/primitives.d.ts +188 -0
- package/lib/messages/primitives.d.ts.map +1 -0
- package/lib/messages/primitives.js +161 -0
- package/lib/messages/primitives.js.map +1 -0
- package/lib/model-server.d.ts +60 -13
- package/lib/model-server.d.ts.map +1 -1
- package/lib/model-server.js +4 -2
- package/lib/model-server.js.map +1 -1
- package/lib/model-service/based-on.d.ts +57 -0
- package/lib/model-service/based-on.d.ts.map +1 -0
- package/lib/model-service/based-on.js +37 -0
- package/lib/model-service/based-on.js.map +1 -0
- package/lib/model-service/index.d.ts +1 -1
- package/lib/model-service/index.d.ts.map +1 -1
- package/lib/model-service/index.js +4 -5
- package/lib/model-service/index.js.map +1 -1
- package/lib/patch-merge.d.ts +28 -27
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +66 -22
- package/lib/patch-merge.js.map +1 -1
- package/lib/profile-session.d.ts +8 -4
- package/lib/profile-session.d.ts.map +1 -1
- package/lib/profile-session.js.map +1 -1
- package/lib/rpc/bind-rpc-methods.d.ts +29 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +22 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +7 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +6 -1
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- package/lib/testing/catalogue-audit.d.ts +80 -0
- package/lib/testing/catalogue-audit.d.ts.map +1 -0
- package/lib/testing/catalogue-audit.js +94 -0
- package/lib/testing/catalogue-audit.js.map +1 -0
- package/lib/testing/data-doubles.d.ts +13 -12
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +19 -5
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/fake-clock.d.ts +9 -1
- package/lib/testing/fake-clock.d.ts.map +1 -1
- package/lib/testing/fake-clock.js +54 -45
- package/lib/testing/fake-clock.js.map +1 -1
- package/lib/testing/index.d.ts +1 -0
- package/lib/testing/index.d.ts.map +1 -1
- package/lib/testing/index.js +4 -1
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/node/index.d.ts +1 -0
- package/lib/testing/node/index.d.ts.map +1 -1
- package/lib/testing/node/index.js +2 -2
- package/lib/testing/node/index.js.map +1 -1
- package/lib/testing/node/message-port-pair.d.ts +25 -0
- package/lib/testing/node/message-port-pair.d.ts.map +1 -0
- package/lib/testing/node/message-port-pair.js +26 -0
- package/lib/testing/node/message-port-pair.js.map +1 -0
- package/lib/transfer-diagnostic.d.ts +33 -0
- package/lib/transfer-diagnostic.d.ts.map +1 -1
- package/lib/transfer-diagnostic.js +23 -0
- package/lib/transfer-diagnostic.js.map +1 -1
- package/lib/transfer-document.d.ts +34 -5
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +14 -1
- package/lib/transfer-document.js.map +1 -1
- package/lib/util.d.ts +8 -0
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +32 -0
- package/lib/util.js.map +1 -1
- package/package.json +11 -2
- package/src/client/data-connection.ts +314 -0
- package/src/client/data-events.ts +33 -1
- package/src/client/data-port.ts +26 -24
- package/src/client/data-session.ts +880 -123
- package/src/client/index.ts +13 -8
- package/src/client/message-relay.ts +29 -7
- package/src/client/post-message-transport.ts +219 -4
- package/src/client/rpc-connection.ts +268 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +56 -0
- package/src/data/data-protocol-methods.ts +11 -3
- package/src/data/data-server-protocol.ts +132 -31
- package/src/data/events.ts +109 -14
- package/src/data/requests.ts +71 -11
- package/src/errors.ts +259 -24
- package/src/glsp-save-model-actions.ts +59 -0
- package/src/index.ts +6 -0
- package/src/latency-collector.ts +8 -3
- package/src/messages/index.ts +36 -0
- package/src/messages/primitives.ts +271 -0
- package/src/model-server.ts +63 -18
- package/src/model-service/based-on.ts +63 -0
- package/src/model-service/index.ts +4 -5
- package/src/patch-merge.ts +90 -37
- package/src/profile-session.ts +9 -4
- package/src/rpc/bind-rpc-methods.ts +49 -4
- package/src/rpc/create-rpc-proxy.ts +14 -1
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +42 -17
- package/src/testing/fake-clock.ts +62 -47
- package/src/testing/index.ts +4 -1
- package/src/testing/node/index.ts +2 -2
- package/src/testing/node/message-port-pair.ts +40 -0
- package/src/transfer-diagnostic.ts +40 -0
- package/src/transfer-document.ts +41 -6
- package/src/util.ts +33 -0
- package/lib/model-service/args.d.ts +0 -64
- package/lib/model-service/args.d.ts.map +0 -1
- package/lib/model-service/args.js +0 -11
- package/lib/model-service/args.js.map +0 -1
- package/src/model-service/args.ts +0 -67
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.makeFakeClock = makeFakeClock;
|
|
12
|
+
const clock_1 = require("../clock");
|
|
12
13
|
const util_1 = require("../util");
|
|
13
14
|
/**
|
|
14
15
|
* In-process {@link Clock} double for deterministic time. The real
|
|
@@ -20,67 +21,75 @@ const util_1 = require("../util");
|
|
|
20
21
|
*
|
|
21
22
|
* Server-free and DI-free — lives in `@hydranium/protocol/testing` so every
|
|
22
23
|
* head can bind it without pulling in a server package.
|
|
24
|
+
*
|
|
25
|
+
* The clock is a `SystemClock` with its time replaced, so its methods live on
|
|
26
|
+
* its prototype and a spread of it carries none of them. Replace one by
|
|
27
|
+
* assigning it onto the clock, or layer over the clock with `Object.create`.
|
|
23
28
|
*/
|
|
24
29
|
function makeFakeClock(options = {}) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
return new VirtualClock(options.now ?? 0);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A `SystemClock` whose time, stopwatches and timers read one virtual axis, so
|
|
34
|
+
* the `measure` and `raceTimer` it inherits run on that axis too.
|
|
35
|
+
*/
|
|
36
|
+
class VirtualClock extends clock_1.SystemClock {
|
|
37
|
+
current;
|
|
38
|
+
timers = [];
|
|
39
|
+
constructor(current) {
|
|
40
|
+
super();
|
|
41
|
+
this.current = current;
|
|
42
|
+
}
|
|
43
|
+
now() {
|
|
44
|
+
return this.current;
|
|
45
|
+
}
|
|
46
|
+
setTimer(callback, ms) {
|
|
47
|
+
const timer = { at: this.current + ms, callback, disposed: false, fired: false };
|
|
48
|
+
this.timers.push(timer);
|
|
49
|
+
return util_1.Disposable.create(() => {
|
|
50
|
+
timer.disposed = true;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
stopwatch() {
|
|
54
|
+
const read = () => this.current;
|
|
55
|
+
const start = read();
|
|
56
|
+
let lastLap = start;
|
|
30
57
|
let stopped;
|
|
31
58
|
return {
|
|
32
59
|
get elapsedMs() {
|
|
33
|
-
return (stopped ??
|
|
60
|
+
return (stopped ?? read()) - start;
|
|
34
61
|
},
|
|
35
62
|
lap() {
|
|
36
|
-
const at = stopped ??
|
|
63
|
+
const at = stopped ?? read();
|
|
37
64
|
const split = at - lastLap;
|
|
38
65
|
lastLap = at;
|
|
39
66
|
return split;
|
|
40
67
|
},
|
|
41
68
|
stop() {
|
|
42
|
-
|
|
43
|
-
stopped = current;
|
|
44
|
-
}
|
|
69
|
+
stopped ??= read();
|
|
45
70
|
return stopped - start;
|
|
46
71
|
}
|
|
47
72
|
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (result instanceof Promise) {
|
|
63
|
-
return result.then(value => ({ result: value, elapsedMs: stopwatch.elapsedMs }));
|
|
64
|
-
}
|
|
65
|
-
return { result: result, elapsedMs: stopwatch.elapsedMs };
|
|
66
|
-
}),
|
|
67
|
-
advance(ms) {
|
|
68
|
-
const target = current + ms;
|
|
69
|
-
// Fire due timers one at a time, re-scanning after each so a callback
|
|
70
|
-
// that schedules a nearer timer still fires within this window.
|
|
71
|
-
for (;;) {
|
|
72
|
-
const next = timers
|
|
73
|
-
.filter(timer => !timer.disposed && !timer.fired && timer.at <= target)
|
|
74
|
-
.sort((left, right) => left.at - right.at)[0];
|
|
75
|
-
if (!next) {
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
current = next.at;
|
|
79
|
-
next.fired = true;
|
|
80
|
-
next.callback();
|
|
73
|
+
}
|
|
74
|
+
pendingTimers() {
|
|
75
|
+
return this.timers.filter(timer => !timer.disposed && !timer.fired).length;
|
|
76
|
+
}
|
|
77
|
+
advance(ms) {
|
|
78
|
+
const target = this.current + ms;
|
|
79
|
+
// Fire due timers one at a time, re-scanning after each so a callback
|
|
80
|
+
// that schedules a nearer timer still fires within this window.
|
|
81
|
+
for (;;) {
|
|
82
|
+
const next = this.timers
|
|
83
|
+
.filter(timer => !timer.disposed && !timer.fired && timer.at <= target)
|
|
84
|
+
.sort((left, right) => left.at - right.at)[0];
|
|
85
|
+
if (!next) {
|
|
86
|
+
break;
|
|
81
87
|
}
|
|
82
|
-
current =
|
|
88
|
+
this.current = next.at;
|
|
89
|
+
next.fired = true;
|
|
90
|
+
next.callback();
|
|
83
91
|
}
|
|
84
|
-
|
|
92
|
+
this.current = target;
|
|
93
|
+
}
|
|
85
94
|
}
|
|
86
95
|
//# sourceMappingURL=fake-clock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-clock.js","sourceRoot":"","sources":["../../src/testing/fake-clock.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;
|
|
1
|
+
{"version":3,"file":"fake-clock.js","sourceRoot":"","sources":["../../src/testing/fake-clock.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AA2ClF,sCAEC;AA3CD,oCAAmE;AACnE,kCAAqC;AAyBrC;;;;;;;;;;;;;;GAcG;AACH,SAAgB,aAAa,CAAC,UAA4B,EAAE;IACzD,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,YAAa,SAAQ,mBAAW;IAGb;IAFH,MAAM,GAAgB,EAAE,CAAC;IAE5C,YAAsB,OAAe;QAClC,KAAK,EAAE,CAAC;QADW,YAAO,GAAP,OAAO,CAAQ;IAErC,CAAC;IAEQ,GAAG;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAEQ,QAAQ,CAAC,QAAoB,EAAE,EAAU;QAC/C,MAAM,KAAK,GAAc,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,GAAG,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAC5F,IAA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,EAAE,IAAI,MAAM,CAAC;iBACtE,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACT,MAAM;YACT,CAAC;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YAClB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACzB,CAAC;CACH"}
|
package/lib/testing/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAiBlF,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
package/lib/testing/index.js
CHANGED
|
@@ -25,7 +25,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
// Subpath barrel for `@hydranium/protocol/testing` — the BROWSER-NEUTRAL shared
|
|
26
26
|
// primitives: `makeFakeClock` (deterministic `Clock` double on one virtual time
|
|
27
27
|
// axis), `waitFor` / `tick`, the client-side data-head doubles
|
|
28
|
-
// (`makeFakeDataPort` / `makeCapturingDataClient`),
|
|
28
|
+
// (`makeFakeDataPort` / `makeCapturingDataClient`), the translation-catalogue
|
|
29
|
+
// audit (`flattenCatalogue` / `findUndeclaredCodes` / `findSharedCodes`), and
|
|
30
|
+
// the `Harness` marker
|
|
29
31
|
// interface every framework harness extends. Kept out of the main barrel so production bundles don't pull
|
|
30
32
|
// the test scaffolding in by default; adopters opt in by importing from
|
|
31
33
|
// `@hydranium/protocol/testing`.
|
|
@@ -34,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
36
|
// duplex transports are NOT here: a `PassThrough` pair is in their exported
|
|
35
37
|
// type, so they cannot be made portable and live at `./testing/node` instead.
|
|
36
38
|
// The same rule the package surface uses — the portable name is the short one.
|
|
39
|
+
__exportStar(require("./catalogue-audit"), exports);
|
|
37
40
|
__exportStar(require("./data-doubles"), exports);
|
|
38
41
|
__exportStar(require("./fake-clock"), exports);
|
|
39
42
|
__exportStar(require("./harness"), exports);
|
package/lib/testing/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,gFAAgF;AAChF,+DAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,gFAAgF;AAChF,+DAA+D;AAC/D,8EAA8E;AAC9E,8EAA8E;AAC9E,uBAAuB;AACvB,0GAA0G;AAC1G,wEAAwE;AACxE,iCAAiC;AACjC,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,+EAA+E;AAE/E,oDAAkC;AAClC,iDAA+B;AAC/B,+CAA6B;AAC7B,4CAA0B;AAC1B,6CAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAYlF,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
@@ -23,8 +23,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
25
|
// Subpath barrel for `@hydranium/protocol/testing/node` — the test transports
|
|
26
|
-
// that need a Node runtime
|
|
27
|
-
// `MessageConnection` bridge over it.
|
|
26
|
+
// that need a Node runtime.
|
|
28
27
|
//
|
|
29
28
|
// Separate from `./testing` because a `PassThrough` is in `DuplexStreamPair`'s
|
|
30
29
|
// exported type and `StreamMessageReader` comes from `vscode-jsonrpc/node`, so
|
|
@@ -34,4 +33,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
33
|
// their own.
|
|
35
34
|
__exportStar(require("./duplex-connection"), exports);
|
|
36
35
|
__exportStar(require("./duplex-stream"), exports);
|
|
36
|
+
__exportStar(require("./message-port-pair"), exports);
|
|
37
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,8EAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/node/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,8EAA8E;AAC9E,4BAA4B;AAC5B,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,aAAa;AAEb,sDAAoC;AACpC,kDAAgC;AAChC,sDAAoC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import type { TransferredMessagePort } from '../../client/post-message-transport';
|
|
10
|
+
/**
|
|
11
|
+
* The two ends of a `worker_threads` `MessageChannel`, typed as the transferred
|
|
12
|
+
* browser ports `createMessagePortTransport` takes. Node's port clones and keeps
|
|
13
|
+
* order as a browser's does, which is what lets a headless test stand in for a
|
|
14
|
+
* worker.
|
|
15
|
+
*
|
|
16
|
+
* `dispose` closes both ports. Node reports that as a close and a browser port
|
|
17
|
+
* reports nothing, so a test that asserts on a close does so before teardown.
|
|
18
|
+
*/
|
|
19
|
+
export interface MessagePortPair {
|
|
20
|
+
readonly port1: TransferredMessagePort;
|
|
21
|
+
readonly port2: TransferredMessagePort;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}
|
|
24
|
+
export declare function makeMessagePortPair(): MessagePortPair;
|
|
25
|
+
//# sourceMappingURL=message-port-pair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-port-pair.d.ts","sourceRoot":"","sources":["../../../src/testing/node/message-port-pair.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAElF;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC7B,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;IACvC,OAAO,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,mBAAmB,IAAI,eAAe,CAYrD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.makeMessagePortPair = makeMessagePortPair;
|
|
12
|
+
const node_worker_threads_1 = require("node:worker_threads");
|
|
13
|
+
function makeMessagePortPair() {
|
|
14
|
+
const channel = new node_worker_threads_1.MessageChannel();
|
|
15
|
+
return {
|
|
16
|
+
// Node's port satisfies the structural type at runtime; the cast records
|
|
17
|
+
// one platform's port standing in for the other's.
|
|
18
|
+
port1: channel.port1,
|
|
19
|
+
port2: channel.port2,
|
|
20
|
+
dispose() {
|
|
21
|
+
channel.port1.close();
|
|
22
|
+
channel.port2.close();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=message-port-pair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-port-pair.js","sourceRoot":"","sources":["../../../src/testing/node/message-port-pair.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAoBlF,kDAYC;AA9BD,6DAAqD;AAkBrD,SAAgB,mBAAmB;IAChC,MAAM,OAAO,GAAG,IAAI,oCAAc,EAAE,CAAC;IACrC,OAAO;QACJ,yEAAyE;QACzE,mDAAmD;QACnD,KAAK,EAAE,OAAO,CAAC,KAA0C;QACzD,KAAK,EAAE,OAAO,CAAC,KAA0C;QACzD,OAAO;YACJ,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;KACH,CAAC;AACL,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
+
import { type MessageParams, type ResolvedMessage } from './messages/primitives';
|
|
9
10
|
/**
|
|
10
11
|
* Generic, transport-friendly diagnostic shape used by the model-server protocol.
|
|
11
12
|
*
|
|
@@ -55,6 +56,21 @@ export interface TransferDiagnostic {
|
|
|
55
56
|
* is not usable as a rule identity on its own.
|
|
56
57
|
*/
|
|
57
58
|
code?: number | string;
|
|
59
|
+
/**
|
|
60
|
+
* Substitutions for the placeholders in the message this {@link code} names,
|
|
61
|
+
* present only for a diagnostic raised from a framework message declaration.
|
|
62
|
+
*
|
|
63
|
+
* Without them a translated template renders with its `{name}` tokens left
|
|
64
|
+
* standing, because substitution leaves an unmatched token in place rather
|
|
65
|
+
* than raising — so a surface that translates from {@link code} alone is
|
|
66
|
+
* correct for a parameterless sentence and visibly wrong for a parameterised
|
|
67
|
+
* one. This is the field that makes the second case work; the LSP carrier has
|
|
68
|
+
* always moved the params, and no carrier below it did.
|
|
69
|
+
*
|
|
70
|
+
* Prefer {@link TransferDiagnostic.resolved} over reading this: it decides
|
|
71
|
+
* whether an identity is present at all, which a lone `params` cannot.
|
|
72
|
+
*/
|
|
73
|
+
params?: MessageParams;
|
|
58
74
|
}
|
|
59
75
|
export declare namespace TransferDiagnostic {
|
|
60
76
|
/** Path separator between AST nodes within an element location. */
|
|
@@ -65,6 +81,23 @@ export declare namespace TransferDiagnostic {
|
|
|
65
81
|
const ELEMENT_PROPERTY_SEPARATOR = "^";
|
|
66
82
|
function isError(diagnostic: TransferDiagnostic): boolean;
|
|
67
83
|
function isParseError(diagnostic: TransferDiagnostic): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The diagnostic as a renderable message, for a surface that translates.
|
|
86
|
+
* `undefined` when it carries no framework identity — a syntactic error, an
|
|
87
|
+
* adopter's own check, a linker failure — which is the case a caller must
|
|
88
|
+
* distinguish rather than render.
|
|
89
|
+
*
|
|
90
|
+
* Hand the result to `renderFrameworkMessage` with whatever catalogue the
|
|
91
|
+
* host has loaded. The `text` is the server's English, so a code the
|
|
92
|
+
* catalogue does not carry still yields a complete sentence.
|
|
93
|
+
*
|
|
94
|
+
* `code` alone does not establish an identity: it also holds Langium's
|
|
95
|
+
* internal code and an adopter's own, and either would be looked up against a
|
|
96
|
+
* catalogue that cannot have it. Requiring `params` is what discriminates,
|
|
97
|
+
* and it is why a parameterless framework message still populates the field
|
|
98
|
+
* with an empty object rather than omitting it.
|
|
99
|
+
*/
|
|
100
|
+
function resolved(diagnostic: TransferDiagnostic): ResolvedMessage | undefined;
|
|
68
101
|
function getPath(diagnostic: TransferDiagnostic): string;
|
|
69
102
|
function errors(diagnostics: TransferDiagnostic[]): TransferDiagnostic[];
|
|
70
103
|
function hasErrors(diagnostics: TransferDiagnostic[]): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-diagnostic.d.ts","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAChC;;;;;OAKG;IACH,IAAI,EAAE,cAAc,GAAG,eAAe,GAAG,kBAAkB,CAAC;IAC5D;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,yBAAiB,kBAAkB,CAAC;IACjC,mEAAmE;IAC5D,MAAM,yBAAyB,MAAM,CAAC;IAC7C,wDAAwD;IACjD,MAAM,uBAAuB,MAAM,CAAC;IAC3C,sFAAsF;IAC/E,MAAM,0BAA0B,MAAM,CAAC;IAE9C,SAAgB,OAAO,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAE/D;IAED,SAA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D;IAED,SAAgB,YAAY,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAEpE;IAED;;;;;;;;;;;;;;;OAeG;IACH,SAAgB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,eAAe,GAAG,SAAS,CAKpF;IAED,SAAgB,OAAO,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAE9D;IAED,SAAgB,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,kBAAkB,EAAE,CAE9E;IAED,SAAgB,SAAS,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAEpE;IAED,SAAgB,cAAc,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAEzE;CACH"}
|
|
@@ -25,6 +25,29 @@ var TransferDiagnostic;
|
|
|
25
25
|
return diagnostic.type === 'parsing-error';
|
|
26
26
|
}
|
|
27
27
|
TransferDiagnostic.isParseError = isParseError;
|
|
28
|
+
/**
|
|
29
|
+
* The diagnostic as a renderable message, for a surface that translates.
|
|
30
|
+
* `undefined` when it carries no framework identity — a syntactic error, an
|
|
31
|
+
* adopter's own check, a linker failure — which is the case a caller must
|
|
32
|
+
* distinguish rather than render.
|
|
33
|
+
*
|
|
34
|
+
* Hand the result to `renderFrameworkMessage` with whatever catalogue the
|
|
35
|
+
* host has loaded. The `text` is the server's English, so a code the
|
|
36
|
+
* catalogue does not carry still yields a complete sentence.
|
|
37
|
+
*
|
|
38
|
+
* `code` alone does not establish an identity: it also holds Langium's
|
|
39
|
+
* internal code and an adopter's own, and either would be looked up against a
|
|
40
|
+
* catalogue that cannot have it. Requiring `params` is what discriminates,
|
|
41
|
+
* and it is why a parameterless framework message still populates the field
|
|
42
|
+
* with an empty object rather than omitting it.
|
|
43
|
+
*/
|
|
44
|
+
function resolved(diagnostic) {
|
|
45
|
+
if (typeof diagnostic.code !== 'string' || diagnostic.params === undefined) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return { code: diagnostic.code, params: diagnostic.params, text: diagnostic.message };
|
|
49
|
+
}
|
|
50
|
+
TransferDiagnostic.resolved = resolved;
|
|
28
51
|
function getPath(diagnostic) {
|
|
29
52
|
return diagnostic.property ? `${diagnostic.element}${TransferDiagnostic.ELEMENT_PROPERTY_SEPARATOR}${diagnostic.property}` : diagnostic.element;
|
|
30
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-diagnostic.js","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;
|
|
1
|
+
{"version":3,"file":"transfer-diagnostic.js","sourceRoot":"","sources":["../src/transfer-diagnostic.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAsElF,IAAiB,kBAAkB,CAsDlC;AAtDD,WAAiB,kBAAkB;IAChC,mEAAmE;IACtD,4CAAyB,GAAG,GAAG,CAAC;IAC7C,wDAAwD;IAC3C,0CAAuB,GAAG,GAAG,CAAC;IAC3C,sFAAsF;IACzE,6CAA0B,GAAG,GAAG,CAAC;IAE9C,SAAgB,OAAO,CAAC,UAA8B;QACnD,OAAO,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC;IAC1C,CAAC;IAFe,0BAAO,UAEtB,CAAA;IAED,SAAgB,YAAY,CAAC,UAA8B;QACxD,OAAO,UAAU,CAAC,IAAI,KAAK,eAAe,CAAC;IAC9C,CAAC;IAFe,+BAAY,eAE3B,CAAA;IAED;;;;;;;;;;;;;;;OAeG;IACH,SAAgB,QAAQ,CAAC,UAA8B;QACpD,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1E,OAAO,SAAS,CAAC;QACpB,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC;IACzF,CAAC;IALe,2BAAQ,WAKvB,CAAA;IAED,SAAgB,OAAO,CAAC,UAA8B;QACnD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,GAAG,mBAAA,0BAA0B,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC;IAChI,CAAC;IAFe,0BAAO,UAEtB,CAAA;IAED,SAAgB,MAAM,CAAC,WAAiC;QACrD,OAAO,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAFe,yBAAM,SAErB,CAAA;IAED,SAAgB,SAAS,CAAC,WAAiC;QACxD,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAFe,4BAAS,YAExB,CAAA;IAED,SAAgB,cAAc,CAAC,WAAiC;QAC7D,OAAO,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;IAFe,iCAAc,iBAE7B,CAAA;AACJ,CAAC,EAtDgB,kBAAkB,kCAAlB,kBAAkB,QAsDlC"}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import type { TransferDiagnostic } from './transfer-diagnostic';
|
|
10
10
|
import type { TransferElement } from './transfer-element';
|
|
11
|
+
import { type SnapshotVersion } from './model-service/based-on';
|
|
11
12
|
/**
|
|
12
13
|
* Wire envelope exchanged between the model-server's data-server head and
|
|
13
14
|
* its clients. Carries a transfer-shaped root — never an AST root — plus
|
|
@@ -25,14 +26,13 @@ export interface TransferDocument<TTransfer extends TransferElement, TDiagnostic
|
|
|
25
26
|
uri: string;
|
|
26
27
|
/**
|
|
27
28
|
* The document version this snapshot was taken at — sourced from the
|
|
28
|
-
* server's text-document version counter.
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* updates and reject them with `ConflictError`.
|
|
29
|
+
* server's text-document version counter. A caller that mutates the document
|
|
30
|
+
* subsequently sends this straight back as `TransferUpdateDocumentArgs.basedOn`, and
|
|
31
|
+
* the server rejects a stale-based update with `ConflictError`.
|
|
32
32
|
*
|
|
33
33
|
* See `@hydranium/protocol#errors` for the conflict-detection contract.
|
|
34
34
|
*/
|
|
35
|
-
version:
|
|
35
|
+
version: SnapshotVersion;
|
|
36
36
|
/**
|
|
37
37
|
* Absent when the document does not exist — the server answers an unknown URI
|
|
38
38
|
* with a shaped envelope rather than an error, so absence is an ordinary
|
|
@@ -41,6 +41,26 @@ export interface TransferDocument<TTransfer extends TransferElement, TDiagnostic
|
|
|
41
41
|
*/
|
|
42
42
|
root?: TTransfer;
|
|
43
43
|
diagnostics: TDiagnostic[];
|
|
44
|
+
/**
|
|
45
|
+
* Whether the server holds text for this document that its file does not,
|
|
46
|
+
* as the server last knew the file: set on every document a data server
|
|
47
|
+
* answers or sends that the server holds, and absent otherwise. A change
|
|
48
|
+
* after this snapshot arrives as `onDocumentDirtyChanged` to a client
|
|
49
|
+
* watching the document.
|
|
50
|
+
*/
|
|
51
|
+
dirty?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* What `textHash` makes of the text the server holds for this document
|
|
54
|
+
* when it sends it: set on every document a data server answers or sends
|
|
55
|
+
* that the server holds, and absent otherwise. Equal texts hash equal,
|
|
56
|
+
* whatever the version, so a client compares the text two snapshots hold,
|
|
57
|
+
* across a revert or a server restart that numbers versions afresh.
|
|
58
|
+
*
|
|
59
|
+
* Of the text alone. The data server's de-duplication fingerprint hashes the
|
|
60
|
+
* text or the transfer root together with the diagnostics, and changes with
|
|
61
|
+
* a diagnostic where this does not.
|
|
62
|
+
*/
|
|
63
|
+
textHash?: string;
|
|
44
64
|
}
|
|
45
65
|
/**
|
|
46
66
|
* A {@link TransferDocument} the server actually had, so `root` is present.
|
|
@@ -62,6 +82,15 @@ export declare namespace TransferDocument {
|
|
|
62
82
|
* with it.
|
|
63
83
|
*/
|
|
64
84
|
function assertLoaded<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(document: TransferDocument<TTransfer, TDiagnostic>): LoadedTransferDocument<TTransfer, TDiagnostic>;
|
|
85
|
+
/**
|
|
86
|
+
* The envelope for a document the server does not have — `root` absent, and
|
|
87
|
+
* the version a read of a URI the store never saw reports.
|
|
88
|
+
*
|
|
89
|
+
* Exists so the absent branch is built the same way the present one is: both
|
|
90
|
+
* doors mark the version as coming from a read, and neither asks a caller to
|
|
91
|
+
* do it.
|
|
92
|
+
*/
|
|
93
|
+
function absent<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(uri: string, diagnostics?: TDiagnostic[]): TransferDocument<TTransfer, TDiagnostic>;
|
|
65
94
|
/**
|
|
66
95
|
* Construct a {@link TransferDocument} envelope. `diagnostics` defaults
|
|
67
96
|
* to `[]` so test fixtures, fake protocol implementations, and the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-document.d.ts","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"transfer-document.d.ts","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEnF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB,CAAC,SAAS,SAAS,eAAe,EAAE,WAAW,GAAG,kBAAkB;IAClG,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,OAAO,EAAE,eAAe,CAAC;IACzB;;;;;O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;CACH"}
|
package/lib/transfer-document.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.TransferDocument = void 0;
|
|
12
|
+
const based_on_1 = require("./model-service/based-on");
|
|
12
13
|
var TransferDocument;
|
|
13
14
|
(function (TransferDocument) {
|
|
14
15
|
/**
|
|
@@ -32,6 +33,18 @@ var TransferDocument;
|
|
|
32
33
|
return document;
|
|
33
34
|
}
|
|
34
35
|
TransferDocument.assertLoaded = assertLoaded;
|
|
36
|
+
/**
|
|
37
|
+
* The envelope for a document the server does not have — `root` absent, and
|
|
38
|
+
* the version a read of a URI the store never saw reports.
|
|
39
|
+
*
|
|
40
|
+
* Exists so the absent branch is built the same way the present one is: both
|
|
41
|
+
* doors mark the version as coming from a read, and neither asks a caller to
|
|
42
|
+
* do it.
|
|
43
|
+
*/
|
|
44
|
+
function absent(uri, diagnostics = []) {
|
|
45
|
+
return { uri, version: (0, based_on_1.asSnapshotVersion)(0), root: undefined, diagnostics };
|
|
46
|
+
}
|
|
47
|
+
TransferDocument.absent = absent;
|
|
35
48
|
/**
|
|
36
49
|
* Construct a {@link TransferDocument} envelope. `diagnostics` defaults
|
|
37
50
|
* to `[]` so test fixtures, fake protocol implementations, and the
|
|
@@ -39,7 +52,7 @@ var TransferDocument;
|
|
|
39
52
|
* at every call site.
|
|
40
53
|
*/
|
|
41
54
|
function create(uri, version, root, diagnostics = []) {
|
|
42
|
-
return { uri, version, root, diagnostics };
|
|
55
|
+
return { uri, version: (0, based_on_1.asSnapshotVersion)(version), root, diagnostics };
|
|
43
56
|
}
|
|
44
57
|
TransferDocument.create = create;
|
|
45
58
|
})(TransferDocument || (exports.TransferDocument = TransferDocument = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-document.js","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;
|
|
1
|
+
{"version":3,"file":"transfer-document.js","sourceRoot":"","sources":["../src/transfer-document.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAIlF,uDAAmF;AAmEnF,IAAiB,gBAAgB,CAuDhC;AAvDD,WAAiB,gBAAgB;IAC9B;;;OAGG;IACH,SAAgB,QAAQ,CACrB,QAAkD;QAElD,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;IACtC,CAAC;IAJe,yBAAQ,WAIvB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,YAAY,CACzB,QAAkD;QAElD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,OAAO,QAAQ,CAAC;IACnB,CAAC;IAPe,6BAAY,eAO3B,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,MAAM,CACnB,GAAW,EACX,cAA6B,EAAE;QAE/B,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAA,4BAAiB,EAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;IAC/E,CAAC;IALe,uBAAM,SAKrB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,MAAM,CACnB,GAAW,EACX,OAAe,EACf,IAAe,EACf,cAA6B,EAAE;QAE/B,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAA,4BAAiB,EAAC,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC1E,CAAC;IAPe,uBAAM,SAOrB,CAAA;AACJ,CAAC,EAvDgB,gBAAgB,gCAAhB,gBAAgB,QAuDhC"}
|
package/lib/util.d.ts
CHANGED
|
@@ -144,4 +144,12 @@ export declare function unreachable(input: never): never;
|
|
|
144
144
|
* uncertain, then narrow with a type-guard.
|
|
145
145
|
*/
|
|
146
146
|
export declare function getAt<T = unknown>(obj: unknown, path: string[]): T | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* A stable, non-cryptographic digest of `text`, equal on every host for equal
|
|
149
|
+
* text: the `TransferDocument.textHash` a data server stamps, so a client can
|
|
150
|
+
* hash text of its own to compare. An array is read as its elements joined, so
|
|
151
|
+
* a large text is hashed in parts without concatenating it. It tells whether a
|
|
152
|
+
* text changed, not who could forge one.
|
|
153
|
+
*/
|
|
154
|
+
export declare function textHash(text: string | readonly string[]): string;
|
|
147
155
|
//# sourceMappingURL=util.d.ts.map
|
package/lib/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,qCAAqC;AACrC,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACxB,OAAO,IAAI,IAAI,CAAC;CAClB;AAED,yBAAiB,UAAU,CAAC;IACzB,SAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,UAAU,CAEtD;IACD;;;;;;OAMG;IACI,MAAM,KAAK,EAAE,UAAwD,CAAC;CAC/E;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,oBAAqB,YAAW,UAAU;IACpD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,CAAM;IAClD,SAAS,CAAC,SAAS,UAAS;IAE5B,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU;IASxC,OAAO,IAAI,IAAI;CAajB;AAED;;;;;;;GAOG;AACH,qBAAa,QAAQ,CAAC,CAAC,GAAG,IAAI;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO,EAAG,CA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AI7D;AAED,iDAAiD;AACjD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAEvC;AAED;8DAC8D;AAC9D,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;AAC/E,wBAAgB,cAAc,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC;AAWjH,qGAAqG;AACrG,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAS9E;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,MAAM,CAGjE"}
|
package/lib/util.js
CHANGED
|
@@ -20,6 +20,7 @@ exports.identity = identity;
|
|
|
20
20
|
exports.findNextUnique = findNextUnique;
|
|
21
21
|
exports.unreachable = unreachable;
|
|
22
22
|
exports.getAt = getAt;
|
|
23
|
+
exports.textHash = textHash;
|
|
23
24
|
var Disposable;
|
|
24
25
|
(function (Disposable) {
|
|
25
26
|
function create(dispose) {
|
|
@@ -208,4 +209,35 @@ function getAt(obj, path) {
|
|
|
208
209
|
}
|
|
209
210
|
return cur;
|
|
210
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* A stable, non-cryptographic digest of `text`, equal on every host for equal
|
|
214
|
+
* text: the `TransferDocument.textHash` a data server stamps, so a client can
|
|
215
|
+
* hash text of its own to compare. An array is read as its elements joined, so
|
|
216
|
+
* a large text is hashed in parts without concatenating it. It tells whether a
|
|
217
|
+
* text changed, not who could forge one.
|
|
218
|
+
*/
|
|
219
|
+
function textHash(text) {
|
|
220
|
+
const { high, low } = cyrb53(typeof text === 'string' ? [text] : text);
|
|
221
|
+
return high.toString(16).padStart(8, '0') + low.toString(16).padStart(8, '0');
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* The two 32-bit words cyrb53 ends on, each unsigned, for `parts` read as one
|
|
225
|
+
* string. It needs no `node:*` module, so every host runs it.
|
|
226
|
+
*/
|
|
227
|
+
function cyrb53(parts) {
|
|
228
|
+
let h1 = 0xdeadbeef;
|
|
229
|
+
let h2 = 0x41c6ce57;
|
|
230
|
+
for (const part of parts) {
|
|
231
|
+
for (let i = 0; i < part.length; i++) {
|
|
232
|
+
const code = part.charCodeAt(i);
|
|
233
|
+
h1 = Math.imul(h1 ^ code, 2654435761);
|
|
234
|
+
h2 = Math.imul(h2 ^ code, 1597334677);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
238
|
+
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
239
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
240
|
+
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
241
|
+
return { high: h2 >>> 0, low: h1 >>> 0 };
|
|
242
|
+
}
|
|
211
243
|
//# sourceMappingURL=util.js.map
|
package/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAiIlF,sCAEC;AAMD,8BAEC;AAID,8BAEC;AASD,sBAmB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