@hydranium/protocol 1.0.0-next.18 → 1.0.0-next.180
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 +35 -1
- package/lib/abstract-logger.d.ts.map +1 -1
- package/lib/abstract-logger.js.map +1 -1
- package/lib/client/data-connection.d.ts +157 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +236 -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 +25 -23
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +440 -78
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +697 -106
- package/lib/client/data-session.js.map +1 -1
- package/lib/client/index.d.ts +13 -8
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +13 -8
- package/lib/client/index.js.map +1 -1
- package/lib/client/message-relay.d.ts +9 -3
- package/lib/client/message-relay.d.ts.map +1 -1
- package/lib/client/message-relay.js +11 -5
- 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 +149 -0
- package/lib/client/rpc-connection.d.ts.map +1 -0
- package/lib/client/rpc-connection.js +202 -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/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 +11 -1
- package/lib/data/data-protocol-methods.js.map +1 -1
- package/lib/data/data-server-protocol.d.ts +111 -31
- package/lib/data/data-server-protocol.d.ts.map +1 -1
- package/lib/data/events.d.ts +103 -14
- package/lib/data/events.d.ts.map +1 -1
- package/lib/data/requests.d.ts +67 -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 +163 -17
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +219 -22
- package/lib/errors.js.map +1 -1
- 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 +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -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.js.map +1 -1
- package/lib/messages/index.d.ts +29 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +58 -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/based-on.d.ts +57 -0
- package/lib/model-service/based-on.d.ts.map +1 -0
- package/lib/model-service/based-on.js +37 -0
- package/lib/model-service/based-on.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/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 +28 -27
- package/lib/patch-merge.d.ts.map +1 -1
- package/lib/patch-merge.js +66 -22
- 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/rpc/bind-rpc-methods.d.ts +29 -3
- package/lib/rpc/bind-rpc-methods.d.ts.map +1 -1
- package/lib/rpc/bind-rpc-methods.js +22 -3
- package/lib/rpc/bind-rpc-methods.js.map +1 -1
- package/lib/rpc/create-rpc-proxy.d.ts +7 -0
- package/lib/rpc/create-rpc-proxy.d.ts.map +1 -1
- package/lib/rpc/create-rpc-proxy.js +6 -1
- package/lib/rpc/create-rpc-proxy.js.map +1 -1
- 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 +13 -12
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +19 -5
- 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 +4 -1
- package/lib/testing/index.js.map +1 -1
- 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.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 +34 -5
- package/lib/transfer-document.d.ts.map +1 -1
- package/lib/transfer-document.js +14 -1
- 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 +27 -18
- package/src/client/data-connection.ts +314 -0
- package/src/client/data-events.ts +33 -1
- package/src/client/data-port.ts +26 -24
- package/src/client/data-session.ts +881 -123
- package/src/client/index.ts +13 -8
- package/src/client/message-relay.ts +29 -7
- package/src/client/post-message-transport.ts +219 -4
- package/src/client/rpc-connection.ts +268 -0
- package/src/client-ids.ts +49 -0
- package/src/clock.ts +56 -0
- package/src/data/data-protocol-methods.ts +11 -3
- package/src/data/data-server-protocol.ts +132 -31
- package/src/data/events.ts +109 -14
- package/src/data/requests.ts +71 -11
- package/src/errors.ts +259 -24
- package/src/glsp-save-model-actions.ts +59 -0
- package/src/index.ts +6 -0
- package/src/latency-collector.ts +8 -3
- package/src/messages/index.ts +36 -0
- package/src/messages/primitives.ts +271 -0
- package/src/model-server.ts +63 -18
- package/src/model-service/based-on.ts +63 -0
- package/src/model-service/index.ts +4 -5
- package/src/patch-merge.ts +90 -37
- package/src/profile-session.ts +9 -4
- package/src/rpc/bind-rpc-methods.ts +49 -4
- package/src/rpc/create-rpc-proxy.ts +14 -1
- package/src/testing/catalogue-audit.ts +111 -0
- package/src/testing/data-doubles.ts +42 -17
- package/src/testing/fake-clock.ts +62 -47
- package/src/testing/index.ts +4 -1
- package/src/testing/node/index.ts +2 -2
- package/src/testing/node/message-port-pair.ts +40 -0
- package/src/transfer-diagnostic.ts +40 -0
- package/src/transfer-document.ts +41 -6
- 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 +0 -11
- package/lib/model-service/args.js.map +0 -1
- package/src/model-service/args.ts +0 -67
package/lib/model-server.d.ts
CHANGED
|
@@ -12,8 +12,14 @@
|
|
|
12
12
|
* language identifier — consumers parameterise the document/root types
|
|
13
13
|
* over `TRoot`.
|
|
14
14
|
*/
|
|
15
|
-
import type { TransferClientArgs } from './model-service/args';
|
|
16
15
|
import type { ReferenceCandidate } from './model-service/reference-candidate';
|
|
16
|
+
/** Identifies a client-document binding. */
|
|
17
|
+
export interface TransferClientArgs {
|
|
18
|
+
/** Document URI. */
|
|
19
|
+
uri: string;
|
|
20
|
+
/** Stable identifier for the client invoking the operation. */
|
|
21
|
+
clientId: string;
|
|
22
|
+
}
|
|
17
23
|
/** Open a document on behalf of a client. */
|
|
18
24
|
export interface OpenModelArgs extends TransferClientArgs {
|
|
19
25
|
/**
|
|
@@ -35,19 +41,43 @@ export interface OpenModelArgs extends TransferClientArgs {
|
|
|
35
41
|
* means read from the filesystem, which is the normal case.
|
|
36
42
|
*
|
|
37
43
|
* Honoured only on the first open of a URI: opening an already-open document
|
|
38
|
-
*
|
|
39
|
-
* through the update path instead.
|
|
44
|
+
* attaches the caller to the existing shared entry and does not replace its
|
|
45
|
+
* content with this seed. Write through the update path instead. The open
|
|
46
|
+
* response reads the current shared content after registration; a textual
|
|
47
|
+
* `didOpen` attach may separately refresh the build.
|
|
40
48
|
*/
|
|
41
49
|
text?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Kept on the server for this client's open until it closes, for the
|
|
52
|
+
* server's own open path to read. Only a client session's open keeps them,
|
|
53
|
+
* and a repeat open keeps the first open's.
|
|
54
|
+
*/
|
|
55
|
+
options?: object;
|
|
42
56
|
}
|
|
43
57
|
/** Close a previously-opened document for the client. */
|
|
44
58
|
export interface CloseModelArgs extends TransferClientArgs {
|
|
45
59
|
}
|
|
46
60
|
export interface TransferUpdatedEvent<TDocument> {
|
|
47
61
|
document: TDocument;
|
|
62
|
+
/**
|
|
63
|
+
* The client whose write this event echoes: the author of the version on a
|
|
64
|
+
* `'changed'`, and the unknown-client id on a `'rebuilt'`, which echoes no
|
|
65
|
+
* write. A recipient compares it against its own id to recognise its echo.
|
|
66
|
+
*/
|
|
48
67
|
sourceClientId: string;
|
|
49
|
-
/** See `
|
|
50
|
-
reason: 'changed' | '
|
|
68
|
+
/** See `TransferDocumentUpdateReason` in `./data/events` for the canonical reason set + semantics. */
|
|
69
|
+
reason: 'changed' | 'rebuilt' | 'saved';
|
|
70
|
+
/**
|
|
71
|
+
* The client whose write caused the build that produced this event, or the
|
|
72
|
+
* unknown-client id when no single client's did. On a `'changed'` it is the
|
|
73
|
+
* version's author. A `'rebuilt'` names the writer of another document, so
|
|
74
|
+
* it is a cause, never an echo: its diagnostics and references are new to
|
|
75
|
+
* that writer too.
|
|
76
|
+
*
|
|
77
|
+
* In-process only: the data head does not send it, and an event built
|
|
78
|
+
* elsewhere may leave it out, which a reader takes as "not known".
|
|
79
|
+
*/
|
|
80
|
+
causedBy?: string;
|
|
51
81
|
}
|
|
52
82
|
export interface TransferSavedEvent<TDocument> {
|
|
53
83
|
/** The document as persisted — the state that reached disk, not the state at request time. */
|
|
@@ -114,10 +144,10 @@ export declare function isElementSource(object: unknown): object is ElementSourc
|
|
|
114
144
|
/** An element of a document that does not yet exist on disk — used during element creation flows. */
|
|
115
145
|
export interface SyntheticSource {
|
|
116
146
|
/**
|
|
117
|
-
* The document the element would belong to.
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
147
|
+
* The document the element would belong to. It need not be loaded, or
|
|
148
|
+
* exist — an unloaded URI materialises a transient empty document, so a
|
|
149
|
+
* folder is a valid anchor. A URI that IS loaded contributes that
|
|
150
|
+
* document's parse root as the container, putting its contents in scope.
|
|
121
151
|
*/
|
|
122
152
|
uri: string;
|
|
123
153
|
/**
|
|
@@ -126,6 +156,16 @@ export interface SyntheticSource {
|
|
|
126
156
|
* it is what scoping filters candidates against.
|
|
127
157
|
*/
|
|
128
158
|
type: string;
|
|
159
|
+
/**
|
|
160
|
+
* The grammar the element will belong to, as a language id.
|
|
161
|
+
*
|
|
162
|
+
* Optional because `uri` and `type` each answer on their own when
|
|
163
|
+
* unambiguous. Set it when neither is: a URI naming no file carries no
|
|
164
|
+
* extension to route on, and a `type` two grammars can produce identifies
|
|
165
|
+
* neither. Unset, such a source reaches the server's own policy, which
|
|
166
|
+
* answers the same way for every caller.
|
|
167
|
+
*/
|
|
168
|
+
language?: string;
|
|
129
169
|
}
|
|
130
170
|
export declare function isSyntheticSource(object: unknown): object is SyntheticSource;
|
|
131
171
|
/**
|
|
@@ -135,7 +175,7 @@ export declare function isSyntheticSource(object: unknown): object is SyntheticS
|
|
|
135
175
|
export declare namespace ReferenceSource {
|
|
136
176
|
function document(uri: string): DocumentSource;
|
|
137
177
|
function element(name: string, type?: string): ElementSource;
|
|
138
|
-
function synthetic(uri: string, type: string): SyntheticSource;
|
|
178
|
+
function synthetic(uri: string, type: string, language?: string): SyntheticSource;
|
|
139
179
|
}
|
|
140
180
|
/**
|
|
141
181
|
* One step in a synthetic navigation path from a {@link ReferenceSource}
|
|
@@ -329,9 +369,10 @@ export interface FindNextNameArgs {
|
|
|
329
369
|
*/
|
|
330
370
|
uri: string;
|
|
331
371
|
/**
|
|
332
|
-
* The AST `$type` of the element being named. Collisions are
|
|
333
|
-
* among elements of that
|
|
334
|
-
*
|
|
372
|
+
* The AST `$type` of the element being named. Collisions are looked for
|
|
373
|
+
* among elements of that type and of any subtype of it, so a supertype
|
|
374
|
+
* names a uniqueness scope its concrete types share; the returned name may
|
|
375
|
+
* still be taken by an element outside that hierarchy.
|
|
335
376
|
*/
|
|
336
377
|
type: string;
|
|
337
378
|
/**
|
|
@@ -348,5 +389,11 @@ export interface FindNextNameArgs {
|
|
|
348
389
|
* See {@link NameTier} for what each tier covers.
|
|
349
390
|
*/
|
|
350
391
|
tier?: NameTier;
|
|
392
|
+
/**
|
|
393
|
+
* The grammar to name under, routed as {@link SyntheticSource.language} —
|
|
394
|
+
* this call builds one. A caller that sets it there must set it here, or
|
|
395
|
+
* candidates and the name it proposes come from different grammars.
|
|
396
|
+
*/
|
|
397
|
+
language?: string;
|
|
351
398
|
}
|
|
352
399
|
//# sourceMappingURL=model-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-server.d.ts","sourceRoot":"","sources":["../src/model-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"model-server.d.ts","sourceRoot":"","sources":["../src/model-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAM9E,4CAA4C;AAC5C,MAAM,WAAW,kBAAkB;IAChC,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;CACnB;AAED,6CAA6C;AAC7C,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACtD;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,yDAAyD;AAEzD,MAAM,WAAW,cAAe,SAAQ,kBAAkB;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E/F;CACH;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEtD,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC9B;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/lib/model-server.js
CHANGED
|
@@ -47,8 +47,10 @@ var ReferenceSource;
|
|
|
47
47
|
return { name, type };
|
|
48
48
|
}
|
|
49
49
|
ReferenceSource.element = element;
|
|
50
|
-
function synthetic(uri, type) {
|
|
51
|
-
|
|
50
|
+
function synthetic(uri, type, language) {
|
|
51
|
+
// The key is omitted rather than set to `undefined`, so a source built
|
|
52
|
+
// without a language stays deep-equal to the two-argument form.
|
|
53
|
+
return language === undefined ? { uri, type } : { uri, type, language };
|
|
52
54
|
}
|
|
53
55
|
ReferenceSource.synthetic = synthetic;
|
|
54
56
|
})(ReferenceSource || (exports.ReferenceSource = ReferenceSource = {}));
|
package/lib/model-server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-server.js","sourceRoot":"","sources":["../src/model-server.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"model-server.js","sourceRoot":"","sources":["../src/model-server.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;AA8HlF;;;;GAIG;AACH,0BAAiC,MAAe;IAC7C,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC;AACtG,CAA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,IAAI,CAAC,OAAyB,EAAE,SAA6B;QAC1E,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,CAAC;IACjD,CAAC;IAFe,iBAAA,IAAI,OAEnB,CAAA;AACJ,CAAC,EAlBgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QAkBhC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
declare const snapshotMarker: unique symbol;
|
|
10
|
+
/**
|
|
11
|
+
* A text-document version that came out of a SNAPSHOT read: a document
|
|
12
|
+
* envelope's `version`, which cannot move once the envelope exists.
|
|
13
|
+
*
|
|
14
|
+
* A plain number at runtime, usable anywhere a number is, and it travels the
|
|
15
|
+
* wire as one. The marker exists only so the compiler can tell it apart from a
|
|
16
|
+
* version read off a LIVE document, which is the same number type and is the
|
|
17
|
+
* defect the conflict gate exists to prevent: read at write time it is whatever
|
|
18
|
+
* the server is at now, which is the number the gate is about to compare it
|
|
19
|
+
* against, so the gate passes unconditionally and a concurrent edit is
|
|
20
|
+
* overwritten with nothing logged.
|
|
21
|
+
*/
|
|
22
|
+
export type SnapshotVersion = number & {
|
|
23
|
+
readonly [snapshotMarker]: true;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* What a write declares it was based on: a version from a snapshot read, or
|
|
27
|
+
* `'anything'`.
|
|
28
|
+
*
|
|
29
|
+
* `'anything'` is a precondition that always holds — the write accepts whatever
|
|
30
|
+
* the server currently has, and therefore overwrites it. It is the honest
|
|
31
|
+
* answer wherever the write was authored against no particular server version,
|
|
32
|
+
* and a lie anywhere a reader handed the writer a document. The field carrying
|
|
33
|
+
* it is required, so an ungated write is a word someone chose rather than a
|
|
34
|
+
* field someone forgot.
|
|
35
|
+
*/
|
|
36
|
+
export type BasedOn = SnapshotVersion | 'anything';
|
|
37
|
+
/**
|
|
38
|
+
* Whether `basedOn` names a version, and so arms the gate.
|
|
39
|
+
*
|
|
40
|
+
* Branch on this rather than on `basedOn !== 'anything'`, which reads as "not
|
|
41
|
+
* based on anything" — the opposite of what the branch tests.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isSnapshotVersion(basedOn: BasedOn): basedOn is SnapshotVersion;
|
|
44
|
+
/**
|
|
45
|
+
* Mark a version as having come from a snapshot read.
|
|
46
|
+
*
|
|
47
|
+
* **For the envelope constructors, not for callers.** Every door that builds a
|
|
48
|
+
* document envelope applies it on the way in, so anything a read returns
|
|
49
|
+
* already carries it and a writer never needs this. A caller reaching for it is
|
|
50
|
+
* asserting a provenance the compiler was about to deny — the read-late defect
|
|
51
|
+
* written out where a reviewer can see it.
|
|
52
|
+
*/
|
|
53
|
+
export declare function asSnapshotVersion(version: number): SnapshotVersion;
|
|
54
|
+
/** A snapshot version no write can match, so a write based on it conflicts. */
|
|
55
|
+
export declare const NO_MATCHING_VERSION: SnapshotVersion;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=based-on.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"based-on.d.ts","sourceRoot":"","sources":["../../src/model-service/based-on.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,CAAC,MAAM,cAAc,EAAE,OAAO,MAAM,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAE3E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,UAAU,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,CAE9E;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAElE;AAED,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,EAAE,eAAuC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.NO_MATCHING_VERSION = void 0;
|
|
12
|
+
exports.isSnapshotVersion = isSnapshotVersion;
|
|
13
|
+
exports.asSnapshotVersion = asSnapshotVersion;
|
|
14
|
+
/**
|
|
15
|
+
* Whether `basedOn` names a version, and so arms the gate.
|
|
16
|
+
*
|
|
17
|
+
* Branch on this rather than on `basedOn !== 'anything'`, which reads as "not
|
|
18
|
+
* based on anything" — the opposite of what the branch tests.
|
|
19
|
+
*/
|
|
20
|
+
function isSnapshotVersion(basedOn) {
|
|
21
|
+
return typeof basedOn === 'number';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Mark a version as having come from a snapshot read.
|
|
25
|
+
*
|
|
26
|
+
* **For the envelope constructors, not for callers.** Every door that builds a
|
|
27
|
+
* document envelope applies it on the way in, so anything a read returns
|
|
28
|
+
* already carries it and a writer never needs this. A caller reaching for it is
|
|
29
|
+
* asserting a provenance the compiler was about to deny — the read-late defect
|
|
30
|
+
* written out where a reviewer can see it.
|
|
31
|
+
*/
|
|
32
|
+
function asSnapshotVersion(version) {
|
|
33
|
+
return version;
|
|
34
|
+
}
|
|
35
|
+
/** A snapshot version no write can match, so a write based on it conflicts. */
|
|
36
|
+
exports.NO_MATCHING_VERSION = asSnapshotVersion(-1);
|
|
37
|
+
//# sourceMappingURL=based-on.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"based-on.js","sourceRoot":"","sources":["../../src/model-service/based-on.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;AA+BlF;;;;;GAKG;AACH,2BAAkC,OAAgB;IAC/C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC;AACtC,CAAC;AAED;;;;;;;;GAQG;AACH,2BAAkC,OAAe;IAC9C,OAAO,OAA0B,CAAC;AACrC,CAAC;AAED,+EAA+E;AAClE,QAAA,mBAAmB,GAAoB,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAMlF,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
|
|
@@ -22,10 +22,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
22
22
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
__exportStar(require("./args"), exports);
|
|
25
|
+
// Generic payload types the data protocol shares with core: the based-on
|
|
26
|
+
// version, which the server's model service checks writes against, and the
|
|
27
|
+
// reference candidates, which core's scope and completion code produce.
|
|
28
|
+
__exportStar(require("./based-on"), exports);
|
|
30
29
|
__exportStar(require("./reference-candidate"), exports);
|
|
31
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model-service/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,yEAAyE;AACzE,2EAA2E;AAC3E,wEAAwE;AAExE,6CAA2B;AAC3B,wDAAsC"}
|
package/lib/noop-logger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop-logger.d.ts","sourceRoot":"","sources":["../src/noop-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAEtD;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,cAAe,YAAW,MAAM;IAC7D,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"noop-logger.d.ts","sourceRoot":"","sources":["../src/noop-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAEtD;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,cAAe,YAAW,MAAM;IAC7D,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAElG;IAEQ,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAGnC;IAED,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGxC;CACH"}
|
package/lib/noop-logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop-logger.js","sourceRoot":"","sources":["../src/noop-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,uDAAmD;AAGnD;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"noop-logger.js","sourceRoot":"","sources":["../src/noop-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,uDAAmD;AAGnD;;;;;;;;GAQG;AACH,gBAAwB,SAAQ,gCAAc;IACjC,IAAI,CAAC,MAAgB,EAAE,MAAc,EAAE,QAAgB,EAAE,KAAyB;QACzF,qCAAqC;IACxC,CAAC;IAEQ,OAAO,CAAC,IAAY;QAC1B,qEAAqE;QACrE,OAAO,IAAI,CAAC;IACf,CAAC;IAES,MAAM,CAAC,SAAiB;QAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAA+C,CAAC;QACtE,OAAO,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observable-value.js","sourceRoot":"","sources":["../src/observable-value.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF
|
|
1
|
+
{"version":3,"file":"observable-value.js","sourceRoot":"","sources":["../src/observable-value.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;AA6ClF,MAAM,eAAe,GAAe,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;AAEhF,6EAA6E;AAC7E,MAAM,WAAW,GAAiB,GAAG,EAAE,CAAC,eAAe,CAAC;AAExD;;;;;GAKG;AACH,2BAAqC,KAA8B;IAChE,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/C,OAAO,KAAK,CAAC;IAChB,CAAC;IACD,MAAM,SAAS,GAAG,KAAoC,CAAC;IACvD,OAAO,OAAO,IAAI,SAAS,IAAI,OAAO,SAAS,CAAC,QAAQ,KAAK,UAAU,CAAC;AAC3E,CAAC;AAED,IAAiB,eAAe,CAoB/B;AApBD,WAAiB,eAAe;IAC7B;;;;;OAKG;IACH,SAAgB,EAAE,CAAI,KAAQ;QAC3B,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAuB,EAAE,CAAC;IACvD,CAAC;IAFe,gBAAA,EAAE,KAEjB,CAAA;IAED;;;;;OAKG;IACH,SAAgB,IAAI,CAAI,KAA8B;QACnD,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC;IAFe,gBAAA,IAAI,OAEnB,CAAA;AACJ,CAAC,EApBgB,eAAe,aAAf,eAAe,GAAf,eAAe,QAoB/B"}
|
package/lib/patch-merge.d.ts
CHANGED
|
@@ -8,58 +8,58 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { type Operation as JsonPatchOperation } from 'fast-json-patch';
|
|
10
10
|
/**
|
|
11
|
-
* Augment a user-intent JSON patch (computed `
|
|
11
|
+
* Augment a user-intent JSON patch (computed `base → ours`) with
|
|
12
12
|
* `test` ops so a strict `applyPatch` against freshly-fetched server state
|
|
13
13
|
* fails loudly when a foreign writer changed a path the user also changed.
|
|
14
14
|
*
|
|
15
15
|
* `fast-json-patch`'s `validateOperation: true` validates op structure and
|
|
16
16
|
* path resolvability but NOT the pre-existing value — a plain `replace` /
|
|
17
17
|
* `remove` silently overwrites whatever the foreign writer put there. For each
|
|
18
|
-
* `replace` / `remove` op we prepend a `test` op carrying the
|
|
18
|
+
* `replace` / `remove` op we prepend a `test` op carrying the base value at
|
|
19
19
|
* that path, so a same-path divergence becomes a `TEST_OPERATION_FAILED` throw.
|
|
20
20
|
* The caller treats that as a real field-level conflict (drop + refetch) rather
|
|
21
21
|
* than silently clobbering the foreign edit.
|
|
22
22
|
*
|
|
23
|
-
* `add` ops
|
|
24
|
-
* to test
|
|
23
|
+
* `add` ops get no `test` op: the path is new, so there is no base value
|
|
24
|
+
* to test. {@link reconcileByPatchReplay} checks them against theirs
|
|
25
|
+
* instead; a caller applying this patch itself does not get that check.
|
|
25
26
|
*
|
|
26
27
|
* Used behind the framework's `ConflictError` contract by every reconcile
|
|
27
28
|
* path — the GLSP recording command's undo/redo and forward-write, via
|
|
28
29
|
* {@link ReconcilingConflictResolver}, and an adopter's form-widget save — so
|
|
29
30
|
* they share one collision-detection rule.
|
|
30
31
|
*/
|
|
31
|
-
export declare function augmentWithTestOps(
|
|
32
|
+
export declare function augmentWithTestOps(base: object, userPatch: ReadonlyArray<JsonPatchOperation>): JsonPatchOperation[];
|
|
32
33
|
/**
|
|
33
|
-
* Outcome of {@link reconcileByPatchReplay}. The caller persists
|
|
34
|
-
*
|
|
35
|
-
* own fallback (e.g. force-retry) on `no-op` / `unavailable`.
|
|
34
|
+
* Outcome of {@link reconcileByPatchReplay}. The caller persists `merged` and
|
|
35
|
+
* takes it as the new base, drops + surfaces the `theirs` root on `conflict`, and
|
|
36
|
+
* decides its own fallback (e.g. force-retry) on `no-op` / `unavailable`.
|
|
36
37
|
*/
|
|
37
38
|
export type ReconcileOutcome<T> = {
|
|
38
39
|
/** The replay succeeded: the foreign writer touched no path the user did. */
|
|
39
40
|
status: 'merged';
|
|
40
41
|
/**
|
|
41
|
-
* A
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* had.
|
|
42
|
+
* A new root built on theirs, carrying both intents. It is NOT the
|
|
43
|
+
* caller's `ours` root — take this value as the new base, or the next
|
|
44
|
+
* write diffs against state the server never had.
|
|
45
45
|
*/
|
|
46
46
|
merged: T;
|
|
47
47
|
} | {
|
|
48
48
|
/**
|
|
49
|
-
* The user's root already equalled the
|
|
49
|
+
* The user's root already equalled the base, so the version gate
|
|
50
50
|
* fired on drift that changed nothing. No refetch was performed and
|
|
51
51
|
* there is nothing to persist — retrying the same write reproduces it.
|
|
52
52
|
*/
|
|
53
53
|
status: 'no-op';
|
|
54
54
|
} | {
|
|
55
|
-
/**
|
|
55
|
+
/** User and foreign writer changed one path, or both added the same element or key. */
|
|
56
56
|
status: 'conflict';
|
|
57
57
|
/**
|
|
58
58
|
* The server's current root, refetched and unmodified — the user's
|
|
59
59
|
* intent was NOT applied to it. Surface it and drop the write; treating
|
|
60
60
|
* it as a merge result silently discards what the user typed.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
theirs: T;
|
|
63
63
|
} | {
|
|
64
64
|
/**
|
|
65
65
|
* The refetch produced nothing, so reconciliation could not be
|
|
@@ -70,22 +70,23 @@ export type ReconcileOutcome<T> = {
|
|
|
70
70
|
};
|
|
71
71
|
/**
|
|
72
72
|
* Shared three-way reconcile for a `ConflictError`: diff the user's intent
|
|
73
|
-
* (`
|
|
73
|
+
* (`base → ours`), refetch the server's current root (theirs), and replay the
|
|
74
74
|
* intent on top under strict, {@link augmentWithTestOps}-guarded `applyPatch`.
|
|
75
75
|
*
|
|
76
|
-
* - `no-op` — the user's root equals the
|
|
76
|
+
* - `no-op` — the user's root equals the base, so the gate fired on a
|
|
77
77
|
* benign version drift; nothing to replay (refetch is skipped).
|
|
78
78
|
* - `unavailable` — the refetch produced nothing; caller falls back.
|
|
79
79
|
* - `merged` — the foreign writer touched only paths the user did not; the
|
|
80
80
|
* merged root carries both intents.
|
|
81
|
-
* - `conflict` — a same-path divergence tripped a `test` op
|
|
82
|
-
* write and
|
|
81
|
+
* - `conflict` — a same-path divergence tripped a `test` op, or an `add`
|
|
82
|
+
* collides with one the foreign writer made; caller drops the write and
|
|
83
|
+
* surfaces `theirs`.
|
|
83
84
|
*
|
|
84
85
|
* I/O is the caller's: `refetch` supplies the current root, and applying the
|
|
85
|
-
* `merged` result (update vs save,
|
|
86
|
+
* `merged` result (update vs save, new base, UI refresh) stays at the call
|
|
86
87
|
* site so form and GLSP paths keep their own persistence semantics.
|
|
87
88
|
*/
|
|
88
|
-
export declare function reconcileByPatchReplay<T extends object>(
|
|
89
|
+
export declare function reconcileByPatchReplay<T extends object>(base: T, ours: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
|
|
89
90
|
/**
|
|
90
91
|
* Strategy for resolving a write that raced a foreign edit. One declarative
|
|
91
92
|
* choice covers every conflict site — `execute` forward-write `(before,
|
|
@@ -95,12 +96,12 @@ export declare function reconcileByPatchReplay<T extends object>(baseline: T, at
|
|
|
95
96
|
*/
|
|
96
97
|
export interface ConflictResolver {
|
|
97
98
|
/**
|
|
98
|
-
* Reconcile the user's `
|
|
99
|
-
* server state (`refetch`), returning a {@link ReconcileOutcome} the caller
|
|
99
|
+
* Reconcile the user's `base → ours` intent against the current
|
|
100
|
+
* server state (theirs, from `refetch`), returning a {@link ReconcileOutcome} the caller
|
|
100
101
|
* acts on (persist `merged`, drop on `conflict`, fall back on `no-op` /
|
|
101
102
|
* `unavailable`).
|
|
102
103
|
*/
|
|
103
|
-
resolve<T extends object>(
|
|
104
|
+
resolve<T extends object>(base: T, ours: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
|
|
104
105
|
}
|
|
105
106
|
/**
|
|
106
107
|
* Default {@link ConflictResolver}: field-level three-way merge via
|
|
@@ -109,15 +110,15 @@ export interface ConflictResolver {
|
|
|
109
110
|
* clobbered.
|
|
110
111
|
*/
|
|
111
112
|
export declare class ReconcilingConflictResolver implements ConflictResolver {
|
|
112
|
-
resolve<T extends object>(
|
|
113
|
+
resolve<T extends object>(base: T, ours: T, refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
115
|
-
* Last-writer-wins {@link ConflictResolver}: always reports the `
|
|
116
|
+
* Last-writer-wins {@link ConflictResolver}: always reports the `ours`
|
|
116
117
|
* state as merged, without refetching or guarding. Suitable for single-client
|
|
117
118
|
* tools or always-regenerated artifacts where a concurrent foreign edit may be
|
|
118
119
|
* overwritten. A foreign edit to any field is clobbered.
|
|
119
120
|
*/
|
|
120
121
|
export declare class ForceConflictResolver implements ConflictResolver {
|
|
121
|
-
resolve<T extends object>(
|
|
122
|
+
resolve<T extends object>(_base: T, ours: T, _refetch: () => Promise<T | undefined>): Promise<ReconcileOutcome<T>>;
|
|
122
123
|
}
|
|
123
124
|
//# sourceMappingURL=patch-merge.d.ts.map
|
package/lib/patch-merge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-merge.d.ts","sourceRoot":"","sources":["../src/patch-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"patch-merge.d.ts","sourceRoot":"","sources":["../src/patch-merge.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAMJ,KAAK,SAAS,IAAI,kBAAkB,EAEtC,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,EAAE,CASnH;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IACzB;IACG,6EAA6E;IAC7E,MAAM,EAAE,QAAQ,CAAC;IACjB;;;;OAIG;IACH,MAAM,EAAE,CAAC,CAAC;CACZ,GACD;IACG;;;;OAIG;IACH,MAAM,EAAE,OAAO,CAAC;CAClB,GACD;IACG,uFAAuF;IACvF,MAAM,EAAE,UAAU,CAAC;IACnB;;;;O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