@hydranium/protocol 1.0.0-next.32 → 1.0.0-next.321
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 +44 -83
- package/lib/abstract-logger.d.ts +5 -0
- package/lib/abstract-logger.d.ts.map +1 -1
- package/lib/abstract-logger.js +7 -0
- package/lib/abstract-logger.js.map +1 -1
- package/lib/client/data-connection.d.ts +302 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +533 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +17 -1
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +25 -0
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +34 -24
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +657 -89
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +1113 -115
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +15 -9
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +15 -9
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +4 -4
- package/lib/client/message-relay.js +4 -4
- 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 +157 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +214 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client/worker-handshake.d.ts +86 -0
- package/lib/client/worker-handshake.d.ts.map +1 -0
- package/lib/client/worker-handshake.js +51 -0
- package/lib/client/worker-handshake.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 +50 -10
- package/lib/clock.d.ts.map +1 -1
- package/lib/clock.js +36 -1
- package/lib/clock.js.map +1 -1
- package/lib/console-logger.d.ts +23 -0
- package/lib/console-logger.d.ts.map +1 -0
- package/lib/console-logger.js +39 -0
- package/lib/console-logger.js.map +1 -0
- 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 +13 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +165 -48
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +137 -21
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +71 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/debouncer.d.ts +3 -3
- package/lib/debouncer.d.ts.map +1 -1
- package/lib/debouncer.js +6 -9
- package/lib/debouncer.js.map +1 -1
- package/lib/errors.d.ts +183 -30
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +268 -32
- package/lib/errors.js.map +1 -1
- package/lib/glsp-request-model-args.d.ts +16 -0
- package/lib/glsp-request-model-args.d.ts.map +1 -0
- package/lib/glsp-request-model-args.js +19 -0
- package/lib/glsp-request-model-args.js.map +1 -0
- 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 +8 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -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/logger.d.ts +38 -7
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +42 -4
- package/lib/logger.js.map +1 -1
- package/lib/messages/index.d.ts +4 -2
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +15 -4
- package/lib/messages/index.js.map +1 -1
- package/lib/messages/primitives.d.ts +59 -4
- package/lib/messages/primitives.d.ts.map +1 -1
- package/lib/messages/primitives.js +97 -4
- package/lib/messages/primitives.js.map +1 -1
- 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/base-version.d.ts +67 -0
- package/lib/model-service/base-version.d.ts.map +1 -0
- package/lib/model-service/base-version.js +44 -0
- package/lib/model-service/base-version.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/model-service/reference-candidate.d.ts +5 -3
- package/lib/model-service/reference-candidate.d.ts.map +1 -1
- package/lib/node/index.d.ts +10 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +29 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/process-memory.d.ts +66 -0
- package/lib/node/process-memory.d.ts.map +1 -0
- package/lib/node/process-memory.js +291 -0
- package/lib/node/process-memory.js.map +1 -0
- package/lib/noop-logger.d.ts.map +1 -1
- package/lib/noop-logger.js.map +1 -1
- package/lib/observable-value.js.map +1 -1
- package/lib/patch-merge.d.ts +63 -35
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +171 -25
- 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/project.d.ts +4 -1
- package/lib/project.d.ts.map +1 -1
- package/lib/project.js.map +1 -1
- package/lib/random-uuid.d.ts +14 -0
- package/lib/random-uuid.d.ts.map +1 -0
- package/lib/random-uuid.js +24 -0
- package/lib/random-uuid.js.map +1 -0
- package/lib/reconcile-write.d.ts +67 -0
- package/lib/reconcile-write.d.ts.map +1 -0
- package/lib/reconcile-write.js +69 -0
- package/lib/reconcile-write.js.map +1 -0
- package/lib/rpc/bind-rpc-methods.d.ts +6 -2
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +17 -7
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +3 -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/rpc/index.d.ts +1 -0
- package/lib/rpc/index.d.ts.map +1 -1
- package/lib/rpc/index.js +1 -0
- package/lib/rpc/index.js.map +1 -1
- package/lib/rpc/send-by-method-name.d.ts +76 -0
- package/lib/rpc/send-by-method-name.d.ts.map +1 -0
- package/lib/rpc/send-by-method-name.js +120 -0
- package/lib/rpc/send-by-method-name.js.map +1 -0
- package/lib/rpc/wire-prefix.js.map +1 -1
- package/lib/save-text-document.d.ts +40 -0
- package/lib/save-text-document.d.ts.map +1 -0
- package/lib/save-text-document.js +34 -0
- package/lib/save-text-document.js.map +1 -0
- package/lib/testing/catalogue-audit.d.ts +1 -1
- package/lib/testing/catalogue-audit.js +1 -1
- package/lib/testing/catalogue-audit.js.map +1 -1
- package/lib/testing/data-doubles.d.ts +41 -12
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +56 -8
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/fake-clock.d.ts +17 -2
- package/lib/testing/fake-clock.d.ts.map +1 -1
- package/lib/testing/fake-clock.js +61 -46
- 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 -3
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/node/duplex-connection.d.ts.map +1 -1
- package/lib/testing/node/duplex-connection.js +3 -2
- package/lib/testing/node/duplex-connection.js.map +1 -1
- package/lib/testing/node/duplex-stream.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/testing/transfer-node-builder.d.ts +81 -0
- package/lib/testing/transfer-node-builder.d.ts.map +1 -0
- package/lib/testing/transfer-node-builder.js +47 -0
- package/lib/testing/transfer-node-builder.js.map +1 -0
- package/lib/testing/wait-for.d.ts +9 -3
- package/lib/testing/wait-for.d.ts.map +1 -1
- package/lib/testing/wait-for.js +57 -11
- package/lib/testing/wait-for.js.map +1 -1
- package/lib/tracer.d.ts.map +1 -1
- package/lib/tracer.js +5 -9
- package/lib/tracer.js.map +1 -1
- package/lib/transfer-diagnostic.js.map +1 -1
- package/lib/transfer-document.d.ts +95 -32
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +17 -9
- package/lib/transfer-document.js.map +1 -1
- package/lib/transfer-element.d.ts +4 -4
- package/lib/types.d.ts +32 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/{model-service/args.js → types.js} +2 -2
- package/lib/types.js.map +1 -0
- package/lib/uri.d.ts.map +1 -1
- package/lib/uri.js.map +1 -1
- package/lib/util.d.ts +8 -2
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +32 -4
- package/lib/util.js.map +1 -1
- package/package.json +24 -40
- package/src/abstract-logger.ts +8 -0
- package/src/client/data-connection.ts +653 -0
- package/src/client/data-events.ts +37 -1
- package/src/client/data-port.ts +36 -25
- package/src/client/data-session.ts +1427 -137
- package/src/client/index.ts +15 -9
- package/src/client/message-relay.ts +4 -4
- package/src/client/post-message-transport.ts +219 -4
- package/src/client/rpc-connection.ts +281 -0
- package/src/client/worker-handshake.ts +113 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +68 -10
- package/src/console-logger.ts +39 -0
- package/src/data/data-protocol-methods.ts +14 -4
- package/src/data/data-server-protocol.ts +192 -48
- package/src/data/events.ts +143 -21
- package/src/data/requests.ts +77 -11
- package/src/debouncer.ts +7 -10
- package/src/errors.ts +326 -40
- package/src/glsp-request-model-args.ts +16 -0
- package/src/glsp-save-model-actions.ts +59 -0
- package/src/index.ts +8 -0
- package/src/latency-collector.ts +8 -3
- package/src/logger.ts +44 -8
- package/src/messages/index.ts +4 -2
- package/src/messages/primitives.ts +129 -5
- package/src/model-server.ts +64 -19
- package/src/model-service/base-version.ts +75 -0
- package/src/model-service/index.ts +4 -5
- package/src/model-service/reference-candidate.ts +5 -3
- package/src/node/index.ts +14 -0
- package/src/node/process-memory.ts +299 -0
- package/src/patch-merge.ts +230 -45
- package/src/profile-session.ts +9 -4
- package/src/project.ts +4 -1
- package/src/random-uuid.ts +21 -0
- package/src/reconcile-write.ts +128 -0
- package/src/rpc/README.md +6 -6
- package/src/rpc/bind-rpc-methods.ts +18 -8
- package/src/rpc/create-rpc-proxy.ts +6 -1
- package/src/rpc/index.ts +1 -0
- package/src/rpc/send-by-method-name.ts +140 -0
- package/src/save-text-document.ts +39 -0
- package/src/testing/catalogue-audit.ts +1 -1
- package/src/testing/data-doubles.ts +141 -19
- package/src/testing/fake-clock.ts +76 -48
- package/src/testing/index.ts +4 -3
- package/src/testing/node/duplex-connection.ts +3 -2
- package/src/testing/node/index.ts +2 -2
- package/src/testing/node/message-port-pair.ts +40 -0
- package/src/testing/transfer-node-builder.ts +107 -0
- package/src/testing/wait-for.ts +61 -13
- package/src/tracer.ts +5 -9
- package/src/transfer-document.ts +115 -34
- package/src/transfer-element.ts +4 -4
- package/src/types.ts +30 -0
- package/src/util.ts +33 -6
- 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.map +0 -1
- package/src/model-service/args.ts +0 -67
|
@@ -34,6 +34,7 @@ exports.makeCapturingDataClient = makeCapturingDataClient;
|
|
|
34
34
|
* which `sourceClientId`, which version, which reason.
|
|
35
35
|
*/
|
|
36
36
|
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
|
|
37
|
+
const data_protocol_methods_1 = require("../data/data-protocol-methods");
|
|
37
38
|
/**
|
|
38
39
|
* A {@link DataPort} over a transport the caller supplies.
|
|
39
40
|
*
|
|
@@ -46,9 +47,9 @@ function makeFakeDataPort(options) {
|
|
|
46
47
|
const reported = [];
|
|
47
48
|
const disposeEmitter = new vscode_jsonrpc_1.Emitter();
|
|
48
49
|
return {
|
|
49
|
-
clientId: options.clientId ?? 'fake-data-port',
|
|
50
50
|
connections,
|
|
51
51
|
reported,
|
|
52
|
+
logger: options.logger,
|
|
52
53
|
onDispose: disposeEmitter.event,
|
|
53
54
|
async connect() {
|
|
54
55
|
const connection = await options.connect();
|
|
@@ -69,7 +70,7 @@ function makeFakeDataPort(options) {
|
|
|
69
70
|
/**
|
|
70
71
|
* A {@link DataClientProtocol} that records every notification it receives.
|
|
71
72
|
*
|
|
72
|
-
* Recording
|
|
73
|
+
* Recording EVERY channel even when a suite reads one is deliberate: an
|
|
73
74
|
* event delivered on the wrong channel is a real defect of the data head, and a
|
|
74
75
|
* double that drops the other two turns it into silence on the one being
|
|
75
76
|
* watched.
|
|
@@ -78,25 +79,72 @@ function makeFakeDataPort(options) {
|
|
|
78
79
|
* the corresponding array stays empty — that is what makes an override usable
|
|
79
80
|
* as a barrier (rejecting, counting differently, throwing) rather than only as
|
|
80
81
|
* a spy.
|
|
82
|
+
*
|
|
83
|
+
* `additionalClientMethods` names the notifications `TClient` adds to
|
|
84
|
+
* {@link DataClientProtocol}. Each is recorded and overridable the same way;
|
|
85
|
+
* one left out is not on the client at all, and overriding it throws, since
|
|
86
|
+
* nothing would call the override.
|
|
81
87
|
*/
|
|
82
|
-
function makeCapturingDataClient(overrides = {}) {
|
|
88
|
+
function makeCapturingDataClient(overrides = {}, additionalClientMethods = []) {
|
|
89
|
+
const bound = new Set([...data_protocol_methods_1.DATA_CLIENT_PROTOCOL_METHODS, ...additionalClientMethods]);
|
|
90
|
+
for (const name of Object.keys(overrides)) {
|
|
91
|
+
if (!bound.has(name)) {
|
|
92
|
+
throw new Error(`Override '${name}' is neither a DataClientProtocol method nor listed in additionalClientMethods, so nothing would call it.`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const frameworkOverrides = overrides;
|
|
83
96
|
const updates = [];
|
|
84
97
|
const saves = [];
|
|
98
|
+
const dirtyChanges = [];
|
|
99
|
+
const deletions = [];
|
|
100
|
+
const builds = [];
|
|
85
101
|
const projectsChanges = [];
|
|
86
|
-
const
|
|
87
|
-
onDocumentUpdated:
|
|
102
|
+
const frameworkClient = {
|
|
103
|
+
onDocumentUpdated: frameworkOverrides.onDocumentUpdated ??
|
|
88
104
|
(event => {
|
|
89
105
|
updates.push(event);
|
|
90
106
|
}),
|
|
91
|
-
onDocumentSaved:
|
|
107
|
+
onDocumentSaved: frameworkOverrides.onDocumentSaved ??
|
|
92
108
|
(event => {
|
|
93
109
|
saves.push(event);
|
|
94
110
|
}),
|
|
95
|
-
|
|
111
|
+
onDocumentDirtyChanged: frameworkOverrides.onDocumentDirtyChanged ??
|
|
112
|
+
(event => {
|
|
113
|
+
dirtyChanges.push(event);
|
|
114
|
+
}),
|
|
115
|
+
onDocumentDeleted: frameworkOverrides.onDocumentDeleted ??
|
|
116
|
+
(event => {
|
|
117
|
+
deletions.push(event);
|
|
118
|
+
}),
|
|
119
|
+
onDocumentsBuilt: frameworkOverrides.onDocumentsBuilt ??
|
|
120
|
+
(event => {
|
|
121
|
+
builds.push(event);
|
|
122
|
+
}),
|
|
123
|
+
onProjectsChanged: frameworkOverrides.onProjectsChanged ??
|
|
96
124
|
(event => {
|
|
97
125
|
projectsChanges.push(event);
|
|
98
126
|
})
|
|
99
127
|
};
|
|
100
|
-
|
|
128
|
+
const additionalNotifications = {};
|
|
129
|
+
const additionalHandlers = {};
|
|
130
|
+
for (const method of additionalClientMethods) {
|
|
131
|
+
const events = [];
|
|
132
|
+
additionalNotifications[method] = events;
|
|
133
|
+
additionalHandlers[method] =
|
|
134
|
+
overrides[method] ??
|
|
135
|
+
((event) => {
|
|
136
|
+
events.push(event);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
client: { ...frameworkClient, ...additionalHandlers },
|
|
141
|
+
updates,
|
|
142
|
+
saves,
|
|
143
|
+
dirtyChanges,
|
|
144
|
+
deletions,
|
|
145
|
+
builds,
|
|
146
|
+
projectsChanges,
|
|
147
|
+
additionalNotifications: additionalNotifications
|
|
148
|
+
};
|
|
101
149
|
}
|
|
102
150
|
//# sourceMappingURL=data-doubles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-doubles.js","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"data-doubles.js","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,mDAAiE;AAEjE,yEAA6E;AAiE7E;;;;;;GAMG;AACH,0BAAiC,OAA4B;IAC1D,MAAM,WAAW,GAAwB,EAAE,CAAC;IAC5C,MAAM,QAAQ,GAAmD,EAAE,CAAC;IACpE,MAAM,cAAc,GAAG,IAAI,wBAAO,EAAQ,CAAC;IAC3C,OAAO;QACJ,WAAW;QACX,QAAQ;QACR,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,cAAc,CAAC,KAAK;QAC/B,KAAK,CAAC,OAAO;YACV,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3C,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC7B,OAAO,UAAU,CAAC;QACrB,CAAC;QACD,WAA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|
14
14
|
* whose deadline falls within the window — in chronological order, each at
|
|
15
15
|
* its own deadline (so `now()` inside a callback reads the fire instant, not
|
|
16
16
|
* the advance target). Timers scheduled by a callback fire too if they fall
|
|
17
|
-
* within the same window.
|
|
17
|
+
* within the same window. A {@link Clock.raceTimer} over a promise that
|
|
18
|
+
* settles through a chain still pending loses to the timer, so let that
|
|
19
|
+
* chain settle before advancing.
|
|
18
20
|
*/
|
|
19
21
|
advance(ms: number): void;
|
|
22
|
+
/**
|
|
23
|
+
* Move `now()` by `ms`, backwards when negative, leaving stopwatches and
|
|
24
|
+
* timers where they are: the wall-clock step a time sync or a manual change makes,
|
|
25
|
+
* which a duration taken from two `now()` readings gets wrong.
|
|
26
|
+
*/
|
|
27
|
+
jumpWallClock(ms: number): void;
|
|
28
|
+
/** How many {@link Clock.setTimer} timers have neither fired nor been disposed. */
|
|
29
|
+
pendingTimers(): number;
|
|
20
30
|
}
|
|
21
31
|
/**
|
|
22
32
|
* In-process {@link Clock} double for deterministic time. The real
|
|
@@ -24,10 +34,15 @@ export interface FakeClock extends Clock {
|
|
|
24
34
|
* (`Date.now` for `now()`, `performance.now()` for the stopwatch); the fake
|
|
25
35
|
* collapses them onto ONE virtual time axis, so a single
|
|
26
36
|
* {@link FakeClock.advance} drives `now()`, every live stopwatch's elapsed, and
|
|
27
|
-
* any due timer together.
|
|
37
|
+
* any due timer together; only {@link FakeClock.jumpWallClock} pulls `now()`
|
|
38
|
+
* off that axis.
|
|
28
39
|
*
|
|
29
40
|
* Server-free and DI-free — lives in `@hydranium/protocol/testing` so every
|
|
30
41
|
* head can bind it without pulling in a server package.
|
|
42
|
+
*
|
|
43
|
+
* The clock is a `SystemClock` with its time replaced, so its methods live on
|
|
44
|
+
* its prototype and a spread of it carries none of them. Replace one by
|
|
45
|
+
* assigning it onto the clock, or layer over the clock with `Object.create`.
|
|
31
46
|
*/
|
|
32
47
|
export declare function makeFakeClock(options?: {
|
|
33
48
|
now?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-clock.d.ts","sourceRoot":"","sources":["../../src/testing/fake-clock.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"fake-clock.d.ts","sourceRoot":"","sources":["../../src/testing/fake-clock.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,KAAK,EAA+B,MAAM,UAAU,CAAC;AAGnE,2FAA2F;AAC3F,MAAM,WAAW,SAAU,SAAQ,KAAK;IACrC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mFAAmF;IACnF,aAAa,IAAI,MAAM,CAAC;CAC1B;AASD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,SAAS,CAEvE"}
|
|
@@ -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
|
|
@@ -16,71 +17,85 @@ const util_1 = require("../util");
|
|
|
16
17
|
* (`Date.now` for `now()`, `performance.now()` for the stopwatch); the fake
|
|
17
18
|
* collapses them onto ONE virtual time axis, so a single
|
|
18
19
|
* {@link FakeClock.advance} drives `now()`, every live stopwatch's elapsed, and
|
|
19
|
-
* any due timer together.
|
|
20
|
+
* any due timer together; only {@link FakeClock.jumpWallClock} pulls `now()`
|
|
21
|
+
* off that axis.
|
|
20
22
|
*
|
|
21
23
|
* Server-free and DI-free — lives in `@hydranium/protocol/testing` so every
|
|
22
24
|
* head can bind it without pulling in a server package.
|
|
25
|
+
*
|
|
26
|
+
* The clock is a `SystemClock` with its time replaced, so its methods live on
|
|
27
|
+
* its prototype and a spread of it carries none of them. Replace one by
|
|
28
|
+
* assigning it onto the clock, or layer over the clock with `Object.create`.
|
|
23
29
|
*/
|
|
24
30
|
function makeFakeClock(options = {}) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
return new VirtualClock(options.now ?? 0);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A `SystemClock` whose time, stopwatches and timers read one virtual axis, so
|
|
35
|
+
* the `measure` and `raceTimer` it inherits run on that axis too.
|
|
36
|
+
*/
|
|
37
|
+
class VirtualClock extends clock_1.SystemClock {
|
|
38
|
+
current;
|
|
39
|
+
timers = [];
|
|
40
|
+
/** What {@link jumpWallClock} has added to `now()`. */
|
|
41
|
+
wallClockOffset = 0;
|
|
42
|
+
constructor(current) {
|
|
43
|
+
super();
|
|
44
|
+
this.current = current;
|
|
45
|
+
}
|
|
46
|
+
now() {
|
|
47
|
+
return this.current + this.wallClockOffset;
|
|
48
|
+
}
|
|
49
|
+
jumpWallClock(ms) {
|
|
50
|
+
this.wallClockOffset += ms;
|
|
51
|
+
}
|
|
52
|
+
setTimer(callback, ms) {
|
|
53
|
+
const timer = { at: this.current + ms, callback, disposed: false, fired: false };
|
|
54
|
+
this.timers.push(timer);
|
|
55
|
+
return util_1.Disposable.create(() => {
|
|
56
|
+
timer.disposed = true;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
stopwatch() {
|
|
60
|
+
const read = () => this.current;
|
|
61
|
+
const start = read();
|
|
62
|
+
let lastLap = start;
|
|
30
63
|
let stopped;
|
|
31
64
|
return {
|
|
32
65
|
get elapsedMs() {
|
|
33
|
-
return (stopped ??
|
|
66
|
+
return (stopped ?? read()) - start;
|
|
34
67
|
},
|
|
35
68
|
lap() {
|
|
36
|
-
const at = stopped ??
|
|
69
|
+
const at = stopped ?? read();
|
|
37
70
|
const split = at - lastLap;
|
|
38
71
|
lastLap = at;
|
|
39
72
|
return split;
|
|
40
73
|
},
|
|
41
74
|
stop() {
|
|
42
|
-
|
|
43
|
-
stopped = current;
|
|
44
|
-
}
|
|
75
|
+
stopped ??= read();
|
|
45
76
|
return stopped - start;
|
|
46
77
|
}
|
|
47
78
|
};
|
|
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();
|
|
79
|
+
}
|
|
80
|
+
pendingTimers() {
|
|
81
|
+
return this.timers.filter(timer => !timer.disposed && !timer.fired).length;
|
|
82
|
+
}
|
|
83
|
+
advance(ms) {
|
|
84
|
+
const target = this.current + ms;
|
|
85
|
+
// Fire due timers one at a time, re-scanning after each so a callback
|
|
86
|
+
// that schedules a nearer timer still fires within this window.
|
|
87
|
+
for (;;) {
|
|
88
|
+
const next = this.timers
|
|
89
|
+
.filter(timer => !timer.disposed && !timer.fired && timer.at <= target)
|
|
90
|
+
.sort((left, right) => left.at - right.at)[0];
|
|
91
|
+
if (!next) {
|
|
92
|
+
break;
|
|
81
93
|
}
|
|
82
|
-
current =
|
|
94
|
+
this.current = next.at;
|
|
95
|
+
next.fired = true;
|
|
96
|
+
next.callback();
|
|
83
97
|
}
|
|
84
|
-
|
|
98
|
+
this.current = target;
|
|
99
|
+
}
|
|
85
100
|
}
|
|
86
101
|
//# 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;;;AAElF,oCAAmE;AACnE,kCAAqC;AA+BrC;;;;;;;;;;;;;;;GAeG;AACH,uBAA8B,OAAO,GAAqB,EAAE;IACzD,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,MAAM,YAAa,SAAQ,mBAAW;IAKb,OAAO;IAJV,MAAM,GAAgB,EAAE,CAAC;IAC5C,uDAAuD;IAC7C,eAAe,GAAG,CAAC,CAAC;IAE9B,YAAsB,OAAe;QAClC,KAAK,EAAE,CAAC;uBADW,OAAO;IAE7B,CAAC;IAEQ,GAAG;QACT,OAAO,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC;IAC9C,CAAC;IAED,aAAa,CAAC,EAAU;QACrB,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;IAC9B,CAAC;IAEQ,QAAQ,CAAC,QAAoB,EAAE,EAAU;QAC/C,MAAM,KAAK,GAAc,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,GAAG,EAAE,EAAE,QAAQ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C,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,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;AAiBlF,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
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,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC"}
|
package/lib/testing/index.js
CHANGED
|
@@ -26,13 +26,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
// primitives: `makeFakeClock` (deterministic `Clock` double on one virtual time
|
|
27
27
|
// axis), `waitFor` / `tick`, the client-side data-head doubles
|
|
28
28
|
// (`makeFakeDataPort` / `makeCapturingDataClient`), the translation-catalogue
|
|
29
|
-
// audit (`flattenCatalogue` / `findUndeclaredCodes` / `findSharedCodes`),
|
|
30
|
-
// the `Harness` marker
|
|
29
|
+
// audit (`flattenCatalogue` / `findUndeclaredCodes` / `findSharedCodes`), the
|
|
30
|
+
// transfer-node builder (`makeTransferNodeBuilder`), and the `Harness` marker
|
|
31
31
|
// interface every framework harness extends. Kept out of the main barrel so production bundles don't pull
|
|
32
32
|
// the test scaffolding in by default; adopters opt in by importing from
|
|
33
33
|
// `@hydranium/protocol/testing`.
|
|
34
34
|
//
|
|
35
|
-
// Neutrality is gated (`scripts/check-neutral-bundles.
|
|
35
|
+
// Neutrality is gated (`scripts/check-neutral-bundles.mts`), which is why the
|
|
36
36
|
// duplex transports are NOT here: a `PassThrough` pair is in their exported
|
|
37
37
|
// type, so they cannot be made portable and live at `./testing/node` instead.
|
|
38
38
|
// The same rule the package surface uses — the portable name is the short one.
|
|
@@ -40,5 +40,6 @@ __exportStar(require("./catalogue-audit"), exports);
|
|
|
40
40
|
__exportStar(require("./data-doubles"), exports);
|
|
41
41
|
__exportStar(require("./fake-clock"), exports);
|
|
42
42
|
__exportStar(require("./harness"), exports);
|
|
43
|
+
__exportStar(require("./transfer-node-builder"), exports);
|
|
43
44
|
__exportStar(require("./wait-for"), exports);
|
|
44
45
|
//# sourceMappingURL=index.js.map
|
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,8EAA8E;AAC9E,8EAA8E;AAC9E,
|
|
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,8EAA8E;AAC9E,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,0DAAwC;AACxC,6CAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplex-connection.d.ts","sourceRoot":"","sources":["../../../src/testing/node/duplex-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGhI;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IAClC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,OAAO,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,wBAAwB,IAAI,oBAAoB,
|
|
1
|
+
{"version":3,"file":"duplex-connection.d.ts","sourceRoot":"","sources":["../../../src/testing/node/duplex-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAqE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGhI;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IAClC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,OAAO,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,wBAAwB,IAAI,oBAAoB,CAuB/D"}
|
|
@@ -17,8 +17,9 @@ function makeDuplexConnectionPair() {
|
|
|
17
17
|
// writes and `left` reads.
|
|
18
18
|
const pair = (0, duplex_stream_1.makeDuplexStreamPair)();
|
|
19
19
|
const { clientToServer, serverToClient } = pair;
|
|
20
|
-
|
|
21
|
-
const
|
|
20
|
+
// `console`, so a protocol fault on either end shows in the test's output.
|
|
21
|
+
const left = (0, node_1.createMessageConnection)(new node_1.StreamMessageReader(serverToClient), new node_1.StreamMessageWriter(clientToServer), console);
|
|
22
|
+
const right = (0, node_1.createMessageConnection)(new node_1.StreamMessageReader(clientToServer), new node_1.StreamMessageWriter(serverToClient), console);
|
|
22
23
|
left.listen();
|
|
23
24
|
right.listen();
|
|
24
25
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplex-connection.js","sourceRoot":"","sources":["../../../src/testing/node/duplex-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"duplex-connection.js","sourceRoot":"","sources":["../../../src/testing/node/duplex-connection.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,8CAAgI;AAChI,mDAAuD;AAiBvD;IACG,0EAA0E;IAC1E,yEAAyE;IACzE,2BAA2B;IAC3B,MAAM,IAAI,GAAG,IAAA,oCAAoB,GAAE,CAAC;IACpC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAEhD,2EAA2E;IAC3E,MAAM,IAAI,GAAG,IAAA,8BAAuB,EAAC,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;IAChI,MAAM,KAAK,GAAG,IAAA,8BAAuB,EAAC,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,IAAI,0BAAmB,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;IAEjI,IAAI,CAAC,MAAM,EAAE,CAAC;IACd,KAAK,CAAC,MAAM,EAAE,CAAC;IAEf,OAAO;QACJ,IAAI;QACJ,KAAK;QACL,OAAO;YACJ,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;KACH,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplex-stream.js","sourceRoot":"","sources":["../../../src/testing/node/duplex-stream.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"duplex-stream.js","sourceRoot":"","sources":["../../../src/testing/node/duplex-stream.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,6CAA0C;AAmB1C;;;;GAIG;AACH;IACG,MAAM,cAAc,GAAG,IAAI,yBAAW,EAAE,CAAC;IACzC,MAAM,cAAc,GAAG,IAAI,yBAAW,EAAE,CAAC;IAEzC,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,OAAO;QACJ,cAAc;QACd,cAAc;QACd,OAAO;YACJ,IAAI,QAAQ,EAAE,CAAC;gBACZ,OAAO;YACV,CAAC;YACD,QAAQ,GAAG,IAAI,CAAC;YAChB,cAAc,CAAC,OAAO,EAAE,CAAC;YACzB,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5B,CAAC;KACH,CAAC;AACL,CAAC"}
|
|
@@ -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;;;AAElF,6DAAqD;AAkBrD;IACG,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"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 { TransferElement } from '../transfer-element';
|
|
10
|
+
import type { ConcreteTypeName, SingleTypeName } from '../types';
|
|
11
|
+
/**
|
|
12
|
+
* The per-type constant the generated transfer model emits under each type's
|
|
13
|
+
* name, as Langium does for the AST. Its `$type` literal picks the interface
|
|
14
|
+
* out of the builder's type map.
|
|
15
|
+
*/
|
|
16
|
+
export interface TransferTypeConstant<TType extends string = string> {
|
|
17
|
+
readonly $type: TType;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What {@link makeTransferNodeBuilder} reads from a reflection: each type's
|
|
21
|
+
* grammar properties and their defaults. The generated
|
|
22
|
+
* `<LanguageId>TransferReflection` satisfies it without importing it, and
|
|
23
|
+
* keeps the literal type of its `types` so the builder can tell which fields
|
|
24
|
+
* the grammar defaults.
|
|
25
|
+
*/
|
|
26
|
+
export interface TransferReflection {
|
|
27
|
+
getTypeMetaData(type: string): {
|
|
28
|
+
readonly properties: Readonly<Record<string, {
|
|
29
|
+
readonly defaultValue?: unknown;
|
|
30
|
+
}>>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** The properties of `TType` that `TReflection`'s literal `types` gives a `defaultValue`; none for a reflection typed only as the interface. */
|
|
34
|
+
type DefaultedKeys<TReflection, TType> = TReflection extends {
|
|
35
|
+
readonly types: infer Types;
|
|
36
|
+
} ? TType extends keyof Types ? Types[TType] extends {
|
|
37
|
+
readonly properties: infer Properties;
|
|
38
|
+
} ? {
|
|
39
|
+
[K in keyof Properties]: Properties[K] extends {
|
|
40
|
+
readonly defaultValue: unknown;
|
|
41
|
+
} ? K : never;
|
|
42
|
+
}[keyof Properties] : never : never : never;
|
|
43
|
+
/**
|
|
44
|
+
* Init payload of a {@link TransferNodeBuilder}: every field of `T` as its
|
|
45
|
+
* interface declares it, except that the fields named by `TDefaulted`, which
|
|
46
|
+
* the grammar defaults, are optional. `$type` comes from the constant.
|
|
47
|
+
*/
|
|
48
|
+
export type TransferNodeInit<T extends TransferElement, TDefaulted extends PropertyKey = never> = Omit<T, '$type' | TDefaulted> & Partial<Pick<T, Extract<TDefaulted, keyof T>>>;
|
|
49
|
+
/**
|
|
50
|
+
* Transfer-node factory bound to a grammar's type map, the transfer twin of
|
|
51
|
+
* core's `AstNodeBuilder`. `TMap` is the generated `<LanguageId>TransferTypes`,
|
|
52
|
+
* `TReflection` the type of the generated reflection.
|
|
53
|
+
*/
|
|
54
|
+
export interface TransferNodeBuilder<TMap, TReflection extends TransferReflection = TransferReflection> {
|
|
55
|
+
/** A complete node: the grammar's defaults, then `init`. */
|
|
56
|
+
<TType extends ConcreteTypeName<TMap>>(typeConstant: TransferTypeConstant<TType> & SingleTypeName<TType>, init: TransferNodeInit<Extract<TMap[TType], TransferElement>, DefaultedKeys<TReflection, TType>>): Extract<TMap[TType], TransferElement>;
|
|
57
|
+
/**
|
|
58
|
+
* A node holding only `init`, with no defaults filled, typed as the
|
|
59
|
+
* incomplete node it is.
|
|
60
|
+
*/
|
|
61
|
+
partial<TType extends ConcreteTypeName<TMap>>(typeConstant: TransferTypeConstant<TType> & SingleTypeName<TType>, init?: Partial<Omit<Extract<TMap[TType], TransferElement>, '$type'>>): Partial<Extract<TMap[TType], TransferElement>> & TransferTypeConstant<TType>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Bind a {@link TransferNodeBuilder} to a grammar's reflection, so a test names
|
|
65
|
+
* only the fields it cares about and a containment field the grammar gains
|
|
66
|
+
* later needs no change at the call site.
|
|
67
|
+
*
|
|
68
|
+
* Defaults come from the reflection's grammar metadata alone, so a derived
|
|
69
|
+
* field the overlay adds is never defaulted, and stays required. An array
|
|
70
|
+
* default is a fresh `[]` per node. An init field named as `undefined` keeps
|
|
71
|
+
* its default, since the init type cannot refuse `undefined` for an optional
|
|
72
|
+
* field and a plain assign would leave the node typed complete without it.
|
|
73
|
+
*
|
|
74
|
+
* The constant's `$type` is written after `init`, because the init type keeps
|
|
75
|
+
* out only a `$type` written in the call: a spread of another node passes the
|
|
76
|
+
* check and would otherwise hand back a node typed as one type and tagged as
|
|
77
|
+
* another.
|
|
78
|
+
*/
|
|
79
|
+
export declare function makeTransferNodeBuilder<TMap, TReflection extends TransferReflection = TransferReflection>(reflection: TReflection): TransferNodeBuilder<TMap, TReflection>;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=transfer-node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
|
+
* 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.makeTransferNodeBuilder = makeTransferNodeBuilder;
|
|
12
|
+
/**
|
|
13
|
+
* Bind a {@link TransferNodeBuilder} to a grammar's reflection, so a test names
|
|
14
|
+
* only the fields it cares about and a containment field the grammar gains
|
|
15
|
+
* later needs no change at the call site.
|
|
16
|
+
*
|
|
17
|
+
* Defaults come from the reflection's grammar metadata alone, so a derived
|
|
18
|
+
* field the overlay adds is never defaulted, and stays required. An array
|
|
19
|
+
* default is a fresh `[]` per node. An init field named as `undefined` keeps
|
|
20
|
+
* its default, since the init type cannot refuse `undefined` for an optional
|
|
21
|
+
* field and a plain assign would leave the node typed complete without it.
|
|
22
|
+
*
|
|
23
|
+
* The constant's `$type` is written after `init`, because the init type keeps
|
|
24
|
+
* out only a `$type` written in the call: a spread of another node passes the
|
|
25
|
+
* check and would otherwise hand back a node typed as one type and tagged as
|
|
26
|
+
* another.
|
|
27
|
+
*/
|
|
28
|
+
function makeTransferNodeBuilder(reflection) {
|
|
29
|
+
const build = (typeConstant, init) => {
|
|
30
|
+
const node = { $type: typeConstant.$type };
|
|
31
|
+
for (const [name, property] of Object.entries(reflection.getTypeMetaData(typeConstant.$type).properties)) {
|
|
32
|
+
if (property.defaultValue !== undefined) {
|
|
33
|
+
node[name] = Array.isArray(property.defaultValue) ? [...property.defaultValue] : property.defaultValue;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
for (const [name, value] of Object.entries(init)) {
|
|
37
|
+
if (value !== undefined || !Object.hasOwn(node, name)) {
|
|
38
|
+
node[name] = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
node.$type = typeConstant.$type;
|
|
42
|
+
return node;
|
|
43
|
+
};
|
|
44
|
+
const partial = (typeConstant, init = {}) => ({ ...init, $type: typeConstant.$type });
|
|
45
|
+
return Object.assign(build, { partial });
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=transfer-node-builder.js.map
|