@hydranium/protocol 1.0.0-next.17 → 1.0.0-next.174
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/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/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/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/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/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/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/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/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 +11 -2
- 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 +880 -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
|
@@ -11,6 +11,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.DATA_CLIENT_PROTOCOL_METHODS = exports.PROJECT_CLIENT_PROTOCOL_METHODS = exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = exports.REFERENCE_SERVER_PROTOCOL_METHODS = exports.DATA_SERVER_PROTOCOL_METHODS = exports.PROJECT_SERVER_PROTOCOL_METHODS = exports.DOCUMENT_SERVER_PROTOCOL_METHODS = void 0;
|
|
12
12
|
/** Request-method names on {@link DocumentServerProtocol}. */
|
|
13
13
|
exports.DOCUMENT_SERVER_PROTOCOL_METHODS = [
|
|
14
|
+
'createSession',
|
|
15
|
+
'closeSession',
|
|
16
|
+
'createModelDocument',
|
|
17
|
+
'updateModelDocuments',
|
|
14
18
|
'openModelDocument',
|
|
15
19
|
'closeModelDocument',
|
|
16
20
|
'getModelDocument',
|
|
@@ -44,7 +48,13 @@ exports.REFERENCE_SERVER_PROTOCOL_METHODS = [
|
|
|
44
48
|
'findNextName'
|
|
45
49
|
];
|
|
46
50
|
/** Notification-method names on {@link DocumentClientProtocol}. */
|
|
47
|
-
exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = [
|
|
51
|
+
exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = [
|
|
52
|
+
'onDocumentUpdated',
|
|
53
|
+
'onDocumentSaved',
|
|
54
|
+
'onDocumentDirtyChanged',
|
|
55
|
+
'onDocumentDeleted',
|
|
56
|
+
'onDocumentsBuilt'
|
|
57
|
+
];
|
|
48
58
|
/** Notification-method names on {@link ProjectClientProtocol}. */
|
|
49
59
|
exports.PROJECT_CLIENT_PROTOCOL_METHODS = ['onProjectsChanged'];
|
|
50
60
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-protocol-methods.js","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAalF,8DAA8D;AACjD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;CACyE,CAAC;AAE3F,6DAA6D;AAChD,QAAA,+BAA+B,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAEhF,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CAC0E,CAAC;AAE5F,mEAAmE;AACtD,QAAA,gCAAgC,GAAG,
|
|
1
|
+
{"version":3,"file":"data-protocol-methods.js","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAalF,8DAA8D;AACjD,QAAA,gCAAgC,GAAG;IAC7C,eAAe;IACf,cAAc;IACd,qBAAqB;IACrB,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,sBAAsB;IACtB,cAAc;CACyE,CAAC;AAE3F,6DAA6D;AAChD,QAAA,+BAA+B,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAEhF,CAAC;AAEF;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CAC0E,CAAC;AAE5F,mEAAmE;AACtD,QAAA,gCAAgC,GAAG;IAC7C,mBAAmB;IACnB,iBAAiB;IACjB,wBAAwB;IACxB,mBAAmB;IACnB,kBAAkB;CACqE,CAAC;AAE3F,kEAAkE;AACrD,QAAA,+BAA+B,GAAG,CAAC,mBAAmB,CAAwE,CAAC;AAE5I;;;;;;GAMG;AACU,QAAA,4BAA4B,GAAG;IACzC,GAAG,wCAAgC;IACnC,GAAG,uCAA+B;CACiD,CAAC"}
|
|
@@ -12,8 +12,8 @@ import type { Project } from '../project';
|
|
|
12
12
|
import type { TransferDocument } from '../transfer-document';
|
|
13
13
|
import type { CloseModelArgs, FindNextNameArgs, OpenModelArgs, ReferenceContext, ReferenceRequest } from '../model-server';
|
|
14
14
|
import type { ReferenceCandidate, ReferenceTarget } from '../model-service/reference-candidate';
|
|
15
|
-
import type { ProjectsChangedEvent, TransferDocumentSavedEvent, TransferDocumentUpdatedEvent } from './events';
|
|
16
|
-
import type { GetModelDocumentArgs, GetProjectForUriArgs, TransferSaveDocumentArgs, WatchModelDocumentArgs, TransferUpdateDocumentArgs } from './requests';
|
|
15
|
+
import type { ProjectsChangedEvent, TransferDocumentDeletedEvent, TransferDocumentDirtyChangedEvent, TransferDocumentSavedEvent, TransferDocumentsBuiltEvent, TransferDocumentUpdatedEvent } from './events';
|
|
16
|
+
import type { CloseSessionArgs, CreateModelDocumentArgs, CreateSessionArgs, GetModelDocumentArgs, GetProjectForUriArgs, TransferSaveDocumentArgs, WatchModelDocumentArgs, TransferUpdateDocumentArgs, TransferUpdateDocumentsArgs } from './requests';
|
|
17
17
|
/**
|
|
18
18
|
* Document-scoped slice of the data-server wire contract: the per-document
|
|
19
19
|
* lifecycle (get / update / save), the per-`(uri, clientId)` watch
|
|
@@ -32,34 +32,70 @@ import type { GetModelDocumentArgs, GetProjectForUriArgs, TransferSaveDocumentAr
|
|
|
32
32
|
*/
|
|
33
33
|
export interface DocumentServerProtocol<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> {
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* {@link getModelDocument} returns, except that `version` is taken from
|
|
40
|
-
* the text-document store so the caller's first `baseVersion` write
|
|
41
|
-
* cannot self-conflict. Idempotent in registration terms: opening an
|
|
42
|
-
* already-open document refreshes the client registration. Note it does
|
|
43
|
-
* NOT avoid a rebuild — a second client attaching triggers
|
|
44
|
-
* `refreshContent`, which fires a change event, so mounting a form on a
|
|
45
|
-
* document already open in a text editor rebuilds it.
|
|
35
|
+
* Register `args.clientId` as a client session owned by this connection.
|
|
36
|
+
* Rejects with a `DuplicateClientIdError` code when the id is live anywhere
|
|
37
|
+
* in the server process, and with a `ReservedClientIdError` code when the
|
|
38
|
+
* framework reserves it.
|
|
46
39
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
40
|
+
* A request carrying a registered id acts as that session: it writes only
|
|
41
|
+
* what the session has open, failing with a `DocumentNotOpenError` code
|
|
42
|
+
* otherwise, and opens nothing implicitly; its open reads the file and takes
|
|
43
|
+
* no `languageId`, `version` or `text` seed. The session ends with
|
|
44
|
+
* {@link closeSession} or when the connection closes, and either closes
|
|
45
|
+
* every document it has open.
|
|
46
|
+
*
|
|
47
|
+
* A registration carrying the `resumeToken` an earlier registration of the
|
|
48
|
+
* same id carried ends that session first, from any connection, so a client
|
|
49
|
+
* whose connection dropped can register again before the server notices.
|
|
50
|
+
*/
|
|
51
|
+
createSession(args: CreateSessionArgs): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* End a session this connection registered: close every document it has
|
|
54
|
+
* open, drop its watches, and free its id. A no-op for an id this
|
|
55
|
+
* connection did not register.
|
|
56
|
+
*/
|
|
57
|
+
closeSession(args: CloseSessionArgs): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Create a document with `args.text`, open for the session, and return it
|
|
60
|
+
* as {@link openModelDocument} does. It reaches disk with the first save.
|
|
61
|
+
* Fails when the file exists or any client has the URI open, and with a
|
|
62
|
+
* `SessionClosedError` code when `args.clientId` is not a session
|
|
63
|
+
* registered on this connection.
|
|
64
|
+
*/
|
|
65
|
+
createModelDocument(args: CreateModelDocumentArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
66
|
+
/**
|
|
67
|
+
* Write several documents the session has open, all or none: a conflict or
|
|
68
|
+
* a document not open fails the whole set before any text applies.
|
|
69
|
+
* Resolves to the documents in the order given. Only for a session
|
|
70
|
+
* registered on this connection.
|
|
71
|
+
*/
|
|
72
|
+
updateModelDocuments(args: TransferUpdateDocumentsArgs<TTransfer>): Promise<TransferDocument<TTransfer, TDiagnostic>[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Open a document for the client session `clientId` and return its current
|
|
75
|
+
* state. `clientId` must be a session this connection registered with
|
|
76
|
+
* {@link createSession}; any other id fails with the closed-session code,
|
|
77
|
+
* as every document request here does. The document is read from disk
|
|
78
|
+
* unless a client has it open already, so the request carries no
|
|
79
|
+
* `languageId`, `version` or `text` seed. Returns the document at
|
|
80
|
+
* the server's configured target phase — the same shape
|
|
81
|
+
* {@link getModelDocument} returns, except that `version` is taken from the
|
|
82
|
+
* text-document store so the caller's first `basedOn` write cannot
|
|
83
|
+
* self-conflict. A repeat open changes nothing.
|
|
84
|
+
*
|
|
85
|
+
* Pair with {@link watchModelDocument} to receive subsequent build-phase
|
|
86
|
+
* events (open returns a one-shot snapshot; later validation diagnostics
|
|
87
|
+
* arrive on the watch channel).
|
|
51
88
|
*/
|
|
52
|
-
openModelDocument(args: OpenModelArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
89
|
+
openModelDocument(args: Pick<OpenModelArgs, 'uri' | 'clientId' | 'options'>): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
53
90
|
/**
|
|
54
|
-
* Close
|
|
55
|
-
* {@link openModelDocument}; the
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* the
|
|
61
|
-
*
|
|
62
|
-
* reader can open without streaming.
|
|
91
|
+
* Close the session's open of `uri`. Counterpart to
|
|
92
|
+
* {@link openModelDocument}; the document stays open until every client
|
|
93
|
+
* has closed it, and the last close reverts it to disk. The default
|
|
94
|
+
* `DataServer` impl ALSO releases any watch for the same
|
|
95
|
+
* `(uri, clientId)` (a forgotten {@link unwatchModelDocument} would
|
|
96
|
+
* otherwise leak dispatch; the implicit unwatch is idempotent).
|
|
97
|
+
* `watchModelDocument` is NOT coupled the other way: opening does not force
|
|
98
|
+
* a watch, so a snapshot reader can open without streaming.
|
|
63
99
|
*/
|
|
64
100
|
closeModelDocument(args: CloseModelArgs): Promise<void>;
|
|
65
101
|
/**
|
|
@@ -70,13 +106,14 @@ export interface DocumentServerProtocol<TTransfer extends TransferElement, TDiag
|
|
|
70
106
|
*/
|
|
71
107
|
getModelDocument(args: GetModelDocumentArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
72
108
|
/**
|
|
73
|
-
* Update a document's content
|
|
74
|
-
*
|
|
75
|
-
* response.
|
|
109
|
+
* Update a document's content as the session `clientId`, which must have
|
|
110
|
+
* it open. The response carries the latest built state including
|
|
111
|
+
* diagnostics; callers observe convergence via that response.
|
|
76
112
|
*/
|
|
77
113
|
updateModelDocument(args: TransferUpdateDocumentArgs<TTransfer>): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
78
114
|
/**
|
|
79
|
-
*
|
|
115
|
+
* Write a document as the session `clientId`, which must have it open, and
|
|
116
|
+
* persist it to disk. The response is the post-save document
|
|
80
117
|
* state (matches the file on disk). Save semantics depend on the
|
|
81
118
|
* filesystem-provider wiring; rejection paths surface as awaited
|
|
82
119
|
* promise rejections.
|
|
@@ -171,6 +208,19 @@ export interface ProjectServerProtocol<TProject extends Project = Project> {
|
|
|
171
208
|
*/
|
|
172
209
|
export interface DataServerProtocol<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project> extends DocumentServerProtocol<TTransfer, TDiagnostic>, ProjectServerProtocol<TProject> {
|
|
173
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* The diagnostic shape a server answers with, read back off its own
|
|
213
|
+
* declaration.
|
|
214
|
+
*
|
|
215
|
+
* This is what lets a client tier stay generic over the server alone and still
|
|
216
|
+
* describe what it hands back. Both parameters must be inferred: naming
|
|
217
|
+
* {@link TransferElement} for the transfer instead fails to match while that
|
|
218
|
+
* parameter is still generic, and a default declared against the constraint
|
|
219
|
+
* then stops satisfying it.
|
|
220
|
+
*/
|
|
221
|
+
export type DiagnosticOf<TServer> = TServer extends DocumentServerProtocol<infer _TTransfer, infer TDiagnostic> ? TDiagnostic : TransferDiagnostic;
|
|
222
|
+
/** The project shape a server answers with, read back off its own declaration. */
|
|
223
|
+
export type ProjectOf<TServer> = TServer extends ProjectServerProtocol<infer TProject> ? TProject : Project;
|
|
174
224
|
/**
|
|
175
225
|
* Cross-reference / naming slice of the server surface — scope-aware
|
|
176
226
|
* queries that resolve against the language's reference services. NOT part
|
|
@@ -235,6 +285,36 @@ export interface DocumentClientProtocol<TTransfer extends TransferElement, TDiag
|
|
|
235
285
|
* codepath, not a subscription codepath).
|
|
236
286
|
*/
|
|
237
287
|
onDocumentSaved(event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>): void;
|
|
288
|
+
/**
|
|
289
|
+
* Delivered when a subscribed document's text starts or stops differing
|
|
290
|
+
* from its file, as the server last knew it. Gated like
|
|
291
|
+
* {@link onDocumentSaved}; the answer at any one moment is the `dirty` of
|
|
292
|
+
* the documents the server sends. After a reconnect, a `DataSession`
|
|
293
|
+
* delivers here the answer of each document it restored, when that differs
|
|
294
|
+
* from the last this client was told: the flips while the connection was
|
|
295
|
+
* down reached no one.
|
|
296
|
+
*/
|
|
297
|
+
onDocumentDirtyChanged(event: TransferDocumentDirtyChangedEvent): void;
|
|
298
|
+
/**
|
|
299
|
+
* Delivered when a document's backing file was removed. Separate from
|
|
300
|
+
* {@link onDocumentUpdated} for the same reason as {@link onDocumentSaved},
|
|
301
|
+
* and more strongly: there is no built state to deliver, and the build-phase
|
|
302
|
+
* path cannot report a deletion at all.
|
|
303
|
+
*
|
|
304
|
+
* Ungated, because on a browser host — where the workspace lives behind the
|
|
305
|
+
* head — no other source can observe a file disappearing. Recipients that
|
|
306
|
+
* only care about their own documents filter by URI.
|
|
307
|
+
*/
|
|
308
|
+
onDocumentDeleted(event: TransferDocumentDeletedEvent): void;
|
|
309
|
+
/**
|
|
310
|
+
* Delivered once per build, naming the documents that reached the
|
|
311
|
+
* subscription phase and that
|
|
312
|
+
* nobody on this connection watches — chiefly the ones rebuilt as a cascade
|
|
313
|
+
* from a dependency's change, which no filesystem watcher can see because
|
|
314
|
+
* their own files did not change. The complement of
|
|
315
|
+
* {@link onDocumentUpdated}; carries URIs and no documents.
|
|
316
|
+
*/
|
|
317
|
+
onDocumentsBuilt(event: TransferDocumentsBuiltEvent): void;
|
|
238
318
|
}
|
|
239
319
|
/**
|
|
240
320
|
* Project-scoped slice of the client surface — the project-registry change
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-server-protocol.d.ts","sourceRoot":"","sources":["../../src/data/data-server-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3H,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"data-server-protocol.d.ts","sourceRoot":"","sources":["../../src/data/data-server-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK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C;IAEjF;;;;;;;;OAQG;IACH,sBAAsB,CAAC,KAAK,EAAE,iCAAiC,GAAG,IAAI,CAAC;IAEvE;;;;;;;;;OASG;IACH,iBAAiB,CAAC,KAAK,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAE7D;;;;;;;OAOG;IACH,gBAAgB,CAAC,KAAK,EAAE,2BAA2B,GAAG,IAAI,CAAC;CAC7D;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CAAC,QAAQ,SAAS,OAAO,GAAG,OAAO;IACtE;;;;;;;;OAQG;IACH,iBAAiB,CAAC,KAAK,EAAE,oBAAoB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;CACjE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB,CAChC,SAAS,SAAS,eAAe,EACjC,WAAW,SAAS,kBAAkB,GAAG,kBAAkB,EAC3D,QAAQ,SAAS,OAAO,GAAG,OAAO,CAElC,SAAQ,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC;CAAG"}
|
package/lib/data/events.d.ts
CHANGED
|
@@ -14,24 +14,30 @@ import type { TransferDocument } from '../transfer-document';
|
|
|
14
14
|
* Why an update event fired. Subscribers filter on reason for behaviour
|
|
15
15
|
* decisions (e.g. dirty-flag handling, undo-history grouping, telemetry):
|
|
16
16
|
*
|
|
17
|
-
* - `'changed'` — the
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* - `'rebuilt'` — the URI was rebuilt as a cascade from another URI's
|
|
25
|
-
* build (dependency graph re-derivation), without itself being passed to
|
|
26
|
-
* `documentBuilder.update`. The complement of `'changed'`.
|
|
17
|
+
* - `'changed'` — the server's first update event for the document's current
|
|
18
|
+
* version: its content changed since the last one. A write whose build a
|
|
19
|
+
* later write cancelled is still `'changed'` in the build that takes over.
|
|
20
|
+
* - `'rebuilt'` — a later event for a version the server already delivered,
|
|
21
|
+
* whether or not any client watched it then: something the document depends
|
|
22
|
+
* on changed, or the document was built again with the same content. The
|
|
23
|
+
* complement of `'changed'`.
|
|
27
24
|
* - `'saved'` — emitted by adopters that synthesise a unified update stream
|
|
28
25
|
* from both `onDocumentUpdated` and `onDocumentSaved`. The framework's own
|
|
29
26
|
* `dispatchPhaseEvent` does NOT emit `'saved'` — saves take the dedicated
|
|
30
27
|
* `DataClientProtocol.onDocumentSaved` channel.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
*
|
|
29
|
+
* The version rule needs a version the server keeps and builds that validate.
|
|
30
|
+
* For a document no client has opened, or when rebuilds do not validate,
|
|
31
|
+
* `'changed'` means the URI was passed to `DocumentBuilder.update` for this
|
|
32
|
+
* build. A document that a validating build skips is `'changed'` every time.
|
|
33
|
+
*
|
|
34
|
+
* Deletion is deliberately NOT a member. An update event carries a built
|
|
35
|
+
* document, which a deleted one has none of, and the phase-driven path that
|
|
36
|
+
* produces these events never runs for a deleted URI — the builder drops the
|
|
37
|
+
* document before deriving the rebuild set. It travels as
|
|
38
|
+
* {@link TransferDocumentDeletedEvent} on its own channel instead.
|
|
33
39
|
*/
|
|
34
|
-
export type TransferDocumentUpdateReason = 'changed' | 'rebuilt' | 'saved'
|
|
40
|
+
export type TransferDocumentUpdateReason = 'changed' | 'rebuilt' | 'saved';
|
|
35
41
|
/**
|
|
36
42
|
* Delivered on the data-server when a document's content (or existence)
|
|
37
43
|
* changed. Subscribers receive this via `DocumentServerProtocol.watchModelDocument`.
|
|
@@ -41,7 +47,13 @@ export type TransferDocumentUpdateReason = 'changed' | 'rebuilt' | 'saved' | 'de
|
|
|
41
47
|
*/
|
|
42
48
|
export interface TransferDocumentUpdatedEvent<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> {
|
|
43
49
|
document: TransferDocument<TTransfer, TDiagnostic>;
|
|
44
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The client whose write this event echoes: the author of the version on a
|
|
52
|
+
* `'changed'`, and the unknown-client id on a `'rebuilt'`, which echoes no
|
|
53
|
+
* write. A recipient compares it against its own id to recognise its echo.
|
|
54
|
+
* The rebuild that reverts a document to disk after its last close names
|
|
55
|
+
* the revert-on-close id instead.
|
|
56
|
+
*/
|
|
45
57
|
sourceClientId: string;
|
|
46
58
|
reason: TransferDocumentUpdateReason;
|
|
47
59
|
}
|
|
@@ -72,6 +84,83 @@ export interface TransferDocumentSavedEvent<TTransfer extends TransferElement, T
|
|
|
72
84
|
}
|
|
73
85
|
/** Callback shape for `DataClientProtocol.onDocumentSaved`. */
|
|
74
86
|
export type TransferDocumentSavedListener<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> = (event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Delivered on the data-server when a watched document's text starts or stops
|
|
89
|
+
* differing from its file, as the server last knew the file. The current
|
|
90
|
+
* answer rides on every transfer document the server sends as `dirty`; this
|
|
91
|
+
* carries only its changes, so a client that follows it needs no rebuild to
|
|
92
|
+
* learn of a save.
|
|
93
|
+
*/
|
|
94
|
+
export interface TransferDocumentDirtyChangedEvent {
|
|
95
|
+
/** Canonical URI, keyed as the subscription is. */
|
|
96
|
+
readonly uri: string;
|
|
97
|
+
readonly dirty: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** Callback shape for `DataClientProtocol.onDocumentDirtyChanged`. */
|
|
100
|
+
export type TransferDocumentDirtyChangedListener = (event: TransferDocumentDirtyChangedEvent) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Delivered on the data-server when a document's backing file was removed.
|
|
103
|
+
* Carries no document, and cannot: the state a
|
|
104
|
+
* {@link TransferDocumentUpdatedEvent} would have to carry no longer exists by
|
|
105
|
+
* the time anyone can be told. That is also why deletion is not a `reason` on
|
|
106
|
+
* the update stream — `DocumentBuilder.update` drops the document before
|
|
107
|
+
* deriving the rebuild set, so the phase-driven path that produces update
|
|
108
|
+
* events never runs for it.
|
|
109
|
+
*
|
|
110
|
+
* **Delivered for EVERY document, not only watched ones**, unlike
|
|
111
|
+
* `onDocumentUpdated` and `onDocumentSaved`. The test that decides which
|
|
112
|
+
* channels are gated is whether any OTHER source can observe the fact on the
|
|
113
|
+
* least capable host: a browser-hosted client's workspace lives behind the
|
|
114
|
+
* head, so nothing there can see a file disappear, and gating the notification
|
|
115
|
+
* would leave it blind. (A Theia frontend's filesystem watcher would cover it,
|
|
116
|
+
* which is why this is a host argument and not a structure-versus-content one.)
|
|
117
|
+
* A watcher is told about its own document's deletion here too, the update
|
|
118
|
+
* channel being silent for deletions by construction. Filter on {@link uri} if
|
|
119
|
+
* the receiver only cares about documents it opened.
|
|
120
|
+
*
|
|
121
|
+
* A watch survives the deletion, so a file that comes back resumes delivering
|
|
122
|
+
* `onDocumentUpdated` to the same subscribers with no re-subscription. A
|
|
123
|
+
* client that responds by closing its editor releases the watch through
|
|
124
|
+
* `closeModelDocument` as usual.
|
|
125
|
+
*/
|
|
126
|
+
export interface TransferDocumentDeletedEvent {
|
|
127
|
+
/** Canonical URI of the removed document, keyed as the subscription is. */
|
|
128
|
+
readonly uri: string;
|
|
129
|
+
}
|
|
130
|
+
/** Callback shape for `DataClientProtocol.onDocumentDeleted`. */
|
|
131
|
+
export type TransferDocumentDeletedListener = (event: TransferDocumentDeletedEvent) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Delivered on the data-server once per build, naming the documents that reached
|
|
134
|
+
* the configured subscription phase (`DataServerOptions.subscriptionPhase`,
|
|
135
|
+
* `Validated` by default) and that NO client on the connection is watching. Not
|
|
136
|
+
* the integrity-settled landmark, which is a different point and a different
|
|
137
|
+
* word in this framework.
|
|
138
|
+
*
|
|
139
|
+
* The complement of {@link TransferDocumentUpdatedEvent}, which is gated per
|
|
140
|
+
* URI: together the two cover every document a build touched. This one exists
|
|
141
|
+
* for the case no source outside the server can observe — a document rebuilt
|
|
142
|
+
* because something it DEPENDS ON changed. Its own file never changed, so a
|
|
143
|
+
* filesystem watcher cannot see it, and it has no subscriber, so the update
|
|
144
|
+
* channel does not report it. A consumer showing data derived from such a
|
|
145
|
+
* document (a tree label, a decorator) would otherwise hold a stale value with
|
|
146
|
+
* nothing to invalidate it.
|
|
147
|
+
*
|
|
148
|
+
* Carries URIs and no documents: a recipient re-reads what it displays, through
|
|
149
|
+
* `getModelDocument` or its own request. That keeps the bandwidth property the
|
|
150
|
+
* per-URI subscription exists for, without gating the message.
|
|
151
|
+
*
|
|
152
|
+
* Not sent when the set is empty, which is the normal case while editing — the
|
|
153
|
+
* document being edited is watched by its own editor and therefore excluded.
|
|
154
|
+
* Workspace initialisation sends nothing either: it does not build to the
|
|
155
|
+
* subscription phase. The largest message a workspace can produce is therefore
|
|
156
|
+
* a whole-workspace rebuild at that phase, which is one message of URIs.
|
|
157
|
+
*/
|
|
158
|
+
export interface TransferDocumentsBuiltEvent {
|
|
159
|
+
/** Canonical URIs, keyed as subscriptions are. Never empty. */
|
|
160
|
+
readonly uris: readonly string[];
|
|
161
|
+
}
|
|
162
|
+
/** Callback shape for `DataClientProtocol.onDocumentsBuilt`. */
|
|
163
|
+
export type TransferDocumentsBuiltListener = (event: TransferDocumentsBuiltEvent) => void;
|
|
75
164
|
/**
|
|
76
165
|
* Why a project-change event fired. `added` — the project was newly
|
|
77
166
|
* registered (descriptor discovered); `updated` — the project's
|
package/lib/data/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/data/events.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,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package/lib/data/requests.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import type {
|
|
9
|
+
import type { BasedOn } from '../model-service/based-on';
|
|
10
10
|
/** Get the current state of a single document. The server returns the latest built version. */
|
|
11
11
|
export interface GetModelDocumentArgs {
|
|
12
12
|
/** Document URI. */
|
|
@@ -37,22 +37,78 @@ export interface GetProjectForUriArgs {
|
|
|
37
37
|
uri: string;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Update a document
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* without an args mapping.
|
|
40
|
+
* Update a document the session `clientId` has open. Generic over `TTransfer`
|
|
41
|
+
* so adopters parameterise the structured shape against their grammar's
|
|
42
|
+
* transfer-model overlay; passing a string is always allowed.
|
|
44
43
|
*/
|
|
45
|
-
export
|
|
46
|
-
/**
|
|
47
|
-
|
|
44
|
+
export interface TransferUpdateDocumentArgs<TTransfer> {
|
|
45
|
+
/** Document URI. */
|
|
46
|
+
uri: string;
|
|
47
|
+
/** The id of a live session registered on this connection. */
|
|
48
|
+
clientId: string;
|
|
49
|
+
/** The whole structured model root, or its serialised textual form. */
|
|
50
|
+
model: TTransfer | string;
|
|
51
|
+
/**
|
|
52
|
+
* What this write was authored against. A `SnapshotVersion` is compared
|
|
53
|
+
* against the server's current text-document version for `uri` and throws
|
|
54
|
+
* `ConflictError` on mismatch; `'anything'` writes unconditionally.
|
|
55
|
+
*
|
|
56
|
+
* **Required so that an ungated write is a decision rather than an
|
|
57
|
+
* omission.** An optional gate is indistinguishable from a forgotten one at
|
|
58
|
+
* the call site, and a file of twenty writes hides the one that lost the
|
|
59
|
+
* field. Nothing else here can see that, since the defect is an absence.
|
|
60
|
+
*/
|
|
61
|
+
basedOn: BasedOn;
|
|
62
|
+
}
|
|
63
|
+
/** Update a document the session `clientId` has open, then persist it to disk. */
|
|
64
|
+
export interface TransferSaveDocumentArgs<TTransfer> extends TransferUpdateDocumentArgs<TTransfer> {
|
|
65
|
+
}
|
|
66
|
+
/** Register a client session on the connection. */
|
|
67
|
+
export interface CreateSessionArgs {
|
|
68
|
+
/** The session's id, minted by the client; unique in the server process while the session is live. */
|
|
69
|
+
clientId: string;
|
|
70
|
+
/** What the participant is; kept as the server session's `label`. */
|
|
71
|
+
label?: string;
|
|
72
|
+
/**
|
|
73
|
+
* A token the client keeps for the session's lifetime. It is no secret: the
|
|
74
|
+
* wire carries no authentication. A later `createSession` for the same id
|
|
75
|
+
* carrying the same token, from any connection, ends the session it names
|
|
76
|
+
* and registers the id afresh, so a client whose connection dropped before
|
|
77
|
+
* the server noticed can register again. Without it the id stays refused
|
|
78
|
+
* until the server notices.
|
|
79
|
+
*/
|
|
80
|
+
resumeToken?: string;
|
|
81
|
+
}
|
|
82
|
+
/** End a client session registered on the connection. */
|
|
83
|
+
export interface CloseSessionArgs {
|
|
84
|
+
clientId: string;
|
|
85
|
+
}
|
|
86
|
+
/** Create a document that exists nowhere yet, open for the session creating it. */
|
|
87
|
+
export interface CreateModelDocumentArgs {
|
|
88
|
+
uri: string;
|
|
89
|
+
/** The id of a live session registered on this connection. */
|
|
90
|
+
clientId: string;
|
|
91
|
+
/** The document's initial content; it reaches disk with the first save. */
|
|
92
|
+
text: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Write several documents a session has open, all or none. `clientId` is on
|
|
96
|
+
* the set rather than on each update: an id per update would allow a set
|
|
97
|
+
* mixing clients, which the server would have to refuse.
|
|
98
|
+
*/
|
|
99
|
+
export interface TransferUpdateDocumentsArgs<TTransfer> {
|
|
100
|
+
/** The id of a live session registered on this connection. */
|
|
101
|
+
clientId: string;
|
|
102
|
+
updates: Omit<TransferUpdateDocumentArgs<TTransfer>, 'clientId'>[];
|
|
103
|
+
}
|
|
48
104
|
/**
|
|
49
105
|
* Identifies a per-document watch on the data server. Shared by both
|
|
50
106
|
* `watchModelDocument` and `unwatchModelDocument` — the `(uri, clientId)`
|
|
51
107
|
* pair is the watch key, so unwatching names the same watch that was
|
|
52
108
|
* started. The `clientId` identifies the originator the same way it does
|
|
53
|
-
* on
|
|
54
|
-
* `
|
|
55
|
-
* bucket so multiple watchers on the same wire stay distinct, AND it lets
|
|
109
|
+
* on the document writes (`TransferUpdateDocumentArgs.clientId`,
|
|
110
|
+
* `TransferSaveDocumentArgs.clientId`): it keys the per-`(uri, clientId)`
|
|
111
|
+
* watch bucket so multiple watchers on the same wire stay distinct, AND it lets
|
|
56
112
|
* each watcher recognise its own echo on inbound `onDocumentUpdated` events
|
|
57
113
|
* (the wire shape's `sourceClientId` carries the originating mutation's
|
|
58
114
|
* `clientId`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/data/requests.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/data/requests.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEzD,+FAA+F;AAC/F,MAAM,WAAW,oBAAoB;IAClC,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IAClC,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B,CAAC,SAAS;IAClD,oBAAoB;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B;;;;;;;;;OASG;IAC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