@hydranium/protocol 1.0.0-next.6 → 1.0.0-next.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -1
- package/lib/client/data-connection.d.ts +76 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +73 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +9 -1
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +14 -0
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +16 -21
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +56 -74
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +67 -101
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +5 -2
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +5 -2
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +8 -2
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +10 -4
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +116 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +155 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/data/data-protocol-methods.d.ts +2 -2
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +6 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +21 -1
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +70 -3
- package/lib/data/events.d.ts.map +1 -1
- package/lib/errors.d.ts +25 -6
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +32 -12
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/messages/index.d.ts +28 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +52 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/primitives.d.ts +141 -0
- package/lib/messages/primitives.d.ts.map +1 -0
- package/lib/messages/primitives.js +138 -0
- package/lib/messages/primitives.js.map +1 -0
- package/lib/model-server.d.ts +2 -2
- package/lib/model-server.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.d.ts +29 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +22 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +7 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +6 -1
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- package/lib/testing/catalogue-audit.d.ts +80 -0
- package/lib/testing/catalogue-audit.d.ts.map +1 -0
- package/lib/testing/catalogue-audit.js +94 -0
- package/lib/testing/catalogue-audit.js.map +1 -0
- package/lib/testing/data-doubles.d.ts +11 -12
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +14 -5
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/index.d.ts +1 -0
- package/lib/testing/index.d.ts.map +1 -1
- package/lib/testing/index.js +4 -1
- package/lib/testing/index.js.map +1 -1
- package/lib/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/package.json +11 -2
- package/src/client/data-connection.ts +114 -0
- package/src/client/data-events.ts +24 -1
- package/src/client/data-port.ts +16 -22
- package/src/client/data-session.ts +86 -124
- package/src/client/index.ts +5 -2
- package/src/client/message-relay.ts +28 -6
- package/src/client/rpc-connection.ts +205 -0
- package/src/data/data-protocol-methods.ts +6 -3
- package/src/data/data-server-protocol.ts +29 -1
- package/src/data/events.ts +74 -3
- package/src/errors.ts +38 -14
- package/src/index.ts +4 -0
- package/src/messages/index.ts +35 -0
- package/src/messages/primitives.ts +215 -0
- package/src/model-server.ts +2 -2
- package/src/rpc/bind-rpc-methods.ts +49 -4
- package/src/rpc/create-rpc-proxy.ts +14 -1
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +33 -17
- package/src/testing/index.ts +4 -1
- package/src/transfer-diagnostic.ts +40 -0
|
@@ -0,0 +1,155 @@
|
|
|
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.RpcConnection = exports.DATA_SERVER_NOT_READY = exports.DATA_SERVER_CONNECT_FAILED = void 0;
|
|
12
|
+
const primitives_1 = require("../messages/primitives");
|
|
13
|
+
const rpc_1 = require("../rpc");
|
|
14
|
+
/**
|
|
15
|
+
* The transport never opened. A complete sentence rather than a fragment: a
|
|
16
|
+
* fragment is nested inside a sentence the framework does not own, so no
|
|
17
|
+
* translator controls the whole and the composition cannot be made to read
|
|
18
|
+
* correctly in every language.
|
|
19
|
+
*/
|
|
20
|
+
exports.DATA_SERVER_CONNECT_FAILED = (0, primitives_1.defineMessage)('hydranium/protocol/data-server-connect-failed', 'Could not connect to the data server: {detail}');
|
|
21
|
+
exports.DATA_SERVER_NOT_READY = (0, primitives_1.defineMessage)('hydranium/protocol/data-server-not-ready', 'The data server did not become ready: {detail}');
|
|
22
|
+
/**
|
|
23
|
+
* One JSON-RPC connection to a head, with the three jobs every host adapter
|
|
24
|
+
* would otherwise re-derive above {@link DataPort}:
|
|
25
|
+
*
|
|
26
|
+
* 1. **Build the typed proxy** over the port's connection, with the caller's
|
|
27
|
+
* wire prefix and client-method allowlist.
|
|
28
|
+
* 2. **Own the readiness gate** — `waitForReady` once per connection, shared
|
|
29
|
+
* across concurrent callers. A client can connect before the workspace walk
|
|
30
|
+
* finishes, and an early request is then answered correctly from an empty
|
|
31
|
+
* registry, which reads as a broken project tier rather than as a race.
|
|
32
|
+
* 3. **Own the reconnect policy**, by dropping its generation when the port
|
|
33
|
+
* disposes and building a fresh one on the next request.
|
|
34
|
+
*
|
|
35
|
+
* Bounded only by {@link ReadyServer}, so a head serving a slice of the data
|
|
36
|
+
* protocol — diagnostics alone, or one with methods excluded — is still a
|
|
37
|
+
* legal server here. `DataConnection` narrows the bound because its sessions
|
|
38
|
+
* call the document methods; nothing at this layer does.
|
|
39
|
+
*/
|
|
40
|
+
class RpcConnection {
|
|
41
|
+
port;
|
|
42
|
+
client;
|
|
43
|
+
methodNamespace;
|
|
44
|
+
clientMethods;
|
|
45
|
+
lifecycle;
|
|
46
|
+
/** The current generation, or `undefined` before the first request / after a teardown. */
|
|
47
|
+
generation;
|
|
48
|
+
disposed = false;
|
|
49
|
+
portDisposeListener;
|
|
50
|
+
constructor(port, client, options) {
|
|
51
|
+
this.port = port;
|
|
52
|
+
this.client = client;
|
|
53
|
+
this.methodNamespace = options.methodNamespace;
|
|
54
|
+
this.clientMethods = options.clientMethods;
|
|
55
|
+
this.lifecycle = options.lifecycle;
|
|
56
|
+
this.portDisposeListener = this.port.onDispose(() => this.dropGeneration());
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The connected, READY server proxy.
|
|
60
|
+
*
|
|
61
|
+
* Returns the proxy rather than `void` on purpose. A reconnect replaces the
|
|
62
|
+
* proxy, so a caller that cached one from an earlier call would go on
|
|
63
|
+
* addressing a dead connection with no error — handing it back per call
|
|
64
|
+
* makes the stale reference unrepresentable.
|
|
65
|
+
*
|
|
66
|
+
* Concurrent callers share one readiness promise, so `waitForReady` is
|
|
67
|
+
* awaited once per generation and not once per caller.
|
|
68
|
+
*/
|
|
69
|
+
async connected() {
|
|
70
|
+
this.assertLive();
|
|
71
|
+
const generation = this.currentGeneration();
|
|
72
|
+
if (!generation.ready) {
|
|
73
|
+
generation.ready = this.awaitReady(generation);
|
|
74
|
+
}
|
|
75
|
+
await generation.ready;
|
|
76
|
+
return generation.server;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The current generation's proxy WITHOUT awaiting readiness — calls queue
|
|
80
|
+
* against the connection promise.
|
|
81
|
+
*
|
|
82
|
+
* Read per access, never cached: a reconnect replaces the generation, and a
|
|
83
|
+
* held reference would address the dead one. Prefer {@link connected}, which
|
|
84
|
+
* also waits for the server's startup gate.
|
|
85
|
+
*/
|
|
86
|
+
get server() {
|
|
87
|
+
this.assertLive();
|
|
88
|
+
return this.currentGeneration().server;
|
|
89
|
+
}
|
|
90
|
+
/** Tear down the current connection and stop tracking the port. Idempotent. */
|
|
91
|
+
dispose() {
|
|
92
|
+
if (this.disposed) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.disposed = true;
|
|
96
|
+
this.portDisposeListener.dispose();
|
|
97
|
+
this.dropGeneration();
|
|
98
|
+
}
|
|
99
|
+
/** The live generation, building one if there is none. */
|
|
100
|
+
currentGeneration() {
|
|
101
|
+
if (this.generation) {
|
|
102
|
+
return this.generation;
|
|
103
|
+
}
|
|
104
|
+
this.lifecycle.onConnecting?.();
|
|
105
|
+
const connection = this.port.connect();
|
|
106
|
+
// Rejection is reported here rather than left to float: an unhandled
|
|
107
|
+
// rejection on a connection promise is the failure mode that reads as
|
|
108
|
+
// "the model is empty" instead of "the transport never opened".
|
|
109
|
+
connection.catch((error) => this.port.reportError(error, (0, primitives_1.resolve)(exports.DATA_SERVER_CONNECT_FAILED, { detail: (0, primitives_1.describeError)(error) })));
|
|
110
|
+
const server = (0, rpc_1.createRpcProxy)(connection, {
|
|
111
|
+
methodNamespace: this.methodNamespace,
|
|
112
|
+
localTarget: this.client,
|
|
113
|
+
localMethods: this.clientMethods
|
|
114
|
+
});
|
|
115
|
+
this.generation = { connection, server };
|
|
116
|
+
return this.generation;
|
|
117
|
+
}
|
|
118
|
+
/** Await the connection and the server's startup gate for one generation. */
|
|
119
|
+
async awaitReady(generation) {
|
|
120
|
+
try {
|
|
121
|
+
await generation.connection;
|
|
122
|
+
await generation.server.waitForReady();
|
|
123
|
+
this.lifecycle.onReady?.();
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
this.lifecycle.onFailed?.(error);
|
|
127
|
+
// Drop the generation so the next request retries rather than
|
|
128
|
+
// re-awaiting a settled rejection forever.
|
|
129
|
+
if (this.generation === generation) {
|
|
130
|
+
this.generation = undefined;
|
|
131
|
+
}
|
|
132
|
+
this.port.reportError(error, (0, primitives_1.resolve)(exports.DATA_SERVER_NOT_READY, { detail: (0, primitives_1.describeError)(error) }));
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Discard the current generation, disposing its connection if it opened.
|
|
138
|
+
* The next {@link connected} builds a fresh one.
|
|
139
|
+
*/
|
|
140
|
+
dropGeneration() {
|
|
141
|
+
const generation = this.generation;
|
|
142
|
+
this.generation = undefined;
|
|
143
|
+
if (!generation) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
generation.connection.then(connection => connection.dispose()).catch(() => undefined);
|
|
147
|
+
}
|
|
148
|
+
assertLive() {
|
|
149
|
+
if (this.disposed) {
|
|
150
|
+
throw new Error(`${this.constructor.name} is disposed`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.RpcConnection = RpcConnection;
|
|
155
|
+
//# sourceMappingURL=rpc-connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc-connection.js","sourceRoot":"","sources":["../../src/client/rpc-connection.ts"],"names":[],"mappings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COL_METHODS: readonly ["findReferenceCandidates", "resolveReference", "findNextName"];
|
|
27
27
|
/** Notification-method names on {@link DocumentClientProtocol}. */
|
|
28
|
-
export declare const DOCUMENT_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved"];
|
|
28
|
+
export declare const DOCUMENT_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onDocumentDeleted", "onDocumentsBuilt"];
|
|
29
29
|
/** Notification-method names on {@link ProjectClientProtocol}. */
|
|
30
30
|
export declare const PROJECT_CLIENT_PROTOCOL_METHODS: readonly ["onProjectsChanged"];
|
|
31
31
|
/**
|
|
@@ -35,5 +35,5 @@ export declare const PROJECT_CLIENT_PROTOCOL_METHODS: readonly ["onProjectsChang
|
|
|
35
35
|
* data head's connection routes `<methodNamespace>onDocumentUpdated` etc. to
|
|
36
36
|
* the bound client target.
|
|
37
37
|
*/
|
|
38
|
-
export declare const DATA_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onProjectsChanged"];
|
|
38
|
+
export declare const DATA_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onDocumentDeleted", "onDocumentsBuilt", "onProjectsChanged"];
|
|
39
39
|
//# sourceMappingURL=data-protocol-methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-protocol-methods.d.ts","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,oLAS6C,CAAC;AAE3F,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,uNAG6C,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,0EAI6C,CAAC;AAE5F,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,
|
|
1
|
+
{"version":3,"file":"data-protocol-methods.d.ts","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,oLAS6C,CAAC;AAE3F,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,uNAG6C,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,0EAI6C,CAAC;AAE5F,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,4FAK6C,CAAC;AAE3F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,gCAA+F,CAAC;AAE5I;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,iHAG6C,CAAC"}
|
|
@@ -44,7 +44,12 @@ exports.REFERENCE_SERVER_PROTOCOL_METHODS = [
|
|
|
44
44
|
'findNextName'
|
|
45
45
|
];
|
|
46
46
|
/** Notification-method names on {@link DocumentClientProtocol}. */
|
|
47
|
-
exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = [
|
|
47
|
+
exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = [
|
|
48
|
+
'onDocumentUpdated',
|
|
49
|
+
'onDocumentSaved',
|
|
50
|
+
'onDocumentDeleted',
|
|
51
|
+
'onDocumentsBuilt'
|
|
52
|
+
];
|
|
48
53
|
/** Notification-method names on {@link ProjectClientProtocol}. */
|
|
49
54
|
exports.PROJECT_CLIENT_PROTOCOL_METHODS = ['onProjectsChanged'];
|
|
50
55
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-protocol-methods.js","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAalF,8DAA8D;AACjD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;CACyE,CAAC;AAE3F,6DAA6D;AAChD,QAAA,+BAA+B,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAEhF,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CAC0E,CAAC;AAE5F,mEAAmE;AACtD,QAAA,gCAAgC,GAAG,
|
|
1
|
+
{"version":3,"file":"data-protocol-methods.js","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAalF,8DAA8D;AACjD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;CACyE,CAAC;AAE3F,6DAA6D;AAChD,QAAA,+BAA+B,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAEhF,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CAC0E,CAAC;AAE5F,mEAAmE;AACtD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,iBAAiB;IACjB,mBAAmB;IACnB,kBAAkB;CACqE,CAAC;AAE3F,kEAAkE;AACrD,QAAA,+BAA+B,GAAG,CAAC,mBAAmB,CAAwE,CAAC;AAE5I;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC"}
|
|
@@ -12,7 +12,7 @@ import type { Project } from '../project';
|
|
|
12
12
|
import type { TransferDocument } from '../transfer-document';
|
|
13
13
|
import type { CloseModelArgs, FindNextNameArgs, OpenModelArgs, ReferenceContext, ReferenceRequest } from '../model-server';
|
|
14
14
|
import type { ReferenceCandidate, ReferenceTarget } from '../model-service/reference-candidate';
|
|
15
|
-
import type { ProjectsChangedEvent, TransferDocumentSavedEvent, TransferDocumentUpdatedEvent } from './events';
|
|
15
|
+
import type { ProjectsChangedEvent, TransferDocumentDeletedEvent, TransferDocumentSavedEvent, TransferDocumentsBuiltEvent, TransferDocumentUpdatedEvent } from './events';
|
|
16
16
|
import type { GetModelDocumentArgs, GetProjectForUriArgs, TransferSaveDocumentArgs, WatchModelDocumentArgs, TransferUpdateDocumentArgs } from './requests';
|
|
17
17
|
/**
|
|
18
18
|
* Document-scoped slice of the data-server wire contract: the per-document
|
|
@@ -235,6 +235,26 @@ export interface DocumentClientProtocol<TTransfer extends TransferElement, TDiag
|
|
|
235
235
|
* codepath, not a subscription codepath).
|
|
236
236
|
*/
|
|
237
237
|
onDocumentSaved(event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>): void;
|
|
238
|
+
/**
|
|
239
|
+
* Delivered when a document's backing file was removed. Separate from
|
|
240
|
+
* {@link onDocumentUpdated} for the same reason as {@link onDocumentSaved},
|
|
241
|
+
* and more strongly: there is no built state to deliver, and the build-phase
|
|
242
|
+
* path cannot report a deletion at all.
|
|
243
|
+
*
|
|
244
|
+
* Ungated, because on a browser host — where the workspace lives behind the
|
|
245
|
+
* head — no other source can observe a file disappearing. Recipients that
|
|
246
|
+
* only care about their own documents filter by URI.
|
|
247
|
+
*/
|
|
248
|
+
onDocumentDeleted(event: TransferDocumentDeletedEvent): void;
|
|
249
|
+
/**
|
|
250
|
+
* Delivered once per build, naming the documents that reached the
|
|
251
|
+
* subscription phase and that
|
|
252
|
+
* nobody on this connection watches — chiefly the ones rebuilt as a cascade
|
|
253
|
+
* from a dependency's change, which no filesystem watcher can see because
|
|
254
|
+
* their own files did not change. The complement of
|
|
255
|
+
* {@link onDocumentUpdated}; carries URIs and no documents.
|
|
256
|
+
*/
|
|
257
|
+
onDocumentsBuilt(event: TransferDocumentsBuiltEvent): void;
|
|
238
258
|
}
|
|
239
259
|
/**
|
|
240
260
|
* Project-scoped slice of the client surface — the project-registry change
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-server-protocol.d.ts","sourceRoot":"","sources":["../../src/data/data-server-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3H,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"data-server-protocol.d.ts","sourceRoot":"","sources":["../../src/data/data-server-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAi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S,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC;IAErF;;;;;;;;;OASG;IACH,eAAe,CAAC,KAAK,EAAE,0BAA0B,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC;IAEjF;;;;;;;;;OASG;IACH,iBAAiB,CAAC,KAAK,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAE7D;;;;;;;OAOG;IACH,gBAAgB,CAAC,KAAK,EAAE,2BAA2B,GAAG,IAAI,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CAAC,QAAQ,SAAS,OAAO,GAAG,OAAO;IACtE;;;;;;;;OAQG;IACH,iBAAiB,CAAC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;CACjE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB,CAChC,SAAS,SAAS,eAAe,EACjC,WAAW,SAAS,kBAAkB,GAAG,kBAAkB,EAC3D,QAAQ,SAAS,OAAO,GAAG,OAAO,CAElC,SAAQ,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC;CAAG"}
|
package/lib/data/events.d.ts
CHANGED
|
@@ -28,10 +28,14 @@ import type { TransferDocument } from '../transfer-document';
|
|
|
28
28
|
* from both `onDocumentUpdated` and `onDocumentSaved`. The framework's own
|
|
29
29
|
* `dispatchPhaseEvent` does NOT emit `'saved'` — saves take the dedicated
|
|
30
30
|
* `DataClientProtocol.onDocumentSaved` channel.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* Deletion is deliberately NOT a member. An update event carries a built
|
|
33
|
+
* document, which a deleted one has none of, and the phase-driven path that
|
|
34
|
+
* produces these events never runs for a deleted URI — the builder drops the
|
|
35
|
+
* document before deriving the rebuild set. It travels as
|
|
36
|
+
* {@link TransferDocumentDeletedEvent} on its own channel instead.
|
|
33
37
|
*/
|
|
34
|
-
export type TransferDocumentUpdateReason = 'changed' | 'rebuilt' | 'saved'
|
|
38
|
+
export type TransferDocumentUpdateReason = 'changed' | 'rebuilt' | 'saved';
|
|
35
39
|
/**
|
|
36
40
|
* Delivered on the data-server when a document's content (or existence)
|
|
37
41
|
* changed. Subscribers receive this via `DocumentServerProtocol.watchModelDocument`.
|
|
@@ -72,6 +76,69 @@ export interface TransferDocumentSavedEvent<TTransfer extends TransferElement, T
|
|
|
72
76
|
}
|
|
73
77
|
/** Callback shape for `DataClientProtocol.onDocumentSaved`. */
|
|
74
78
|
export type TransferDocumentSavedListener<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> = (event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>) => void;
|
|
79
|
+
/**
|
|
80
|
+
* Delivered on the data-server when a document's backing file was removed.
|
|
81
|
+
* Carries no document, and cannot: the state a
|
|
82
|
+
* {@link TransferDocumentUpdatedEvent} would have to carry no longer exists by
|
|
83
|
+
* the time anyone can be told. That is also why deletion is not a `reason` on
|
|
84
|
+
* the update stream — `DocumentBuilder.update` drops the document before
|
|
85
|
+
* deriving the rebuild set, so the phase-driven path that produces update
|
|
86
|
+
* events never runs for it.
|
|
87
|
+
*
|
|
88
|
+
* **Delivered for EVERY document, not only watched ones**, unlike
|
|
89
|
+
* `onDocumentUpdated` and `onDocumentSaved`. The test that decides which
|
|
90
|
+
* channels are gated is whether any OTHER source can observe the fact on the
|
|
91
|
+
* least capable host: a browser-hosted client's workspace lives behind the
|
|
92
|
+
* head, so nothing there can see a file disappear, and gating the notification
|
|
93
|
+
* would leave it blind. (A Theia frontend's filesystem watcher would cover it,
|
|
94
|
+
* which is why this is a host argument and not a structure-versus-content one.)
|
|
95
|
+
* A watcher is told about its own document's deletion here too, the update
|
|
96
|
+
* channel being silent for deletions by construction. Filter on {@link uri} if
|
|
97
|
+
* the receiver only cares about documents it opened.
|
|
98
|
+
*
|
|
99
|
+
* A watch survives the deletion, so a file that comes back resumes delivering
|
|
100
|
+
* `onDocumentUpdated` to the same subscribers with no re-subscription. A
|
|
101
|
+
* client that responds by closing its editor releases the watch through
|
|
102
|
+
* `closeModelDocument` as usual.
|
|
103
|
+
*/
|
|
104
|
+
export interface TransferDocumentDeletedEvent {
|
|
105
|
+
/** Canonical URI of the removed document, keyed as the subscription is. */
|
|
106
|
+
readonly uri: string;
|
|
107
|
+
}
|
|
108
|
+
/** Callback shape for `DataClientProtocol.onDocumentDeleted`. */
|
|
109
|
+
export type TransferDocumentDeletedListener = (event: TransferDocumentDeletedEvent) => void;
|
|
110
|
+
/**
|
|
111
|
+
* Delivered on the data-server once per build, naming the documents that reached
|
|
112
|
+
* the configured subscription phase (`DataServerOptions.subscriptionPhase`,
|
|
113
|
+
* `Validated` by default) and that NO client on the connection is watching. Not
|
|
114
|
+
* the integrity-settled landmark, which is a different point and a different
|
|
115
|
+
* word in this framework.
|
|
116
|
+
*
|
|
117
|
+
* The complement of {@link TransferDocumentUpdatedEvent}, which is gated per
|
|
118
|
+
* URI: together the two cover every document a build touched. This one exists
|
|
119
|
+
* for the case no source outside the server can observe — a document rebuilt
|
|
120
|
+
* because something it DEPENDS ON changed. Its own file never changed, so a
|
|
121
|
+
* filesystem watcher cannot see it, and it has no subscriber, so the update
|
|
122
|
+
* channel does not report it. A consumer showing data derived from such a
|
|
123
|
+
* document (a tree label, a decorator) would otherwise hold a stale value with
|
|
124
|
+
* nothing to invalidate it.
|
|
125
|
+
*
|
|
126
|
+
* Carries URIs and no documents: a recipient re-reads what it displays, through
|
|
127
|
+
* `getModelDocument` or its own request. That keeps the bandwidth property the
|
|
128
|
+
* per-URI subscription exists for, without gating the message.
|
|
129
|
+
*
|
|
130
|
+
* Not sent when the set is empty, which is the normal case while editing — the
|
|
131
|
+
* document being edited is watched by its own editor and therefore excluded.
|
|
132
|
+
* Workspace initialisation sends nothing either: it does not build to the
|
|
133
|
+
* subscription phase. The largest message a workspace can produce is therefore
|
|
134
|
+
* a whole-workspace rebuild at that phase, which is one message of URIs.
|
|
135
|
+
*/
|
|
136
|
+
export interface TransferDocumentsBuiltEvent {
|
|
137
|
+
/** Canonical URIs, keyed as subscriptions are. Never empty. */
|
|
138
|
+
readonly uris: readonly string[];
|
|
139
|
+
}
|
|
140
|
+
/** Callback shape for `DataClientProtocol.onDocumentsBuilt`. */
|
|
141
|
+
export type TransferDocumentsBuiltListener = (event: TransferDocumentsBuiltEvent) => void;
|
|
75
142
|
/**
|
|
76
143
|
* Why a project-change event fired. `added` — the project was newly
|
|
77
144
|
* registered (descriptor discovered); `updated` — the project's
|
package/lib/data/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/data/events.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/data/events.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,4BAA4B,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B,CAC1C,SAAS,SAAS,eAAe,EAC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B,KAAK,IAAI,CAAC;AAE1F;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAElE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,oBAAoB,CAAC,QAAQ,SAAS,OAAO,GAAG,OAAO;IACrE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACvC;AAED,iEAAiE;AACjE,MAAM,MAAM,uBAAuB,CAAC,QAAQ,SAAS,OAAO,GAAG,OAAO,IAAI,CAAC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC"}
|
package/lib/errors.d.ts
CHANGED
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { ResponseError } from 'vscode-jsonrpc';
|
|
10
|
+
import { type HydraniumMessageData } from './messages/primitives';
|
|
11
|
+
/**
|
|
12
|
+
* The catalogue declaration behind {@link ConflictError}'s sentence.
|
|
13
|
+
*
|
|
14
|
+
* Its English must keep containing {@link CONFLICT_ERROR_MESSAGE_MARKER}: the
|
|
15
|
+
* marker is tier 3 of {@link isConflictError}'s ladder, and it matches on text.
|
|
16
|
+
* That tier only ever works untranslated, which is why it is the last resort
|
|
17
|
+
* behind the numeric code rather than the primary check.
|
|
18
|
+
*/
|
|
19
|
+
export declare const STALE_BASED_UPDATE: import("./messages/primitives").MessageDefinition<"Stale-based update for {uri}: expected v{expectedVersion}, server is at v{actualVersion}">;
|
|
10
20
|
/**
|
|
11
21
|
* Application-specific JSON-RPC error code for {@link ConflictError}.
|
|
12
22
|
* Outside the reserved range (-32768 .. -32000) per JSON-RPC 2.0.
|
|
@@ -21,12 +31,12 @@ export declare const CONFLICT_ERROR_CODE = 1001;
|
|
|
21
31
|
* Structured payload carried in {@link ConflictError.data}, and the only place
|
|
22
32
|
* a post-RPC caller can read the version mismatch from.
|
|
23
33
|
*/
|
|
24
|
-
export interface ConflictErrorData {
|
|
34
|
+
export interface ConflictErrorData extends HydraniumMessageData {
|
|
25
35
|
readonly uri: string;
|
|
26
36
|
/** The based-on version the caller authored against. */
|
|
27
|
-
readonly
|
|
37
|
+
readonly expectedVersion: number;
|
|
28
38
|
/** The server's current text-document version at the time of the throw. */
|
|
29
|
-
readonly
|
|
39
|
+
readonly actualVersion: number;
|
|
30
40
|
}
|
|
31
41
|
/**
|
|
32
42
|
* Thrown by `ModelService.update` / `ModelService.save` when the caller-
|
|
@@ -60,10 +70,19 @@ export interface ConflictErrorData {
|
|
|
60
70
|
* No auto-retry or auto-merge ships by default.
|
|
61
71
|
*/
|
|
62
72
|
export declare class ConflictError extends ResponseError<ConflictErrorData> {
|
|
63
|
-
constructor(uri: string,
|
|
73
|
+
constructor(uri: string, expectedVersion: number, actualVersion: number);
|
|
64
74
|
get uri(): string;
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
/**
|
|
76
|
+
* The based-on version the caller authored against.
|
|
77
|
+
*
|
|
78
|
+
* Must not be renamed to `expected`, nor its sibling to `actual`: a test
|
|
79
|
+
* reporter reads an error carrying both as an assertion failure, and
|
|
80
|
+
* vitest's formatter then ASSIGNS to them, which throws on an accessor and
|
|
81
|
+
* replaces the real failure with a `TypeError`.
|
|
82
|
+
*/
|
|
83
|
+
get expectedVersion(): number;
|
|
84
|
+
/** The server's version at the time of the throw. Not `actual` — see {@link expectedVersion}. */
|
|
85
|
+
get actualVersion(): number;
|
|
67
86
|
}
|
|
68
87
|
/**
|
|
69
88
|
* Type guard for {@link ConflictError}. Detection ladder:
|
package/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAiB,KAAK,oBAAoB,EAAe,MAAM,uBAAuB,CAAC;AAE9F;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,+IAG9B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC5D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,aAAc,SAAQ,aAAa,CAAC,iBAAiB,CAAC;gBACpD,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAgBvE,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED;;;;;;;OAOG;IACH,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,iGAAiG;IACjG,IAAI,aAAa,IAAI,MAAM,CAE1B;CACH;AAOD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAYtE"}
|
package/lib/errors.js
CHANGED
|
@@ -8,9 +8,19 @@
|
|
|
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.ConflictError = exports.CONFLICT_ERROR_CODE = exports.STALE_BASED_UPDATE = void 0;
|
|
12
12
|
exports.isConflictError = isConflictError;
|
|
13
13
|
const vscode_jsonrpc_1 = require("vscode-jsonrpc");
|
|
14
|
+
const primitives_1 = require("./messages/primitives");
|
|
15
|
+
/**
|
|
16
|
+
* The catalogue declaration behind {@link ConflictError}'s sentence.
|
|
17
|
+
*
|
|
18
|
+
* Its English must keep containing {@link CONFLICT_ERROR_MESSAGE_MARKER}: the
|
|
19
|
+
* marker is tier 3 of {@link isConflictError}'s ladder, and it matches on text.
|
|
20
|
+
* That tier only ever works untranslated, which is why it is the last resort
|
|
21
|
+
* behind the numeric code rather than the primary check.
|
|
22
|
+
*/
|
|
23
|
+
exports.STALE_BASED_UPDATE = (0, primitives_1.defineMessage)('hydranium/protocol/stale-based-update', 'Stale-based update for {uri}: expected v{expectedVersion}, server is at v{actualVersion}');
|
|
14
24
|
/**
|
|
15
25
|
* Application-specific JSON-RPC error code for {@link ConflictError}.
|
|
16
26
|
* Outside the reserved range (-32768 .. -32000) per JSON-RPC 2.0.
|
|
@@ -53,28 +63,38 @@ exports.CONFLICT_ERROR_CODE = 1001;
|
|
|
53
63
|
* No auto-retry or auto-merge ships by default.
|
|
54
64
|
*/
|
|
55
65
|
class ConflictError extends vscode_jsonrpc_1.ResponseError {
|
|
56
|
-
constructor(uri,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
66
|
+
constructor(uri, expectedVersion, actualVersion) {
|
|
67
|
+
const params = { uri, expectedVersion, actualVersion };
|
|
68
|
+
// The identity rides alongside the typed payload rather than replacing
|
|
69
|
+
// it: `isConflictError`'s name check is surface an adopter may bind, so
|
|
70
|
+
// adding the identity widens the payload rather than reshaping it.
|
|
71
|
+
super(exports.CONFLICT_ERROR_CODE, exports.STALE_BASED_UPDATE.format(params), { ...params, ...(0, primitives_1.messageData)(exports.STALE_BASED_UPDATE, params) });
|
|
62
72
|
this.name = 'ConflictError';
|
|
63
73
|
// ResponseError's constructor calls `Object.setPrototypeOf(this,
|
|
64
74
|
// ResponseError.prototype)` to keep its own prototype chain intact across
|
|
65
75
|
// transpilation targets; that resets us to ResponseError, hiding the
|
|
66
76
|
// ConflictError-specific getters. Restore the prototype here so
|
|
67
|
-
// `err.uri` / `.
|
|
77
|
+
// `err.uri` / `.expectedVersion` / `.actualVersion` resolve through this
|
|
78
|
+
// class.
|
|
68
79
|
Object.setPrototypeOf(this, ConflictError.prototype);
|
|
69
80
|
}
|
|
70
81
|
get uri() {
|
|
71
82
|
return this.data.uri;
|
|
72
83
|
}
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
/**
|
|
85
|
+
* The based-on version the caller authored against.
|
|
86
|
+
*
|
|
87
|
+
* Must not be renamed to `expected`, nor its sibling to `actual`: a test
|
|
88
|
+
* reporter reads an error carrying both as an assertion failure, and
|
|
89
|
+
* vitest's formatter then ASSIGNS to them, which throws on an accessor and
|
|
90
|
+
* replaces the real failure with a `TypeError`.
|
|
91
|
+
*/
|
|
92
|
+
get expectedVersion() {
|
|
93
|
+
return this.data.expectedVersion;
|
|
75
94
|
}
|
|
76
|
-
|
|
77
|
-
|
|
95
|
+
/** The server's version at the time of the throw. Not `actual` — see {@link expectedVersion}. */
|
|
96
|
+
get actualVersion() {
|
|
97
|
+
return this.data.actualVersion;
|
|
78
98
|
}
|
|
79
99
|
}
|
|
80
100
|
exports.ConflictError = ConflictError;
|
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;;;AAmIlF,0CAYC;AA7ID,mDAA+C;AAC/C,sDAA8F;AAE9F;;;;;;;GAOG;AACU,QAAA,kBAAkB,GAAG,IAAA,0BAAa,EAC5C,uCAAuC,EACvC,0FAA0F,CAC5F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AAC;QAClC,OAAO,IAAI,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAI,KAAyC,CAAC,IAAI,CAAC;IAC7D,IAAI,IAAI,KAAK,2BAAmB,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"}
|
package/lib/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from './errors';
|
|
|
16
16
|
export * from './host-diagnostics';
|
|
17
17
|
export * from './logger';
|
|
18
18
|
export * from './latency-collector';
|
|
19
|
+
export * from './messages/primitives';
|
|
19
20
|
export * from './patch-merge';
|
|
20
21
|
export * from './noop-logger';
|
|
21
22
|
export * from './observable-value';
|
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,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;AAIpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,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,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -38,6 +38,10 @@ __exportStar(require("./errors"), exports);
|
|
|
38
38
|
__exportStar(require("./host-diagnostics"), exports);
|
|
39
39
|
__exportStar(require("./logger"), exports);
|
|
40
40
|
__exportStar(require("./latency-collector"), exports);
|
|
41
|
+
// The primitives only. The `./messages` subpath additionally enumerates this
|
|
42
|
+
// package's own declarations, which the root barrel already re-exports through
|
|
43
|
+
// the modules that raise them.
|
|
44
|
+
__exportStar(require("./messages/primitives"), exports);
|
|
41
45
|
__exportStar(require("./patch-merge"), exports);
|
|
42
46
|
__exportStar(require("./noop-logger"), exports);
|
|
43
47
|
__exportStar(require("./observable-value"), 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,2CAAyB;AACzB,0CAAwB;AACxB,yCAAuB;AACvB,oDAAkC;AAClC,8CAA4B;AAC5B,2CAAyB;AACzB,qDAAmC;AACnC,2CAAyB;AACzB,sDAAoC;AACpC,6EAA6E;AAC7E,+EAA+E;AAC/E,+BAA+B;AAC/B,wDAAsC;AACtC,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 message-externalization mechanism, plus every user-facing message
|
|
11
|
+
* `@hydranium/protocol` itself raises.
|
|
12
|
+
*
|
|
13
|
+
* Declarations stay beside their call sites and are re-exported here, so this is
|
|
14
|
+
* enumeration rather than centralization: a code's package segment has to name
|
|
15
|
+
* the package that raises it, and a shared module would make that segment a lie
|
|
16
|
+
* for every message in it. Adding a message therefore touches the file that
|
|
17
|
+
* raises it and this list, and nothing else.
|
|
18
|
+
*
|
|
19
|
+
* A barrel makes every code and English default public API, so renaming a code
|
|
20
|
+
* is a breaking change. That was already true — an adopter's catalogue keys on
|
|
21
|
+
* these codes either way — but it is now in the type system rather than implicit.
|
|
22
|
+
* The English is a fallback, not a contract; the code is the contract.
|
|
23
|
+
*/
|
|
24
|
+
export * from './primitives';
|
|
25
|
+
export { STALE_BASED_UPDATE } from '../errors';
|
|
26
|
+
export { DATA_SERVER_CONNECT_FAILED, DATA_SERVER_NOT_READY } from '../client/rpc-connection';
|
|
27
|
+
export { RELAY_REPLAY_FAILED, RELAY_TRANSPORT_OPEN_FAILED, RELAY_TRANSPORT_READ_FAILED, RELAY_TRANSPORT_WRITE_FAILED } from '../client/message-relay';
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;GAcG;AAEH,cAAc,cAAc,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EACJ,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,EAC3B,4BAA4B,EAC9B,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
22
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.RELAY_TRANSPORT_WRITE_FAILED = exports.RELAY_TRANSPORT_READ_FAILED = exports.RELAY_TRANSPORT_OPEN_FAILED = exports.RELAY_REPLAY_FAILED = exports.DATA_SERVER_NOT_READY = exports.DATA_SERVER_CONNECT_FAILED = exports.STALE_BASED_UPDATE = void 0;
|
|
26
|
+
/**
|
|
27
|
+
* The message-externalization mechanism, plus every user-facing message
|
|
28
|
+
* `@hydranium/protocol` itself raises.
|
|
29
|
+
*
|
|
30
|
+
* Declarations stay beside their call sites and are re-exported here, so this is
|
|
31
|
+
* enumeration rather than centralization: a code's package segment has to name
|
|
32
|
+
* the package that raises it, and a shared module would make that segment a lie
|
|
33
|
+
* for every message in it. Adding a message therefore touches the file that
|
|
34
|
+
* raises it and this list, and nothing else.
|
|
35
|
+
*
|
|
36
|
+
* A barrel makes every code and English default public API, so renaming a code
|
|
37
|
+
* is a breaking change. That was already true — an adopter's catalogue keys on
|
|
38
|
+
* these codes either way — but it is now in the type system rather than implicit.
|
|
39
|
+
* The English is a fallback, not a contract; the code is the contract.
|
|
40
|
+
*/
|
|
41
|
+
__exportStar(require("./primitives"), exports);
|
|
42
|
+
var errors_1 = require("../errors");
|
|
43
|
+
Object.defineProperty(exports, "STALE_BASED_UPDATE", { enumerable: true, get: function () { return errors_1.STALE_BASED_UPDATE; } });
|
|
44
|
+
var rpc_connection_1 = require("../client/rpc-connection");
|
|
45
|
+
Object.defineProperty(exports, "DATA_SERVER_CONNECT_FAILED", { enumerable: true, get: function () { return rpc_connection_1.DATA_SERVER_CONNECT_FAILED; } });
|
|
46
|
+
Object.defineProperty(exports, "DATA_SERVER_NOT_READY", { enumerable: true, get: function () { return rpc_connection_1.DATA_SERVER_NOT_READY; } });
|
|
47
|
+
var message_relay_1 = require("../client/message-relay");
|
|
48
|
+
Object.defineProperty(exports, "RELAY_REPLAY_FAILED", { enumerable: true, get: function () { return message_relay_1.RELAY_REPLAY_FAILED; } });
|
|
49
|
+
Object.defineProperty(exports, "RELAY_TRANSPORT_OPEN_FAILED", { enumerable: true, get: function () { return message_relay_1.RELAY_TRANSPORT_OPEN_FAILED; } });
|
|
50
|
+
Object.defineProperty(exports, "RELAY_TRANSPORT_READ_FAILED", { enumerable: true, get: function () { return message_relay_1.RELAY_TRANSPORT_READ_FAILED; } });
|
|
51
|
+
Object.defineProperty(exports, "RELAY_TRANSPORT_WRITE_FAILED", { enumerable: true, get: function () { return message_relay_1.RELAY_TRANSPORT_WRITE_FAILED; } });
|
|
52
|
+
//# sourceMappingURL=index.js.map
|