@hydranium/protocol 1.0.0-next.25 → 1.0.0-next.251
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 -49
- 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 +245 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +425 -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 +44 -27
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +473 -81
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +743 -108
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +14 -9
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +14 -9
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +10 -4
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +12 -6
- 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-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/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 +12 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +132 -41
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +117 -21
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +69 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/debouncer.d.ts.map +1 -1
- package/lib/debouncer.js.map +1 -1
- package/lib/errors.d.ts +187 -29
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +270 -29
- 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 +7 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -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 +22 -1
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +31 -3
- package/lib/logger.js.map +1 -1
- package/lib/messages/index.d.ts +30 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +62 -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/base-version.d.ts +64 -0
- package/lib/model-service/base-version.d.ts.map +1 -0
- package/lib/model-service/base-version.js +43 -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/{model-service/args.js → node/index.d.ts} +2 -3
- 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 +35 -32
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +67 -23
- 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/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 +65 -0
- package/lib/reconcile-write.d.ts.map +1 -0
- package/lib/reconcile-write.js +67 -0
- package/lib/reconcile-write.js.map +1 -0
- package/lib/rpc/bind-rpc-methods.d.ts +33 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +32 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +10 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +12 -2
- 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/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 +46 -15
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +58 -10
- 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 +5 -2
- 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/wait-for.d.ts +3 -2
- package/lib/testing/wait-for.d.ts.map +1 -1
- package/lib/testing/wait-for.js +40 -10
- package/lib/testing/wait-for.js.map +1 -1
- package/lib/tracer.d.ts.map +1 -1
- package/lib/tracer.js.map +1 -1
- 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 +70 -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/uri.d.ts.map +1 -1
- package/lib/uri.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 +29 -37
- package/src/abstract-logger.ts +8 -0
- package/src/client/data-connection.ts +520 -0
- package/src/client/data-events.ts +33 -1
- package/src/client/data-port.ts +46 -28
- package/src/client/data-session.ts +951 -126
- package/src/client/index.ts +14 -9
- package/src/client/message-relay.ts +30 -8
- package/src/client/post-message-transport.ts +219 -4
- package/src/client/rpc-connection.ts +281 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +56 -0
- package/src/console-logger.ts +39 -0
- package/src/data/data-protocol-methods.ts +13 -4
- package/src/data/data-server-protocol.ts +157 -41
- package/src/data/events.ts +123 -21
- package/src/data/requests.ts +74 -11
- package/src/errors.ts +322 -36
- package/src/glsp-request-model-args.ts +16 -0
- package/src/glsp-save-model-actions.ts +59 -0
- package/src/index.ts +10 -0
- package/src/latency-collector.ts +8 -3
- package/src/logger.ts +28 -2
- package/src/messages/index.ts +37 -0
- package/src/messages/primitives.ts +271 -0
- package/src/model-server.ts +64 -19
- package/src/model-service/base-version.ts +72 -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 +97 -42
- package/src/profile-session.ts +9 -4
- package/src/random-uuid.ts +21 -0
- package/src/reconcile-write.ts +124 -0
- package/src/rpc/README.md +4 -5
- package/src/rpc/bind-rpc-methods.ts +59 -4
- package/src/rpc/create-rpc-proxy.ts +20 -2
- package/src/rpc/index.ts +1 -0
- package/src/rpc/send-by-method-name.ts +140 -0
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +149 -25
- package/src/testing/fake-clock.ts +62 -47
- package/src/testing/index.ts +5 -2
- 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/wait-for.ts +38 -11
- package/src/transfer-diagnostic.ts +40 -0
- package/src/transfer-document.ts +87 -34
- 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.map +0 -1
- package/src/model-service/args.ts +0 -67
package/lib/errors.js
CHANGED
|
@@ -8,38 +8,85 @@
|
|
|
8
8
|
* SPDX-License-Identifier: MIT
|
|
9
9
|
********************************************************************************/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.ConflictError = exports.CONFLICT_ERROR_CODE = void 0;
|
|
11
|
+
exports.ReservedClientIdError = exports.DuplicateClientIdError = exports.DUPLICATE_CLIENT_ID = exports.DocumentNotOpenError = exports.DOCUMENT_NOT_OPEN = exports.SessionClosedError = exports.SESSION_CLOSED = exports.RESERVED_CLIENT_ID_ERROR_CODE = exports.DUPLICATE_CLIENT_ID_ERROR_CODE = exports.DOCUMENT_NOT_OPEN_ERROR_CODE = exports.SESSION_CLOSED_ERROR_CODE = exports.ConflictError = exports.CONFLICT_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES = exports.STALE_BASE_VERSION_UPDATE = void 0;
|
|
12
|
+
exports.isResponseError = isResponseError;
|
|
13
|
+
exports.reviveProtocolError = reviveProtocolError;
|
|
14
|
+
exports.isSessionClosedError = isSessionClosedError;
|
|
15
|
+
exports.isDocumentNotOpenError = isDocumentNotOpenError;
|
|
16
|
+
exports.isDuplicateClientIdError = isDuplicateClientIdError;
|
|
17
|
+
exports.isReservedClientIdError = isReservedClientIdError;
|
|
12
18
|
exports.isConflictError = isConflictError;
|
|
13
19
|
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
|
|
20
|
+
const primitives_1 = require("./messages/primitives");
|
|
21
|
+
const base_version_1 = require("./model-service/base-version");
|
|
22
|
+
/*
|
|
23
|
+
* Every error here is a typed error: a caller reacts to it, so it has a class,
|
|
24
|
+
* a JSON-RPC code and an `is*` guard, and an English message. A typed error
|
|
25
|
+
* also carries a message identity where the framework can write an end-user
|
|
26
|
+
* sentence that needs no context. A URI may stay in that sentence; a client id
|
|
27
|
+
* or a raw version stays out of it, worded or left to `data`.
|
|
28
|
+
*
|
|
29
|
+
* An error nothing reacts to does not belong here: it stays a plain `Error`, or
|
|
30
|
+
* a named subclass without a code, at its throw site, since a code and a guard
|
|
31
|
+
* are public API that no caller would use.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* The catalogue declaration behind {@link ConflictError}'s sentence. It words
|
|
35
|
+
* the version mismatch rather than stating it: the two numbers mean nothing to
|
|
36
|
+
* an end user, and they stay in {@link ConflictErrorData}.
|
|
37
|
+
*
|
|
38
|
+
* Its English must keep containing {@link CONFLICT_ERROR_MESSAGE_MARKER}: the
|
|
39
|
+
* marker is tier 3 of {@link isConflictError}'s ladder, and it matches on text.
|
|
40
|
+
* That tier only ever works untranslated, which is why it is the last resort
|
|
41
|
+
* behind the numeric code rather than the primary check.
|
|
42
|
+
*/
|
|
43
|
+
exports.STALE_BASE_VERSION_UPDATE = (0, primitives_1.defineMessage)('hydranium/protocol/stale-base-version-update', 'The edit to {uri} was not applied: it was made to an older version of the document.');
|
|
44
|
+
/**
|
|
45
|
+
* Every JSON-RPC error code the framework raises, from any package, keyed by
|
|
46
|
+
* the error it identifies.
|
|
47
|
+
*
|
|
48
|
+
* The framework reserves the block 42000 to 42999 for these, and an adopter's
|
|
49
|
+
* own codes stay outside it: after an RPC a guard matches on the code alone, so
|
|
50
|
+
* an adopter's error carrying one of these reads as the framework's. A new code
|
|
51
|
+
* takes the next unused number in the block, whichever package raises it, and
|
|
52
|
+
* is declared here, where tests hold every code distinct and inside the block.
|
|
53
|
+
* The block sits clear of the range JSON-RPC 2.0 reserves for itself, -32768
|
|
54
|
+
* to -32000.
|
|
55
|
+
*/
|
|
56
|
+
exports.HYDRANIUM_ERROR_CODES = {
|
|
57
|
+
conflict: 42001,
|
|
58
|
+
noActiveProfile: 42002,
|
|
59
|
+
referenceSettleTimeout: 42003,
|
|
60
|
+
sessionClosed: 42004,
|
|
61
|
+
documentNotOpen: 42005,
|
|
62
|
+
duplicateClientId: 42006,
|
|
63
|
+
reservedClientId: 42007
|
|
64
|
+
};
|
|
14
65
|
/**
|
|
15
|
-
*
|
|
16
|
-
* Outside the reserved range (-32768 .. -32000) per JSON-RPC 2.0.
|
|
66
|
+
* JSON-RPC error code for {@link ConflictError}.
|
|
17
67
|
*
|
|
18
68
|
* The code is the load-bearing identifier across realm boundaries —
|
|
19
69
|
* `code` is a first-class field on the JSON-RPC error envelope and
|
|
20
70
|
* survives wire reconstruction; the custom `Error` subclass name does
|
|
21
71
|
* not.
|
|
22
72
|
*/
|
|
23
|
-
exports.CONFLICT_ERROR_CODE =
|
|
73
|
+
exports.CONFLICT_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.conflict;
|
|
24
74
|
/**
|
|
25
|
-
* Thrown by `
|
|
26
|
-
* supplied
|
|
75
|
+
* Thrown by a client session's `update` / `save` when the caller-
|
|
76
|
+
* supplied base version no longer matches the server's current text-
|
|
27
77
|
* document version for the same URI — i.e. the snapshot the caller
|
|
28
78
|
* authored against has been superseded by an intervening edit.
|
|
29
79
|
*
|
|
30
80
|
* Extends vscode-jsonrpc's {@link ResponseError} so the typed
|
|
31
81
|
* {@link ConflictErrorData} payload rides on the standard JSON-RPC
|
|
32
82
|
* error envelope (`code`, `message`, `data`) — all three fields are
|
|
33
|
-
* preserved by RPC reconstruction.
|
|
34
|
-
* the receiving side
|
|
35
|
-
* `err.data`
|
|
36
|
-
* `ResponseError`, so subclass getters / fields do not survive).
|
|
83
|
+
* preserved by RPC reconstruction. `createRpcProxy` revives it into
|
|
84
|
+
* this class on the receiving side; a path that does not leaves a
|
|
85
|
+
* plain `ResponseError`, readable through `err.data` only.
|
|
37
86
|
*
|
|
38
|
-
* Detection is
|
|
39
|
-
*
|
|
40
|
-
* no gating.
|
|
41
|
-
* posture, so headless / CLI / batch tooling with no meaningful based-on
|
|
42
|
-
* version can opt out explicitly.
|
|
87
|
+
* Detection is driven by the required `baseVersion` field of every write
|
|
88
|
+
* request; a caller with no meaningful base version passes
|
|
89
|
+
* `'any'` and gets no gating.
|
|
43
90
|
*
|
|
44
91
|
* Three reasonable adopter recovery strategies:
|
|
45
92
|
*
|
|
@@ -53,35 +100,228 @@ exports.CONFLICT_ERROR_CODE = 1001;
|
|
|
53
100
|
* No auto-retry or auto-merge ships by default.
|
|
54
101
|
*/
|
|
55
102
|
class ConflictError extends vscode_jsonrpc_1.ResponseError {
|
|
56
|
-
constructor(uri,
|
|
57
|
-
|
|
103
|
+
constructor(uri, baseVersion, actualVersion) {
|
|
104
|
+
// The identity rides alongside the typed payload rather than replacing
|
|
105
|
+
// it: `isConflictError`'s name check is surface an adopter may bind, so
|
|
106
|
+
// adding the identity widens the payload rather than reshaping it.
|
|
107
|
+
super(exports.CONFLICT_ERROR_CODE, exports.STALE_BASE_VERSION_UPDATE.format({ uri }), {
|
|
58
108
|
uri,
|
|
59
|
-
|
|
60
|
-
|
|
109
|
+
baseVersion,
|
|
110
|
+
actualVersion,
|
|
111
|
+
...(0, primitives_1.messageData)(exports.STALE_BASE_VERSION_UPDATE, { uri })
|
|
61
112
|
});
|
|
62
113
|
this.name = 'ConflictError';
|
|
63
114
|
// ResponseError's constructor calls `Object.setPrototypeOf(this,
|
|
64
115
|
// ResponseError.prototype)` to keep its own prototype chain intact across
|
|
65
116
|
// transpilation targets; that resets us to ResponseError, hiding the
|
|
66
117
|
// ConflictError-specific getters. Restore the prototype here so
|
|
67
|
-
// `err.uri` / `.
|
|
118
|
+
// `err.uri` / `.baseVersion` / `.actualVersion` resolve through this
|
|
119
|
+
// class.
|
|
68
120
|
Object.setPrototypeOf(this, ConflictError.prototype);
|
|
69
121
|
}
|
|
70
122
|
get uri() {
|
|
71
123
|
return this.data.uri;
|
|
72
124
|
}
|
|
73
|
-
|
|
74
|
-
|
|
125
|
+
/**
|
|
126
|
+
* The base version the caller authored against.
|
|
127
|
+
*
|
|
128
|
+
* Must not be renamed to `expected`, nor its sibling to `actual`: a test
|
|
129
|
+
* reporter reads an error carrying both as an assertion failure, and
|
|
130
|
+
* vitest's formatter then ASSIGNS to them, which throws on an accessor and
|
|
131
|
+
* replaces the real failure with a `TypeError`.
|
|
132
|
+
*/
|
|
133
|
+
get baseVersion() {
|
|
134
|
+
return this.data.baseVersion;
|
|
75
135
|
}
|
|
76
|
-
|
|
77
|
-
|
|
136
|
+
/** The server's version at the time of the throw. Not `actual` — see {@link baseVersion}. */
|
|
137
|
+
get actualVersion() {
|
|
138
|
+
return this.data.actualVersion;
|
|
78
139
|
}
|
|
79
140
|
}
|
|
80
141
|
exports.ConflictError = ConflictError;
|
|
142
|
+
/**
|
|
143
|
+
* JSON-RPC code for {@link SessionClosedError}, beside {@link CONFLICT_ERROR_CODE}
|
|
144
|
+
* and for the same reason: the code survives reconstruction, the class does not.
|
|
145
|
+
*/
|
|
146
|
+
exports.SESSION_CLOSED_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.sessionClosed;
|
|
147
|
+
/** JSON-RPC code for {@link DocumentNotOpenError}. */
|
|
148
|
+
exports.DOCUMENT_NOT_OPEN_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.documentNotOpen;
|
|
149
|
+
/** JSON-RPC code for {@link DuplicateClientIdError}. */
|
|
150
|
+
exports.DUPLICATE_CLIENT_ID_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.duplicateClientId;
|
|
151
|
+
/** JSON-RPC code for {@link ReservedClientIdError}. */
|
|
152
|
+
exports.RESERVED_CLIENT_ID_ERROR_CODE = exports.HYDRANIUM_ERROR_CODES.reservedClientId;
|
|
153
|
+
/**
|
|
154
|
+
* The catalogue declaration behind {@link SessionClosedError}'s default
|
|
155
|
+
* sentence. It names no client id: the sentence can reach an end user, and the
|
|
156
|
+
* id stays in {@link SessionClosedErrorData.clientId} for whoever needs it.
|
|
157
|
+
*/
|
|
158
|
+
exports.SESSION_CLOSED = (0, primitives_1.defineMessage)('hydranium/protocol/session-closed', 'The editing session has ended.');
|
|
159
|
+
/**
|
|
160
|
+
* Thrown by every call on a client session after it ended, and by an open that
|
|
161
|
+
* was still in flight when its session ended: by the server for its sessions,
|
|
162
|
+
* and by a client-side `DataSession` once disposed, so a caller handles both
|
|
163
|
+
* the same way. A caller recognises it with {@link isSessionClosedError}, never
|
|
164
|
+
* by its sentence.
|
|
165
|
+
*/
|
|
166
|
+
class SessionClosedError extends vscode_jsonrpc_1.ResponseError {
|
|
167
|
+
/**
|
|
168
|
+
* `message` replaces the default English, for a caller that knows more than
|
|
169
|
+
* that the session is gone. The identity stays {@link SESSION_CLOSED}'s, so a
|
|
170
|
+
* translating renderer renders the catalogue sentence in its place.
|
|
171
|
+
*/
|
|
172
|
+
constructor(clientId, message = exports.SESSION_CLOSED.format()) {
|
|
173
|
+
super(exports.SESSION_CLOSED_ERROR_CODE, message, { clientId, ...(0, primitives_1.messageData)(exports.SESSION_CLOSED) });
|
|
174
|
+
this.name = 'SessionClosedError';
|
|
175
|
+
// `ResponseError` resets the prototype to its own; see `ConflictError`.
|
|
176
|
+
Object.setPrototypeOf(this, SessionClosedError.prototype);
|
|
177
|
+
}
|
|
178
|
+
get clientId() {
|
|
179
|
+
return this.data.clientId;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.SessionClosedError = SessionClosedError;
|
|
183
|
+
/**
|
|
184
|
+
* The catalogue declaration behind {@link DocumentNotOpenError}'s sentence. The
|
|
185
|
+
* client id stays in {@link DocumentNotOpenErrorData.clientId}.
|
|
186
|
+
*/
|
|
187
|
+
exports.DOCUMENT_NOT_OPEN = (0, primitives_1.defineMessage)('hydranium/protocol/document-not-open', 'The document {uri} is not open in this editing session.');
|
|
188
|
+
/**
|
|
189
|
+
* Thrown when a client session writes a document it does not have open.
|
|
190
|
+
*
|
|
191
|
+
* A session writes only what it has open, so this is the answer both to a write
|
|
192
|
+
* that never opened and to one whose open was closed underneath it — by the
|
|
193
|
+
* session itself, or by the document being deleted.
|
|
194
|
+
*/
|
|
195
|
+
class DocumentNotOpenError extends vscode_jsonrpc_1.ResponseError {
|
|
196
|
+
constructor(uri, clientId) {
|
|
197
|
+
super(exports.DOCUMENT_NOT_OPEN_ERROR_CODE, exports.DOCUMENT_NOT_OPEN.format({ uri }), {
|
|
198
|
+
uri,
|
|
199
|
+
clientId,
|
|
200
|
+
...(0, primitives_1.messageData)(exports.DOCUMENT_NOT_OPEN, { uri })
|
|
201
|
+
});
|
|
202
|
+
this.name = 'DocumentNotOpenError';
|
|
203
|
+
Object.setPrototypeOf(this, DocumentNotOpenError.prototype);
|
|
204
|
+
}
|
|
205
|
+
get uri() {
|
|
206
|
+
return this.data.uri;
|
|
207
|
+
}
|
|
208
|
+
get clientId() {
|
|
209
|
+
return this.data.clientId;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.DocumentNotOpenError = DocumentNotOpenError;
|
|
213
|
+
/**
|
|
214
|
+
* The catalogue declaration behind {@link DuplicateClientIdError}'s sentence.
|
|
215
|
+
* The client id stays in {@link DuplicateClientIdErrorData.clientId}.
|
|
216
|
+
*/
|
|
217
|
+
exports.DUPLICATE_CLIENT_ID = (0, primitives_1.defineMessage)('hydranium/protocol/duplicate-client-id', 'Could not start an editing session: its identifier is still in use by another editor.');
|
|
218
|
+
/**
|
|
219
|
+
* Thrown when a client session is started under an id that is already live in
|
|
220
|
+
* the process. The id frees up once its holder ends or closes its last
|
|
221
|
+
* document, so a caller may retry.
|
|
222
|
+
*
|
|
223
|
+
* Ids are unique process-wide because the id is also the author label on every
|
|
224
|
+
* version and the key a client recognises its own echoes by; two participants
|
|
225
|
+
* sharing one would each take the other's writes for their own.
|
|
226
|
+
*/
|
|
227
|
+
class DuplicateClientIdError extends vscode_jsonrpc_1.ResponseError {
|
|
228
|
+
constructor(clientId) {
|
|
229
|
+
super(exports.DUPLICATE_CLIENT_ID_ERROR_CODE, exports.DUPLICATE_CLIENT_ID.format(), { clientId, ...(0, primitives_1.messageData)(exports.DUPLICATE_CLIENT_ID) });
|
|
230
|
+
this.name = 'DuplicateClientIdError';
|
|
231
|
+
Object.setPrototypeOf(this, DuplicateClientIdError.prototype);
|
|
232
|
+
}
|
|
233
|
+
get clientId() {
|
|
234
|
+
return this.data.clientId;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.DuplicateClientIdError = DuplicateClientIdError;
|
|
238
|
+
/**
|
|
239
|
+
* Thrown when a client session is started under an id the framework reserves
|
|
240
|
+
* for one of its own participants. A reserved id never frees up, so a caller
|
|
241
|
+
* that retries on {@link DuplicateClientIdError} stops on this one.
|
|
242
|
+
*
|
|
243
|
+
* It carries no message identity: a host that picks a reserved id has a bug,
|
|
244
|
+
* and no sentence addressed to an end user is true for it.
|
|
245
|
+
*/
|
|
246
|
+
class ReservedClientIdError extends vscode_jsonrpc_1.ResponseError {
|
|
247
|
+
constructor(clientId) {
|
|
248
|
+
super(exports.RESERVED_CLIENT_ID_ERROR_CODE, `Client id ${clientId} is reserved for a framework participant`, { clientId });
|
|
249
|
+
this.name = 'ReservedClientIdError';
|
|
250
|
+
Object.setPrototypeOf(this, ReservedClientIdError.prototype);
|
|
251
|
+
}
|
|
252
|
+
get clientId() {
|
|
253
|
+
return this.data.clientId;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
exports.ReservedClientIdError = ReservedClientIdError;
|
|
257
|
+
/** One entry per typed error class, keyed by its code; a class without one reaches a caller as a plain `ResponseError`. */
|
|
258
|
+
const PROTOCOL_ERROR_REVIVERS = new Map([
|
|
259
|
+
[
|
|
260
|
+
exports.CONFLICT_ERROR_CODE,
|
|
261
|
+
({ uri, baseVersion, actualVersion }) => typeof uri === 'string' && typeof baseVersion === 'number' && typeof actualVersion === 'number'
|
|
262
|
+
? new ConflictError(uri, (0, base_version_1.asModelVersion)(baseVersion), actualVersion)
|
|
263
|
+
: undefined
|
|
264
|
+
],
|
|
265
|
+
[exports.SESSION_CLOSED_ERROR_CODE, ({ clientId }) => (typeof clientId === 'string' ? new SessionClosedError(clientId) : undefined)],
|
|
266
|
+
[
|
|
267
|
+
exports.DOCUMENT_NOT_OPEN_ERROR_CODE,
|
|
268
|
+
({ uri, clientId }) => (typeof uri === 'string' && typeof clientId === 'string' ? new DocumentNotOpenError(uri, clientId) : undefined)
|
|
269
|
+
],
|
|
270
|
+
[exports.DUPLICATE_CLIENT_ID_ERROR_CODE, ({ clientId }) => (typeof clientId === 'string' ? new DuplicateClientIdError(clientId) : undefined)],
|
|
271
|
+
[exports.RESERVED_CLIENT_ID_ERROR_CODE, ({ clientId }) => (typeof clientId === 'string' ? new ReservedClientIdError(clientId) : undefined)]
|
|
272
|
+
]);
|
|
273
|
+
/**
|
|
274
|
+
* Whether `error` is a `ResponseError` from any copy of `vscode-jsonrpc`. An
|
|
275
|
+
* install holds several copies, and `instanceof` recognises only its own. An
|
|
276
|
+
* error that merely carries an integer `code` has no `toJson`, and is not one.
|
|
277
|
+
*/
|
|
278
|
+
function isResponseError(error) {
|
|
279
|
+
return (error instanceof Error && 'code' in error && Number.isInteger(error.code) && 'toJson' in error && typeof error.toJson === 'function');
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* `error` as an instance of the typed error class its code names, with its
|
|
283
|
+
* message, data and stack kept, or `error` itself when its code names none or
|
|
284
|
+
* its data lacks the fields that class reads.
|
|
285
|
+
* An RPC reconstructs every rejection as a plain `ResponseError`, which has
|
|
286
|
+
* none of the class getters.
|
|
287
|
+
*/
|
|
288
|
+
function reviveProtocolError(error) {
|
|
289
|
+
if (!isResponseError(error) || error.data === null || typeof error.data !== 'object') {
|
|
290
|
+
return error;
|
|
291
|
+
}
|
|
292
|
+
const revived = PROTOCOL_ERROR_REVIVERS.get(error.code)?.({ ...error.data });
|
|
293
|
+
if (!revived) {
|
|
294
|
+
return error;
|
|
295
|
+
}
|
|
296
|
+
return Object.assign(revived, { message: error.message, data: error.data, stack: error.stack });
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Whether `error` is a {@link SessionClosedError}: by name in-process, by code
|
|
300
|
+
* when it arrives as a plain `ResponseError`, through a path that does not
|
|
301
|
+
* {@link reviveProtocolError revive} it.
|
|
302
|
+
*/
|
|
303
|
+
function isSessionClosedError(error) {
|
|
304
|
+
return hasErrorIdentity(error, 'SessionClosedError', exports.SESSION_CLOSED_ERROR_CODE);
|
|
305
|
+
}
|
|
306
|
+
/** Whether `error` is a {@link DocumentNotOpenError}; see {@link isSessionClosedError}. */
|
|
307
|
+
function isDocumentNotOpenError(error) {
|
|
308
|
+
return hasErrorIdentity(error, 'DocumentNotOpenError', exports.DOCUMENT_NOT_OPEN_ERROR_CODE);
|
|
309
|
+
}
|
|
310
|
+
/** Whether `error` is a {@link DuplicateClientIdError}; see {@link isSessionClosedError}. */
|
|
311
|
+
function isDuplicateClientIdError(error) {
|
|
312
|
+
return hasErrorIdentity(error, 'DuplicateClientIdError', exports.DUPLICATE_CLIENT_ID_ERROR_CODE);
|
|
313
|
+
}
|
|
314
|
+
/** Whether `error` is a {@link ReservedClientIdError}; see {@link isSessionClosedError}. */
|
|
315
|
+
function isReservedClientIdError(error) {
|
|
316
|
+
return hasErrorIdentity(error, 'ReservedClientIdError', exports.RESERVED_CLIENT_ID_ERROR_CODE);
|
|
317
|
+
}
|
|
318
|
+
function hasErrorIdentity(error, name, code) {
|
|
319
|
+
return error instanceof Error && (error.name === name || error.code === code);
|
|
320
|
+
}
|
|
81
321
|
/** Marker substring present in every {@link ConflictError} message, used by
|
|
82
322
|
* {@link isConflictError} as a fallback when a transport re-wraps the error
|
|
83
323
|
* and drops the JSON-RPC code. */
|
|
84
|
-
const CONFLICT_ERROR_MESSAGE_MARKER = '
|
|
324
|
+
const CONFLICT_ERROR_MESSAGE_MARKER = ': it was made to an older version of the document';
|
|
85
325
|
/**
|
|
86
326
|
* Type guard for {@link ConflictError}. Detection ladder:
|
|
87
327
|
*
|
|
@@ -91,11 +331,12 @@ const CONFLICT_ERROR_MESSAGE_MARKER = 'Stale-based update for ';
|
|
|
91
331
|
* canonical wire-side check; the JSON-RPC `code` field is preserved
|
|
92
332
|
* across reconstruction, so any adopter catching after an RPC call
|
|
93
333
|
* hits this branch.
|
|
94
|
-
* 3. `error.message
|
|
95
|
-
* for transports that re-wrap the message
|
|
334
|
+
* 3. `error.message` contains the marker {@link STALE_BASE_VERSION_UPDATE}'s
|
|
335
|
+
* English carries — fallback for transports that re-wrap the message
|
|
336
|
+
* and drop the code (rare).
|
|
96
337
|
*
|
|
97
|
-
* `instanceof ConflictError` alone
|
|
98
|
-
*
|
|
338
|
+
* `instanceof ConflictError` alone returns `false` on a rejection that was
|
|
339
|
+
* not {@link reviveProtocolError revived}, so callers do not use it.
|
|
99
340
|
*/
|
|
100
341
|
function isConflictError(error) {
|
|
101
342
|
if (!(error instanceof Error)) {
|
package/lib/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,mDAA+C;AAC/C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AED,6FAA6F;AAC7F,kCAAyC,KAAc;IACpD,OAAO,gBAAgB,CAAC,KAAK,EAAE,wBAAwB,EAAE,QAAA,8BAA8B,CAAC,CAAC;AAC5F,CAAC;AAED,4FAA4F;AAC5F,iCAAwC,KAAc;IACnD,OAAO,gBAAgB,CAAC,KAAK,EAAE,uBAAuB,EAAE,QAAA,6BAA6B,CAAC,CAAC;AAC1F,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc,EAAE,IAAY,EAAE,IAAY;IACjE,OAAO,KAAK,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,IAAK,KAAyC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtH,CAAC;AAED;;mCAEmC;AACnC,MAAM,6BAA6B,GAAG,mDAAmD,CAAC;AAE1F;;;;;;;;;;;;;;;GAeG;AACH,yBAAgC,KAAc;IAC3C,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IAChB,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAI,KAAyC,CAAC,IAAI,CAAC;IAC7D,IAAI,IAAI,KAAK,QAAA,mBAAmB,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACf,CAAC;IACD,OAAO,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, 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
|
+
/**
|
|
10
|
+
* The `RequestModelAction` option carrying a diagram's resume token. A load
|
|
11
|
+
* whose token matches the one the live session under its client id was started
|
|
12
|
+
* with takes that session over, so a diagram that reconnects or reloads keeps
|
|
13
|
+
* its unsaved text; without it, the id held by another session is refused.
|
|
14
|
+
*/
|
|
15
|
+
export declare const RESUME_TOKEN_ARG = "hydraniumResumeToken";
|
|
16
|
+
//# sourceMappingURL=glsp-request-model-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-request-model-args.d.ts","sourceRoot":"","sources":["../src/glsp-request-model-args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, 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.RESUME_TOKEN_ARG = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* The `RequestModelAction` option carrying a diagram's resume token. A load
|
|
14
|
+
* whose token matches the one the live session under its client id was started
|
|
15
|
+
* with takes that session over, so a diagram that reconnects or reloads keeps
|
|
16
|
+
* its unsaved text; without it, the id held by another session is refused.
|
|
17
|
+
*/
|
|
18
|
+
exports.RESUME_TOKEN_ARG = 'hydraniumResumeToken';
|
|
19
|
+
//# sourceMappingURL=glsp-request-model-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-request-model-args.js","sourceRoot":"","sources":["../src/glsp-request-model-args.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF;;;;;GAKG;AACU,QAAA,gBAAgB,GAAG,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, 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
|
+
/**
|
|
10
|
+
* A save of a diagram's model that the server answers, with a
|
|
11
|
+
* {@link ModelSavedAction} once the save has finished or a GLSP
|
|
12
|
+
* `RejectAction` when it fails.
|
|
13
|
+
*
|
|
14
|
+
* It carries what GLSP's `SaveModelAction` carries, and the server saves it the
|
|
15
|
+
* same way. GLSP's `SaveModelAction` is not answered: the server's only
|
|
16
|
+
* reply is a dirty-state change, which the client drops when the dirty flag
|
|
17
|
+
* does not change, so a client cannot tell which save an answer belongs to or
|
|
18
|
+
* whether a save failed.
|
|
19
|
+
*/
|
|
20
|
+
export interface RequestSaveModelAction {
|
|
21
|
+
kind: typeof RequestSaveModelAction.KIND;
|
|
22
|
+
/** The id the response echoes as its `responseId`. Empty until the dispatcher assigns one. */
|
|
23
|
+
requestId: string;
|
|
24
|
+
/** How long the receiver waits for its own handler, in milliseconds. */
|
|
25
|
+
timeout?: number;
|
|
26
|
+
/** The file to save to, as in GLSP's `SaveModelAction`; absent saves to the diagram's source. */
|
|
27
|
+
fileUri?: string;
|
|
28
|
+
/** GLSP's typing marker for the response. Never set. */
|
|
29
|
+
readonly _?: ModelSavedAction;
|
|
30
|
+
}
|
|
31
|
+
export declare namespace RequestSaveModelAction {
|
|
32
|
+
const KIND = "hydraniumRequestSaveModel";
|
|
33
|
+
function create(options?: {
|
|
34
|
+
fileUri?: string;
|
|
35
|
+
requestId?: string;
|
|
36
|
+
}): RequestSaveModelAction;
|
|
37
|
+
}
|
|
38
|
+
/** The server's answer to a {@link RequestSaveModelAction} that saved. */
|
|
39
|
+
export interface ModelSavedAction {
|
|
40
|
+
kind: typeof ModelSavedAction.KIND;
|
|
41
|
+
/** The `requestId` of the save this answers. The server's dispatcher sets it. */
|
|
42
|
+
responseId: string;
|
|
43
|
+
}
|
|
44
|
+
export declare namespace ModelSavedAction {
|
|
45
|
+
const KIND = "hydraniumModelSaved";
|
|
46
|
+
function create(options?: {
|
|
47
|
+
responseId?: string;
|
|
48
|
+
}): ModelSavedAction;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=glsp-save-model-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-save-model-actions.d.ts","sourceRoot":"","sources":["../src/glsp-save-model-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAOlF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACpC,IAAI,EAAE,OAAO,sBAAsB,CAAC,IAAI,CAAC;IACzC,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,QAAQ,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED,yBAAiB,sBAAsB,CAAC;IAC9B,MAAM,IAAI,8BAA8B,CAAC;IAEhD,SAAgB,MAAM,CAAC,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,sBAAsB,CAErG;CACH;AAED,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAC9B,IAAI,EAAE,OAAO,gBAAgB,CAAC,IAAI,CAAC;IACnC,iFAAiF;IACjF,UAAU,EAAE,MAAM,CAAC;CACrB;AAED,yBAAiB,gBAAgB,CAAC;IACxB,MAAM,IAAI,wBAAwB,CAAC;IAE1C,SAAgB,MAAM,CAAC,OAAO,GAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,gBAAgB,CAE9E;CACH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 CrossBreeze, 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.ModelSavedAction = exports.RequestSaveModelAction = void 0;
|
|
12
|
+
var RequestSaveModelAction;
|
|
13
|
+
(function (RequestSaveModelAction) {
|
|
14
|
+
RequestSaveModelAction.KIND = 'hydraniumRequestSaveModel';
|
|
15
|
+
function create(options = {}) {
|
|
16
|
+
return { kind: RequestSaveModelAction.KIND, requestId: '', ...options };
|
|
17
|
+
}
|
|
18
|
+
RequestSaveModelAction.create = create;
|
|
19
|
+
})(RequestSaveModelAction || (exports.RequestSaveModelAction = RequestSaveModelAction = {}));
|
|
20
|
+
var ModelSavedAction;
|
|
21
|
+
(function (ModelSavedAction) {
|
|
22
|
+
ModelSavedAction.KIND = 'hydraniumModelSaved';
|
|
23
|
+
function create(options = {}) {
|
|
24
|
+
return { kind: ModelSavedAction.KIND, responseId: '', ...options };
|
|
25
|
+
}
|
|
26
|
+
ModelSavedAction.create = create;
|
|
27
|
+
})(ModelSavedAction || (exports.ModelSavedAction = ModelSavedAction = {}));
|
|
28
|
+
//# sourceMappingURL=glsp-save-model-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-save-model-actions.js","sourceRoot":"","sources":["../src/glsp-save-model-actions.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AA8BlF,IAAiB,sBAAsB,CAMtC;AAND,WAAiB,sBAAsB;IACvB,2BAAI,GAAG,2BAA2B,CAAC;IAEhD,SAAgB,MAAM,CAAC,OAAO,GAA6C,EAAE;QAC1E,OAAO,EAAE,IAAI,EAAE,2BAAI,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,CAAC;IAFe,uBAAA,MAAM,SAErB,CAAA;AACJ,CAAC,EANgB,sBAAsB,aAAtB,sBAAsB,GAAtB,sBAAsB,QAMtC;AASD,IAAiB,gBAAgB,CAMhC;AAND,WAAiB,gBAAgB;IACjB,qBAAI,GAAG,qBAAqB,CAAC;IAE1C,SAAgB,MAAM,CAAC,OAAO,GAA4B,EAAE;QACzD,OAAO,EAAE,IAAI,EAAE,qBAAI,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC;IACrD,CAAC;IAFe,iBAAA,MAAM,SAErB,CAAA;AACJ,CAAC,EANgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QAMhC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -7,16 +7,22 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
export * from './abstract-logger';
|
|
10
|
+
export * from './console-logger';
|
|
10
11
|
export * from './client';
|
|
12
|
+
export * from './client-ids';
|
|
11
13
|
export * from './clock';
|
|
12
14
|
export * from './data';
|
|
13
15
|
export * from './browser-runtime';
|
|
14
16
|
export * from './debouncer';
|
|
17
|
+
export * from './glsp-request-model-args';
|
|
18
|
+
export * from './glsp-save-model-actions';
|
|
15
19
|
export * from './errors';
|
|
16
20
|
export * from './host-diagnostics';
|
|
17
21
|
export * from './logger';
|
|
18
22
|
export * from './latency-collector';
|
|
23
|
+
export * from './messages/primitives';
|
|
19
24
|
export * from './patch-merge';
|
|
25
|
+
export * from './reconcile-write';
|
|
20
26
|
export * from './noop-logger';
|
|
21
27
|
export * from './observable-value';
|
|
22
28
|
export * from './profile-session';
|
|
@@ -28,6 +34,7 @@ export * from './model-service';
|
|
|
28
34
|
export * from './transfer-document';
|
|
29
35
|
export * from './model-server';
|
|
30
36
|
export * from './project';
|
|
37
|
+
export * from './random-uuid';
|
|
31
38
|
export * from './rpc';
|
|
32
39
|
export * from './uri';
|
|
33
40
|
export * from './util';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AASlF,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AASlF,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AAIpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -29,16 +29,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
// on the opposite constraint: re-exporting it would put the test doubles in
|
|
30
30
|
// every production bundle that imports the root.
|
|
31
31
|
__exportStar(require("./abstract-logger"), exports);
|
|
32
|
+
__exportStar(require("./console-logger"), exports);
|
|
32
33
|
__exportStar(require("./client"), exports);
|
|
34
|
+
__exportStar(require("./client-ids"), exports);
|
|
33
35
|
__exportStar(require("./clock"), exports);
|
|
34
36
|
__exportStar(require("./data"), exports);
|
|
35
37
|
__exportStar(require("./browser-runtime"), exports);
|
|
36
38
|
__exportStar(require("./debouncer"), exports);
|
|
39
|
+
__exportStar(require("./glsp-request-model-args"), exports);
|
|
40
|
+
__exportStar(require("./glsp-save-model-actions"), exports);
|
|
37
41
|
__exportStar(require("./errors"), exports);
|
|
38
42
|
__exportStar(require("./host-diagnostics"), exports);
|
|
39
43
|
__exportStar(require("./logger"), exports);
|
|
40
44
|
__exportStar(require("./latency-collector"), exports);
|
|
45
|
+
// The primitives only. The `./messages` subpath additionally enumerates this
|
|
46
|
+
// package's own declarations, which the root barrel already re-exports through
|
|
47
|
+
// the modules that raise them.
|
|
48
|
+
__exportStar(require("./messages/primitives"), exports);
|
|
41
49
|
__exportStar(require("./patch-merge"), exports);
|
|
50
|
+
__exportStar(require("./reconcile-write"), exports);
|
|
42
51
|
__exportStar(require("./noop-logger"), exports);
|
|
43
52
|
__exportStar(require("./observable-value"), exports);
|
|
44
53
|
__exportStar(require("./profile-session"), exports);
|
|
@@ -50,6 +59,7 @@ __exportStar(require("./model-service"), exports);
|
|
|
50
59
|
__exportStar(require("./transfer-document"), exports);
|
|
51
60
|
__exportStar(require("./model-server"), exports);
|
|
52
61
|
__exportStar(require("./project"), exports);
|
|
62
|
+
__exportStar(require("./random-uuid"), exports);
|
|
53
63
|
__exportStar(require("./rpc"), exports);
|
|
54
64
|
__exportStar(require("./uri"), exports);
|
|
55
65
|
__exportStar(require("./util"), exports);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kFAAkF;AAClF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,iDAAiD;AAEjD,oDAAkC;AAClC,2CAAyB;AACzB,0CAAwB;AACxB,yCAAuB;AACvB,oDAAkC;AAClC,8CAA4B;AAC5B,2CAAyB;AACzB,qDAAmC;AACnC,2CAAyB;AACzB,sDAAoC;AACpC,gDAA8B;AAC9B,gDAA8B;AAC9B,qDAAmC;AACnC,oDAAkC;AAClC,8CAA4B;AAC5B,2CAAyB;AACzB,wDAAsC;AACtC,qDAAmC;AACnC,kDAAgC;AAChC,sDAAoC;AACpC,iDAA+B;AAC/B,4CAA0B;AAC1B,wCAAsB;AACtB,wCAAsB;AACtB,yCAAuB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kFAAkF;AAClF,+EAA+E;AAC/E,8EAA8E;AAC9E,+EAA+E;AAC/E,4EAA4E;AAC5E,iDAAiD;AAEjD,oDAAkC;AAClC,mDAAiC;AACjC,2CAAyB;AACzB,+CAA6B;AAC7B,0CAAwB;AACxB,yCAAuB;AACvB,oDAAkC;AAClC,8CAA4B;AAC5B,4DAA0C;AAC1C,4DAA0C;AAC1C,2CAAyB;AACzB,qDAAmC;AACnC,2CAAyB;AACzB,sDAAoC;AACpC,6EAA6E;AAC7E,+EAA+E;AAC/E,+BAA+B;AAC/B,wDAAsC;AACtC,gDAA8B;AAC9B,oDAAkC;AAClC,gDAA8B;AAC9B,qDAAmC;AACnC,oDAAkC;AAClC,8CAA4B;AAC5B,2CAAyB;AACzB,wDAAsC;AACtC,qDAAmC;AACnC,kDAAgC;AAChC,sDAAoC;AACpC,iDAA+B;AAC/B,4CAA0B;AAC1B,gDAA8B;AAC9B,wCAAsB;AACtB,wCAAsB;AACtB,yCAAuB"}
|
|
@@ -76,8 +76,13 @@ export type LatencyRetention = {
|
|
|
76
76
|
readonly kind: 'ring-buffer';
|
|
77
77
|
readonly maxSamplesPerMethod: number;
|
|
78
78
|
};
|
|
79
|
-
/**
|
|
80
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Per-method state: retained samples (bounded in ring-buffer mode) plus lifetime
|
|
81
|
+
* totals. The mutable tally behind {@link MethodLatency}, which is the derived
|
|
82
|
+
* report row. Held by the `protected` {@link LatencyCollector.durations}, so a
|
|
83
|
+
* subclass recording its own samples has to name it.
|
|
84
|
+
*/
|
|
85
|
+
export interface MethodLatencyTally {
|
|
81
86
|
/** Retained durations for percentile estimation; capped in ring-buffer mode. Order is irrelevant (report sorts). */
|
|
82
87
|
readonly samples: number[];
|
|
83
88
|
/** Next slot to overwrite once the ring buffer is full (ring-buffer mode only). */
|
|
@@ -100,7 +105,7 @@ interface MethodAccumulator {
|
|
|
100
105
|
export declare class LatencyCollector {
|
|
101
106
|
protected readonly clock: Clock;
|
|
102
107
|
protected readonly retention: LatencyRetention;
|
|
103
|
-
protected readonly durations: Map<string,
|
|
108
|
+
protected readonly durations: Map<string, MethodLatencyTally>;
|
|
104
109
|
protected window: Stopwatch;
|
|
105
110
|
constructor(clock?: Clock, retention?: LatencyRetention);
|
|
106
111
|
/** Record a pre-measured call duration (ms) for `method`. */
|
|
@@ -122,5 +127,4 @@ export declare class LatencyCollector {
|
|
|
122
127
|
* command channel — the latency counterpart to `formatProfileReport`.
|
|
123
128
|
*/
|
|
124
129
|
export declare function formatLatencyReport(report: LatencyReport, label?: string): string;
|
|
125
|
-
export {};
|
|
126
130
|
//# sourceMappingURL=latency-collector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latency-collector.d.ts","sourceRoot":"","sources":["../src/latency-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,SAAS,EAAe,MAAM,YAAY,CAAC;AAErE,oEAAoE;AACpE,MAAM,WAAW,aAAa;IAC3B;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;CAClB;AAED,2FAA2F;AAC3F,MAAM,WAAW,aAAa;IAC3B;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtI
|
|
1
|
+
{"version":3,"file":"latency-collector.d.ts","sourceRoot":"","sources":["../src/latency-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,OAAO,EAAE,KAA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