@hydranium/glsp-server 1.0.0-next.31 → 1.0.0-next.313

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 (217) hide show
  1. package/README.md +80 -88
  2. package/lib/browser/start-glsp-server-in-worker.d.ts +43 -42
  3. package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -1
  4. package/lib/browser/start-glsp-server-in-worker.js +62 -13
  5. package/lib/browser/start-glsp-server-in-worker.js.map +1 -1
  6. package/lib/command/diagram-edit-dropped-error.d.ts +31 -0
  7. package/lib/command/diagram-edit-dropped-error.d.ts.map +1 -0
  8. package/lib/command/diagram-edit-dropped-error.js +48 -0
  9. package/lib/command/diagram-edit-dropped-error.js.map +1 -0
  10. package/lib/command/hydranium-glsp-command-stack.d.ts +33 -0
  11. package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -0
  12. package/lib/command/hydranium-glsp-command-stack.js +63 -0
  13. package/lib/command/hydranium-glsp-command-stack.js.map +1 -0
  14. package/lib/command/hydranium-glsp-operation-action-handler.d.ts +64 -0
  15. package/lib/command/hydranium-glsp-operation-action-handler.d.ts.map +1 -0
  16. package/lib/command/hydranium-glsp-operation-action-handler.js +142 -0
  17. package/lib/command/hydranium-glsp-operation-action-handler.js.map +1 -0
  18. package/lib/command/hydranium-glsp-operation-command.d.ts +250 -0
  19. package/lib/command/hydranium-glsp-operation-command.d.ts.map +1 -0
  20. package/lib/command/hydranium-glsp-operation-command.js +491 -0
  21. package/lib/command/hydranium-glsp-operation-command.js.map +1 -0
  22. package/lib/command/hydranium-glsp-recording-command.d.ts +26 -87
  23. package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
  24. package/lib/command/hydranium-glsp-recording-command.js +40 -117
  25. package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
  26. package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts +23 -0
  27. package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts.map +1 -0
  28. package/lib/command/hydranium-glsp-undo-redo-action-handler.js +41 -0
  29. package/lib/command/hydranium-glsp-undo-redo-action-handler.js.map +1 -0
  30. package/lib/command/index.d.ts +5 -0
  31. package/lib/command/index.d.ts.map +1 -1
  32. package/lib/command/index.js +5 -0
  33. package/lib/command/index.js.map +1 -1
  34. package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts +1 -1
  35. package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts.map +1 -1
  36. package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js +2 -2
  37. package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js.map +1 -1
  38. package/lib/dispatcher/server-action-dispatcher.d.ts +25 -24
  39. package/lib/dispatcher/server-action-dispatcher.d.ts.map +1 -1
  40. package/lib/dispatcher/server-action-dispatcher.js +38 -26
  41. package/lib/dispatcher/server-action-dispatcher.js.map +1 -1
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.d.ts.map +1 -1
  44. package/lib/index.js +1 -0
  45. package/lib/index.js.map +1 -1
  46. package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +35 -59
  47. package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -1
  48. package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +60 -71
  49. package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -1
  50. package/lib/launcher/drop-notifications-to-gone-client.d.ts +23 -0
  51. package/lib/launcher/drop-notifications-to-gone-client.d.ts.map +1 -0
  52. package/lib/launcher/drop-notifications-to-gone-client.js +43 -0
  53. package/lib/launcher/drop-notifications-to-gone-client.js.map +1 -0
  54. package/lib/launcher/glsp-app-module.d.ts +1 -2
  55. package/lib/launcher/glsp-app-module.d.ts.map +1 -1
  56. package/lib/launcher/glsp-app-module.js.map +1 -1
  57. package/lib/launcher/glsp-connection-logger.d.ts +19 -0
  58. package/lib/launcher/glsp-connection-logger.d.ts.map +1 -0
  59. package/lib/launcher/glsp-connection-logger.js +24 -0
  60. package/lib/launcher/glsp-connection-logger.js.map +1 -0
  61. package/lib/launcher/glsp-server-overrides.d.ts +10 -8
  62. package/lib/launcher/glsp-server-overrides.d.ts.map +1 -1
  63. package/lib/launcher/glsp-server-overrides.js +25 -11
  64. package/lib/launcher/glsp-server-overrides.js.map +1 -1
  65. package/lib/launcher/hydranium-glsp-server.d.ts +60 -15
  66. package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
  67. package/lib/launcher/hydranium-glsp-server.js +145 -22
  68. package/lib/launcher/hydranium-glsp-server.js.map +1 -1
  69. package/lib/launcher/index.d.ts +2 -0
  70. package/lib/launcher/index.d.ts.map +1 -1
  71. package/lib/launcher/index.js +5 -4
  72. package/lib/launcher/index.js.map +1 -1
  73. package/lib/logging/glsp-client-logger.d.ts +10 -6
  74. package/lib/logging/glsp-client-logger.d.ts.map +1 -1
  75. package/lib/logging/glsp-client-logger.js +14 -7
  76. package/lib/logging/glsp-client-logger.js.map +1 -1
  77. package/lib/messages/index.d.ts +11 -6
  78. package/lib/messages/index.d.ts.map +1 -1
  79. package/lib/messages/index.js +11 -6
  80. package/lib/messages/index.js.map +1 -1
  81. package/lib/node/start-glsp-server.d.ts +50 -15
  82. package/lib/node/start-glsp-server.d.ts.map +1 -1
  83. package/lib/node/start-glsp-server.js +97 -30
  84. package/lib/node/start-glsp-server.js.map +1 -1
  85. package/lib/state/abstract-hydranium-glsp-state.d.ts +326 -102
  86. package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
  87. package/lib/state/abstract-hydranium-glsp-state.js +529 -139
  88. package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
  89. package/lib/state/diagram-status.d.ts +38 -0
  90. package/lib/state/diagram-status.d.ts.map +1 -0
  91. package/lib/state/diagram-status.js +27 -0
  92. package/lib/state/diagram-status.js.map +1 -0
  93. package/lib/state/full-text-hydranium-glsp-state.d.ts +22 -9
  94. package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
  95. package/lib/state/full-text-hydranium-glsp-state.js +45 -18
  96. package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
  97. package/lib/state/hydranium-glsp-index.d.ts +40 -29
  98. package/lib/state/hydranium-glsp-index.d.ts.map +1 -1
  99. package/lib/state/hydranium-glsp-index.js +82 -45
  100. package/lib/state/hydranium-glsp-index.js.map +1 -1
  101. package/lib/state/hydranium-shared-core-services.d.ts +16 -29
  102. package/lib/state/hydranium-shared-core-services.d.ts.map +1 -1
  103. package/lib/state/hydranium-shared-core-services.js +15 -28
  104. package/lib/state/hydranium-shared-core-services.js.map +1 -1
  105. package/lib/state/index.d.ts +1 -0
  106. package/lib/state/index.d.ts.map +1 -1
  107. package/lib/state/index.js +1 -0
  108. package/lib/state/index.js.map +1 -1
  109. package/lib/state/model-ready-timeout-error.d.ts.map +1 -1
  110. package/lib/state/model-ready-timeout-error.js.map +1 -1
  111. package/lib/state/reconcile-source-model-write.d.ts +13 -27
  112. package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
  113. package/lib/state/reconcile-source-model-write.js +44 -32
  114. package/lib/state/reconcile-source-model-write.js.map +1 -1
  115. package/lib/state/reconciling-multi-document-glsp-state.d.ts +125 -69
  116. package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
  117. package/lib/state/reconciling-multi-document-glsp-state.js +242 -100
  118. package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
  119. package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +36 -28
  120. package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
  121. package/lib/state/reconciling-transfer-hydranium-glsp-state.js +59 -42
  122. package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
  123. package/lib/status/diagram-status-reporter.d.ts +44 -0
  124. package/lib/status/diagram-status-reporter.d.ts.map +1 -0
  125. package/lib/status/diagram-status-reporter.js +88 -0
  126. package/lib/status/diagram-status-reporter.js.map +1 -0
  127. package/lib/status/hydranium-glsp-request-model-action-handler.d.ts +27 -0
  128. package/lib/status/hydranium-glsp-request-model-action-handler.d.ts.map +1 -0
  129. package/lib/status/hydranium-glsp-request-model-action-handler.js +52 -0
  130. package/lib/status/hydranium-glsp-request-model-action-handler.js.map +1 -0
  131. package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts +27 -0
  132. package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts.map +1 -0
  133. package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js +53 -0
  134. package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js.map +1 -0
  135. package/lib/status/index.d.ts +12 -0
  136. package/lib/status/index.d.ts.map +1 -0
  137. package/lib/status/index.js +12 -0
  138. package/lib/status/index.js.map +1 -0
  139. package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts +30 -0
  140. package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts.map +1 -0
  141. package/lib/storage/hydranium-glsp-request-save-model-action-handler.js +47 -0
  142. package/lib/storage/hydranium-glsp-request-save-model-action-handler.js.map +1 -0
  143. package/lib/storage/hydranium-glsp-storage.d.ts +324 -143
  144. package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
  145. package/lib/storage/hydranium-glsp-storage.js +569 -213
  146. package/lib/storage/hydranium-glsp-storage.js.map +1 -1
  147. package/lib/storage/index.d.ts +2 -1
  148. package/lib/storage/index.d.ts.map +1 -1
  149. package/lib/storage/index.js +2 -1
  150. package/lib/storage/index.js.map +1 -1
  151. package/lib/storage/save-delivery-policy.d.ts +51 -0
  152. package/lib/storage/save-delivery-policy.d.ts.map +1 -0
  153. package/lib/storage/{save-conflict-policy.js → save-delivery-policy.js} +7 -8
  154. package/lib/storage/save-delivery-policy.js.map +1 -0
  155. package/lib/submission/hydranium-glsp-submission-handler.d.ts +44 -4
  156. package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -1
  157. package/lib/submission/hydranium-glsp-submission-handler.js +82 -6
  158. package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -1
  159. package/lib/testing/glsp-harness.d.ts +34 -7
  160. package/lib/testing/glsp-harness.d.ts.map +1 -1
  161. package/lib/testing/glsp-harness.js +47 -19
  162. package/lib/testing/glsp-harness.js.map +1 -1
  163. package/lib/validation/diagnostic-markers.d.ts +3 -3
  164. package/lib/validation/diagnostic-markers.d.ts.map +1 -1
  165. package/lib/validation/diagnostic-markers.js +1 -1
  166. package/lib/validation/diagnostic-markers.js.map +1 -1
  167. package/lib/validation/hydranium-glsp-model-validator.d.ts +1 -2
  168. package/lib/validation/hydranium-glsp-model-validator.d.ts.map +1 -1
  169. package/lib/validation/hydranium-glsp-model-validator.js +1 -1
  170. package/lib/validation/hydranium-glsp-model-validator.js.map +1 -1
  171. package/package.json +31 -52
  172. package/src/browser/start-glsp-server-in-worker.ts +79 -51
  173. package/src/command/diagram-edit-dropped-error.ts +51 -0
  174. package/src/command/hydranium-glsp-command-stack.ts +47 -0
  175. package/src/command/hydranium-glsp-operation-action-handler.ts +141 -0
  176. package/src/command/hydranium-glsp-operation-command.ts +602 -0
  177. package/src/command/hydranium-glsp-recording-command.ts +40 -121
  178. package/src/command/hydranium-glsp-undo-redo-action-handler.ts +29 -0
  179. package/src/command/index.ts +10 -0
  180. package/src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts +2 -2
  181. package/src/dispatcher/server-action-dispatcher.ts +39 -31
  182. package/src/index.ts +1 -0
  183. package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +79 -91
  184. package/src/launcher/drop-notifications-to-gone-client.ts +47 -0
  185. package/src/launcher/glsp-app-module.ts +1 -2
  186. package/src/launcher/glsp-connection-logger.ts +27 -0
  187. package/src/launcher/glsp-server-overrides.ts +27 -11
  188. package/src/launcher/hydranium-glsp-server.ts +153 -23
  189. package/src/launcher/index.ts +5 -4
  190. package/src/logging/glsp-client-logger.ts +16 -9
  191. package/src/messages/index.ts +16 -6
  192. package/src/node/start-glsp-server.ts +133 -40
  193. package/src/state/abstract-hydranium-glsp-state.ts +609 -154
  194. package/src/state/diagram-status.ts +41 -0
  195. package/src/state/full-text-hydranium-glsp-state.ts +46 -18
  196. package/src/state/hydranium-glsp-index.ts +85 -41
  197. package/src/state/hydranium-shared-core-services.ts +16 -29
  198. package/src/state/index.ts +1 -0
  199. package/src/state/reconcile-source-model-write.ts +51 -53
  200. package/src/state/reconciling-multi-document-glsp-state.ts +276 -102
  201. package/src/state/reconciling-transfer-hydranium-glsp-state.ts +67 -45
  202. package/src/status/diagram-status-reporter.ts +106 -0
  203. package/src/status/hydranium-glsp-request-model-action-handler.ts +43 -0
  204. package/src/status/hydranium-glsp-set-edit-mode-action-handler.ts +38 -0
  205. package/src/status/index.ts +12 -0
  206. package/src/storage/hydranium-glsp-request-save-model-action-handler.ts +40 -0
  207. package/src/storage/hydranium-glsp-storage.ts +647 -223
  208. package/src/storage/index.ts +2 -1
  209. package/src/storage/save-delivery-policy.ts +49 -0
  210. package/src/submission/hydranium-glsp-submission-handler.ts +91 -5
  211. package/src/testing/glsp-harness.ts +67 -25
  212. package/src/validation/diagnostic-markers.ts +3 -3
  213. package/src/validation/hydranium-glsp-model-validator.ts +4 -5
  214. package/lib/storage/save-conflict-policy.d.ts +0 -56
  215. package/lib/storage/save-conflict-policy.d.ts.map +0 -1
  216. package/lib/storage/save-conflict-policy.js.map +0 -1
  217. package/src/storage/save-conflict-policy.ts +0 -52
package/README.md CHANGED
@@ -1,39 +1,20 @@
1
1
  # `@hydranium/glsp-server`
2
2
 
3
- The graphical-editing head of [hydranium](../../README.md): a generic
4
- [GLSP](https://eclipse.dev/glsp/) server, built on `@eclipse-glsp/server`, that
5
- treats the shared Langium AST as its source of truth. Installed by the server
6
- process that already composes [`@hydranium/core`](../core); the translation to
7
- the diagram model is adopter-side, bound per diagram module.
3
+ The graphical-editing head of
4
+ [Hydranium](https://github.com/eclipse-emfcloud/hydranium): a
5
+ [GLSP](https://eclipse.dev/glsp/) server that draws diagrams from your model
6
+ and writes their edits back to it. Install it in the server that composes
7
+ `@hydranium/core`; `@hydranium/glsp-client` is its client in any host, and
8
+ `@hydranium/glsp-client-theia` in Theia.
8
9
 
9
10
  ## What it gives you
10
11
 
11
- - **DI composition against the shared workspace.** `HydraniumGlspAppModule` binds
12
- the `HydraniumTypes` token registry onto an already-composed
13
- `ServerSharedServices` tree and exposes a `configureAdditionalBindings` hook;
14
- `AbstractHydraniumGlspDiagramModule` and `bindDiagramLanguage` carry the per-diagram
15
- half.
16
- - **Base model state, so an adopter binds a factory rather than a lifecycle:**
17
- `AbstractHydraniumGlspState`, with the ready-made
18
- `ReconcilingTransferHydraniumGlspState`, `ReconcilingMultiDocumentGlspState`
19
- and `FullTextHydraniumGlspState` specialisations, plus `HydraniumGlspIndex`
20
- over the GModel.
21
- - **Load / save against the live AST.** `HydraniumGlspStorage` loads a document
22
- on diagram open and writes user operations back through the shared model
23
- coordination layer, with `SaveConflictPolicy` deciding what a concurrent
24
- external write means. `HydraniumGlspRecordingCommand` is the operation-handler
25
- seam — the framework provides no base handler class.
26
- - **A submission and dispatch lifecycle that waits for the model.**
27
- `HydraniumGlspSubmissionHandler` gates submit on the readiness event,
28
- `HydraniumGlspServerActionDispatcher` adds timing and direction to dispatch,
29
- and `HydraniumGlspComputedBoundsActionHandler` is handshake-aware.
30
- - **Diagram diagnostics for free.** `HydraniumGlspModelValidator` and
31
- `diagnosticsToMarkers` project the language server's diagnostics onto GLSP
32
- markers, so a validation error shows on the diagram and in the text editor from
33
- one source.
34
- - **Two bringups from one composition:** `startGlspServer` over a socket at
35
- `./node`, `startGlspServerInWorker` over a transferred `MessagePort` at
36
- `./browser`. Both load the same framework overrides and adopter app modules.
12
+ - Diagrams on the same workspace as the text editor: an edit in the diagram is
13
+ written to the shared document, and every other head sees it.
14
+ - A per-diagram module and base classes for its state, storage and submission.
15
+ You write the GModel factory and the operation handlers.
16
+ - The language's diagnostics as markers on the diagram, when you bind
17
+ `HydraniumGlspModelValidator` as the diagram's model validator.
37
18
 
38
19
  ## Install
39
20
 
@@ -41,66 +22,77 @@ the diagram model is adopter-side, bound per diagram module.
41
22
  npm install @hydranium/glsp-server
42
23
  ```
43
24
 
44
- Peers: `@eclipse-glsp/server` and `@eclipse-glsp/protocol`, `inversify` and
45
- `reflect-metadata` (the DI runtime — import `reflect-metadata` once at your entry
46
- point), `@hydranium/core`, `@hydranium/protocol`, `@hydranium/langium`,
47
- `vscode-jsonrpc` and `vscode-languageserver-types`. The only bundled runtime
48
- dependency is `uuid`. You must already have a composed hydranium shared services
49
- tree, a grammar, and a GModel factory of your own — there is no framework GModel
50
- factory.
51
-
52
- **This head needs one line in your own root manifest, and the install works
53
- without it right up until the server starts.** `@eclipse-glsp/*` depends on
54
- `vscode-jsonrpc@8.2.0` exactly, while the Langium chain under hydranium pins the
55
- transport at `9.0.1` — the version this package declares as its peer. Two
56
- physical copies in one process throw `Unknown parameter structure auto` during
57
- GLSP server init, and no peer declaration can prevent a nested copy. Add an
58
- `overrides` block collapsing the chain and reinstall from scratch;
59
- [Requirements](../../docs/adopting/requirements.md) gives the exact block.
60
-
61
- ## Exports
62
-
63
- | subpath | holds | platform |
64
- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
65
- | `.` | Composition and the head itself: app / diagram modules, state, storage, submission, command, dispatcher, computed-bounds, validation, logging, `serviceIdentifier`. | browser-neutral |
66
- | `./browser` | `startGlspServerInWorker` and `BrowserGlspServerOptions` — the web-worker bringup on GLSP's `WorkerServerLauncher`. | browser-only |
67
- | `./node` | `startGlspServer`, `GlspServerOptions`, `StartedGlspServer` — the socket bringup on GLSP's `SocketServerLauncher`. | Node-only |
68
- | `./testing` | `makeGlspHarness`, `makeNoopGlspLogger`, `makeCapturingGlspLogger`. | browser-neutral |
69
-
70
- This is the one head with three platform subpaths
71
- ([why](../../docs/concepts/head-module-maps.md#hydraniumglsp-server--graphical-head)). `.` and
72
- `./testing` are
73
- gated as browser-neutral in CI (`scripts/check-neutral-bundles.mjs`), which
74
- depends on `.` naming only the bare `@eclipse-glsp/server` specifier: a slip back
75
- to a `/node` subpath in the portable tree fails that gate. `./browser` is
76
- browser-only rather than neutral — no portability is claimed for it. What the
77
- gate does and does not promise is [what "gated neutral" does and does not promise](../../docs/concepts/browser-hosting.md#a-note-on-what-gated-neutral-does-and-does-not-promise).
78
- Each subpath also has a `./lib/…` twin for consumers on
79
- `moduleResolution: "Node"`.
80
-
81
- ## Getting oriented
82
-
83
- Build the app container, load `HydraniumGlspAppModule` plus your own app modules,
84
- and hand the result to `startGlspServer` (or `startGlspServerInWorker`, whose
85
- `context` is a required transferred `MessagePort`). Per diagram open, storage
86
- loads the document, your GModel factory renders it, and user operations travel
87
- back into the shared AST through the recording command, after which the GModel is
88
- re-derived and every listener on that document is notified. The module-by-module
89
- map is in
90
- [`docs/concepts/head-module-maps.md`](../../docs/concepts/head-module-maps.md);
91
- the worker bringup and its two bundler accommodations are in
92
- [`docs/concepts/browser-hosting.md`](../../docs/concepts/browser-hosting.md); the
93
- framework/adopter seams are in
94
- [`docs/concepts/framework-vs-adopter.md`](../../docs/concepts/framework-vs-adopter.md).
95
- The Theia-side client wiring lives in `@hydranium/glsp-client-theia`.
25
+ | Peer | Range |
26
+ | ----------------------------- | ------------- |
27
+ | `@eclipse-glsp/server` | `^2.6.0` |
28
+ | `@hydranium/core` | `^1.0.0-next` |
29
+ | `@hydranium/langium` | `^1.0.0-next` |
30
+ | `@hydranium/protocol` | `^1.0.0-next` |
31
+ | `inversify` | `^6.0.0` |
32
+ | `reflect-metadata` | `^0.2.2` |
33
+ | `vscode-jsonrpc` | `^9.0.0` |
34
+ | `vscode-languageserver-types` | `^3.17.5` |
35
+
36
+ Import `reflect-metadata` once, first, in your server's entry point: the DI
37
+ decorators need it.
38
+
39
+ ## Wiring
40
+
41
+ 1. Subclass `AbstractHydraniumGlspDiagramModule` per diagram, and bind your
42
+ model state, storage, submission handler, configuration and GModel factory.
43
+ 2. Start the head on the shared services with `startGlspServer` from `./node`:
44
+ your diagram modules in `serverModule`,
45
+ `new HydraniumGlspAppModule({ shared })` in `appModules`, and a
46
+ `GlspClientLogger` from `createLogger`. Pass `lspConnection` and
47
+ `portCommand` to tell the client its port. Without an LSP head, pass the
48
+ workspace root as `workspace`: the head brings the workspace up before it
49
+ listens.
50
+ 3. In a browser, start it with `startGlspServerInWorker` from `./browser`
51
+ instead, on a transferred `MessagePort`.
52
+
53
+ See *Make a diagram editable* and *Host in a browser* in
54
+ [Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
55
+
56
+ ## Things to know
57
+
58
+ - **Replace the launcher with `rebind`.** Each head binds GLSP's launcher token
59
+ before your `appModules` load, so a second `bind` fails the start with
60
+ `Ambiguous match found for serviceIdentifier`.
61
+ - **A replacement launcher extends the Hydranium one**,
62
+ `HydraniumGlspSocketServerLauncher` or `HydraniumGlspWorkerServerLauncher`.
63
+ If it overrides `createConnection`, it passes
64
+ `createGlspConnectionLogger(this.logger)` as the connection's logger, or the
65
+ connection logs to `console` or nowhere instead of your logger. It also wraps
66
+ the result in `dropNotificationsToGoneClient(connection, this.logger)`, or
67
+ every client that disconnects leaves an unhandled rejection in the server.
68
+ - **GLSP brings its own copy of `vscode-jsonrpc`.** A typed message built by
69
+ one copy and sent over a connection from another throws
70
+ `Unknown parameter structure auto`. Wrap a connection you hand GLSP, or send
71
+ GLSP's typed messages over, with `sendByMethodName` from
72
+ `@hydranium/protocol`.
73
+
74
+ ## Entry points
75
+
76
+ | Subpath | Use it for | Runs in |
77
+ | ------------ | ------------------------------------------------------------ | --------------- |
78
+ | `.` | The app and diagram modules and the bases you subclass | browser-neutral |
79
+ | `./browser` | Starting the head in a web worker | browser-only |
80
+ | `./node` | Starting the head on a socket | Node-only |
81
+ | `./messages` | The codes of the messages this package raises | browser-neutral |
82
+ | `./testing` | A harness and logger doubles for diagram tests | browser-neutral |
83
+
84
+ The subpaths need a TypeScript `moduleResolution` that reads `exports`
85
+ (`NodeNext` or `Bundler`); see *Requirements* in
86
+ [Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
96
87
 
97
88
  ## Status
98
89
 
99
- Alpha — pre-v0, not yet published. The API is not stable and may change without a
100
- deprecation cycle. See the [repository README](../../README.md) for the current
101
- status and known limitations.
90
+ Alpha: every release is a prerelease that may break the API, so pin an exact
91
+ version. Guides and known limitations:
92
+ [Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
102
93
 
103
94
  ## License
104
95
 
105
- `MIT` — see this package's [`LICENSE`](./LICENSE). Third-party notices for the
106
- repository are recorded in [`NOTICE.md`](../../NOTICE.md).
96
+ `MIT` — see this package's [`LICENSE`](./LICENSE), and the repository
97
+ [`NOTICE.md`](https://github.com/eclipse-emfcloud/hydranium/blob/main/NOTICE.md)
98
+ for third-party notices.
@@ -6,42 +6,39 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
- import { type Logger as GlspLogger, type ServerModule } from '@eclipse-glsp/server/browser.js';
10
- import { type ContainerModule } from 'inversify';
11
- import type { Logger } from '@hydranium/protocol';
9
+ import { type Logger as GlspLogger, type ServerModule, type WorkerLaunchOptions, WorkerServerLauncher } from '@eclipse-glsp/server/browser.js';
10
+ import { ContainerModule } from 'inversify';
11
+ import { type Logger, type TransferredMessagePort } from '@hydranium/protocol';
12
12
  import type { IntegratedServer } from '@hydranium/core';
13
+ export type { TransferredMessagePort } from '@hydranium/protocol';
13
14
  /**
14
- * A `MessagePort` the host transferred into the worker, described structurally.
15
+ * The default worker launcher of {@link startGlspServerInWorker}: GLSP's
16
+ * own, with its connection built over `createMessagePortTransport` rather than
17
+ * over `BrowserMessageReader`/`BrowserMessageWriter`, which never report a
18
+ * close. So the client disposing its connection closes this one, and upstream
19
+ * disposes the server instance, and with it every client session, as it does
20
+ * when a socket closes.
15
21
  *
16
- * This package inherits `tsconfig.base.json`'s `lib: ["ES2022"]` and so compiles
17
- * without the DOM lib, which is what keeps `document` / `window` compile errors
18
- * here — so `MessagePort` has no name either and the contract has to be spelled
19
- * out.
22
+ * Requires `context`: unlike upstream it never falls back to the worker global.
20
23
  *
21
- * **The member set is chosen to admit a `MessagePort` and REJECT a `Worker` or
22
- * the worker global**, both of which the launcher's own reader would otherwise
23
- * accept. Only a port needs starting, so `start` is what tells the three apart,
24
- * and naming it here turns "never bind a head to the global" from a rule in a
25
- * document into a compile error at the call site.
26
- *
27
- * **That compile error happens at the ADOPTER, not here.** This project resolves
28
- * neither `MessagePort` nor `Worker` as a type, so nothing in this package can
29
- * demonstrate the rejection; a host compiling its worker against `lib.webworker`
30
- * (or a page against `lib.dom`) is where the names resolve and the guard bites.
31
- * Measured there: passing the worker global fails with `Property 'start' is
32
- * missing in type 'DedicatedWorkerGlobalScope'`.
33
- *
34
- * `addEventListener` is not a discriminator — `postMessage` plus `start` already
35
- * excludes the other two — and nothing in this module calls any of the three
36
- * (the reader assigns `onmessage`, which starts a port implicitly). It is listed
37
- * because it is part of what the reader uses, so the interface reads as the
38
- * contract rather than as a minimal trick.
24
+ * The connection sends GLSP's typed messages by method name: it comes from this
25
+ * package's copy of `vscode-jsonrpc` and the types from GLSP's own copy, and a
26
+ * type sent over another copy's connection throws.
39
27
  */
40
- export interface TransferredMessagePort {
41
- postMessage(message: unknown): void;
42
- addEventListener(type: 'message', listener: (event: unknown) => void, options?: unknown): void;
43
- start(): void;
28
+ export declare class HydraniumGlspWorkerServerLauncher extends WorkerServerLauncher {
29
+ protected createConnection(options: WorkerLaunchOptions): ReturnType<WorkerServerLauncher['createConnection']>;
44
30
  }
31
+ /**
32
+ * Binds GLSP's own `WorkerServerLauncher` token to
33
+ * {@link HydraniumGlspWorkerServerLauncher}. {@link startGlspServerInWorker}
34
+ * loads it before the adopter's `appModules`, so an adopter replaces the launcher
35
+ * with `rebind`; a second `bind` makes the resolve ambiguous and the start throws.
36
+ * A replacement extends {@link HydraniumGlspWorkerServerLauncher}: GLSP's own
37
+ * launcher builds its connection from GLSP's copy, so framework errors lose
38
+ * their code, and GLSP's typed messages throw where its packages nest
39
+ * separate copies.
40
+ */
41
+ export declare function createGlspWorkerLauncherModule(): ContainerModule;
45
42
  /**
46
43
  * Options for {@link startGlspServerInWorker}.
47
44
  *
@@ -55,14 +52,15 @@ export interface BrowserGlspServerOptions {
55
52
  /**
56
53
  * The port the host transferred into the worker for this head.
57
54
  *
58
- * **Required, and that is the whole point.** GLSP's
59
- * `WorkerServerLauncher.createConnection` falls back to the worker global
60
- * when it is omitted, and a head on the global receives every other head's
61
- * traffic — `BrowserMessageReader` filters nothing, so this is not a race
62
- * under load but every message delivered to the wrong reader. The global is
63
- * unusable even for a single head, because the launcher posts its startup
64
- * string through the global `postMessage` regardless of the connection it
65
- * was given, and no JSON-RPC reader can parse that.
55
+ * **Required: the worker global is no substitute.** A head on the global
56
+ * receives every other head's traffic — a reader filters nothing, so this is
57
+ * not a race under load but every message delivered to the wrong reader — and
58
+ * GLSP's launcher posts its startup string through the global `postMessage`
59
+ * regardless of the connection it was given, which no JSON-RPC reader parses.
60
+ * Unlike upstream's, this head's launcher never falls back to the global.
61
+ *
62
+ * The page's end must connect through `createMessagePortTransport` as well:
63
+ * the head reads its close signal from the port, and posts one on it.
66
64
  */
67
65
  readonly context: TransferredMessagePort;
68
66
  /**
@@ -82,8 +80,10 @@ export interface BrowserGlspServerOptions {
82
80
  readonly serverModule: ServerModule;
83
81
  /**
84
82
  * Additional Inversify modules to load on the app container AFTER GLSP's
85
- * own app module and the framework overrides. Adopters wire language-services
86
- * bindings (e.g. their own shared-services symbol) here.
83
+ * own app module, the framework overrides and
84
+ * {@link createGlspWorkerLauncherModule}. Adopters wire language-services
85
+ * bindings (e.g. their own shared-services symbol) here, and replace the
86
+ * launcher with `rebind`.
87
87
  */
88
88
  readonly appModules?: ReadonlyArray<ContainerModule>;
89
89
  /**
@@ -114,8 +114,9 @@ export interface BrowserGlspServerOptions {
114
114
  * below. There is no transport handshake to wait on: the port arrived live,
115
115
  * and the launcher's own readiness signal is a string it posts on the worker
116
116
  * global, which nothing here reads.
117
- * - `stopped` resolves when the connection closes, and rejects on a connection
118
- * error.
117
+ * - `stopped` resolves when the connection closes, which the client disposing
118
+ * its connection causes, and rejects on a connection error. Nothing reports a
119
+ * page that dies, because the port cannot.
119
120
  */
120
121
  export declare function startGlspServerInWorker(options: BrowserGlspServerOptions): IntegratedServer;
121
122
  //# sourceMappingURL=start-glsp-server-in-worker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-glsp-server-in-worker.d.ts","sourceRoot":"","sources":["../../src/browser/start-glsp-server-in-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,IAAI,UAAU,EACzB,KAAK,YAAY,EAInB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIxD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,sBAAsB;IACpC,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/F,KAAK,IAAI,IAAI,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACtC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,gBAAgB,CAsE3F"}
1
+ {"version":3,"file":"start-glsp-server-in-worker.d.ts","sourceRoot":"","sources":["../../src/browser/start-glsp-server-in-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,IAAI,UAAU,EACzB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,oBAAoB,EAEtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAa,eAAe,EAAc,MAAM,WAAW,CAAC;AACnE,OAAO,EAIJ,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC7B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOxD,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;;;;;;;;;;GAaG;AACH,qBACa,iCAAkC,SAAQ,oBAAoB;IACxE,UAAmB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,UAAU,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAC,CAMtH;CACH;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,IAAI,eAAe,CAIhE;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACtC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,GAAG,gBAAgB,CA0E3F"}
@@ -6,10 +6,59 @@
6
6
  *
7
7
  * SPDX-License-Identifier: MIT
8
8
  ********************************************************************************/
9
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
14
+ };
9
15
  import { WorkerServerLauncher, createAppModule } from '@eclipse-glsp/server/browser.js';
10
- import { Container } from 'inversify';
16
+ import { Container, ContainerModule, injectable } from 'inversify';
17
+ import { createMessagePortTransport, describeErrorWithStack, sendByMethodName } from '@hydranium/protocol';
18
+ import { createMessageConnection } from 'vscode-jsonrpc/browser';
19
+ import { dropNotificationsToGoneClient } from '../launcher/drop-notifications-to-gone-client.js';
20
+ import { createGlspConnectionLogger } from '../launcher/glsp-connection-logger.js';
11
21
  import { createGlspFrameworkOverrides } from '../launcher/glsp-framework-overrides.js';
12
22
  import { createGlspServerOverrides } from '../launcher/glsp-server-overrides.js';
23
+ /**
24
+ * The default worker launcher of {@link startGlspServerInWorker}: GLSP's
25
+ * own, with its connection built over `createMessagePortTransport` rather than
26
+ * over `BrowserMessageReader`/`BrowserMessageWriter`, which never report a
27
+ * close. So the client disposing its connection closes this one, and upstream
28
+ * disposes the server instance, and with it every client session, as it does
29
+ * when a socket closes.
30
+ *
31
+ * Requires `context`: unlike upstream it never falls back to the worker global.
32
+ *
33
+ * The connection sends GLSP's typed messages by method name: it comes from this
34
+ * package's copy of `vscode-jsonrpc` and the types from GLSP's own copy, and a
35
+ * type sent over another copy's connection throws.
36
+ */
37
+ let HydraniumGlspWorkerServerLauncher = class HydraniumGlspWorkerServerLauncher extends WorkerServerLauncher {
38
+ createConnection(options) {
39
+ const transport = createMessagePortTransport(options.context);
40
+ return dropNotificationsToGoneClient(sendByMethodName(createMessageConnection(transport.reader, transport.writer, createGlspConnectionLogger(this.logger))), this.logger);
41
+ }
42
+ };
43
+ HydraniumGlspWorkerServerLauncher = __decorate([
44
+ injectable()
45
+ ], HydraniumGlspWorkerServerLauncher);
46
+ export { HydraniumGlspWorkerServerLauncher };
47
+ /**
48
+ * Binds GLSP's own `WorkerServerLauncher` token to
49
+ * {@link HydraniumGlspWorkerServerLauncher}. {@link startGlspServerInWorker}
50
+ * loads it before the adopter's `appModules`, so an adopter replaces the launcher
51
+ * with `rebind`; a second `bind` makes the resolve ambiguous and the start throws.
52
+ * A replacement extends {@link HydraniumGlspWorkerServerLauncher}: GLSP's own
53
+ * launcher builds its connection from GLSP's copy, so framework errors lose
54
+ * their code, and GLSP's typed messages throw where its packages nest
55
+ * separate copies.
56
+ */
57
+ export function createGlspWorkerLauncherModule() {
58
+ return new ContainerModule(bind => {
59
+ bind(WorkerServerLauncher).to(HydraniumGlspWorkerServerLauncher);
60
+ });
61
+ }
13
62
  /**
14
63
  * Start a GLSP head on a transferred `MessagePort` inside a web worker, with no
15
64
  * Node runtime and no backend process.
@@ -32,8 +81,9 @@ import { createGlspServerOverrides } from '../launcher/glsp-server-overrides.js'
32
81
  * below. There is no transport handshake to wait on: the port arrived live,
33
82
  * and the launcher's own readiness signal is a string it posts on the worker
34
83
  * global, which nothing here reads.
35
- * - `stopped` resolves when the connection closes, and rejects on a connection
36
- * error.
84
+ * - `stopped` resolves when the connection closes, which the client disposing
85
+ * its connection causes, and rejects on a connection error. Nothing reports a
86
+ * page that dies, because the port cannot.
37
87
  */
38
88
  export function startGlspServerInWorker(options) {
39
89
  const lifecycle = options.logger;
@@ -47,18 +97,17 @@ export function startGlspServerInWorker(options) {
47
97
  // configured is unbound a line later.
48
98
  const glspAppModule = createAppModule({ consoleLog: false });
49
99
  const appContainer = new Container();
50
- appContainer.load(glspAppModule, createGlspFrameworkOverrides(options.createLogger), ...(options.appModules ?? []));
51
- const launcher = appContainer.resolve(WorkerServerLauncher);
100
+ appContainer.load(glspAppModule, createGlspFrameworkOverrides(options.createLogger), createGlspWorkerLauncherModule(), ...(options.appModules ?? []));
101
+ const launcher = appContainer.get(WorkerServerLauncher);
52
102
  // Additional module rather than an app-container binding, as on Node: the
53
- // launcher loads these into the per-connection SERVER container, the only
54
- // tier where the adopter's `ServerModule` binding of `GLSPServer` is
55
- // rebindable.
103
+ // launcher loads these into the per-connection SERVER container, the tier
104
+ // where each connection gets a server of its own.
56
105
  launcher.configure(options.serverModule, createGlspServerOverrides());
57
106
  try {
58
- // Upstream declares `WorkerLaunchOptions.context` as `Worker`, narrower
59
- // than the `MessagePort | Worker | DedicatedWorkerGlobalScope` its own
60
- // `BrowserMessageReader` accepts — so the value that is CORRECT here is
61
- // the one the declaration names as wrong.
107
+ // Upstream declares `WorkerLaunchOptions.context` as `Worker`, and
108
+ // `HydraniumGlspWorkerServerLauncher.createConnection` reads it as a
109
+ // port — so the value that is CORRECT here is the one the declaration
110
+ // names as wrong.
62
111
  //
63
112
  // **The cast is currently redundant, and is kept deliberately.** `Worker`
64
113
  // does not resolve under this package's `lib`, so `skipLibCheck` leaves
@@ -88,7 +137,7 @@ export function startGlspServerInWorker(options) {
88
137
  if (connection === undefined) {
89
138
  const error = new Error('startGlspServerInWorker: the launcher built no connection synchronously — ' +
90
139
  'WorkerServerLauncher.run has become asynchronous and readiness now needs a real signal');
91
- lifecycle?.error(`[GlspServer] ${error.message}`);
140
+ lifecycle?.error(`[GlspServer] ${describeErrorWithStack(error)}`);
92
141
  return { started: Promise.reject(error), stopped: stoppedPromise };
93
142
  }
94
143
  lifecycle?.info('[GlspServer] Ready to accept client requests on the transferred port');
@@ -1 +1 @@
1
- {"version":3,"file":"start-glsp-server-in-worker.js","sourceRoot":"","sources":["../../src/browser/start-glsp-server-in-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAIJ,oBAAoB,EACpB,eAAe,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAC;AAG5D,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAsFjF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAiC;IACtE,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAEjC,uEAAuE;IACvE,4EAA4E;IAC5E,iFAAiF;IACjF,6EAA6E;IAC7E,2EAA2E;IAC3E,0EAA0E;IAC1E,oEAAoE;IACpE,sCAAsC;IACtC,MAAM,aAAa,GAAG,eAAe,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,IAAI,SAAS,EAAE,CAAC;IACrC,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE,4BAA4B,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC;IAEpH,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAuB,oBAAoB,CAAC,CAAC;IAClF,0EAA0E;IAC1E,0EAA0E;IAC1E,qEAAqE;IACrE,cAAc;IACd,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE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,0 +1,31 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { type Action, type Logger } from '@eclipse-glsp/server';
10
+ /**
11
+ * Thrown when the reconcile of a diagram edit's write dropped it: a foreign
12
+ * edit changed a field the edit writes. Declined by design rather than failed,
13
+ * and the reconcile has logged it, so whoever ends it tells the client without
14
+ * logging it again. It never crosses a wire, so it carries no error code.
15
+ */
16
+ export declare class DiagramEditDroppedError extends Error {
17
+ constructor(message: string);
18
+ }
19
+ /**
20
+ * Whether `error` is a {@link DiagramEditDroppedError}, by name, so one thrown
21
+ * by another installed copy of this package counts too.
22
+ */
23
+ export declare function isDiagramEditDroppedError(error: unknown): error is DiagramEditDroppedError;
24
+ /**
25
+ * Log an action that failed, once, at the level of what happened: a dropped
26
+ * edit at `debug`, since its reconcile has logged it, a conflict at `warn`
27
+ * naming its versions, since it was declined, and anything else at `error`.
28
+ * A request is named by its id too, which its client's reject carries.
29
+ */
30
+ export declare function logActionFailure(logger: Logger, action: Action, error: unknown): void;
31
+ //# sourceMappingURL=diagram-edit-dropped-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-edit-dropped-error.d.ts","sourceRoot":"","sources":["../../src/command/diagram-edit-dropped-error.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAiB,MAAM,sBAAsB,CAAC;AAG/E;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAC/C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACH;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,uBAAuB,CAE1F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAWrF"}
@@ -0,0 +1,48 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { RequestAction } from '@eclipse-glsp/server';
10
+ import { describeError, describeErrorWithStack, isConflictError } from '@hydranium/protocol';
11
+ /**
12
+ * Thrown when the reconcile of a diagram edit's write dropped it: a foreign
13
+ * edit changed a field the edit writes. Declined by design rather than failed,
14
+ * and the reconcile has logged it, so whoever ends it tells the client without
15
+ * logging it again. It never crosses a wire, so it carries no error code.
16
+ */
17
+ export class DiagramEditDroppedError extends Error {
18
+ constructor(message) {
19
+ super(message);
20
+ this.name = 'DiagramEditDroppedError';
21
+ }
22
+ }
23
+ /**
24
+ * Whether `error` is a {@link DiagramEditDroppedError}, by name, so one thrown
25
+ * by another installed copy of this package counts too.
26
+ */
27
+ export function isDiagramEditDroppedError(error) {
28
+ return error instanceof Error && error.name === 'DiagramEditDroppedError';
29
+ }
30
+ /**
31
+ * Log an action that failed, once, at the level of what happened: a dropped
32
+ * edit at `debug`, since its reconcile has logged it, a conflict at `warn`
33
+ * naming its versions, since it was declined, and anything else at `error`.
34
+ * A request is named by its id too, which its client's reject carries.
35
+ */
36
+ export function logActionFailure(logger, action, error) {
37
+ const named = `'${action.kind}'${RequestAction.is(action) ? ` (${action.requestId})` : ''}`;
38
+ if (isDiagramEditDroppedError(error)) {
39
+ logger.debug(`Could not process action ${named}: ${describeError(error)}`);
40
+ }
41
+ else if (isConflictError(error)) {
42
+ logger.warn(`Could not process action ${named}: ${describeError(error)} (model v${error.baseVersion} / text v${error.actualVersion})`);
43
+ }
44
+ else {
45
+ logger.error(`Could not process action ${named}: ${describeErrorWithStack(error)}`);
46
+ }
47
+ }
48
+ //# sourceMappingURL=diagram-edit-dropped-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-edit-dropped-error.js","sourceRoot":"","sources":["../../src/command/diagram-edit-dropped-error.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAA4B,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC/C,YAAY,OAAe;QACxB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACzC,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACrD,OAAO,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,yBAAyB,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,MAAc,EAAE,KAAc;IAC5E,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,IAAI,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC5F,IAAI,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,4BAA4B,KAAK,KAAK,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC9E,CAAC;SAAM,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CACR,4BAA4B,KAAK,KAAK,aAAa,CAAC,KAAK,CAAC,YAAY,KAAK,CAAC,WAAW,YAAY,KAAK,CAAC,aAAa,GAAG,CAC3H,CAAC;IACL,CAAC;SAAM,CAAC;QACL,MAAM,CAAC,KAAK,CAAC,4BAA4B,KAAK,KAAK,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACvF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import { DefaultCommandStack, ModelState } from '@eclipse-glsp/server';
10
+ import { type ServerSharedServices } from '@hydranium/core';
11
+ /**
12
+ * GLSP's command stack with the diagram's dirty state read from the text store:
13
+ * dirty while any document the diagram's client session has open differs from
14
+ * its file, as the store last knew the file. Undo and redo are GLSP's.
15
+ *
16
+ * GLSP's own answer counts the diagram's commands since its last save, so it
17
+ * misses every change the diagram did not make: another client's unsaved edit
18
+ * leaves it clean, and a save it did not make of a document other than the
19
+ * diagram's own leaves it dirty. Every `SetDirtyStateAction` GLSP sends reads
20
+ * this answer.
21
+ */
22
+ export declare class HydraniumGlspCommandStack extends DefaultCommandStack {
23
+ protected readonly modelState: ModelState;
24
+ protected readonly sharedServices: ServerSharedServices;
25
+ get isDirty(): boolean;
26
+ /**
27
+ * Lifted from `@eclipse-glsp/server` 2.7.0's `DefaultCommandStack.handleError`
28
+ * without its `error` line: the failure is rethrown, and whoever ends it
29
+ * logs it. The accompanying test pins upstream's source.
30
+ */
31
+ protected handleError(error: unknown): never;
32
+ }
33
+ //# sourceMappingURL=hydranium-glsp-command-stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydranium-glsp-command-stack.d.ts","sourceRoot":"","sources":["../../src/command/hydranium-glsp-command-stack.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAI5D;;;;;;;;;;GAUG;AACH,qBACa,yBAA0B,SAAQ,mBAAmB;IAC3C,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAG,UAAU,CAAC;IACpB,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAG,oBAAoB,CAAC;IAEpG,IAAa,OAAO,IAAI,OAAO,CAI9B;IAED;;;;OAIG;IACH,UAAmB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAIpD;CACH"}