@hydranium/data-server 1.0.0-next.28 → 1.0.0-next.281
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -73
- package/lib/data-server.d.ts +428 -291
- package/lib/data-server.d.ts.map +1 -1
- package/lib/data-server.js +716 -502
- package/lib/data-server.js.map +1 -1
- package/lib/messages/index.d.ts +1 -1
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +1 -1
- package/lib/messages/index.js.map +1 -1
- package/lib/node/node-diagnostics-provider.d.ts.map +1 -1
- package/lib/node/node-diagnostics-provider.js +2 -1
- package/lib/node/node-diagnostics-provider.js.map +1 -1
- package/lib/testing/data-server-harness.d.ts +31 -14
- package/lib/testing/data-server-harness.d.ts.map +1 -1
- package/lib/testing/data-server-harness.js +8 -3
- package/lib/testing/data-server-harness.js.map +1 -1
- package/lib/testing/index.d.ts +1 -0
- package/lib/testing/index.d.ts.map +1 -1
- package/lib/testing/index.js.map +1 -1
- package/package.json +32 -44
- package/src/data-server.ts +865 -542
- package/src/messages/index.ts +8 -1
- package/src/node/node-diagnostics-provider.ts +2 -8
- package/src/testing/data-server-harness.ts +55 -26
- package/src/testing/index.ts +5 -2
package/README.md
CHANGED
|
@@ -1,42 +1,21 @@
|
|
|
1
1
|
# `@hydranium/data-server`
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[`@hydranium/core`](../core); a client needs only
|
|
8
|
-
[`@hydranium/protocol`](../protocol).
|
|
3
|
+
The data head of [Hydranium](https://github.com/eclipse-emfcloud/hydranium): it
|
|
4
|
+
serves your model over JSON-RPC to clients other than a text editor, such as
|
|
5
|
+
forms, tree views and code generators. Install it in the server that composes
|
|
6
|
+
`@hydranium/core`; a client talks to it through `@hydranium/protocol`.
|
|
9
7
|
|
|
10
8
|
## What it gives you
|
|
11
9
|
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
`
|
|
20
|
-
`
|
|
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.
|
|
10
|
+
- Typed reads, updates and saves of documents in the shared workspace, as your
|
|
11
|
+
transfer model. An edit from a data client reaches the other heads.
|
|
12
|
+
- Notifications when a document is rebuilt, saved or deleted, so a client
|
|
13
|
+
never polls.
|
|
14
|
+
- Your own methods on the same connection, through a `DataServer` subclass and
|
|
15
|
+
its `additionalMethods` option.
|
|
16
|
+
- An optional reference and naming slice: pass
|
|
17
|
+
`REFERENCE_SERVER_PROTOCOL_METHODS` from `@hydranium/protocol/data` in
|
|
18
|
+
`additionalMethods`.
|
|
40
19
|
|
|
41
20
|
## Install
|
|
42
21
|
|
|
@@ -44,48 +23,49 @@ to keep in sync.
|
|
|
44
23
|
npm install @hydranium/data-server
|
|
45
24
|
```
|
|
46
25
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
hydranium
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
`
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
[
|
|
26
|
+
| Peer | Range |
|
|
27
|
+
| ------------------------------------ | ------------- |
|
|
28
|
+
| `@hydranium/core` | `^1.0.0-next` |
|
|
29
|
+
| `@hydranium/langium` | `^1.0.0-next` |
|
|
30
|
+
| `@hydranium/protocol` | `^1.0.0-next` |
|
|
31
|
+
| `vscode-jsonrpc` | `^9.0.0` |
|
|
32
|
+
| `vscode-languageserver-textdocument` | `^1.0.12` |
|
|
33
|
+
|
|
34
|
+
## Wiring
|
|
35
|
+
|
|
36
|
+
The head adds no services module: it reads the shared services you composed
|
|
37
|
+
with `@hydranium/core`.
|
|
38
|
+
|
|
39
|
+
1. Start a launcher from `@hydranium/core/node`: `startSocketServer` beside the
|
|
40
|
+
LSP head, with `publishPortOnLspConnection` to tell the client its port, or
|
|
41
|
+
`startStdioServer` for a data head alone.
|
|
42
|
+
2. In its connection callback, create `new DataServer(connection, shared)`. It
|
|
43
|
+
cleans up when the connection closes.
|
|
44
|
+
|
|
45
|
+
See *Add a data-server method* and *Connect a data client* in
|
|
46
|
+
[Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
|
|
47
|
+
|
|
48
|
+
## Entry points
|
|
49
|
+
|
|
50
|
+
| Subpath | Use it for | Runs in |
|
|
51
|
+
| ------------ | ---------------------------------------------------------- | --------------- |
|
|
52
|
+
| `.` | `DataServer`, its options, and the diagnostics seam | browser-neutral |
|
|
53
|
+
| `./node` | The Node implementation of the diagnostics seam | Node-only |
|
|
54
|
+
| `./messages` | The codes of the messages this package raises | browser-neutral |
|
|
55
|
+
| `./testing` | A harness that drives a real data head in-process | Node-only |
|
|
56
|
+
|
|
57
|
+
The subpaths need a TypeScript `moduleResolution` that reads `exports`
|
|
58
|
+
(`NodeNext` or `Bundler`); see *Requirements* in
|
|
59
|
+
[Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
|
|
81
60
|
|
|
82
61
|
## Status
|
|
83
62
|
|
|
84
|
-
Alpha
|
|
85
|
-
|
|
86
|
-
|
|
63
|
+
Alpha: every release is a prerelease that may break the API, so pin an exact
|
|
64
|
+
version. Guides and known limitations:
|
|
65
|
+
[Adopting Hydranium](https://github.com/eclipse-emfcloud/hydranium/blob/main/docs/ADOPTING.md).
|
|
87
66
|
|
|
88
67
|
## License
|
|
89
68
|
|
|
90
|
-
`MIT` — see this package's [`LICENSE`](./LICENSE)
|
|
91
|
-
|
|
69
|
+
`MIT` — see this package's [`LICENSE`](./LICENSE), and the repository
|
|
70
|
+
[`NOTICE.md`](https://github.com/eclipse-emfcloud/hydranium/blob/main/NOTICE.md)
|
|
71
|
+
for third-party notices.
|