@hydranium/protocol 1.0.0-next.22 → 1.0.0-next.220
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 +39 -3
- 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 +157 -0
- package/lib/client/data-connection.d.ts.map +1 -0
- package/lib/client/data-connection.js +237 -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 +24 -22
- package/lib/client/data-port.d.ts.map +1 -1
- package/lib/client/data-session.d.ts +471 -81
- package/lib/client/data-session.d.ts.map +1 -1
- package/lib/client/data-session.js +738 -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 +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/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 +29 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +59 -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 +39 -15
- package/lib/testing/data-doubles.d.ts.map +1 -1
- package/lib/testing/data-doubles.js +57 -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.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 +315 -0
- package/src/client/data-events.ts +33 -1
- package/src/client/data-port.ts +25 -23
- package/src/client/data-session.ts +946 -126
- package/src/client/index.ts +14 -9
- 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/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 +36 -0
- package/src/messages/primitives.ts +271 -0
- package/src/model-server.ts +63 -18
- 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 +2 -3
- 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 +141 -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/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
|
@@ -0,0 +1,39 @@
|
|
|
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.ConsoleLogger = void 0;
|
|
12
|
+
const abstract_logger_1 = require("./abstract-logger");
|
|
13
|
+
/** `console.trace` prints a stack with every line, so `trace` goes out at `debug`. */
|
|
14
|
+
const CONSOLE_METHODS = {
|
|
15
|
+
error: 'error',
|
|
16
|
+
warn: 'warn',
|
|
17
|
+
info: 'info',
|
|
18
|
+
debug: 'debug',
|
|
19
|
+
trace: 'debug'
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* {@link Logger} that writes each line to `console`, at the method matching its
|
|
23
|
+
* level: the framework's `[Label - time] [component]` prefix and the message,
|
|
24
|
+
* then any trailing arguments as they are, so a browser console can expand
|
|
25
|
+
* them. For a browser page, webview or extension host, which has no other sink
|
|
26
|
+
* to hand. On Node, `info` and `debug` reach stdout, so a process whose stdout
|
|
27
|
+
* carries a protocol stream must not use it.
|
|
28
|
+
*/
|
|
29
|
+
class ConsoleLogger extends abstract_logger_1.AbstractLogger {
|
|
30
|
+
emit(level, label, message, args) {
|
|
31
|
+
console[CONSOLE_METHODS[level]](`${this.formatLinePrefix(label)} ${message}`, ...args);
|
|
32
|
+
}
|
|
33
|
+
derive(component) {
|
|
34
|
+
const Subclass = this.constructor;
|
|
35
|
+
return new Subclass(component);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
39
|
+
//# sourceMappingURL=console-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-logger.js","sourceRoot":"","sources":["../src/console-logger.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;AAElF,uDAAmD;AAGnD,sFAAsF;AACtF,MAAM,eAAe,GAA0D;IAC5E,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,mBAA2B,SAAQ,gCAAc;IACpC,IAAI,CAAC,KAAe,EAAE,KAAa,EAAE,OAAe,EAAE,IAAwB;QACrF,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,OAAO,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;IAC1F,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"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
/** Request-method names on {@link DocumentServerProtocol}. */
|
|
10
|
-
export declare const DOCUMENT_SERVER_PROTOCOL_METHODS: readonly ["openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady"];
|
|
10
|
+
export declare const DOCUMENT_SERVER_PROTOCOL_METHODS: readonly ["createSession", "closeSession", "createModelDocument", "updateModelDocuments", "openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "persistModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady"];
|
|
11
11
|
/** Request-method names on {@link ProjectServerProtocol}. */
|
|
12
12
|
export declare const PROJECT_SERVER_PROTOCOL_METHODS: readonly ["getProjects", "getProjectForUri"];
|
|
13
13
|
/**
|
|
@@ -16,7 +16,7 @@ export declare const PROJECT_SERVER_PROTOCOL_METHODS: readonly ["getProjects", "
|
|
|
16
16
|
* constraint makes the array typed against the interface — stale names (typos,
|
|
17
17
|
* renamed methods) fail to typecheck.
|
|
18
18
|
*/
|
|
19
|
-
export declare const DATA_SERVER_PROTOCOL_METHODS: readonly ["openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady", "getProjects", "getProjectForUri"];
|
|
19
|
+
export declare const DATA_SERVER_PROTOCOL_METHODS: readonly ["createSession", "closeSession", "createModelDocument", "updateModelDocuments", "openModelDocument", "closeModelDocument", "getModelDocument", "updateModelDocument", "saveModelDocument", "persistModelDocument", "watchModelDocument", "unwatchModelDocument", "waitForReady", "getProjects", "getProjectForUri"];
|
|
20
20
|
/**
|
|
21
21
|
* Request-method names on {@link ReferenceServerProtocol}. NOT part of
|
|
22
22
|
* {@link DATA_SERVER_PROTOCOL_METHODS} — adopters that compose the reference
|
|
@@ -25,7 +25,7 @@ export declare const DATA_SERVER_PROTOCOL_METHODS: readonly ["openModelDocument"
|
|
|
25
25
|
*/
|
|
26
26
|
export declare const REFERENCE_SERVER_PROTOCOL_METHODS: readonly ["findReferenceCandidates", "resolveReference", "findNextName"];
|
|
27
27
|
/** Notification-method names on {@link DocumentClientProtocol}. */
|
|
28
|
-
export declare const DOCUMENT_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved"];
|
|
28
|
+
export declare const DOCUMENT_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onDocumentDirtyChanged", "onDocumentDeleted", "onDocumentsBuilt"];
|
|
29
29
|
/** Notification-method names on {@link ProjectClientProtocol}. */
|
|
30
30
|
export declare const PROJECT_CLIENT_PROTOCOL_METHODS: readonly ["onProjectsChanged"];
|
|
31
31
|
/**
|
|
@@ -35,5 +35,5 @@ export declare const PROJECT_CLIENT_PROTOCOL_METHODS: readonly ["onProjectsChang
|
|
|
35
35
|
* data head's connection routes `<methodNamespace>onDocumentUpdated` etc. to
|
|
36
36
|
* the bound client target.
|
|
37
37
|
*/
|
|
38
|
-
export declare const DATA_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onProjectsChanged"];
|
|
38
|
+
export declare const DATA_CLIENT_PROTOCOL_METHODS: readonly ["onDocumentUpdated", "onDocumentSaved", "onDocumentDirtyChanged", "onDocumentDeleted", "onDocumentsBuilt", "onProjectsChanged"];
|
|
39
39
|
//# sourceMappingURL=data-protocol-methods.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-protocol-methods.d.ts","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,
|
|
1
|
+
{"version":3,"file":"data-protocol-methods.d.ts","sourceRoot":"","sources":["../../src/data/data-protocol-methods.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAalF,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,4RAc6C,CAAC;AAE3F,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,8CAE3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,+TAG6C,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,0EAI4B,CAAC;AAE3E,mEAAmE;AACnE,eAAO,MAAM,gCAAgC,sHAM6C,CAAC;AAE3F,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,gCAA+F,CAAC;AAE5I;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,2IAG6C,CAAC"}
|
|
@@ -11,11 +11,16 @@ 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',
|
|
17
21
|
'updateModelDocument',
|
|
18
22
|
'saveModelDocument',
|
|
23
|
+
'persistModelDocument',
|
|
19
24
|
'watchModelDocument',
|
|
20
25
|
'unwatchModelDocument',
|
|
21
26
|
'waitForReady'
|
|
@@ -44,7 +49,13 @@ exports.REFERENCE_SERVER_PROTOCOL_METHODS = [
|
|
|
44
49
|
'findNextName'
|
|
45
50
|
];
|
|
46
51
|
/** Notification-method names on {@link DocumentClientProtocol}. */
|
|
47
|
-
exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = [
|
|
52
|
+
exports.DOCUMENT_CLIENT_PROTOCOL_METHODS = [
|
|
53
|
+
'onDocumentUpdated',
|
|
54
|
+
'onDocumentSaved',
|
|
55
|
+
'onDocumentDirtyChanged',
|
|
56
|
+
'onDocumentDeleted',
|
|
57
|
+
'onDocumentsBuilt'
|
|
58
|
+
];
|
|
48
59
|
/** Notification-method names on {@link ProjectClientProtocol}. */
|
|
49
60
|
exports.PROJECT_CLIENT_PROTOCOL_METHODS = ['onProjectsChanged'];
|
|
50
61
|
/**
|
|
@@ -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,
|
|
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,sBAAsB;IACtB,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,QAAA,gCAAgC;IACnC,GAAG,QAAA,+BAA+B;CACiD,CAAC;AAEvF;;;;;GAKG;AACU,QAAA,iCAAiC,GAAG;IAC9C,yBAAyB;IACzB,kBAAkB;IAClB,cAAc;CACyD,CAAC;AAE3E,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,QAAA,gCAAgC;IACnC,GAAG,QAAA,+BAA+B;CACiD,CAAC"}
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
import type { TransferDiagnostic } from '../transfer-diagnostic';
|
|
10
10
|
import type { TransferElement } from '../transfer-element';
|
|
11
11
|
import type { Project } from '../project';
|
|
12
|
-
import type { TransferDocument } from '../transfer-document';
|
|
12
|
+
import type { TransferDocument, TransferSavedDocument } 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, TransferPersistDocumentArgs, 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,69 @@ 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, as {@link getModelDocument} does.
|
|
81
|
+
* A repeat open changes nothing.
|
|
82
|
+
*
|
|
83
|
+
* Pair with {@link watchModelDocument} to receive subsequent build-phase
|
|
84
|
+
* events (open returns a one-shot snapshot; later validation diagnostics
|
|
85
|
+
* arrive on the watch channel).
|
|
51
86
|
*/
|
|
52
|
-
openModelDocument(args: OpenModelArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
87
|
+
openModelDocument(args: Pick<OpenModelArgs, 'uri' | 'clientId' | 'options'>): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
53
88
|
/**
|
|
54
|
-
* Close
|
|
55
|
-
* {@link openModelDocument}; the
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* forgotten {@link unwatchModelDocument} would
|
|
60
|
-
* the implicit unwatch is idempotent).
|
|
61
|
-
* coupled the other way: opening does not force
|
|
62
|
-
* reader can open without streaming.
|
|
89
|
+
* Close the session's open of `uri`. Counterpart to
|
|
90
|
+
* {@link openModelDocument}; the document stays open until every client
|
|
91
|
+
* has closed it, and then the server releases it, by default reverting it
|
|
92
|
+
* to disk. The default
|
|
93
|
+
* `DataServer` impl ALSO releases any watch for the same
|
|
94
|
+
* `(uri, clientId)` (a forgotten {@link unwatchModelDocument} would
|
|
95
|
+
* otherwise leak dispatch; the implicit unwatch is idempotent).
|
|
96
|
+
* `watchModelDocument` is NOT coupled the other way: opening does not force
|
|
97
|
+
* a watch, so a snapshot reader can open without streaming.
|
|
63
98
|
*/
|
|
64
99
|
closeModelDocument(args: CloseModelArgs): Promise<void>;
|
|
65
100
|
/**
|
|
@@ -70,18 +105,28 @@ export interface DocumentServerProtocol<TTransfer extends TransferElement, TDiag
|
|
|
70
105
|
*/
|
|
71
106
|
getModelDocument(args: GetModelDocumentArgs): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
72
107
|
/**
|
|
73
|
-
* Update a document's content
|
|
74
|
-
*
|
|
75
|
-
* response.
|
|
108
|
+
* Update a document's content as the session `clientId`, which must have
|
|
109
|
+
* it open. The response carries the latest built state including
|
|
110
|
+
* diagnostics; callers observe convergence via that response.
|
|
76
111
|
*/
|
|
77
112
|
updateModelDocument(args: TransferUpdateDocumentArgs<TTransfer>): Promise<TransferDocument<TTransfer, TDiagnostic>>;
|
|
78
113
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
114
|
+
* Write a document as the session `clientId`, which must have it open, and
|
|
115
|
+
* persist it to disk. The response is the latest build of the document,
|
|
116
|
+
* with the version of the text written in `persisted`. Save semantics
|
|
117
|
+
* depend on the filesystem-provider wiring; rejection paths surface as
|
|
118
|
+
* awaited promise rejections.
|
|
119
|
+
*/
|
|
120
|
+
saveModelDocument(args: TransferSaveDocumentArgs<TTransfer>): Promise<TransferSavedDocument<TTransfer, TDiagnostic>>;
|
|
121
|
+
/**
|
|
122
|
+
* Persist the text the server holds for a document the session `clientId`
|
|
123
|
+
* has open, as it is: no update and no serialisation, so another client's
|
|
124
|
+
* unsaved text keeps its formatting. `baseVersion` is checked in the step
|
|
125
|
+
* that takes the text, so text that moved on fails with a `ConflictError`
|
|
126
|
+
* code. The saved event names this session, whoever wrote the text.
|
|
127
|
+
* Responds as {@link saveModelDocument} does.
|
|
83
128
|
*/
|
|
84
|
-
|
|
129
|
+
persistModelDocument(args: TransferPersistDocumentArgs): Promise<TransferSavedDocument<TTransfer, TDiagnostic>>;
|
|
85
130
|
/**
|
|
86
131
|
* Start watching `(uri, clientId)`. The server starts dispatching
|
|
87
132
|
* {@link DocumentClientProtocol.onDocumentUpdated} on the paired wire
|
|
@@ -171,6 +216,19 @@ export interface ProjectServerProtocol<TProject extends Project = Project> {
|
|
|
171
216
|
*/
|
|
172
217
|
export interface DataServerProtocol<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic, TProject extends Project = Project> extends DocumentServerProtocol<TTransfer, TDiagnostic>, ProjectServerProtocol<TProject> {
|
|
173
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* The diagnostic shape a server answers with, read back off its own
|
|
221
|
+
* declaration.
|
|
222
|
+
*
|
|
223
|
+
* This is what lets a client tier stay generic over the server alone and still
|
|
224
|
+
* describe what it hands back. Both parameters must be inferred: naming
|
|
225
|
+
* {@link TransferElement} for the transfer instead fails to match while that
|
|
226
|
+
* parameter is still generic, and a default declared against the constraint
|
|
227
|
+
* then stops satisfying it.
|
|
228
|
+
*/
|
|
229
|
+
export type DiagnosticOf<TServer> = TServer extends DocumentServerProtocol<infer _TTransfer, infer TDiagnostic> ? TDiagnostic : TransferDiagnostic;
|
|
230
|
+
/** The project shape a server answers with, read back off its own declaration. */
|
|
231
|
+
export type ProjectOf<TServer> = TServer extends ProjectServerProtocol<infer TProject> ? TProject : Project;
|
|
174
232
|
/**
|
|
175
233
|
* Cross-reference / naming slice of the server surface — scope-aware
|
|
176
234
|
* queries that resolve against the language's reference services. NOT part
|
|
@@ -181,11 +239,11 @@ export interface DataServerProtocol<TTransfer extends TransferElement, TDiagnost
|
|
|
181
239
|
* source/URI (an `ElementSource` with no URI resolves to the sole
|
|
182
240
|
* registered language; a multi-language workspace overrides).
|
|
183
241
|
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
242
|
+
* Not generic over a server's root type: {@link resolveReference} answers with
|
|
243
|
+
* a node a reference names, which is no document root, and candidates and
|
|
244
|
+
* names are diagnostic-free.
|
|
187
245
|
*/
|
|
188
|
-
export interface ReferenceServerProtocol
|
|
246
|
+
export interface ReferenceServerProtocol {
|
|
189
247
|
/**
|
|
190
248
|
* List the reference candidates reachable for the property named in `ctx`
|
|
191
249
|
* from its (possibly synthetic) source. Backed by the language's
|
|
@@ -197,8 +255,11 @@ export interface ReferenceServerProtocol<TTransfer extends TransferElement> {
|
|
|
197
255
|
* target's document URI, display fields, and the resolved node's encoded
|
|
198
256
|
* transfer subtree. Resolves via the language's reference services;
|
|
199
257
|
* `undefined` when the reference does not resolve.
|
|
258
|
+
*
|
|
259
|
+
* `TElement` is the caller's claim about the target node's type; nothing
|
|
260
|
+
* checks it, so leave it at the default unless the reference names one type.
|
|
200
261
|
*/
|
|
201
|
-
resolveReference(ref: ReferenceRequest): Promise<ReferenceTarget<
|
|
262
|
+
resolveReference<TElement extends TransferElement = TransferElement>(ref: ReferenceRequest): Promise<ReferenceTarget<TElement> | undefined>;
|
|
202
263
|
/**
|
|
203
264
|
* Compute the next free name for a new element of `args.type` based on
|
|
204
265
|
* `args.proposal`, unique within the `args.tier` scope (default
|
|
@@ -235,6 +296,36 @@ export interface DocumentClientProtocol<TTransfer extends TransferElement, TDiag
|
|
|
235
296
|
* codepath, not a subscription codepath).
|
|
236
297
|
*/
|
|
237
298
|
onDocumentSaved(event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>): void;
|
|
299
|
+
/**
|
|
300
|
+
* Delivered when a subscribed document's text starts or stops differing
|
|
301
|
+
* from its file, as the server last knew it. Gated like
|
|
302
|
+
* {@link onDocumentSaved}; the answer at any one moment is the `dirty` of
|
|
303
|
+
* the documents the server sends. After a reconnect, a `DataSession`
|
|
304
|
+
* delivers here the answer of each document it restored, when that differs
|
|
305
|
+
* from the last this client was told: the flips while the connection was
|
|
306
|
+
* down reached no one.
|
|
307
|
+
*/
|
|
308
|
+
onDocumentDirtyChanged(event: TransferDocumentDirtyChangedEvent): void;
|
|
309
|
+
/**
|
|
310
|
+
* Delivered when a document's backing file was removed. Separate from
|
|
311
|
+
* {@link onDocumentUpdated} for the same reason as {@link onDocumentSaved},
|
|
312
|
+
* and more strongly: there is no built state to deliver, and the build-phase
|
|
313
|
+
* path cannot report a deletion at all.
|
|
314
|
+
*
|
|
315
|
+
* Ungated, because on a browser host — where the workspace lives behind the
|
|
316
|
+
* head — no other source can observe a file disappearing. Recipients that
|
|
317
|
+
* only care about their own documents filter by URI.
|
|
318
|
+
*/
|
|
319
|
+
onDocumentDeleted(event: TransferDocumentDeletedEvent): void;
|
|
320
|
+
/**
|
|
321
|
+
* Delivered once per build, naming the documents that reached the
|
|
322
|
+
* subscription phase and that
|
|
323
|
+
* nobody on this connection watches — chiefly the ones rebuilt as a cascade
|
|
324
|
+
* from a dependency's change, which no filesystem watcher can see because
|
|
325
|
+
* their own files did not change. The complement of
|
|
326
|
+
* {@link onDocumentUpdated}; carries URIs and no documents.
|
|
327
|
+
*/
|
|
328
|
+
onDocumentsBuilt(event: TransferDocumentsBuiltEvent): void;
|
|
238
329
|
}
|
|
239
330
|
/**
|
|
240
331
|
* 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;
|
|
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,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACpF,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,EACT,oBAAoB,EACpB,4BAA4B,EAC5B,iCAAiC,EACjC,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC9B,MAAM,UAAU,C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;;;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
|
@@ -9,29 +9,35 @@
|
|
|
9
9
|
import type { TransferDiagnostic } from '../transfer-diagnostic';
|
|
10
10
|
import type { TransferElement } from '../transfer-element';
|
|
11
11
|
import type { Project } from '../project';
|
|
12
|
-
import type { TransferDocument } from '../transfer-document';
|
|
12
|
+
import type { TextState, TransferDocument } from '../transfer-document';
|
|
13
13
|
/**
|
|
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 build that follows a document's release names the release id
|
|
55
|
+
* instead.
|
|
56
|
+
*/
|
|
45
57
|
sourceClientId: string;
|
|
46
58
|
reason: TransferDocumentUpdateReason;
|
|
47
59
|
}
|
|
@@ -49,8 +61,8 @@ export interface TransferDocumentUpdatedEvent<TTransfer extends TransferElement,
|
|
|
49
61
|
export type TransferDocumentUpdatedListener<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> = (event: TransferDocumentUpdatedEvent<TTransfer, TDiagnostic>) => void;
|
|
50
62
|
/**
|
|
51
63
|
* Delivered on the data-server when a document was persisted to disk via
|
|
52
|
-
* `DataServerProtocol.saveModelDocument`. Distinct
|
|
53
|
-
* {@link TransferDocumentUpdatedEvent}: subscribers that only care about
|
|
64
|
+
* `DataServerProtocol.saveModelDocument` or `persistModelDocument`. Distinct
|
|
65
|
+
* from {@link TransferDocumentUpdatedEvent}: subscribers that only care about
|
|
54
66
|
* persistence (external sync, editor "saved" indicators, dirty-flag
|
|
55
67
|
* clear) listen for this event family instead of filtering an update
|
|
56
68
|
* stream for `reason: 'saved'`.
|
|
@@ -63,15 +75,99 @@ export type TransferDocumentUpdatedListener<TTransfer extends TransferElement, T
|
|
|
63
75
|
export interface TransferDocumentSavedEvent<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> {
|
|
64
76
|
document: TransferDocument<TTransfer, TDiagnostic>;
|
|
65
77
|
/**
|
|
66
|
-
* The client whose `saveModelDocument`
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
78
|
+
* The client whose `saveModelDocument` or `persistModelDocument` call
|
|
79
|
+
* produced this, also when another client wrote the persisted text. Every
|
|
80
|
+
* subscriber receives the event including the originator, which already had
|
|
81
|
+
* the same state as the RPC response — compare against your own id to drop
|
|
82
|
+
* the echo rather than re-rendering from it.
|
|
70
83
|
*/
|
|
71
84
|
sourceClientId: string;
|
|
72
85
|
}
|
|
73
86
|
/** Callback shape for `DataClientProtocol.onDocumentSaved`. */
|
|
74
87
|
export type TransferDocumentSavedListener<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic> = (event: TransferDocumentSavedEvent<TTransfer, TDiagnostic>) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Delivered on the data-server when a watched document's text starts or stops
|
|
90
|
+
* differing from its file, as the server last knew the file. The current
|
|
91
|
+
* answer rides on every transfer document the server sends as `text.dirty`;
|
|
92
|
+
* this carries only its changes, so a client that follows it needs no rebuild
|
|
93
|
+
* to learn of a save.
|
|
94
|
+
*/
|
|
95
|
+
export interface TransferDocumentDirtyChangedEvent {
|
|
96
|
+
/** Canonical URI, keyed as the subscription is. */
|
|
97
|
+
readonly uri: string;
|
|
98
|
+
/**
|
|
99
|
+
* The text the answer was decided on. It is sent before that text is
|
|
100
|
+
* built, so a `text.version` ahead of the model a client holds means an
|
|
101
|
+
* update at this version or a later one follows. Absent when the document
|
|
102
|
+
* no longer exists, or when the build that follows its release failed.
|
|
103
|
+
*/
|
|
104
|
+
readonly text?: TextState;
|
|
105
|
+
}
|
|
106
|
+
/** Callback shape for `DataClientProtocol.onDocumentDirtyChanged`. */
|
|
107
|
+
export type TransferDocumentDirtyChangedListener = (event: TransferDocumentDirtyChangedEvent) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Delivered on the data-server when a document's backing file was removed.
|
|
110
|
+
* Carries no document, and cannot: the state a
|
|
111
|
+
* {@link TransferDocumentUpdatedEvent} would have to carry no longer exists by
|
|
112
|
+
* the time anyone can be told. That is also why deletion is not a `reason` on
|
|
113
|
+
* the update stream — `DocumentBuilder.update` drops the document before
|
|
114
|
+
* deriving the rebuild set, so the phase-driven path that produces update
|
|
115
|
+
* events never runs for it.
|
|
116
|
+
*
|
|
117
|
+
* **Delivered for EVERY document, not only watched ones**, unlike
|
|
118
|
+
* `onDocumentUpdated` and `onDocumentSaved`. The test that decides which
|
|
119
|
+
* channels are gated is whether any OTHER source can observe the fact on the
|
|
120
|
+
* least capable host: a browser-hosted client's workspace lives behind the
|
|
121
|
+
* head, so nothing there can see a file disappear, and gating the notification
|
|
122
|
+
* would leave it blind. (A Theia frontend's filesystem watcher would cover it,
|
|
123
|
+
* which is why this is a host argument and not a structure-versus-content one.)
|
|
124
|
+
* A watcher is told about its own document's deletion here too, the update
|
|
125
|
+
* channel being silent for deletions by construction. Filter on {@link uri} if
|
|
126
|
+
* the receiver only cares about documents it opened.
|
|
127
|
+
*
|
|
128
|
+
* A watch survives the deletion, so a file that comes back resumes delivering
|
|
129
|
+
* `onDocumentUpdated` to the same subscribers with no re-subscription. A
|
|
130
|
+
* client that responds by closing its editor releases the watch through
|
|
131
|
+
* `closeModelDocument` as usual.
|
|
132
|
+
*/
|
|
133
|
+
export interface TransferDocumentDeletedEvent {
|
|
134
|
+
/** Canonical URI of the removed document, keyed as the subscription is. */
|
|
135
|
+
readonly uri: string;
|
|
136
|
+
}
|
|
137
|
+
/** Callback shape for `DataClientProtocol.onDocumentDeleted`. */
|
|
138
|
+
export type TransferDocumentDeletedListener = (event: TransferDocumentDeletedEvent) => void;
|
|
139
|
+
/**
|
|
140
|
+
* Delivered on the data-server once per build, naming the documents that reached
|
|
141
|
+
* the configured subscription phase (`DataServerOptions.subscriptionPhase`,
|
|
142
|
+
* `Validated` by default) and that NO client on the connection is watching. Not
|
|
143
|
+
* the integrity-settled landmark, which is a different point and a different
|
|
144
|
+
* word in this framework.
|
|
145
|
+
*
|
|
146
|
+
* The complement of {@link TransferDocumentUpdatedEvent}, which is gated per
|
|
147
|
+
* URI: together the two cover every document a build touched. This one exists
|
|
148
|
+
* for the case no source outside the server can observe — a document rebuilt
|
|
149
|
+
* because something it DEPENDS ON changed. Its own file never changed, so a
|
|
150
|
+
* filesystem watcher cannot see it, and it has no subscriber, so the update
|
|
151
|
+
* channel does not report it. A consumer showing data derived from such a
|
|
152
|
+
* document (a tree label, a decorator) would otherwise hold a stale value with
|
|
153
|
+
* nothing to invalidate it.
|
|
154
|
+
*
|
|
155
|
+
* Carries URIs and no documents: a recipient re-reads what it displays, through
|
|
156
|
+
* `getModelDocument` or its own request. That keeps the bandwidth property the
|
|
157
|
+
* per-URI subscription exists for, without gating the message.
|
|
158
|
+
*
|
|
159
|
+
* Not sent when the set is empty, which is the normal case while editing — the
|
|
160
|
+
* document being edited is watched by its own editor and therefore excluded.
|
|
161
|
+
* Workspace initialisation sends nothing either: it does not build to the
|
|
162
|
+
* subscription phase. The largest message a workspace can produce is therefore
|
|
163
|
+
* a whole-workspace rebuild at that phase, which is one message of URIs.
|
|
164
|
+
*/
|
|
165
|
+
export interface TransferDocumentsBuiltEvent {
|
|
166
|
+
/** Canonical URIs, keyed as subscriptions are. Never empty. */
|
|
167
|
+
readonly uris: readonly string[];
|
|
168
|
+
}
|
|
169
|
+
/** Callback shape for `DataClientProtocol.onDocumentsBuilt`. */
|
|
170
|
+
export type TransferDocumentsBuiltListener = (event: TransferDocumentsBuiltEvent) => void;
|
|
75
171
|
/**
|
|
76
172
|
* Why a project-change event fired. `added` — the project was newly
|
|
77
173
|
* 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,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/data/events.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,M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