@hydranium/data-server 1.0.0-next.10

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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +91 -0
  3. package/lib/data-server.d.ts +614 -0
  4. package/lib/data-server.d.ts.map +1 -0
  5. package/lib/data-server.js +1003 -0
  6. package/lib/data-server.js.map +1 -0
  7. package/lib/default-diagnostics.browser.d.ts +18 -0
  8. package/lib/default-diagnostics.browser.d.ts.map +1 -0
  9. package/lib/default-diagnostics.browser.js +36 -0
  10. package/lib/default-diagnostics.browser.js.map +1 -0
  11. package/lib/default-diagnostics.d.ts +36 -0
  12. package/lib/default-diagnostics.d.ts.map +1 -0
  13. package/lib/default-diagnostics.js +38 -0
  14. package/lib/default-diagnostics.js.map +1 -0
  15. package/lib/diagnostics-provider.d.ts +65 -0
  16. package/lib/diagnostics-provider.d.ts.map +1 -0
  17. package/lib/diagnostics-provider.js +10 -0
  18. package/lib/diagnostics-provider.js.map +1 -0
  19. package/lib/index.d.ts +11 -0
  20. package/lib/index.d.ts.map +1 -0
  21. package/lib/index.js +15 -0
  22. package/lib/index.js.map +1 -0
  23. package/lib/node/index.d.ts +10 -0
  24. package/lib/node/index.d.ts.map +1 -0
  25. package/lib/node/index.js +16 -0
  26. package/lib/node/index.js.map +1 -0
  27. package/lib/node/node-diagnostics-provider.d.ts +18 -0
  28. package/lib/node/node-diagnostics-provider.d.ts.map +1 -0
  29. package/lib/node/node-diagnostics-provider.js +68 -0
  30. package/lib/node/node-diagnostics-provider.js.map +1 -0
  31. package/lib/testing/data-server-harness.d.ts +85 -0
  32. package/lib/testing/data-server-harness.d.ts.map +1 -0
  33. package/lib/testing/data-server-harness.js +47 -0
  34. package/lib/testing/data-server-harness.js.map +1 -0
  35. package/lib/testing/index.d.ts +11 -0
  36. package/lib/testing/index.d.ts.map +1 -0
  37. package/lib/testing/index.js +10 -0
  38. package/lib/testing/index.js.map +1 -0
  39. package/package.json +93 -0
  40. package/src/data-server.ts +1282 -0
  41. package/src/default-diagnostics.browser.ts +41 -0
  42. package/src/default-diagnostics.ts +40 -0
  43. package/src/diagnostics-provider.ts +70 -0
  44. package/src/index.ts +15 -0
  45. package/src/node/index.ts +17 -0
  46. package/src/node/node-diagnostics-provider.ts +82 -0
  47. package/src/testing/data-server-harness.ts +147 -0
  48. package/src/testing/index.ts +19 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CrossBreeze, EclipseSource and others.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # `@hydranium/data-server`
2
+
3
+ The typed JSON-RPC data head of [hydranium](../../README.md): it exposes the live
4
+ Langium AST to non-LSP clients — form editors, tree views, code generators — as
5
+ an adopter-defined transfer model over a `vscode-jsonrpc` `MessageConnection`.
6
+ Installed by the server process that already composes
7
+ [`@hydranium/core`](../core); a client needs only
8
+ [`@hydranium/protocol`](../protocol).
9
+
10
+ ## What it gives you
11
+
12
+ - **One class, `DataServer`.** `new DataServer(connection, services, options)`
13
+ self-wires: a single `createRpcProxy` call registers the inbound
14
+ `DataServerProtocol` handlers and builds the outbound `DataClientProtocol`
15
+ proxy on the same wire. It contributes no shared-tier DI bindings — it reads
16
+ exclusively from `ServerSharedServices`, so there is no shared module to
17
+ compose.
18
+ - **A document lifecycle over the shared workspace:** `openModelDocument`,
19
+ `getModelDocument`, `updateModelDocument`, `saveModelDocument`,
20
+ `closeModelDocument`, `watchModelDocument` / `unwatchModelDocument`, and
21
+ `waitForReady` for clients that must not race workspace initialisation.
22
+ - **Push notifications instead of polling:** `onDocumentUpdated` when a
23
+ subscribed document reaches the configured build phase
24
+ (`DataServerOptions.subscriptionPhase`, `DocumentState.Validated` by default),
25
+ `onDocumentSaved` on a separate channel, and `onProjectsChanged` from the
26
+ project registry.
27
+ - **Projects as first-class:** `getProjects` and `getProjectForUri`, answered from
28
+ the framework's `ProjectManager`.
29
+ - **An opt-in reference/naming slice** — `findReferenceCandidates`,
30
+ `resolveReference`, `findNextName` — implemented here but deliberately outside
31
+ the `DataServerProtocol` composition, so a pure data consumer does not pay for
32
+ it. Compose `ReferenceServerProtocol` onto the connection explicitly.
33
+ - **A diagnostics seam,** `DataServerDiagnosticsProvider`, with the Node
34
+ implementation `nodeDataServerDiagnostics()` behind `./node` so the portable
35
+ entry keeps bundling for a browser.
36
+
37
+ The projection itself is not this package's: it delegates to `TransferEncoder`
38
+ and `ModelService` from `@hydranium/core`, so there is no second in-memory model
39
+ to keep in sync.
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ npm install @hydranium/data-server
45
+ ```
46
+
47
+ This package bundles no runtime dependencies. Its peers must be present:
48
+ `@hydranium/core`, `@hydranium/protocol`, `@hydranium/langium`, `vscode-jsonrpc`
49
+ and `vscode-languageserver-textdocument`. You must already have a composed
50
+ hydranium shared services tree and a `MessageConnection` — the socket and stdio
51
+ launchers live in `@hydranium/core/node`, not here.
52
+
53
+ ## Exports
54
+
55
+ | subpath | holds | platform |
56
+ | ----------- | ---------------------------------------------------------------------------------------------------------------- | --------------------------------- |
57
+ | `.` | `DataServer` and its option types, plus the `DataServerDiagnosticsProvider` seam — the whole production surface. | browser-neutral |
58
+ | `./node` | `nodeDataServerDiagnostics()`, the runtime-backed half of the diagnostics seam. | Node-only |
59
+ | `./testing` | `makeDataServerHarness` — a real server driven in-process over a duplex connection pair. | Node-only (`vscode-jsonrpc/node`) |
60
+
61
+ `.` is gated as browser-neutral in CI (`scripts/check-neutral-bundles.mjs`). It
62
+ stays that way through a `browser` field in `package.json` that swaps the
63
+ diagnostics default for a browser twin, so a bundler never follows the
64
+ `@hydranium/core/node` import a Node host resolves — see [what "gated neutral" does and does not promise](../../docs/concepts/browser-hosting.md#a-note-on-what-gated-neutral-does-and-does-not-promise).
65
+ Each subpath also has a `./lib/…` twin for consumers on
66
+ `moduleResolution: "Node"`.
67
+
68
+ ## Getting oriented
69
+
70
+ Construct the head after the shared services tree exists and keep the returned
71
+ instance for `dispose`; it registers its handlers on the connection you pass and
72
+ subscribes to the document builder, the text-document store and the project
73
+ manager for its push notifications. The typed contract a client codes against —
74
+ `DataServerProtocol`, `DataClientProtocol`, the drift-proof method-name lists and
75
+ the port constants — lives in `@hydranium/protocol/data`, and the generic
76
+ `createRpcProxy` / `bindRpcMethods` machinery in `@hydranium/protocol`. The four
77
+ distinct meanings of "document" this head sits between are worth reading first:
78
+ [`docs/concepts/document-layers.md`](../../docs/concepts/document-layers.md). See
79
+ also [`docs/concepts/architecture.md`](../../docs/concepts/architecture.md) and
80
+ [`docs/concepts/head-module-maps.md`](../../docs/concepts/head-module-maps.md).
81
+
82
+ ## Status
83
+
84
+ Alpha — pre-v0, not yet published. The API is not stable and may change without a
85
+ deprecation cycle. See the [repository README](../../README.md) for the current
86
+ status and known limitations.
87
+
88
+ ## License
89
+
90
+ `MIT` — see this package's [`LICENSE`](./LICENSE). Third-party notices for the
91
+ repository are recorded in [`NOTICE.md`](../../NOTICE.md).