@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.
- package/README.md +44 -49
- package/lib/abstract-logger.d.ts +5 -0
- package/lib/abstract-logger.d.ts.map +1 -1
- package/lib/abstract-logger.js +7 -0
- package/lib/abstract-logger.js.map +1 -1
- package/lib/client/data-connection.d.ts +245 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +425 -0
- package/lib/client/data-connection.js.map +1 -0
- package/lib/client/data-events.d.ts +13 -1
- package/lib/client/data-events.d.ts.map +1 -1
- package/lib/client/data-events.js +21 -0
- package/lib/client/data-events.js.map +1 -1
- package/lib/client/data-port.d.ts +44 -27
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +473 -81
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +743 -108
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +14 -9
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +14 -9
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +10 -4
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +12 -6
- package/lib/client/message-relay.js.map +1 -1
- package/lib/client/post-message-transport.d.ts +64 -3
- package/lib/client/post-message-transport.d.ts.map +1 -1
- package/lib/client/post-message-transport.js +175 -1
- package/lib/client/post-message-transport.js.map +1 -1
- package/lib/client/rpc-connection.d.ts +157 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +214 -0
- package/lib/client/rpc-connection.js.map +1 -0
- package/lib/client-ids.d.ts +45 -0
- package/lib/client-ids.d.ts.map +1 -0
- package/lib/client-ids.js +48 -0
- package/lib/client-ids.js.map +1 -0
- package/lib/clock.d.ts +38 -0
- package/lib/clock.d.ts.map +1 -1
- package/lib/clock.js +36 -1
- package/lib/clock.js.map +1 -1
- package/lib/console-logger.d.ts +23 -0
- package/lib/console-logger.d.ts.map +1 -0
- package/lib/console-logger.js +39 -0
- package/lib/console-logger.js.map +1 -0
- package/lib/data/data-protocol-methods.d.ts +4 -4
- package/lib/data/data-protocol-methods.d.ts.map +1 -1
- package/lib/data/data-protocol-methods.js +12 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +132 -41
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +117 -21
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +69 -11
- package/lib/data/requests.d.ts.map +1 -1
- package/lib/debouncer.d.ts.map +1 -1
- package/lib/debouncer.js.map +1 -1
- package/lib/errors.d.ts +187 -29
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +270 -29
- package/lib/errors.js.map +1 -1
- package/lib/glsp-request-model-args.d.ts +16 -0
- package/lib/glsp-request-model-args.d.ts.map +1 -0
- package/lib/glsp-request-model-args.js +19 -0
- package/lib/glsp-request-model-args.js.map +1 -0
- package/lib/glsp-save-model-actions.d.ts +50 -0
- package/lib/glsp-save-model-actions.d.ts.map +1 -0
- package/lib/glsp-save-model-actions.js +28 -0
- package/lib/glsp-save-model-actions.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -1
- package/lib/latency-collector.d.ts +8 -4
- package/lib/latency-collector.d.ts.map +1 -1
- package/lib/latency-collector.js.map +1 -1
- package/lib/logger.d.ts +22 -1
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +31 -3
- package/lib/logger.js.map +1 -1
- package/lib/messages/index.d.ts +30 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +62 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/messages/primitives.d.ts +188 -0
- package/lib/messages/primitives.d.ts.map +1 -0
- package/lib/messages/primitives.js +161 -0
- package/lib/messages/primitives.js.map +1 -0
- package/lib/model-server.d.ts +60 -13
- package/lib/model-server.d.ts.map +1 -1
- package/lib/model-server.js +4 -2
- package/lib/model-server.js.map +1 -1
- package/lib/model-service/base-version.d.ts +64 -0
- package/lib/model-service/base-version.d.ts.map +1 -0
- package/lib/model-service/base-version.js +43 -0
- package/lib/model-service/base-version.js.map +1 -0
- package/lib/model-service/index.d.ts +1 -1
- package/lib/model-service/index.d.ts.map +1 -1
- package/lib/model-service/index.js +4 -5
- package/lib/model-service/index.js.map +1 -1
- package/lib/model-service/reference-candidate.d.ts +5 -3
- package/lib/model-service/reference-candidate.d.ts.map +1 -1
- package/lib/{model-service/args.js → node/index.d.ts} +2 -3
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +29 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/process-memory.d.ts +66 -0
- package/lib/node/process-memory.d.ts.map +1 -0
- package/lib/node/process-memory.js +291 -0
- package/lib/node/process-memory.js.map +1 -0
- package/lib/noop-logger.d.ts.map +1 -1
- package/lib/noop-logger.js.map +1 -1
- package/lib/observable-value.js.map +1 -1
- package/lib/patch-merge.d.ts +35 -32
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +67 -23
- package/lib/patch-merge.js.map +1 -1
- package/lib/profile-session.d.ts +8 -4
- package/lib/profile-session.d.ts.map +1 -1
- package/lib/profile-session.js.map +1 -1
- package/lib/random-uuid.d.ts +14 -0
- package/lib/random-uuid.d.ts.map +1 -0
- package/lib/random-uuid.js +24 -0
- package/lib/random-uuid.js.map +1 -0
- package/lib/reconcile-write.d.ts +65 -0
- package/lib/reconcile-write.d.ts.map +1 -0
- package/lib/reconcile-write.js +67 -0
- package/lib/reconcile-write.js.map +1 -0
- package/lib/rpc/bind-rpc-methods.d.ts +33 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +32 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +10 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +12 -2
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- package/lib/rpc/index.d.ts +1 -0
- package/lib/rpc/index.d.ts.map +1 -1
- package/lib/rpc/index.js +1 -0
- package/lib/rpc/index.js.map +1 -1
- package/lib/rpc/send-by-method-name.d.ts +76 -0
- package/lib/rpc/send-by-method-name.d.ts.map +1 -0
- package/lib/rpc/send-by-method-name.js +120 -0
- package/lib/rpc/send-by-method-name.js.map +1 -0
- package/lib/rpc/wire-prefix.js.map +1 -1
- package/lib/testing/catalogue-audit.d.ts +80 -0
- package/lib/testing/catalogue-audit.d.ts.map +1 -0
- package/lib/testing/catalogue-audit.js +94 -0
- package/lib/testing/catalogue-audit.js.map +1 -0
- package/lib/testing/data-doubles.d.ts +46 -15
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +58 -10
- package/lib/testing/data-doubles.js.map +1 -1
- package/lib/testing/fake-clock.d.ts +9 -1
- package/lib/testing/fake-clock.d.ts.map +1 -1
- package/lib/testing/fake-clock.js +54 -45
- package/lib/testing/fake-clock.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 +5 -2
- package/lib/testing/index.js.map +1 -1
- package/lib/testing/node/duplex-connection.d.ts.map +1 -1
- package/lib/testing/node/duplex-connection.js +3 -2
- package/lib/testing/node/duplex-connection.js.map +1 -1
- package/lib/testing/node/duplex-stream.js.map +1 -1
- package/lib/testing/node/index.d.ts +1 -0
- package/lib/testing/node/index.d.ts.map +1 -1
- package/lib/testing/node/index.js +2 -2
- package/lib/testing/node/index.js.map +1 -1
- package/lib/testing/node/message-port-pair.d.ts +25 -0
- package/lib/testing/node/message-port-pair.d.ts.map +1 -0
- package/lib/testing/node/message-port-pair.js +26 -0
- package/lib/testing/node/message-port-pair.js.map +1 -0
- package/lib/testing/wait-for.d.ts +3 -2
- package/lib/testing/wait-for.d.ts.map +1 -1
- package/lib/testing/wait-for.js +40 -10
- package/lib/testing/wait-for.js.map +1 -1
- package/lib/tracer.d.ts.map +1 -1
- package/lib/tracer.js.map +1 -1
- package/lib/transfer-diagnostic.d.ts +33 -0
- package/lib/transfer-diagnostic.d.ts.map +1 -1
- package/lib/transfer-diagnostic.js +23 -0
- package/lib/transfer-diagnostic.js.map +1 -1
- package/lib/transfer-document.d.ts +70 -32
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +17 -9
- package/lib/transfer-document.js.map +1 -1
- package/lib/uri.d.ts.map +1 -1
- package/lib/uri.js.map +1 -1
- package/lib/util.d.ts +8 -0
- package/lib/util.d.ts.map +1 -1
- package/lib/util.js +32 -0
- package/lib/util.js.map +1 -1
- package/package.json +29 -37
- package/src/abstract-logger.ts +8 -0
- package/src/client/data-connection.ts +520 -0
- package/src/client/data-events.ts +33 -1
- package/src/client/data-port.ts +46 -28
- package/src/client/data-session.ts +951 -126
- package/src/client/index.ts +14 -9
- package/src/client/message-relay.ts +30 -8
- package/src/client/post-message-transport.ts +219 -4
- package/src/client/rpc-connection.ts +281 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +56 -0
- package/src/console-logger.ts +39 -0
- package/src/data/data-protocol-methods.ts +13 -4
- package/src/data/data-server-protocol.ts +157 -41
- package/src/data/events.ts +123 -21
- package/src/data/requests.ts +74 -11
- package/src/errors.ts +322 -36
- package/src/glsp-request-model-args.ts +16 -0
- package/src/glsp-save-model-actions.ts +59 -0
- package/src/index.ts +10 -0
- package/src/latency-collector.ts +8 -3
- package/src/logger.ts +28 -2
- package/src/messages/index.ts +37 -0
- package/src/messages/primitives.ts +271 -0
- package/src/model-server.ts +64 -19
- package/src/model-service/base-version.ts +72 -0
- package/src/model-service/index.ts +4 -5
- package/src/model-service/reference-candidate.ts +5 -3
- package/src/node/index.ts +14 -0
- package/src/node/process-memory.ts +299 -0
- package/src/patch-merge.ts +97 -42
- package/src/profile-session.ts +9 -4
- package/src/random-uuid.ts +21 -0
- package/src/reconcile-write.ts +124 -0
- package/src/rpc/README.md +4 -5
- package/src/rpc/bind-rpc-methods.ts +59 -4
- package/src/rpc/create-rpc-proxy.ts +20 -2
- package/src/rpc/index.ts +1 -0
- package/src/rpc/send-by-method-name.ts +140 -0
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +149 -25
- package/src/testing/fake-clock.ts +62 -47
- package/src/testing/index.ts +5 -2
- package/src/testing/node/duplex-connection.ts +3 -2
- package/src/testing/node/index.ts +2 -2
- package/src/testing/node/message-port-pair.ts +40 -0
- package/src/testing/wait-for.ts +38 -11
- package/src/transfer-diagnostic.ts +40 -0
- package/src/transfer-document.ts +87 -34
- package/src/util.ts +33 -0
- package/lib/model-service/args.d.ts +0 -64
- package/lib/model-service/args.d.ts.map +0 -1
- package/lib/model-service/args.js.map +0 -1
- package/src/model-service/args.ts +0 -67
package/src/transfer-document.ts
CHANGED
|
@@ -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
|
|
16
|
-
*
|
|
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}).
|
|
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
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
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
|
-
|
|
45
|
-
|
|
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 `
|
|
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
|
-
|
|
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.
|
|
109
|
+
return document.model !== undefined;
|
|
68
110
|
}
|
|
69
111
|
|
|
70
112
|
/**
|
|
71
|
-
* The same document with `
|
|
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 `
|
|
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
|
|
87
|
-
*
|
|
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
|
-
|
|
142
|
+
hash: string,
|
|
143
|
+
diagnostics?: TDiagnostic[],
|
|
144
|
+
text?: TextState
|
|
96
145
|
): TransferDocument<TTransfer, TDiagnostic> {
|
|
97
|
-
return {
|
|
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
|
-
}
|