@hydranium/protocol 1.0.0-next.25 → 1.0.0-next.250

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 +44 -49
  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 +64 -19
  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
@@ -9,51 +9,93 @@
9
9
 
10
10
  import type { TransferDiagnostic } from './transfer-diagnostic';
11
11
  import type { TransferElement } from './transfer-element';
12
+ import { asModelVersion, type ModelVersion, type TextVersion } from './model-service/base-version';
13
+
14
+ /** The model a data server built for a document, encoded for the wire. */
15
+ export interface TransferModelSnapshot<TRoot extends TransferElement, TDiagnostic = TransferDiagnostic> {
16
+ root: TRoot;
17
+ /** Absent until the document is validated; `[]` once it is and nothing was found. */
18
+ diagnostics?: TDiagnostic[];
19
+ /**
20
+ * The version of the text `root` was parsed from. A caller that mutates the
21
+ * model sends this back as the `baseVersion` of its write, and the server
22
+ * rejects the write with `ConflictError` once its text has moved past it.
23
+ */
24
+ version: ModelVersion;
25
+ /**
26
+ * The data server's fingerprint of `root` and `diagnostics`, or under its
27
+ * `'text-diagnostics'` strategy of the text `root` was parsed from and
28
+ * `diagnostics`.
29
+ * Independent of `version`; an equal hash also means equally validated.
30
+ */
31
+ hash: string;
32
+ }
33
+
34
+ /** The text a data server held for a document when it sent it. */
35
+ export interface TextState {
36
+ /**
37
+ * The server's version of that text. A `TransferModelSnapshot.version` below it
38
+ * means the model was parsed from older text, and an update at this version
39
+ * or a later one follows.
40
+ */
41
+ version: TextVersion;
42
+ /**
43
+ * What `textHash` makes of the text alone: equal texts hash equal whatever
44
+ * their version or dirty state, across a revert or a server restart that
45
+ * numbers versions afresh.
46
+ */
47
+ hash: string;
48
+ /**
49
+ * Whether the text differs from the file, as the server last knew the file.
50
+ * A later change arrives as `onDocumentDirtyChanged` to a client watching
51
+ * the document.
52
+ */
53
+ dirty: boolean;
54
+ }
12
55
 
13
56
  /**
14
57
  * Wire envelope exchanged between the model-server's data-server head and
15
- * its clients. Carries a transfer-shaped root — never an AST root — plus
16
- * the document's diagnostics in the adopter's wire-diagnostic shape.
58
+ * its clients: the server's model of a document and the text it holds for it,
59
+ * each absent where the server has none.
17
60
  *
18
61
  * The constraint `TTransfer extends TransferElement` pins the type system
19
62
  * to the wire data shape (no `$container` cycles, references as strings;
20
- * see {@link TransferElement}). The paired server-internal envelope is
21
- * `AstDocument<TAst extends AstNode, TDiagnostic>` in
22
- * `@hydranium/core` — same structural shape, different generic
23
- * constraint, used at the AST layer before the `TransferEncoder`
24
- * translation produces a {@link TransferDocument}.
63
+ * see {@link TransferElement}).
25
64
  */
26
65
  export interface TransferDocument<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic> {
27
66
  uri: string;
28
67
  /**
29
- * The document version this snapshot was taken at — sourced from the
30
- * server's text-document version counter. Callers that mutate the
31
- * document subsequently pass this value back as `TransferUpdateArgs.baseVersion`
32
- * (or `TransferSaveArgs.baseVersion`) so the server can detect stale-based
33
- * updates and reject them with `ConflictError`.
34
- *
35
- * See `@hydranium/protocol#errors` for the conflict-detection contract.
36
- */
37
- version: number;
38
- /**
39
- * Absent when the document does not exist — the server answers an unknown URI
40
- * with a shaped envelope rather than an error, so absence is an ordinary
41
- * branch and not a catch. Declared required it reads as a guarantee, and
42
- * every `root.x` compiles into a throw.
68
+ * Absent when the document does not exist: the server answers an unknown
69
+ * URI with a shaped envelope rather than an error, so absence is an
70
+ * ordinary branch and not a catch.
43
71
  */
44
- root?: TTransfer;
45
- diagnostics: TDiagnostic[];
72
+ model?: TransferModelSnapshot<TTransfer, TDiagnostic>;
73
+ /** Absent when the server holds no text for the document. */
74
+ text?: TextState;
46
75
  }
47
76
 
48
77
  /**
49
- * A {@link TransferDocument} the server actually had, so `root` is present.
78
+ * A {@link TransferDocument} the server actually had, so `model` is present.
50
79
  * Narrowed to by {@link TransferDocument.isLoaded} / {@link TransferDocument.assertLoaded}.
51
80
  */
52
81
  export type LoadedTransferDocument<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic> = TransferDocument<
53
82
  TTransfer,
54
83
  TDiagnostic
55
84
  > & {
56
- root: TTransfer;
85
+ model: TransferModelSnapshot<TTransfer, TDiagnostic>;
86
+ };
87
+
88
+ /**
89
+ * What a save or a persist answers: the document, and in `persisted` the
90
+ * version of the text it wrote to the file. That can differ from
91
+ * `model.version` either way, since writes land between the build and the
92
+ * take, so a client marking a version saved takes it from here.
93
+ */
94
+ export type TransferSavedDocument<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic> = TransferDocument<
95
+ TTransfer,
96
+ TDiagnostic
97
+ > & {
98
+ persisted: { version: TextVersion };
57
99
  };
58
100
 
59
101
  export namespace TransferDocument {
@@ -64,13 +106,13 @@ export namespace TransferDocument {
64
106
  export function isLoaded<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(
65
107
  document: TransferDocument<TTransfer, TDiagnostic>
66
108
  ): document is LoadedTransferDocument<TTransfer, TDiagnostic> {
67
- return document.root !== undefined;
109
+ return document.model !== undefined;
68
110
  }
69
111
 
70
112
  /**
71
- * The same document with `root` no longer optional, or a throw. For call
113
+ * The same document with `model` no longer optional, or a throw. For call
72
114
  * sites where absence is a bug rather than a branch; the whole envelope is
73
- * returned because a caller needing `root` usually needs `uri` or `version`
115
+ * returned because a caller needing `model` usually needs `uri` or `text`
74
116
  * with it.
75
117
  */
76
118
  export function assertLoaded<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(
@@ -82,18 +124,29 @@ export namespace TransferDocument {
82
124
  return document;
83
125
  }
84
126
 
127
+ /** The envelope for a document the server does not have. */
128
+ export function absent<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(
129
+ uri: string
130
+ ): TransferDocument<TTransfer, TDiagnostic> {
131
+ return { uri };
132
+ }
133
+
85
134
  /**
86
- * Construct a {@link TransferDocument} envelope. `diagnostics` defaults
87
- * to `[]` so test fixtures, fake protocol implementations, and the
88
- * "no diagnostics yet" code paths don't need to repeat the empty array
89
- * at every call site.
135
+ * Construct a {@link TransferDocument} envelope with a model, its version
136
+ * marked as coming from a read. `diagnostics` absent means not validated.
90
137
  */
91
138
  export function create<TTransfer extends TransferElement, TDiagnostic = TransferDiagnostic>(
92
139
  uri: string,
93
140
  version: number,
94
141
  root: TTransfer,
95
- diagnostics: TDiagnostic[] = []
142
+ hash: string,
143
+ diagnostics?: TDiagnostic[],
144
+ text?: TextState
96
145
  ): TransferDocument<TTransfer, TDiagnostic> {
97
- return { uri, version, root, diagnostics };
146
+ return {
147
+ uri,
148
+ model: { root, version: asModelVersion(version), hash, ...(diagnostics === undefined ? {} : { diagnostics }) },
149
+ ...(text === undefined ? {} : { text })
150
+ };
98
151
  }
99
152
  }
package/src/util.ts CHANGED
@@ -248,3 +248,36 @@ export function getAt<T = unknown>(obj: unknown, path: string[]): T | undefined
248
248
  }
249
249
  return cur as T;
250
250
  }
251
+
252
+ /**
253
+ * A stable, non-cryptographic digest of `text`, equal on every host for equal
254
+ * text: the `TextState.hash` a data server stamps, so a client can
255
+ * hash text of its own to compare. An array is read as its elements joined, so
256
+ * a large text is hashed in parts without concatenating it. It tells whether a
257
+ * text changed, not who could forge one.
258
+ */
259
+ export function textHash(text: string | readonly string[]): string {
260
+ const { high, low } = cyrb53(typeof text === 'string' ? [text] : text);
261
+ return high.toString(16).padStart(8, '0') + low.toString(16).padStart(8, '0');
262
+ }
263
+
264
+ /**
265
+ * The two 32-bit words cyrb53 ends on, each unsigned, for `parts` read as one
266
+ * string. It needs no `node:*` module, so every host runs it.
267
+ */
268
+ function cyrb53(parts: readonly string[]): { readonly high: number; readonly low: number } {
269
+ let h1 = 0xdeadbeef;
270
+ let h2 = 0x41c6ce57;
271
+ for (const part of parts) {
272
+ for (let i = 0; i < part.length; i++) {
273
+ const code = part.charCodeAt(i);
274
+ h1 = Math.imul(h1 ^ code, 2654435761);
275
+ h2 = Math.imul(h2 ^ code, 1597334677);
276
+ }
277
+ }
278
+ h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
279
+ h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
280
+ h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
281
+ h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
282
+ return { high: h2 >>> 0, low: h1 >>> 0 };
283
+ }
@@ -1,64 +0,0 @@
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
- * Argument shapes for the in-process `ModelService` facade — the
11
- * canonical home for the lifecycle operation signatures. Implementation
12
- * lives in `@hydranium/core/langium/model-service`; this protocol
13
- * package owns the types so wire-side projections (the data-server
14
- * protocol in `./data`) can structurally extend them rather than
15
- * mirroring them by hand.
16
- *
17
- * `./model-server.ts` re-exports them, so an import from either path
18
- * resolves.
19
- */
20
- /** Identifies a client-document binding. Every facade operation carries these fields. */
21
- export interface TransferClientArgs {
22
- /** Document URI. */
23
- uri: string;
24
- /** Stable identifier for the client invoking the operation. */
25
- clientId: string;
26
- }
27
- /**
28
- * Update a document's content via the in-process facade. `model` may be
29
- * the structured (transfer-model or AST) root or its serialised textual
30
- * form — implementations decide which is faster on their transport.
31
- * Generic over `T` so adopters parameterise the structured shape against
32
- * their grammar's transfer-model overlay; passing a string is always
33
- * allowed.
34
- */
35
- export interface TransferUpdateArgs<T> extends TransferClientArgs {
36
- /** Structured model root or its serialised textual form. */
37
- model: T | string;
38
- /**
39
- * Optional based-on version: the text-document version this update
40
- * was authored against. When set, the server compares against its
41
- * current text-document version for `uri` and throws
42
- * `ConflictError` on mismatch. Omit to opt out of the gate — mirrors
43
- * LSP's `OptionalVersionedTextDocumentIdentifier` posture, intended
44
- * for headless / CLI / batch tooling without a meaningful based-on
45
- * version.
46
- */
47
- baseVersion?: number;
48
- }
49
- /**
50
- * Persist a document to disk via the in-process facade. Same `model`
51
- * shape as {@link TransferUpdateArgs}.
52
- */
53
- export interface TransferSaveArgs<T> extends TransferClientArgs {
54
- /** Structured model root or its serialised textual form. */
55
- model: T | string;
56
- /**
57
- * Optional based-on version — same semantics as
58
- * {@link TransferUpdateArgs.baseVersion}. `save` delegates the gating
59
- * check to its inner `update`, so this field threads through to the
60
- * same `ConflictError` site.
61
- */
62
- baseVersion?: number;
63
- }
64
- //# sourceMappingURL=args.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/model-service/args.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;GAUG;AAEH,yFAAyF;AACzF,MAAM,WAAW,kBAAkB;IAChC,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IAC9D,4DAA4D;IAC5D,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;IAClB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,kBAAkB;IAC5D,4DAA4D;IAC5D,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC;IAClB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/model-service/args.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF"}
@@ -1,67 +0,0 @@
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
- /**
11
- * Argument shapes for the in-process `ModelService` facade — the
12
- * canonical home for the lifecycle operation signatures. Implementation
13
- * lives in `@hydranium/core/langium/model-service`; this protocol
14
- * package owns the types so wire-side projections (the data-server
15
- * protocol in `./data`) can structurally extend them rather than
16
- * mirroring them by hand.
17
- *
18
- * `./model-server.ts` re-exports them, so an import from either path
19
- * resolves.
20
- */
21
-
22
- /** Identifies a client-document binding. Every facade operation carries these fields. */
23
- export interface TransferClientArgs {
24
- /** Document URI. */
25
- uri: string;
26
- /** Stable identifier for the client invoking the operation. */
27
- clientId: string;
28
- }
29
-
30
- /**
31
- * Update a document's content via the in-process facade. `model` may be
32
- * the structured (transfer-model or AST) root or its serialised textual
33
- * form — implementations decide which is faster on their transport.
34
- * Generic over `T` so adopters parameterise the structured shape against
35
- * their grammar's transfer-model overlay; passing a string is always
36
- * allowed.
37
- */
38
- export interface TransferUpdateArgs<T> extends TransferClientArgs {
39
- /** Structured model root or its serialised textual form. */
40
- model: T | string;
41
- /**
42
- * Optional based-on version: the text-document version this update
43
- * was authored against. When set, the server compares against its
44
- * current text-document version for `uri` and throws
45
- * `ConflictError` on mismatch. Omit to opt out of the gate — mirrors
46
- * LSP's `OptionalVersionedTextDocumentIdentifier` posture, intended
47
- * for headless / CLI / batch tooling without a meaningful based-on
48
- * version.
49
- */
50
- baseVersion?: number;
51
- }
52
-
53
- /**
54
- * Persist a document to disk via the in-process facade. Same `model`
55
- * shape as {@link TransferUpdateArgs}.
56
- */
57
- export interface TransferSaveArgs<T> extends TransferClientArgs {
58
- /** Structured model root or its serialised textual form. */
59
- model: T | string;
60
- /**
61
- * Optional based-on version — same semantics as
62
- * {@link TransferUpdateArgs.baseVersion}. `save` delegates the gating
63
- * check to its inner `update`, so this field threads through to the
64
- * same `ConflictError` site.
65
- */
66
- baseVersion?: number;
67
- }