@hydranium/protocol 1.0.0-next.24 → 1.0.0-next.241

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.
Files changed (250) hide show
  1. package/README.md +40 -3
  2. package/lib/abstract-logger.d.ts +5 -0
  3. package/lib/abstract-logger.d.ts.map +1 -1
  4. package/lib/abstract-logger.js +7 -0
  5. package/lib/abstract-logger.js.map +1 -1
  6. package/lib/client/data-connection.d.ts +245 -0
  7. package/lib/client/data-connection.d.ts.map +1 -0
  8. package/lib/client/data-connection.js +425 -0
  9. package/lib/client/data-connection.js.map +1 -0
  10. package/lib/client/data-events.d.ts +13 -1
  11. package/lib/client/data-events.d.ts.map +1 -1
  12. package/lib/client/data-events.js +21 -0
  13. package/lib/client/data-events.js.map +1 -1
  14. package/lib/client/data-port.d.ts +44 -27
  15. package/lib/client/data-port.d.ts.map +1 -1
  16. package/lib/client/data-session.d.ts +473 -81
  17. package/lib/client/data-session.d.ts.map +1 -1
  18. package/lib/client/data-session.js +743 -108
  19. package/lib/client/data-session.js.map +1 -1
  20. package/lib/client/index.d.ts +14 -9
  21. package/lib/client/index.d.ts.map +1 -1
  22. package/lib/client/index.js +14 -9
  23. package/lib/client/index.js.map +1 -1
  24. package/lib/client/message-relay.d.ts +10 -4
  25. package/lib/client/message-relay.d.ts.map +1 -1
  26. package/lib/client/message-relay.js +12 -6
  27. package/lib/client/message-relay.js.map +1 -1
  28. package/lib/client/post-message-transport.d.ts +64 -3
  29. package/lib/client/post-message-transport.d.ts.map +1 -1
  30. package/lib/client/post-message-transport.js +175 -1
  31. package/lib/client/post-message-transport.js.map +1 -1
  32. package/lib/client/rpc-connection.d.ts +157 -0
  33. package/lib/client/rpc-connection.d.ts.map +1 -0
  34. package/lib/client/rpc-connection.js +214 -0
  35. package/lib/client/rpc-connection.js.map +1 -0
  36. package/lib/client-ids.d.ts +45 -0
  37. package/lib/client-ids.d.ts.map +1 -0
  38. package/lib/client-ids.js +48 -0
  39. package/lib/client-ids.js.map +1 -0
  40. package/lib/clock.d.ts +38 -0
  41. package/lib/clock.d.ts.map +1 -1
  42. package/lib/clock.js +36 -1
  43. package/lib/clock.js.map +1 -1
  44. package/lib/console-logger.d.ts +23 -0
  45. package/lib/console-logger.d.ts.map +1 -0
  46. package/lib/console-logger.js +39 -0
  47. package/lib/console-logger.js.map +1 -0
  48. package/lib/data/data-protocol-methods.d.ts +4 -4
  49. package/lib/data/data-protocol-methods.d.ts.map +1 -1
  50. package/lib/data/data-protocol-methods.js +12 -1
  51. package/lib/data/data-protocol-methods.js.map +1 -1
  52. package/lib/data/data-server-protocol.d.ts +132 -41
  53. package/lib/data/data-server-protocol.d.ts.map +1 -1
  54. package/lib/data/events.d.ts +117 -21
  55. package/lib/data/events.d.ts.map +1 -1
  56. package/lib/data/requests.d.ts +69 -11
  57. package/lib/data/requests.d.ts.map +1 -1
  58. package/lib/debouncer.d.ts.map +1 -1
  59. package/lib/debouncer.js.map +1 -1
  60. package/lib/errors.d.ts +187 -29
  61. package/lib/errors.d.ts.map +1 -1
  62. package/lib/errors.js +270 -29
  63. package/lib/errors.js.map +1 -1
  64. package/lib/glsp-request-model-args.d.ts +16 -0
  65. package/lib/glsp-request-model-args.d.ts.map +1 -0
  66. package/lib/glsp-request-model-args.js +19 -0
  67. package/lib/glsp-request-model-args.js.map +1 -0
  68. package/lib/glsp-save-model-actions.d.ts +50 -0
  69. package/lib/glsp-save-model-actions.d.ts.map +1 -0
  70. package/lib/glsp-save-model-actions.js +28 -0
  71. package/lib/glsp-save-model-actions.js.map +1 -0
  72. package/lib/index.d.ts +7 -0
  73. package/lib/index.d.ts.map +1 -1
  74. package/lib/index.js +10 -0
  75. package/lib/index.js.map +1 -1
  76. package/lib/latency-collector.d.ts +8 -4
  77. package/lib/latency-collector.d.ts.map +1 -1
  78. package/lib/latency-collector.js.map +1 -1
  79. package/lib/logger.d.ts +22 -1
  80. package/lib/logger.d.ts.map +1 -1
  81. package/lib/logger.js +31 -3
  82. package/lib/logger.js.map +1 -1
  83. package/lib/messages/index.d.ts +30 -0
  84. package/lib/messages/index.d.ts.map +1 -0
  85. package/lib/messages/index.js +62 -0
  86. package/lib/messages/index.js.map +1 -0
  87. package/lib/messages/primitives.d.ts +188 -0
  88. package/lib/messages/primitives.d.ts.map +1 -0
  89. package/lib/messages/primitives.js +161 -0
  90. package/lib/messages/primitives.js.map +1 -0
  91. package/lib/model-server.d.ts +60 -13
  92. package/lib/model-server.d.ts.map +1 -1
  93. package/lib/model-server.js +4 -2
  94. package/lib/model-server.js.map +1 -1
  95. package/lib/model-service/base-version.d.ts +64 -0
  96. package/lib/model-service/base-version.d.ts.map +1 -0
  97. package/lib/model-service/base-version.js +43 -0
  98. package/lib/model-service/base-version.js.map +1 -0
  99. package/lib/model-service/index.d.ts +1 -1
  100. package/lib/model-service/index.d.ts.map +1 -1
  101. package/lib/model-service/index.js +4 -5
  102. package/lib/model-service/index.js.map +1 -1
  103. package/lib/model-service/reference-candidate.d.ts +5 -3
  104. package/lib/model-service/reference-candidate.d.ts.map +1 -1
  105. package/lib/{model-service/args.js → node/index.d.ts} +2 -3
  106. package/lib/node/index.d.ts.map +1 -0
  107. package/lib/node/index.js +29 -0
  108. package/lib/node/index.js.map +1 -0
  109. package/lib/node/process-memory.d.ts +66 -0
  110. package/lib/node/process-memory.d.ts.map +1 -0
  111. package/lib/node/process-memory.js +291 -0
  112. package/lib/node/process-memory.js.map +1 -0
  113. package/lib/noop-logger.d.ts.map +1 -1
  114. package/lib/noop-logger.js.map +1 -1
  115. package/lib/observable-value.js.map +1 -1
  116. package/lib/patch-merge.d.ts +35 -32
  117. package/lib/patch-merge.d.ts.map +1 -1
  118. package/lib/patch-merge.js +67 -23
  119. package/lib/patch-merge.js.map +1 -1
  120. package/lib/profile-session.d.ts +8 -4
  121. package/lib/profile-session.d.ts.map +1 -1
  122. package/lib/profile-session.js.map +1 -1
  123. package/lib/random-uuid.d.ts +14 -0
  124. package/lib/random-uuid.d.ts.map +1 -0
  125. package/lib/random-uuid.js +24 -0
  126. package/lib/random-uuid.js.map +1 -0
  127. package/lib/reconcile-write.d.ts +65 -0
  128. package/lib/reconcile-write.d.ts.map +1 -0
  129. package/lib/reconcile-write.js +67 -0
  130. package/lib/reconcile-write.js.map +1 -0
  131. package/lib/rpc/bind-rpc-methods.d.ts +33 -3
  132. package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
  133. package/lib/rpc/bind-rpc-methods.js +32 -3
  134. package/lib/rpc/bind-rpc-methods.js.map +1 -1
  135. package/lib/rpc/create-rpc-proxy.d.ts +10 -0
  136. package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
  137. package/lib/rpc/create-rpc-proxy.js +12 -2
  138. package/lib/rpc/create-rpc-proxy.js.map +1 -1
  139. package/lib/rpc/index.d.ts +1 -0
  140. package/lib/rpc/index.d.ts.map +1 -1
  141. package/lib/rpc/index.js +1 -0
  142. package/lib/rpc/index.js.map +1 -1
  143. package/lib/rpc/send-by-method-name.d.ts +76 -0
  144. package/lib/rpc/send-by-method-name.d.ts.map +1 -0
  145. package/lib/rpc/send-by-method-name.js +120 -0
  146. package/lib/rpc/send-by-method-name.js.map +1 -0
  147. package/lib/rpc/wire-prefix.js.map +1 -1
  148. package/lib/testing/catalogue-audit.d.ts +80 -0
  149. package/lib/testing/catalogue-audit.d.ts.map +1 -0
  150. package/lib/testing/catalogue-audit.js +94 -0
  151. package/lib/testing/catalogue-audit.js.map +1 -0
  152. package/lib/testing/data-doubles.d.ts +46 -15
  153. package/lib/testing/data-doubles.d.ts.map +1 -1
  154. package/lib/testing/data-doubles.js +58 -10
  155. package/lib/testing/data-doubles.js.map +1 -1
  156. package/lib/testing/fake-clock.d.ts +9 -1
  157. package/lib/testing/fake-clock.d.ts.map +1 -1
  158. package/lib/testing/fake-clock.js +54 -45
  159. package/lib/testing/fake-clock.js.map +1 -1
  160. package/lib/testing/index.d.ts +1 -0
  161. package/lib/testing/index.d.ts.map +1 -1
  162. package/lib/testing/index.js +5 -2
  163. package/lib/testing/index.js.map +1 -1
  164. package/lib/testing/node/duplex-connection.d.ts.map +1 -1
  165. package/lib/testing/node/duplex-connection.js +3 -2
  166. package/lib/testing/node/duplex-connection.js.map +1 -1
  167. package/lib/testing/node/duplex-stream.js.map +1 -1
  168. package/lib/testing/node/index.d.ts +1 -0
  169. package/lib/testing/node/index.d.ts.map +1 -1
  170. package/lib/testing/node/index.js +2 -2
  171. package/lib/testing/node/index.js.map +1 -1
  172. package/lib/testing/node/message-port-pair.d.ts +25 -0
  173. package/lib/testing/node/message-port-pair.d.ts.map +1 -0
  174. package/lib/testing/node/message-port-pair.js +26 -0
  175. package/lib/testing/node/message-port-pair.js.map +1 -0
  176. package/lib/testing/wait-for.d.ts +3 -2
  177. package/lib/testing/wait-for.d.ts.map +1 -1
  178. package/lib/testing/wait-for.js +40 -10
  179. package/lib/testing/wait-for.js.map +1 -1
  180. package/lib/tracer.d.ts.map +1 -1
  181. package/lib/tracer.js.map +1 -1
  182. package/lib/transfer-diagnostic.d.ts +33 -0
  183. package/lib/transfer-diagnostic.d.ts.map +1 -1
  184. package/lib/transfer-diagnostic.js +23 -0
  185. package/lib/transfer-diagnostic.js.map +1 -1
  186. package/lib/transfer-document.d.ts +70 -32
  187. package/lib/transfer-document.d.ts.map +1 -1
  188. package/lib/transfer-document.js +17 -9
  189. package/lib/transfer-document.js.map +1 -1
  190. package/lib/uri.d.ts.map +1 -1
  191. package/lib/uri.js.map +1 -1
  192. package/lib/util.d.ts +8 -0
  193. package/lib/util.d.ts.map +1 -1
  194. package/lib/util.js +32 -0
  195. package/lib/util.js.map +1 -1
  196. package/package.json +29 -37
  197. package/src/abstract-logger.ts +8 -0
  198. package/src/client/data-connection.ts +520 -0
  199. package/src/client/data-events.ts +33 -1
  200. package/src/client/data-port.ts +46 -28
  201. package/src/client/data-session.ts +951 -126
  202. package/src/client/index.ts +14 -9
  203. package/src/client/message-relay.ts +30 -8
  204. package/src/client/post-message-transport.ts +219 -4
  205. package/src/client/rpc-connection.ts +281 -0
  206. package/src/client-ids.ts +49 -0
  207. package/src/clock.ts +56 -0
  208. package/src/console-logger.ts +39 -0
  209. package/src/data/data-protocol-methods.ts +13 -4
  210. package/src/data/data-server-protocol.ts +157 -41
  211. package/src/data/events.ts +123 -21
  212. package/src/data/requests.ts +74 -11
  213. package/src/errors.ts +322 -36
  214. package/src/glsp-request-model-args.ts +16 -0
  215. package/src/glsp-save-model-actions.ts +59 -0
  216. package/src/index.ts +10 -0
  217. package/src/latency-collector.ts +8 -3
  218. package/src/logger.ts +28 -2
  219. package/src/messages/index.ts +37 -0
  220. package/src/messages/primitives.ts +271 -0
  221. package/src/model-server.ts +63 -18
  222. package/src/model-service/base-version.ts +72 -0
  223. package/src/model-service/index.ts +4 -5
  224. package/src/model-service/reference-candidate.ts +5 -3
  225. package/src/node/index.ts +14 -0
  226. package/src/node/process-memory.ts +299 -0
  227. package/src/patch-merge.ts +97 -42
  228. package/src/profile-session.ts +9 -4
  229. package/src/random-uuid.ts +21 -0
  230. package/src/reconcile-write.ts +124 -0
  231. package/src/rpc/README.md +4 -5
  232. package/src/rpc/bind-rpc-methods.ts +59 -4
  233. package/src/rpc/create-rpc-proxy.ts +20 -2
  234. package/src/rpc/index.ts +1 -0
  235. package/src/rpc/send-by-method-name.ts +140 -0
  236. package/src/testing/catalogue-audit.ts +111 -0
  237. package/src/testing/data-doubles.ts +149 -25
  238. package/src/testing/fake-clock.ts +62 -47
  239. package/src/testing/index.ts +5 -2
  240. package/src/testing/node/duplex-connection.ts +3 -2
  241. package/src/testing/node/index.ts +2 -2
  242. package/src/testing/node/message-port-pair.ts +40 -0
  243. package/src/testing/wait-for.ts +38 -11
  244. package/src/transfer-diagnostic.ts +40 -0
  245. package/src/transfer-document.ts +87 -34
  246. package/src/util.ts +33 -0
  247. package/lib/model-service/args.d.ts +0 -64
  248. package/lib/model-service/args.d.ts.map +0 -1
  249. package/lib/model-service/args.js.map +0 -1
  250. package/src/model-service/args.ts +0 -67
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.defaultIsNotification = defaultIsNotification;
12
12
  exports.createRpcProxy = createRpcProxy;
13
13
  const vscode_jsonrpc_1 = require("vscode-jsonrpc");
14
+ const errors_1 = require("../errors");
14
15
  const bind_rpc_methods_1 = require("./bind-rpc-methods");
15
16
  const wire_prefix_1 = require("./wire-prefix");
16
17
  /**
@@ -61,6 +62,9 @@ function assertSingleArg(wireName, args) {
61
62
  * params, results and errors, and a second layer here would double every
62
63
  * traced line.
63
64
  *
65
+ * A rejection whose code names one of the framework's typed errors is rethrown
66
+ * as that class, through {@link reviveProtocolError}.
67
+ *
64
68
  * Accepts either a ready connection or a `Promise<MessageConnection>` —
65
69
  * proxy methods called before the promise resolves queue until it does,
66
70
  * then dispatch, so adopters can wire the proxy before its underlying
@@ -92,7 +96,12 @@ function createRpcProxy(connection, options = {}) {
92
96
  // connection; see `localTarget` for why no `Disposable` is surfaced.
93
97
  const { localTarget, localMethods } = options;
94
98
  if (localTarget && localMethods && localMethods.length > 0) {
95
- const binding = (0, bind_rpc_methods_1.bindRpcMethods)(connection, localTarget, localMethods, { methodNamespace, isNotification, latency: options.latency });
99
+ const binding = (0, bind_rpc_methods_1.bindRpcMethods)(connection, localTarget, localMethods, {
100
+ methodNamespace,
101
+ isNotification,
102
+ latency: options.latency,
103
+ renderErrorMessage: options.renderErrorMessage
104
+ });
96
105
  resolvedConnection.then(conn => conn.onClose(() => binding.dispose())).catch(() => undefined);
97
106
  }
98
107
  const onDidOpenConnectionEmitter = new vscode_jsonrpc_1.Emitter();
@@ -145,7 +154,8 @@ function createRpcProxy(connection, options = {}) {
145
154
  const capturedError = new Error(`RPC request '${wireName}' failed`);
146
155
  return resolvedConnection
147
156
  .then(connection => connection.sendRequest(wireName, args[0]))
148
- .catch((err) => {
157
+ .catch((rejection) => {
158
+ const err = (0, errors_1.reviveProtocolError)(rejection);
149
159
  if (err instanceof Error && capturedError.stack) {
150
160
  err.stack = `${err.stack ?? err.message}\nCaused by request from:\n${capturedError.stack}`;
151
161
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-rpc-proxy.js","sourceRoot":"","sources":["../../src/rpc/create-rpc-proxy.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AAqJlF,sDAEC;AAwDD,wCA6EC;AA1RD,mDAA6E;AAC7E,yDAAgF;AAChF,+CAA2D;AAiI3D;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,qBAAqB,CAAC,UAAkB;IACrD,OAAO,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CAAC,QAAgB,EAAE,IAAe;IACvD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACZ,eAAe,QAAQ,iBAAiB,IAAI,CAAC,MAAM,2DAA2D;YAC3G,uDAAuD,CAC5D,CAAC;IACL,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,cAAc,CAC3B,UAA0D,EAC1D,UAAyC,EAAE;IAE3C,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,EAAE,CAAC;IACtD,IAAA,wCAA0B,EAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IAC9D,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,qBAAqB,CAAC;IACvE,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAEvD,wEAAwE;IACxE,qEAAqE;IACrE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAC9C,IAAI,WAAW,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,EAAE,WAAW,EAAE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L,CAAC;KACH,CAAgB,CAAC;AACrB,CAAC"}
@@ -8,5 +8,6 @@
8
8
  ********************************************************************************/
9
9
  export * from './bind-rpc-methods';
10
10
  export * from './create-rpc-proxy';
11
+ export * from './send-by-method-name';
11
12
  export * from './wire-prefix';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
package/lib/rpc/index.js CHANGED
@@ -27,5 +27,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
27
27
  // specialised composition.
28
28
  __exportStar(require("./bind-rpc-methods"), exports);
29
29
  __exportStar(require("./create-rpc-proxy"), exports);
30
+ __exportStar(require("./send-by-method-name"), exports);
30
31
  __exportStar(require("./wire-prefix"), exports);
31
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kEAAkE;AAClE,+DAA+D;AAC/D,2BAA2B;AAE3B,qDAAmC;AACnC,qDAAmC;AACnC,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rpc/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,kEAAkE;AAClE,+DAA+D;AAC/D,2BAA2B;AAE3B,qDAAmC;AACnC,qDAAmC;AACnC,wDAAsC;AACtC,gDAA8B"}
@@ -0,0 +1,76 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ /**
10
+ * `connection` with `sendRequest` and `sendNotification` sending a typed message
11
+ * by its method name, so it survives a message type built by another copy of
12
+ * `vscode-jsonrpc`. Wrap a connection wherever it is handed to code that sends
13
+ * another copy's typed messages, GLSP's clients and launchers in particular.
14
+ *
15
+ * **Why an install holds several copies.** Upstream pins exactly:
16
+ * - `@eclipse-glsp/*` 2.x pin `vscode-jsonrpc` `8.2.0`, and npm can nest a copy
17
+ * under each GLSP package, so GLSP's packages can split from each other: a
18
+ * connection one of them creates rejects the typed messages another builds.
19
+ * GLSP's upgrade to 9.x, which could let it share the framework's copy, is
20
+ * open as https://github.com/eclipse-glsp/glsp/issues/1720.
21
+ * - `vscode-languageserver@10.0.1` pins `vscode-languageserver-protocol`
22
+ * `3.18.1`, which pins `vscode-jsonrpc` `9.0.0`.
23
+ * - Theia brings protocol `3.17.5` and with it `vscode-jsonrpc` 8.
24
+ *
25
+ * npm hoists one version per name and nests the rest. `overrides` are read from
26
+ * the root manifest alone and never ship with a package, so the framework cannot
27
+ * collapse an adopter's tree.
28
+ *
29
+ * **What breaks across copies.**
30
+ * - Sending: a connection compares a typed message's parameter structure with
31
+ * its own copy's `ParameterStructures.auto` singleton by identity, so a
32
+ * `RequestType` or `NotificationType` built by another copy throws
33
+ * `Unknown parameter structure auto`. GLSP sends typed messages, in
34
+ * `BaseJsonrpcGLSPClient` and in `JsonrpcClientProxy.process`.
35
+ * `vscode-languageserver`'s connection resends by method name already, which
36
+ * is why LSP sends are unaffected.
37
+ * - Types: `ParameterStructures` has a private member, so TypeScript treats each
38
+ * copy's `MessageConnection` as a different type.
39
+ * - Errors: a connection keeps a thrown `ResponseError`'s code and data only
40
+ * when the error is an instance of its own copy's class, and sends a returned
41
+ * one of another copy as a successful result.
42
+ *
43
+ * **What is copy-safe.** Receiving a typed message from another copy, since the
44
+ * receive path compares only against its own `byName` and `byPosition`. With
45
+ * sends by method name, the LSP, data and GLSP heads run over a tree whose GLSP
46
+ * packages keep `vscode-jsonrpc` `8.2.0`.
47
+ *
48
+ * **How it works.** A `Proxy` whose `sendRequest` and `sendNotification` pass the
49
+ * typed message's `method` string; every other member is the connection's own.
50
+ * The parameters go out as the typed send packs them: the first
51
+ * `numberOfParams`, missing ones `null`, and a request's cancellation token
52
+ * from the position after them. Sent by method name, a single parameter goes by
53
+ * name when it is an object and by position otherwise, which matches `auto` and
54
+ * `byName` with an object, as `vscode-languageserver-protocol`'s types use it. A
55
+ * `byPosition` object or a `byName` non-object throws rather than going out in
56
+ * another shape, the packing read from the type's `toString()` since it cannot
57
+ * be compared by identity. So wrapping narrows what a connection accepts: its
58
+ * own copy sends such a type unwrapped. The result is typed as whichever copy's
59
+ * connection its context expects, or as `connection`'s own type without one.
60
+ * That type is the caller's assertion: it holds for the members both copies
61
+ * share, since the sends go by name and the receives are copy-safe.
62
+ *
63
+ * **Where it stops.** Errors: a rejection it produces is still its own copy's
64
+ * `ResponseError`, so recognise errors with `isResponseError`, and build a
65
+ * connection whose errors must keep their code from the framework's copy.
66
+ *
67
+ * See https://github.com/eclipse-emfcloud/hydranium/issues/279.
68
+ */
69
+ export declare function sendByMethodName<In extends {
70
+ sendRequest<R>(method: string, ...params: unknown[]): Promise<R>;
71
+ sendNotification(method: string, ...params: unknown[]): Promise<void>;
72
+ }, Out extends {
73
+ sendRequest<R>(method: string, ...params: unknown[]): Promise<R>;
74
+ sendNotification(method: string, ...params: unknown[]): Promise<void>;
75
+ } = In>(connection: In): Out;
76
+ //# sourceMappingURL=send-by-method-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-by-method-name.d.ts","sourceRoot":"","sources":["../../src/rpc/send-by-method-name.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAgB,gBAAgB,CAC7B,EAAE,SAAS;IACR,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,EACD,GAAG,SAAS;IACT,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE,GAAG,EAAE,EACP,UAAU,EAAE,EAAE,GAAG,GAAG,CAsBrB"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the MIT License which is available in the project root.
7
+ *
8
+ * SPDX-License-Identifier: MIT
9
+ ********************************************************************************/
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.sendByMethodName = sendByMethodName;
12
+ const vscode_jsonrpc_1 = require("vscode-jsonrpc");
13
+ /**
14
+ * `connection` with `sendRequest` and `sendNotification` sending a typed message
15
+ * by its method name, so it survives a message type built by another copy of
16
+ * `vscode-jsonrpc`. Wrap a connection wherever it is handed to code that sends
17
+ * another copy's typed messages, GLSP's clients and launchers in particular.
18
+ *
19
+ * **Why an install holds several copies.** Upstream pins exactly:
20
+ * - `@eclipse-glsp/*` 2.x pin `vscode-jsonrpc` `8.2.0`, and npm can nest a copy
21
+ * under each GLSP package, so GLSP's packages can split from each other: a
22
+ * connection one of them creates rejects the typed messages another builds.
23
+ * GLSP's upgrade to 9.x, which could let it share the framework's copy, is
24
+ * open as https://github.com/eclipse-glsp/glsp/issues/1720.
25
+ * - `vscode-languageserver@10.0.1` pins `vscode-languageserver-protocol`
26
+ * `3.18.1`, which pins `vscode-jsonrpc` `9.0.0`.
27
+ * - Theia brings protocol `3.17.5` and with it `vscode-jsonrpc` 8.
28
+ *
29
+ * npm hoists one version per name and nests the rest. `overrides` are read from
30
+ * the root manifest alone and never ship with a package, so the framework cannot
31
+ * collapse an adopter's tree.
32
+ *
33
+ * **What breaks across copies.**
34
+ * - Sending: a connection compares a typed message's parameter structure with
35
+ * its own copy's `ParameterStructures.auto` singleton by identity, so a
36
+ * `RequestType` or `NotificationType` built by another copy throws
37
+ * `Unknown parameter structure auto`. GLSP sends typed messages, in
38
+ * `BaseJsonrpcGLSPClient` and in `JsonrpcClientProxy.process`.
39
+ * `vscode-languageserver`'s connection resends by method name already, which
40
+ * is why LSP sends are unaffected.
41
+ * - Types: `ParameterStructures` has a private member, so TypeScript treats each
42
+ * copy's `MessageConnection` as a different type.
43
+ * - Errors: a connection keeps a thrown `ResponseError`'s code and data only
44
+ * when the error is an instance of its own copy's class, and sends a returned
45
+ * one of another copy as a successful result.
46
+ *
47
+ * **What is copy-safe.** Receiving a typed message from another copy, since the
48
+ * receive path compares only against its own `byName` and `byPosition`. With
49
+ * sends by method name, the LSP, data and GLSP heads run over a tree whose GLSP
50
+ * packages keep `vscode-jsonrpc` `8.2.0`.
51
+ *
52
+ * **How it works.** A `Proxy` whose `sendRequest` and `sendNotification` pass the
53
+ * typed message's `method` string; every other member is the connection's own.
54
+ * The parameters go out as the typed send packs them: the first
55
+ * `numberOfParams`, missing ones `null`, and a request's cancellation token
56
+ * from the position after them. Sent by method name, a single parameter goes by
57
+ * name when it is an object and by position otherwise, which matches `auto` and
58
+ * `byName` with an object, as `vscode-languageserver-protocol`'s types use it. A
59
+ * `byPosition` object or a `byName` non-object throws rather than going out in
60
+ * another shape, the packing read from the type's `toString()` since it cannot
61
+ * be compared by identity. So wrapping narrows what a connection accepts: its
62
+ * own copy sends such a type unwrapped. The result is typed as whichever copy's
63
+ * connection its context expects, or as `connection`'s own type without one.
64
+ * That type is the caller's assertion: it holds for the members both copies
65
+ * share, since the sends go by name and the receives are copy-safe.
66
+ *
67
+ * **Where it stops.** Errors: a rejection it produces is still its own copy's
68
+ * `ResponseError`, so recognise errors with `isResponseError`, and build a
69
+ * connection whose errors must keep their code from the framework's copy.
70
+ *
71
+ * See https://github.com/eclipse-emfcloud/hydranium/issues/279.
72
+ */
73
+ function sendByMethodName(connection) {
74
+ const sendRequest = (type, ...params) => typeof type === 'string'
75
+ ? connection.sendRequest(type, ...params)
76
+ : connection.sendRequest(type.method, ...argsOf(type, params, true));
77
+ const sendNotification = (type, ...params) => typeof type === 'string'
78
+ ? connection.sendNotification(type, ...params)
79
+ : connection.sendNotification(type.method, ...argsOf(type, params, false));
80
+ const wrapped = new Proxy(connection, {
81
+ get(target, property, receiver) {
82
+ if (property === 'sendRequest') {
83
+ return sendRequest;
84
+ }
85
+ if (property === 'sendNotification') {
86
+ return sendNotification;
87
+ }
88
+ return Reflect.get(target, property, receiver);
89
+ }
90
+ });
91
+ // Typed as the connection its context expects, which the doc above justifies.
92
+ return wrapped;
93
+ }
94
+ /** Whether `vscode-jsonrpc` sends `param` by name under `auto`. */
95
+ function isNamedParam(param) {
96
+ return param !== undefined && param !== null && !Array.isArray(param) && typeof param === 'object';
97
+ }
98
+ /**
99
+ * The arguments that send `type` by method name with the typed send's params:
100
+ * the first `numberOfParams` of `params`, missing ones `null`, then a request's
101
+ * cancellation token, which the typed send takes from that position. A request
102
+ * always ends in a token, `CancellationToken.None` when it has none, since a
103
+ * send by method name takes a token-shaped last argument for its token. Throws
104
+ * for the one-parameter packing a send by method name cannot express.
105
+ */
106
+ function argsOf(type, params, isRequest) {
107
+ const args = Array.from({ length: type.numberOfParams }, (_, i) => (i < params.length ? params[i] : null));
108
+ if (type.numberOfParams === 1) {
109
+ const packing = String(type.parameterStructures);
110
+ if ((packing === 'byPosition' && isNamedParam(args[0])) || (packing === 'byName' && !isNamedParam(args[0]))) {
111
+ throw new Error(`sendByMethodName cannot send '${type.method}' ${packing}: by method name, a single object goes by name and anything else by position.`);
112
+ }
113
+ }
114
+ if (!isRequest) {
115
+ return args;
116
+ }
117
+ const token = params[type.numberOfParams];
118
+ return [...args, vscode_jsonrpc_1.CancellationToken.is(token) ? token : vscode_jsonrpc_1.CancellationToken.None];
119
+ }
120
+ //# sourceMappingURL=send-by-method-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-by-method-name.js","sourceRoot":"","sources":["../../src/rpc/send-by-method-name.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,mDAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,0BASE,UAAc;IACb,MAAM,WAAW,GAAG,CAAC,IAA2B,EAAE,GAAG,MAAiB,EAAE,EAAE,CACvE,OAAO,IAAI,KAAK,QAAQ;QACrB,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC;QACzC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAC3E,MAAM,gBAAgB,GAAG,CAAC,IAA2B,EAAE,GAAG,MAAiB,EAAE,EAAE,CAC5E,OAAO,IAAI,KAAK,QAAQ;QACrB,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC;QAC9C,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,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AAO,KAAK,QAAQ,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3G,MAAM,IAAI,KAAK,CACZ,iCAAiC,IAAI,CAAC,MAAM,KAAK,OAAO,+EAA+E,CACzI,CAAC;QACL,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,SAAS,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,IAAI,EAAE,kCAAiB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,kCAAiB,CAAC,IAAI,CAAC,CAAC;AAClF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"wire-prefix.js","sourceRoot":"","sources":["../../src/rpc/wire-prefix.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;AA6BlF,gEAWC;AAtCD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,0BAA0B,CAAC,eAAuB,EAAE,MAAc;IAC/E,IAAI,eAAe,KAAK,EAAE,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3D,OAAO;IACV,CAAC;IACD,MAAM,IAAI,SAAS,CAChB,GAAG,MAAM,sBAAsB,eAAe,qCAAqC;QAChF,qFAAqF;QACrF,yDAAyD,eAAe,cAAc;QACtF,6CAA6C,eAAe,gBAAgB;QAC5E,gBAAgB,eAAe,2CAA2C,CAC/E,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"wire-prefix.js","sourceRoot":"","sources":["../../src/rpc/wire-prefix.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oCAA2C,eAAuB,EAAE,MAAc;IAC/E,IAAI,eAAe,KAAK,EAAE,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3D,OAAO;IACV,CAAC;IACD,MAAM,IAAI,SAAS,CAChB,GAAG,MAAM,sBAAsB,eAAe,qCAAqC;QAChF,qFAAqF;QACrF,yDAAyD,eAAe,cAAc;QACtF,6CAA6C,eAAe,gBAAgB;QAC5E,gBAAgB,eAAe,2CAA2C,CAC/E,CAAC;AACL,CAAC"}
@@ -0,0 +1,80 @@
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
+ * Audit a translation catalogue against the codes that actually exist.
11
+ *
12
+ * **The one failure mode a catalogue has, and the only one nothing else
13
+ * catches.** A key naming no declared code falls back to the English — which is
14
+ * byte-identical to a deliberate omission, so a typo is invisible at runtime and
15
+ * indistinguishable from the partial-catalogue behaviour every adopter relies
16
+ * on. Nothing on the render path can tell them apart, `theia nls-extract`
17
+ * reports what the SOURCE declares rather than whether a catalogue matches it,
18
+ * and the framework's own gates see only the framework's own files.
19
+ *
20
+ * Shipped as test support rather than as a runtime check on purpose: an
21
+ * orphaned key is an authoring mistake, and failing a server boot over one would
22
+ * take a running product down for a cosmetic defect.
23
+ */
24
+ /**
25
+ * Flatten a nested catalogue into the `/`-joined keys a message code is spelled
26
+ * with, dropping `_`-prefixed keys as notes to a human reader.
27
+ *
28
+ * Nesting is a HOST convention, not the framework's: Theia flattens a nested
29
+ * catalogue by joining keys with `/`, which is the separator a code already
30
+ * uses, so an adopter on that host writes the file nested and one handed
31
+ * straight to a `DefaultMessageRenderer` writes it flat. Both end up here.
32
+ *
33
+ * `_`-prefixed keys are dropped by PREFIX rather than by matching one literal
34
+ * name, so a second note added to a file cannot silently become a catalogue
35
+ * entry. A code is three `/`-separated segments, so no real entry can begin
36
+ * with `_`.
37
+ */
38
+ export declare function flattenCatalogue(catalogue: Record<string, unknown>, prefix?: string): Record<string, string>;
39
+ /** Options for {@link findUndeclaredCodes}. */
40
+ export interface CatalogueAuditOptions {
41
+ /**
42
+ * Key prefixes to skip, for entries whose codes are NOT declared through a
43
+ * `defineMessage` barrel.
44
+ *
45
+ * The real case is a host's own mechanism: Theia's `nls.localize` takes its
46
+ * key as an inline literal at the call site, so those keys exist only in
47
+ * source text and no barrel can enumerate them. Keep this as narrow as the
48
+ * host layer actually is — exempting a namespace is exempting every typo in
49
+ * it, which is what this function exists to find.
50
+ */
51
+ readonly exemptPrefixes?: readonly string[];
52
+ }
53
+ /**
54
+ * Every catalogue key that names no code any of `barrels` declares.
55
+ *
56
+ * Barrels are taken as opaque objects and read with {@link collectMessages},
57
+ * which is what lets a caller pass a `import * as messages` namespace directly:
58
+ * a barrel's value type is a union of its declarations AND its functions, and
59
+ * filtering that union will not narrow to a `MessageDefinition`.
60
+ *
61
+ * Returns the offending keys rather than a boolean, so a failing assertion names
62
+ * WHICH key is wrong — a count says only that something is.
63
+ */
64
+ export declare function findUndeclaredCodes(catalogueKeys: readonly string[], barrels: readonly object[], options?: CatalogueAuditOptions): string[];
65
+ /**
66
+ * Keys present in more than one catalogue — the shape a split catalogue rots
67
+ * into.
68
+ *
69
+ * Exactly one side renders a given message, so two catalogues holding one code
70
+ * are two authorities over one sentence and they diverge on the first reword.
71
+ * Nothing at runtime notices: both sides render, and whichever ran last wins on
72
+ * its own surface.
73
+ *
74
+ * Takes the key sets rather than a boolean answer for the same reason as
75
+ * {@link findUndeclaredCodes}, and reports NOTHING when a set is empty — an
76
+ * empty catalogue shares no key with anything, so a caller must assert
77
+ * non-emptiness separately or a failed read passes this vacuously.
78
+ */
79
+ export declare function findSharedCodes(first: readonly string[], second: readonly string[]): string[];
80
+ //# sourceMappingURL=catalogue-audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue-audit.d.ts","sourceRoot":"","sources":["../../src/testing/catalogue-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,SAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcxG;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAChC,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,GAAE,qBAA0B,GACnC,MAAM,EAAE,CAIV;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAG7F"}
@@ -0,0 +1,94 @@
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.flattenCatalogue = flattenCatalogue;
12
+ exports.findUndeclaredCodes = findUndeclaredCodes;
13
+ exports.findSharedCodes = findSharedCodes;
14
+ const primitives_1 = require("../messages/primitives");
15
+ /**
16
+ * Audit a translation catalogue against the codes that actually exist.
17
+ *
18
+ * **The one failure mode a catalogue has, and the only one nothing else
19
+ * catches.** A key naming no declared code falls back to the English — which is
20
+ * byte-identical to a deliberate omission, so a typo is invisible at runtime and
21
+ * indistinguishable from the partial-catalogue behaviour every adopter relies
22
+ * on. Nothing on the render path can tell them apart, `theia nls-extract`
23
+ * reports what the SOURCE declares rather than whether a catalogue matches it,
24
+ * and the framework's own gates see only the framework's own files.
25
+ *
26
+ * Shipped as test support rather than as a runtime check on purpose: an
27
+ * orphaned key is an authoring mistake, and failing a server boot over one would
28
+ * take a running product down for a cosmetic defect.
29
+ */
30
+ /**
31
+ * Flatten a nested catalogue into the `/`-joined keys a message code is spelled
32
+ * with, dropping `_`-prefixed keys as notes to a human reader.
33
+ *
34
+ * Nesting is a HOST convention, not the framework's: Theia flattens a nested
35
+ * catalogue by joining keys with `/`, which is the separator a code already
36
+ * uses, so an adopter on that host writes the file nested and one handed
37
+ * straight to a `DefaultMessageRenderer` writes it flat. Both end up here.
38
+ *
39
+ * `_`-prefixed keys are dropped by PREFIX rather than by matching one literal
40
+ * name, so a second note added to a file cannot silently become a catalogue
41
+ * entry. A code is three `/`-separated segments, so no real entry can begin
42
+ * with `_`.
43
+ */
44
+ function flattenCatalogue(catalogue, prefix = '') {
45
+ const flat = {};
46
+ for (const [key, value] of Object.entries(catalogue)) {
47
+ if (key.startsWith('_')) {
48
+ continue;
49
+ }
50
+ const joined = prefix ? `${prefix}/${key}` : key;
51
+ if (typeof value === 'string') {
52
+ flat[joined] = value;
53
+ }
54
+ else if (typeof value === 'object' && value !== null) {
55
+ Object.assign(flat, flattenCatalogue(value, joined));
56
+ }
57
+ }
58
+ return flat;
59
+ }
60
+ /**
61
+ * Every catalogue key that names no code any of `barrels` declares.
62
+ *
63
+ * Barrels are taken as opaque objects and read with {@link collectMessages},
64
+ * which is what lets a caller pass a `import * as messages` namespace directly:
65
+ * a barrel's value type is a union of its declarations AND its functions, and
66
+ * filtering that union will not narrow to a `MessageDefinition`.
67
+ *
68
+ * Returns the offending keys rather than a boolean, so a failing assertion names
69
+ * WHICH key is wrong — a count says only that something is.
70
+ */
71
+ function findUndeclaredCodes(catalogueKeys, barrels, options = {}) {
72
+ const declared = new Set(barrels.flatMap(barrel => (0, primitives_1.collectMessages)(barrel).map(message => message.code)));
73
+ const exempt = options.exemptPrefixes ?? [];
74
+ return catalogueKeys.filter(key => !exempt.some(prefix => key.startsWith(prefix)) && !declared.has(key));
75
+ }
76
+ /**
77
+ * Keys present in more than one catalogue — the shape a split catalogue rots
78
+ * into.
79
+ *
80
+ * Exactly one side renders a given message, so two catalogues holding one code
81
+ * are two authorities over one sentence and they diverge on the first reword.
82
+ * Nothing at runtime notices: both sides render, and whichever ran last wins on
83
+ * its own surface.
84
+ *
85
+ * Takes the key sets rather than a boolean answer for the same reason as
86
+ * {@link findUndeclaredCodes}, and reports NOTHING when a set is empty — an
87
+ * empty catalogue shares no key with anything, so a caller must assert
88
+ * non-emptiness separately or a failed read passes this vacuously.
89
+ */
90
+ function findSharedCodes(first, second) {
91
+ const other = new Set(second);
92
+ return first.filter(key => other.has(key));
93
+ }
94
+ //# sourceMappingURL=catalogue-audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalogue-audit.js","sourceRoot":"","sources":["../../src/testing/catalogue-audit.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;AAElF,uDAAyD;AAEzD;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;GAaG;AACH,0BAAiC,SAAkC,EAAE,MAAM,GAAG,EAAE;IAC7E,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,SAAS;QACZ,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,KAAgC,EAAE,MAAM,CAAC,CAAC,CAAC;QACnF,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACf,CAAC;AAiBD;;;;;;;;;;GAUG;AACH,6BACG,aAAgC,EAChC,OAA0B,EAC1B,OAAO,GAA0B,EAAE;IAEnC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1G,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;IAC5C,OAAO,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5G,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,yBAAgC,KAAwB,EAAE,MAAyB;IAChF,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -32,7 +32,10 @@
32
32
  import { type MessageConnection } from 'vscode-jsonrpc';
33
33
  import type { DataPort } from '../client/data-port';
34
34
  import type { DataClientProtocol } from '../data/data-server-protocol';
35
- import type { ProjectsChangedEvent, TransferDocumentSavedEvent, TransferDocumentUpdatedEvent } from '../data/events';
35
+ import type { ProjectsChangedEvent, TransferDocumentDeletedEvent, TransferDocumentDirtyChangedEvent, TransferDocumentSavedEvent, TransferDocumentsBuiltEvent, TransferDocumentUpdatedEvent } from '../data/events';
36
+ import type { Logger } from '../logger';
37
+ import type { ResolvedMessage } from '../messages/primitives';
38
+ import type { RpcProxyLifecycle } from '../rpc/create-rpc-proxy';
36
39
  import type { Project } from '../project';
37
40
  import type { TransferDiagnostic } from '../transfer-diagnostic';
38
41
  import type { TransferElement } from '../transfer-element';
@@ -46,15 +49,14 @@ export interface FakeDataPortOptions {
46
49
  *
47
50
  * Throwing (or rejecting) here is the transport-construction failure path,
48
51
  * which the consumer surfaces through {@link FakeDataPort.reported}.
52
+ *
53
+ * The double disposes none of these connections and goes on connecting
54
+ * after its dispose, where a real port releases its connection and refuses:
55
+ * the test owns them.
49
56
  */
50
57
  connect(): MessageConnection | Promise<MessageConnection>;
51
- /**
52
- * Stable client identity. Defaults to `'fake-data-port'`, which avoids the
53
- * three sentinels the framework reserves (`'language-client'`, `'unknown'`,
54
- * `'revert-on-close'`); override it when a test needs two distinguishable
55
- * clients on one server.
56
- */
57
- clientId?: string;
58
+ /** The port's {@link DataPort.logger}. */
59
+ logger?: Logger;
58
60
  }
59
61
  /** A {@link DataPort} that records what passed through it. */
60
62
  export interface FakeDataPort extends DataPort {
@@ -69,12 +71,13 @@ export interface FakeDataPort extends DataPort {
69
71
  /**
70
72
  * Every {@link DataPort.reportError} call, in order. Read from outside: this
71
73
  * is the only place a transport failure surfaces, so a test for the failure
72
- * path asserts on the `context` string here rather than on a rejection that
73
- * the consumer may legitimately swallow.
74
+ * path asserts here rather than on a rejection the consumer may legitimately
75
+ * swallow. Prefer asserting on `message.code`, which is stable, over
76
+ * `message.text`, which is the English default and may be reworded.
74
77
  */
75
78
  readonly reported: readonly {
76
79
  readonly error: unknown;
77
- readonly context: string;
80
+ readonly message: ResolvedMessage;
78
81
  }[];
79
82
  /**
80
83
  * Fire {@link DataPort.onDispose} — the host tearing the transport down, a
@@ -93,21 +96,43 @@ export interface FakeDataPort extends DataPort {
93
96
  * connection with no server behind it, a different one per generation.
94
97
  */
95
98
  export declare function makeFakeDataPort(options: FakeDataPortOptions): FakeDataPort;
99
+ type UpperLetter = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
100
+ /**
101
+ * A notification name `TClient` adds to {@link DataClientProtocol}. Limited to
102
+ * `on` plus a letter A–Z, the names the proxy sends as notifications; any other
103
+ * name would be bound as a request. The {@link RpcProxyLifecycle} names are
104
+ * excluded too: the proxy returns its own events for them and sends nothing.
105
+ */
106
+ export type AdditionalClientMethod<TClient> = Exclude<keyof TClient, keyof DataClientProtocol<TransferElement> | keyof RpcProxyLifecycle> & `on${UpperLetter}${string}`;
96
107
  /** A {@link DataClientProtocol} plus the arrays it records into. */
97
- export interface CapturingDataClient<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project> {
108
+ export interface CapturingDataClient<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project, TClient extends DataClientProtocol<TTransfer, TDiagnostic, TProject> = DataClientProtocol<TTransfer, TDiagnostic, TProject>> {
98
109
  /** The client to hand to a `DataSession` or bind as an RPC `localTarget`. */
99
- readonly client: DataClientProtocol<TTransfer, TDiagnostic, TProject>;
110
+ readonly client: TClient;
100
111
  /** Every `onDocumentUpdated` event, in arrival order. */
101
112
  readonly updates: TransferDocumentUpdatedEvent<TTransfer, TDiagnostic>[];
102
113
  /** Every `onDocumentSaved` event, in arrival order. */
103
114
  readonly saves: TransferDocumentSavedEvent<TTransfer, TDiagnostic>[];
115
+ /** Every `onDocumentDirtyChanged` event, in arrival order. */
116
+ readonly dirtyChanges: TransferDocumentDirtyChangedEvent[];
117
+ /** Every `onDocumentDeleted` event, in arrival order. */
118
+ readonly deletions: TransferDocumentDeletedEvent[];
119
+ /** Every `onDocumentsBuilt` event, in arrival order. */
120
+ readonly builds: TransferDocumentsBuiltEvent[];
104
121
  /** Every `onProjectsChanged` event, in arrival order. */
105
122
  readonly projectsChanges: ProjectsChangedEvent<TProject>[];
123
+ /**
124
+ * Every event of each additional client method, keyed by method, in arrival
125
+ * order. A method of `TClient` left out of `additionalClientMethods` has no
126
+ * entry.
127
+ */
128
+ readonly additionalNotifications: {
129
+ readonly [K in AdditionalClientMethod<TClient>]: TClient[K] extends (event: infer TEvent) => void ? TEvent[] : never;
130
+ };
106
131
  }
107
132
  /**
108
133
  * A {@link DataClientProtocol} that records every notification it receives.
109
134
  *
110
- * Recording ALL THREE channels even when a suite reads one is deliberate: an
135
+ * Recording EVERY channel even when a suite reads one is deliberate: an
111
136
  * event delivered on the wrong channel is a real defect of the data head, and a
112
137
  * double that drops the other two turns it into silence on the one being
113
138
  * watched.
@@ -116,6 +141,12 @@ export interface CapturingDataClient<TTransfer extends TransferElement, TDiagnos
116
141
  * the corresponding array stays empty — that is what makes an override usable
117
142
  * as a barrier (rejecting, counting differently, throwing) rather than only as
118
143
  * a spy.
144
+ *
145
+ * `additionalClientMethods` names the notifications `TClient` adds to
146
+ * {@link DataClientProtocol}. Each is recorded and overridable the same way;
147
+ * one left out is not on the client at all, and overriding it throws, since
148
+ * nothing would call the override.
119
149
  */
120
- export declare function makeCapturingDataClient<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project>(overrides?: Partial<DataClientProtocol<TTransfer, TDiagnostic, TProject>>): CapturingDataClient<TTransfer, TDiagnostic, TProject>;
150
+ export declare function makeCapturingDataClient<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project, TClient extends DataClientProtocol<TTransfer, TDiagnostic, TProject> = DataClientProtocol<TTransfer, TDiagnostic, TProject>>(overrides?: Partial<TClient>, additionalClientMethods?: readonly AdditionalClientMethod<TClient>[]): CapturingDataClient<TTransfer, TDiagnostic, TProject, TClient>;
151
+ export {};
121
152
  //# sourceMappingURL=data-doubles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-doubles.d.ts","sourceRoot":"","sources":["../../src/testing/data-doubles.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAW,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AACrH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,0CAA0C;AAC1C,MAAM,WAAW,mBAAmB;IACjC;;;;;;;;OAQG;IACH,OAAO,IAAI,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,8DAA8D;AAC9D,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC3C;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACnD;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpF;;;;OAIG;I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