@hydranium/glsp-server 1.0.0-next.31 → 1.0.0-next.313
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 +80 -88
- package/lib/browser/start-glsp-server-in-worker.d.ts +43 -42
- package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -1
- package/lib/browser/start-glsp-server-in-worker.js +62 -13
- package/lib/browser/start-glsp-server-in-worker.js.map +1 -1
- package/lib/command/diagram-edit-dropped-error.d.ts +31 -0
- package/lib/command/diagram-edit-dropped-error.d.ts.map +1 -0
- package/lib/command/diagram-edit-dropped-error.js +48 -0
- package/lib/command/diagram-edit-dropped-error.js.map +1 -0
- package/lib/command/hydranium-glsp-command-stack.d.ts +33 -0
- package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-command-stack.js +63 -0
- package/lib/command/hydranium-glsp-command-stack.js.map +1 -0
- package/lib/command/hydranium-glsp-operation-action-handler.d.ts +64 -0
- package/lib/command/hydranium-glsp-operation-action-handler.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-operation-action-handler.js +142 -0
- package/lib/command/hydranium-glsp-operation-action-handler.js.map +1 -0
- package/lib/command/hydranium-glsp-operation-command.d.ts +250 -0
- package/lib/command/hydranium-glsp-operation-command.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-operation-command.js +491 -0
- package/lib/command/hydranium-glsp-operation-command.js.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts +26 -87
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-recording-command.js +40 -117
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
- package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts +23 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.js +41 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.js.map +1 -0
- package/lib/command/index.d.ts +5 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +5 -0
- package/lib/command/index.js.map +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts.map +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js +2 -2
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js.map +1 -1
- package/lib/dispatcher/server-action-dispatcher.d.ts +25 -24
- package/lib/dispatcher/server-action-dispatcher.d.ts.map +1 -1
- package/lib/dispatcher/server-action-dispatcher.js +38 -26
- package/lib/dispatcher/server-action-dispatcher.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +35 -59
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +60 -71
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -1
- package/lib/launcher/drop-notifications-to-gone-client.d.ts +23 -0
- package/lib/launcher/drop-notifications-to-gone-client.d.ts.map +1 -0
- package/lib/launcher/drop-notifications-to-gone-client.js +43 -0
- package/lib/launcher/drop-notifications-to-gone-client.js.map +1 -0
- package/lib/launcher/glsp-app-module.d.ts +1 -2
- package/lib/launcher/glsp-app-module.d.ts.map +1 -1
- package/lib/launcher/glsp-app-module.js.map +1 -1
- package/lib/launcher/glsp-connection-logger.d.ts +19 -0
- package/lib/launcher/glsp-connection-logger.d.ts.map +1 -0
- package/lib/launcher/glsp-connection-logger.js +24 -0
- package/lib/launcher/glsp-connection-logger.js.map +1 -0
- package/lib/launcher/glsp-server-overrides.d.ts +10 -8
- package/lib/launcher/glsp-server-overrides.d.ts.map +1 -1
- package/lib/launcher/glsp-server-overrides.js +25 -11
- package/lib/launcher/glsp-server-overrides.js.map +1 -1
- package/lib/launcher/hydranium-glsp-server.d.ts +60 -15
- package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
- package/lib/launcher/hydranium-glsp-server.js +145 -22
- package/lib/launcher/hydranium-glsp-server.js.map +1 -1
- package/lib/launcher/index.d.ts +2 -0
- package/lib/launcher/index.d.ts.map +1 -1
- package/lib/launcher/index.js +5 -4
- package/lib/launcher/index.js.map +1 -1
- package/lib/logging/glsp-client-logger.d.ts +10 -6
- package/lib/logging/glsp-client-logger.d.ts.map +1 -1
- package/lib/logging/glsp-client-logger.js +14 -7
- package/lib/logging/glsp-client-logger.js.map +1 -1
- package/lib/messages/index.d.ts +11 -6
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +11 -6
- package/lib/messages/index.js.map +1 -1
- package/lib/node/start-glsp-server.d.ts +50 -15
- package/lib/node/start-glsp-server.d.ts.map +1 -1
- package/lib/node/start-glsp-server.js +97 -30
- package/lib/node/start-glsp-server.js.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts +326 -102
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.js +529 -139
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
- package/lib/state/diagram-status.d.ts +38 -0
- package/lib/state/diagram-status.d.ts.map +1 -0
- package/lib/state/diagram-status.js +27 -0
- package/lib/state/diagram-status.js.map +1 -0
- package/lib/state/full-text-hydranium-glsp-state.d.ts +22 -9
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.js +45 -18
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
- package/lib/state/hydranium-glsp-index.d.ts +40 -29
- package/lib/state/hydranium-glsp-index.d.ts.map +1 -1
- package/lib/state/hydranium-glsp-index.js +82 -45
- package/lib/state/hydranium-glsp-index.js.map +1 -1
- package/lib/state/hydranium-shared-core-services.d.ts +16 -29
- package/lib/state/hydranium-shared-core-services.d.ts.map +1 -1
- package/lib/state/hydranium-shared-core-services.js +15 -28
- package/lib/state/hydranium-shared-core-services.js.map +1 -1
- package/lib/state/index.d.ts +1 -0
- package/lib/state/index.d.ts.map +1 -1
- package/lib/state/index.js +1 -0
- package/lib/state/index.js.map +1 -1
- package/lib/state/model-ready-timeout-error.d.ts.map +1 -1
- package/lib/state/model-ready-timeout-error.js.map +1 -1
- package/lib/state/reconcile-source-model-write.d.ts +13 -27
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
- package/lib/state/reconcile-source-model-write.js +44 -32
- package/lib/state/reconcile-source-model-write.js.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +125 -69
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.js +242 -100
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +36 -28
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +59 -42
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
- package/lib/status/diagram-status-reporter.d.ts +44 -0
- package/lib/status/diagram-status-reporter.d.ts.map +1 -0
- package/lib/status/diagram-status-reporter.js +88 -0
- package/lib/status/diagram-status-reporter.js.map +1 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.d.ts +27 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.d.ts.map +1 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.js +52 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.js.map +1 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts +27 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts.map +1 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js +53 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js.map +1 -0
- package/lib/status/index.d.ts +12 -0
- package/lib/status/index.d.ts.map +1 -0
- package/lib/status/index.js +12 -0
- package/lib/status/index.js.map +1 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts +30 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts.map +1 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.js +47 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.js.map +1 -0
- package/lib/storage/hydranium-glsp-storage.d.ts +324 -143
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
- package/lib/storage/hydranium-glsp-storage.js +569 -213
- package/lib/storage/hydranium-glsp-storage.js.map +1 -1
- package/lib/storage/index.d.ts +2 -1
- package/lib/storage/index.d.ts.map +1 -1
- package/lib/storage/index.js +2 -1
- package/lib/storage/index.js.map +1 -1
- package/lib/storage/save-delivery-policy.d.ts +51 -0
- package/lib/storage/save-delivery-policy.d.ts.map +1 -0
- package/lib/storage/{save-conflict-policy.js → save-delivery-policy.js} +7 -8
- package/lib/storage/save-delivery-policy.js.map +1 -0
- package/lib/submission/hydranium-glsp-submission-handler.d.ts +44 -4
- package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -1
- package/lib/submission/hydranium-glsp-submission-handler.js +82 -6
- package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -1
- package/lib/testing/glsp-harness.d.ts +34 -7
- package/lib/testing/glsp-harness.d.ts.map +1 -1
- package/lib/testing/glsp-harness.js +47 -19
- package/lib/testing/glsp-harness.js.map +1 -1
- package/lib/validation/diagnostic-markers.d.ts +3 -3
- package/lib/validation/diagnostic-markers.d.ts.map +1 -1
- package/lib/validation/diagnostic-markers.js +1 -1
- package/lib/validation/diagnostic-markers.js.map +1 -1
- package/lib/validation/hydranium-glsp-model-validator.d.ts +1 -2
- package/lib/validation/hydranium-glsp-model-validator.d.ts.map +1 -1
- package/lib/validation/hydranium-glsp-model-validator.js +1 -1
- package/lib/validation/hydranium-glsp-model-validator.js.map +1 -1
- package/package.json +31 -52
- package/src/browser/start-glsp-server-in-worker.ts +79 -51
- package/src/command/diagram-edit-dropped-error.ts +51 -0
- package/src/command/hydranium-glsp-command-stack.ts +47 -0
- package/src/command/hydranium-glsp-operation-action-handler.ts +141 -0
- package/src/command/hydranium-glsp-operation-command.ts +602 -0
- package/src/command/hydranium-glsp-recording-command.ts +40 -121
- package/src/command/hydranium-glsp-undo-redo-action-handler.ts +29 -0
- package/src/command/index.ts +10 -0
- package/src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts +2 -2
- package/src/dispatcher/server-action-dispatcher.ts +39 -31
- package/src/index.ts +1 -0
- package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +79 -91
- package/src/launcher/drop-notifications-to-gone-client.ts +47 -0
- package/src/launcher/glsp-app-module.ts +1 -2
- package/src/launcher/glsp-connection-logger.ts +27 -0
- package/src/launcher/glsp-server-overrides.ts +27 -11
- package/src/launcher/hydranium-glsp-server.ts +153 -23
- package/src/launcher/index.ts +5 -4
- package/src/logging/glsp-client-logger.ts +16 -9
- package/src/messages/index.ts +16 -6
- package/src/node/start-glsp-server.ts +133 -40
- package/src/state/abstract-hydranium-glsp-state.ts +609 -154
- package/src/state/diagram-status.ts +41 -0
- package/src/state/full-text-hydranium-glsp-state.ts +46 -18
- package/src/state/hydranium-glsp-index.ts +85 -41
- package/src/state/hydranium-shared-core-services.ts +16 -29
- package/src/state/index.ts +1 -0
- package/src/state/reconcile-source-model-write.ts +51 -53
- package/src/state/reconciling-multi-document-glsp-state.ts +276 -102
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +67 -45
- package/src/status/diagram-status-reporter.ts +106 -0
- package/src/status/hydranium-glsp-request-model-action-handler.ts +43 -0
- package/src/status/hydranium-glsp-set-edit-mode-action-handler.ts +38 -0
- package/src/status/index.ts +12 -0
- package/src/storage/hydranium-glsp-request-save-model-action-handler.ts +40 -0
- package/src/storage/hydranium-glsp-storage.ts +647 -223
- package/src/storage/index.ts +2 -1
- package/src/storage/save-delivery-policy.ts +49 -0
- package/src/submission/hydranium-glsp-submission-handler.ts +91 -5
- package/src/testing/glsp-harness.ts +67 -25
- package/src/validation/diagnostic-markers.ts +3 -3
- package/src/validation/hydranium-glsp-model-validator.ts +4 -5
- package/lib/storage/save-conflict-policy.d.ts +0 -56
- package/lib/storage/save-conflict-policy.d.ts.map +0 -1
- package/lib/storage/save-conflict-policy.js.map +0 -1
- package/src/storage/save-conflict-policy.ts +0 -52
|
@@ -9,30 +9,62 @@
|
|
|
9
9
|
import { type Action, ActionDispatcher, type ClientSession, type ClientSessionListener, ClientSessionManager, type DefaultCommandStack, type Disposable, Logger as GlspLogger, type MaybePromise, ModelValidator, type RequestModelAction, type SaveModelAction, type SourceModelStorage } from '@eclipse-glsp/server';
|
|
10
10
|
import { Debouncer, DisposableCollection } from '@hydranium/protocol';
|
|
11
11
|
import { type AstNode } from '@hydranium/langium';
|
|
12
|
-
import { AstDocument, type AstDocumentSavedEvent, type AstDocumentUpdatedEvent, type ServerSharedServices } from '@hydranium/core';
|
|
12
|
+
import { type AstDocument, type AstDocumentSavedEvent, type AstDocumentUpdatedEvent, type ClientSession as ModelClientSession, type ModelDirtyChangedEvent, type ServerSharedServices, type SessionEndCause } from '@hydranium/core';
|
|
13
13
|
import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
|
|
14
|
+
import { type DiagramStatusEntry } from '../state/diagram-status.js';
|
|
14
15
|
import { type HydraniumGlspSubmissionHandler } from '../submission/hydranium-glsp-submission-handler.js';
|
|
15
|
-
import {
|
|
16
|
+
import { SaveDeliveryPolicy } from './save-delivery-policy.js';
|
|
16
17
|
/**
|
|
17
|
-
* A save action arrived with nowhere to write to.
|
|
18
|
+
* A save action arrived with nowhere to write to. A save action carries no
|
|
19
|
+
* request id, so it falls through to the error handler and `message` becomes
|
|
20
|
+
* the toast text.
|
|
18
21
|
*
|
|
19
|
-
*
|
|
20
|
-
* action
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* `cause?.toString?.()`, so a code there would sit inside human text.
|
|
22
|
+
* Rendered at the raise site rather than by a carrier method, because GLSP's
|
|
23
|
+
* action protocol has no slot for an identity anywhere — every member of its
|
|
24
|
+
* message, status and reject actions is prose or an enum, and
|
|
25
|
+
* `MessageAction.details` is not a substitute since it is prose populated from
|
|
26
|
+
* `cause?.toString?.()`, and a Theia host shows it to a user on demand. So the
|
|
27
|
+
* throw is the last place that still knows which message this is.
|
|
26
28
|
*/
|
|
27
29
|
export declare const SAVE_TARGET_UNKNOWN: import("@hydranium/protocol").MessageDefinition<"Could not determine where to save this model">;
|
|
28
30
|
/**
|
|
29
31
|
* A model request arrived without the source URI it is required to carry.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* protocol has no slot for an identity, so the English is what a client
|
|
33
|
-
* receives.
|
|
32
|
+
* Rendered at the raise site, like its save-path sibling and for the same
|
|
33
|
+
* reason.
|
|
34
34
|
*/
|
|
35
35
|
export declare const SOURCE_URI_MISSING: import("@hydranium/protocol").MessageDefinition<"Could not open this model: the request did not say which document to load">;
|
|
36
|
+
/**
|
|
37
|
+
* Why the canvas has stopped accepting edits.
|
|
38
|
+
*
|
|
39
|
+
* **A READONLY canvas is otherwise indistinguishable from a broken one.** The
|
|
40
|
+
* client's answer to a read-only edit mode is to withdraw the tool palette,
|
|
41
|
+
* so the surface a reader was working in silently loses the only control it had,
|
|
42
|
+
* with the cause — a syntax error in a document that may not even be open —
|
|
43
|
+
* nowhere on screen. The mode flip is the mechanism; this is the only part of it
|
|
44
|
+
* a user can see.
|
|
45
|
+
*
|
|
46
|
+
* Rendered at the raise site, like its two siblings above and for the same
|
|
47
|
+
* reason: every member of GLSP's status action is prose or an enum.
|
|
48
|
+
*
|
|
49
|
+
* It names the document and the recovery rather than the fault, because the
|
|
50
|
+
* fault already has a surface — the squiggle and the problems list, both of which
|
|
51
|
+
* say WHICH character — and repeating it here would put a second, less precise
|
|
52
|
+
* account of the same error on screen. What no other surface says is that the
|
|
53
|
+
* diagram is waiting on it, and the document it waits on need not be the one
|
|
54
|
+
* the diagram was opened on.
|
|
55
|
+
*/
|
|
56
|
+
export declare const DIAGRAM_READONLY_PARSE_ERROR: import("@hydranium/protocol").MessageDefinition<"Read-only: {document} has a syntax error. Fix it to edit the diagram again.">;
|
|
57
|
+
/**
|
|
58
|
+
* The diagram's GLSP client id is still live as another participant's client
|
|
59
|
+
* id once the load has waited for it to free, so the diagram does not load.
|
|
60
|
+
*
|
|
61
|
+
* Rendered at the raise site, as {@link SAVE_TARGET_UNKNOWN} is and for the
|
|
62
|
+
* same reason, and dispatched to the client as a message of its own: a model
|
|
63
|
+
* request fails as a rejection whose detail is the English cause, which no user
|
|
64
|
+
* sees. It names the recovery: a host that numbers its diagram clients gives a
|
|
65
|
+
* reopened diagram a fresh id.
|
|
66
|
+
*/
|
|
67
|
+
export declare const DIAGRAM_SESSION_REFUSED: import("@hydranium/protocol").MessageDefinition<"Could not open this diagram: its identifier is still in use by another editor. Close the diagram and open it again.">;
|
|
36
68
|
/**
|
|
37
69
|
* GLSP source-model storage base shared by all hydranium adopters.
|
|
38
70
|
* Provides the DI signature, the {@link ClientSessionListener} +
|
|
@@ -43,27 +75,37 @@ export declare const SOURCE_URI_MISSING: import("@hydranium/protocol").MessageDe
|
|
|
43
75
|
* invariant.
|
|
44
76
|
*
|
|
45
77
|
* **The settled-root invariant.** Every {@link AbstractHydraniumGlspState.setSourceRoot}
|
|
46
|
-
* the
|
|
78
|
+
* the storage performs captures a root that has reached
|
|
47
79
|
* `IntegrityService.SettledState` (post-`Linked`, references indexed, on-build
|
|
48
|
-
* integrity rules applied). The
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* document
|
|
80
|
+
* integrity rules applied). The end of an operation captures the root its
|
|
81
|
+
* write produced, settled or not, and the operation's own submit waits for the
|
|
82
|
+
* settled one through `ready()`. The GModel factory therefore always walks a
|
|
83
|
+
* fully linked + reprojected AST. The resubmit path re-`settled()`s rather
|
|
84
|
+
* than keeping the `onModelUpdated` event's document: the event's document
|
|
85
|
+
* holds only while its listener runs, and the resubmit runs after a debounce,
|
|
86
|
+
* by which time another build can have reset it.
|
|
53
87
|
*
|
|
54
88
|
* Adopters with richer needs override the seams ({@link isStructurallyBroken},
|
|
55
|
-
* {@link
|
|
56
|
-
* whole flow, and select a {@link
|
|
57
|
-
* tune how {@link saveSourceModel}
|
|
89
|
+
* {@link parseErrorStatus}, {@link onSourceModelSettled}) rather than the
|
|
90
|
+
* whole flow, and select a {@link SaveDeliveryPolicy} via the bound option to
|
|
91
|
+
* tune how {@link saveSourceModel} delivers its result.
|
|
58
92
|
*
|
|
59
|
-
* **
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* {@link
|
|
65
|
-
*
|
|
66
|
-
*
|
|
93
|
+
* **One client session per GLSP client session.** The load registers the GLSP
|
|
94
|
+
* client id as a client session ({@link registerModelSession}), with the
|
|
95
|
+
* request's {@link RESUME_TOKEN_ARG}, and hands it to the state as
|
|
96
|
+
* `modelSession`. The primary is opened through it, and
|
|
97
|
+
* every document that joins the write set as it joins
|
|
98
|
+
* ({@link openSecondary}); a document that leaves the write set stays open
|
|
99
|
+
* until the next save, so leaving never reverts the diagram's unsaved edits to
|
|
100
|
+
* it. Disposing the storage ends the session, which closes everything it has
|
|
101
|
+
* open.
|
|
102
|
+
*
|
|
103
|
+
* **Default `saveSourceModel` flow.** Flushes the stored text of every
|
|
104
|
+
* document the diagram's session has open through the session's `persist`, with
|
|
105
|
+
* no serializer in the path — the update path already put the settled text in
|
|
106
|
+
* the store. The bound {@link SaveDeliveryPolicy} (default
|
|
107
|
+
* {@link DEFAULT_SAVE_DELIVERY_POLICY}, `await`) decides
|
|
108
|
+
* await-vs-fire-and-forget and failure handling.
|
|
67
109
|
*
|
|
68
110
|
* **tempId filter.** GLSP's `DefaultGlobalActionProvider` spins up a
|
|
69
111
|
* throwaway per-diagram-type container with upstream's {@link TEMPORARY_CLIENT_ID}
|
|
@@ -74,9 +116,12 @@ export declare const SOURCE_URI_MISSING: import("@hydranium/protocol").MessageDe
|
|
|
74
116
|
* **Lifecycle ordering.** `init` runs after DI resolution and parks the
|
|
75
117
|
* secondary-write-set watch, which outlives any single load.
|
|
76
118
|
* {@link sessionDisposed} calls {@link dispose}, which drains
|
|
77
|
-
* {@link toDispose} idempotently
|
|
78
|
-
*
|
|
79
|
-
*
|
|
119
|
+
* {@link toDispose} idempotently and then ends the client session. The
|
|
120
|
+
* framework's GLSP server disposes the storage as lost first when it shuts
|
|
121
|
+
* down, which is how the client's connection ending reaches it, so the
|
|
122
|
+
* diagram's unsaved text waits out the release grace. Every
|
|
123
|
+
* transient subscription created in {@link doLoadSourceModel} is parked on
|
|
124
|
+
* {@link toDispose} so the drain catches them on client-detach.
|
|
80
125
|
*/
|
|
81
126
|
export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel = string> implements SourceModelStorage, ClientSessionListener, Disposable {
|
|
82
127
|
protected readonly logger: GlspLogger;
|
|
@@ -95,14 +140,13 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
95
140
|
*/
|
|
96
141
|
protected readonly modelValidator?: ModelValidator;
|
|
97
142
|
/**
|
|
98
|
-
* Selected {@link
|
|
99
|
-
* {@link
|
|
100
|
-
* left unbound it resolves to {@link
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* `@optional()` member.
|
|
143
|
+
* Selected {@link SaveDeliveryPolicy} for {@link saveSourceModel}. Bind the
|
|
144
|
+
* {@link SaveDeliveryPolicy} token in a `DiagramModule` to choose a policy;
|
|
145
|
+
* left unbound it resolves to {@link DEFAULT_SAVE_DELIVERY_POLICY}. Read via
|
|
146
|
+
* {@link saveDeliveryPolicy} so the fallback is applied even when inversify
|
|
147
|
+
* injects `undefined` for an unbound `@optional()` member.
|
|
104
148
|
*/
|
|
105
|
-
protected readonly
|
|
149
|
+
protected readonly boundSaveDeliveryPolicy?: SaveDeliveryPolicy;
|
|
106
150
|
/** Disposables created during {@link doLoadSourceModel}; drained on session disposal. */
|
|
107
151
|
protected toDispose: DisposableCollection;
|
|
108
152
|
/**
|
|
@@ -115,13 +159,18 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
115
159
|
*/
|
|
116
160
|
protected readonly secondarySubscriptions: Map<string, Disposable>;
|
|
117
161
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* only place that sees operation submits too.
|
|
162
|
+
* Documents that left the write set since the last save. They stay open in
|
|
163
|
+
* the diagram's session until that save has persisted them, and are closed
|
|
164
|
+
* after it: closing a document as it leaves would revert the diagram's
|
|
165
|
+
* unsaved edits to it where the diagram was its last client.
|
|
123
166
|
*/
|
|
124
|
-
protected
|
|
167
|
+
protected readonly departedSecondaries: Set<string>;
|
|
168
|
+
/** How long a load without a resume token waits for a held client id to free; see {@link loadModelSession}. */
|
|
169
|
+
protected readonly sessionWaitMs: number;
|
|
170
|
+
/** Set by {@link dispose}; a disposed storage registers no session again. */
|
|
171
|
+
protected disposed: boolean;
|
|
172
|
+
/** Saves of the diagram's own that GLSP's save handler awaits; see {@link handleDirtyChanged}. */
|
|
173
|
+
protected ownSavesPending: number;
|
|
125
174
|
/**
|
|
126
175
|
* Trailing-edge debounce for the external resubmit. Rescheduled on each
|
|
127
176
|
* {@link handleModelUpdated} so back-to-back rebuilds (cascade relinks,
|
|
@@ -130,9 +179,41 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
130
179
|
* hence its `Clock` — is available by then); disposed on session teardown.
|
|
131
180
|
*/
|
|
132
181
|
protected resubmitDebouncer: Debouncer;
|
|
133
|
-
/** Latest event document awaiting the debounced resubmit; read by {@link flushResubmit} (last write wins). */
|
|
134
|
-
protected pendingResubmitDocument?: AstDocument<AstNode, unknown>;
|
|
135
182
|
protected init(): void;
|
|
183
|
+
/**
|
|
184
|
+
* Register the diagram's client session under the GLSP client id, or
|
|
185
|
+
* `undefined` when another participant holds that id, which is logged, and
|
|
186
|
+
* the diagram then refuses to load ({@link requireModelSession}). Taking
|
|
187
|
+
* the id over would end that participant's session under it, and working
|
|
188
|
+
* without a session would share its opens and echoes, so its close would
|
|
189
|
+
* take the diagram's documents with it.
|
|
190
|
+
*
|
|
191
|
+
* The exception is a `resumeToken` the holder registered with, which takes
|
|
192
|
+
* its session over: a diagram that reconnected or reloaded, whose old
|
|
193
|
+
* connection the server has not seen close yet.
|
|
194
|
+
*
|
|
195
|
+
* A client id the framework reserves throws `ReservedClientIdError`:
|
|
196
|
+
* whoever chose the GLSP client id has a bug, and no later registration can
|
|
197
|
+
* succeed.
|
|
198
|
+
*/
|
|
199
|
+
protected registerModelSession(resumeToken?: string): ModelClientSession<AstNode> | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* The diagram's client session. Throws `SessionClosedError` once the
|
|
202
|
+
* storage is disposed, and the refusal before a load has registered one.
|
|
203
|
+
* Registering here instead would start the session without the load's
|
|
204
|
+
* resume token, which a later resume then fails to match.
|
|
205
|
+
*/
|
|
206
|
+
protected requireModelSession(): ModelClientSession<AstNode>;
|
|
207
|
+
/**
|
|
208
|
+
* {@link requireModelSession} for the load, registering with the request's
|
|
209
|
+
* resume token, and telling the user when the id is refused. A load with
|
|
210
|
+
* no token waits up to {@link sessionWaitMs} for a held id to free: a
|
|
211
|
+
* client that resumes no session reconnects under its old id before the
|
|
212
|
+
* server has seen the old connection close.
|
|
213
|
+
*/
|
|
214
|
+
protected loadModelSession(action: RequestModelAction): Promise<ModelClientSession<AstNode>>;
|
|
215
|
+
/** Resolve once the client session under `clientId` ends, or after `timeoutMs`. */
|
|
216
|
+
protected waitForSessionEnd(clientId: string, timeoutMs: number): Promise<void>;
|
|
136
217
|
/**
|
|
137
218
|
* Default load flow — {@link doLoadSourceModel}. Adopters whose load flow
|
|
138
219
|
* needs more than the seams allow override this method.
|
|
@@ -140,12 +221,14 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
140
221
|
loadSourceModel(action: RequestModelAction): MaybePromise<void>;
|
|
141
222
|
protected doLoadSourceModel(action: RequestModelAction): Promise<void>;
|
|
142
223
|
/**
|
|
143
|
-
* Capture the initial settled root and
|
|
144
|
-
*
|
|
145
|
-
* the first {@link handleModelUpdated} (at `Validated`, with diagnostics) flips
|
|
146
|
-
* it READONLY if the document has structural parse errors. Edit-mode +
|
|
147
|
-
* settle-hook actions are dispatched on a macrotask so the initial
|
|
224
|
+
* Capture the initial settled root and its parse-error status. Settle-hook
|
|
225
|
+
* actions are dispatched on a macrotask so the initial
|
|
148
226
|
* `requestModel → setModel` handshake isn't perturbed.
|
|
227
|
+
*
|
|
228
|
+
* The initial status is decided from the root's own parse (see
|
|
229
|
+
* {@link isStructurallyBroken}), not from diagnostics: `settled()` can hand
|
|
230
|
+
* back a document it drove to the integrity landmark, before validation,
|
|
231
|
+
* with no diagnostics yet.
|
|
149
232
|
*/
|
|
150
233
|
protected captureSettledRoot(rootUri: string, document: AstDocument<AstNode, never>): Promise<void>;
|
|
151
234
|
/**
|
|
@@ -166,52 +249,55 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
166
249
|
* piece is a subscription, not an invalidation.
|
|
167
250
|
*/
|
|
168
251
|
protected reconcileSecondarySubscriptions(): void;
|
|
252
|
+
/**
|
|
253
|
+
* Open a document that joined the write set through the diagram's session,
|
|
254
|
+
* where it stays open until the diagram's next save after it leaves the set,
|
|
255
|
+
* or the diagram's end. A document that does not exist yet is left to the
|
|
256
|
+
* write that creates it, and a failed open is logged: the write that needs
|
|
257
|
+
* the document opens it again and fails there.
|
|
258
|
+
*/
|
|
259
|
+
protected openSecondary(uri: string): void;
|
|
169
260
|
/**
|
|
170
261
|
* React to a rebuild of a SECONDARY document by resubmitting the diagram, so
|
|
171
262
|
* an external edit to (say) a layout file reaches the canvas.
|
|
172
263
|
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
264
|
+
* Applies {@link handleModelUpdated}'s guard, and that is the load-bearing
|
|
265
|
+
* half rather than the resubmit: a diagram interaction that writes a
|
|
175
266
|
* secondary — a drag persisting bounds to a layout file — comes back through
|
|
176
|
-
* this listener
|
|
267
|
+
* this listener caused by the client's own write, and resubmitting on it
|
|
177
268
|
* fights the optimistic client-side move the user is still holding.
|
|
178
269
|
*
|
|
179
|
-
* Schedules the PRIMARY's current document, never the secondary's.
|
|
180
|
-
* {@link doUpdateAndSubmit} reads its event document only for the edit-mode
|
|
181
|
-
* and structurally-broken decisions, both of which are statements about the
|
|
182
|
-
* document the canvas edits: passing the secondary's would let a typo in a
|
|
183
|
-
* layout file flip the canvas READONLY and take the keep-the-last-valid-GModel
|
|
184
|
-
* branch off an unrelated document's parse state. The pending-document field
|
|
185
|
-
* is shared with the primary path, so it would poison a concurrently
|
|
186
|
-
* scheduled primary resubmit too.
|
|
187
|
-
*
|
|
188
270
|
* No marker refresh, unlike the primary path: a secondary's diagnostics reach
|
|
189
271
|
* the client only if an adopter's index registers elements as rendering that
|
|
190
272
|
* document, and refreshing here unconditionally would add a dispatch to every
|
|
191
273
|
* drag this client authors — the guard above gates the resubmit, not the
|
|
192
274
|
* markers.
|
|
193
275
|
*/
|
|
194
|
-
protected handleSecondaryUpdated(uri: string, event: AstDocumentUpdatedEvent<AstNode
|
|
276
|
+
protected handleSecondaryUpdated(uri: string, event: AstDocumentUpdatedEvent<AstNode>): void;
|
|
195
277
|
/**
|
|
196
278
|
* The primary document's current state, or `undefined` when it is not
|
|
197
279
|
* registered.
|
|
198
280
|
*
|
|
199
|
-
* Synchronous by construction
|
|
200
|
-
*
|
|
201
|
-
* `settled()` is not an alternative: it strips diagnostics by phase contract,
|
|
202
|
-
* and diagnostics are the reason {@link doUpdateAndSubmit} takes a separate
|
|
203
|
-
* event document at all.
|
|
281
|
+
* Synchronous by construction, so the parse-error status reads the text as
|
|
282
|
+
* it stands rather than waiting for a build.
|
|
204
283
|
*/
|
|
205
|
-
protected currentPrimaryDocument(): AstDocument<AstNode
|
|
284
|
+
protected currentPrimaryDocument(): AstDocument<AstNode> | undefined;
|
|
206
285
|
/**
|
|
207
286
|
* React to an external rebuild reaching `Validated`. Self-cleans if the
|
|
208
287
|
* session has vanished but this listener leaked (neither `sessionDisposed`
|
|
209
|
-
* nor `onClientClosed` fired on tab close). Resubmits for any
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
288
|
+
* nor `onClientClosed` fired on tab close). Resubmits for any update this
|
|
289
|
+
* client's own write did not cause alone, then refreshes diagnostic markers
|
|
290
|
+
* for every update — including own writes, which skip the resubmit but can
|
|
291
|
+
* still change diagnostics. An event without `causedBy` is resubmitted.
|
|
292
|
+
*
|
|
293
|
+
* Own writes include a primary that the build of a write to a secondary
|
|
294
|
+
* swept in, which arrives `rebuilt`. Skipping it loses nothing the canvas
|
|
295
|
+
* shows: the operation behind the write submits once the write has
|
|
296
|
+
* answered, and a build steps its whole batch through each phase, so that
|
|
297
|
+
* submit already renders the relinked primary. What the later `Validated`
|
|
298
|
+
* adds are diagnostics, which the marker refresh carries.
|
|
213
299
|
*/
|
|
214
|
-
protected handleModelUpdated(rootUri: string, event: AstDocumentUpdatedEvent<AstNode
|
|
300
|
+
protected handleModelUpdated(rootUri: string, event: AstDocumentUpdatedEvent<AstNode>): Promise<void>;
|
|
215
301
|
/**
|
|
216
302
|
* Whether this storage has outlived its session — disposing it as a side
|
|
217
303
|
* effect when so. Checked from every subscription entry point because GLSP's
|
|
@@ -222,83 +308,161 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
222
308
|
*/
|
|
223
309
|
protected disposeIfStale(context: string): boolean;
|
|
224
310
|
/**
|
|
225
|
-
*
|
|
226
|
-
* {@link
|
|
227
|
-
* {@link doUpdateAndSubmit} once with the most recent document.
|
|
311
|
+
* (Re)arm the trailing-edge {@link resubmitDebouncer}, so a burst of
|
|
312
|
+
* rebuilds runs {@link doUpdateAndSubmit} once.
|
|
228
313
|
*/
|
|
229
|
-
protected scheduleUpdateAndSubmit(
|
|
314
|
+
protected scheduleUpdateAndSubmit(): void;
|
|
230
315
|
/**
|
|
231
|
-
* Debouncer callback: run the resubmit
|
|
232
|
-
*
|
|
233
|
-
*
|
|
316
|
+
* Debouncer callback: run the resubmit against this storage's (invariant)
|
|
317
|
+
* source URI and dispatch the result. Fire-and-forget — failures are
|
|
318
|
+
* logged, not surfaced to the timer caller.
|
|
234
319
|
*/
|
|
235
320
|
protected flushResubmit(): void;
|
|
236
321
|
/**
|
|
237
|
-
*
|
|
238
|
-
* mark
|
|
239
|
-
*
|
|
322
|
+
* For a diagram module on GLSP's own command stack, which counts commands:
|
|
323
|
+
* mark it clean when another client persists the document.
|
|
324
|
+
* `HydraniumGlspCommandStack` reads the text store instead, and this does
|
|
325
|
+
* not move it.
|
|
326
|
+
*/
|
|
327
|
+
protected handleModelSaved(event: AstDocumentSavedEvent<AstNode>): void;
|
|
328
|
+
/**
|
|
329
|
+
* Send the diagram's dirty state when a document it has open turns dirty or
|
|
330
|
+
* clean, the answer being the command stack's. GLSP sends it only with a
|
|
331
|
+
* model submission or a save of the diagram's own, so a save by another
|
|
332
|
+
* client, an editor included, or an edit that changes nothing the diagram
|
|
333
|
+
* shows would otherwise leave the client's marker wrong until the next
|
|
334
|
+
* gesture. A flip the diagram's own operation causes is sent twice, once
|
|
335
|
+
* here and once with the submission, and the client keeps the one state.
|
|
336
|
+
*
|
|
337
|
+
* Nothing is sent while a save of the diagram's own is awaited: GLSP's save
|
|
338
|
+
* handler sends the state once the save settles, reason `save`, and GLSP's
|
|
339
|
+
* client keeps a state only when it changes, so the save's own flip sent
|
|
340
|
+
* here first would leave that answer changing nothing. GLSP's saveable
|
|
341
|
+
* waits for exactly that answer, and times out without it.
|
|
240
342
|
*/
|
|
241
|
-
protected
|
|
343
|
+
protected handleDirtyChanged(event: ModelDirtyChangedEvent): void;
|
|
344
|
+
/** Send the command stack's dirty state, reason `external`. */
|
|
345
|
+
protected sendDirtyState(): void;
|
|
242
346
|
/**
|
|
243
347
|
* Re-settle to a guaranteed fully-linked + reprojected root, capture it, and
|
|
244
|
-
* (unless suppressed) resubmit a deduped external GModel.
|
|
245
|
-
*
|
|
246
|
-
*
|
|
348
|
+
* (unless suppressed) resubmit a deduped external GModel.
|
|
349
|
+
*
|
|
350
|
+
* The settle is awaited outside {@link AbstractHydraniumGlspState.runExclusive},
|
|
351
|
+
* so an operation does not wait on a build; the capture and the render run
|
|
352
|
+
* inside it, the render's own wait for the document included, since an
|
|
353
|
+
* operation opened between that wait and the GModel build would be rendered.
|
|
247
354
|
*/
|
|
248
|
-
protected doUpdateAndSubmit(rootUri: string
|
|
355
|
+
protected doUpdateAndSubmit(rootUri: string): Promise<Action[]>;
|
|
249
356
|
/**
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
357
|
+
* The part of {@link doUpdateAndSubmit} that runs inside the boundary.
|
|
358
|
+
* `root` is not captured when the state already holds a later one: an
|
|
359
|
+
* operation that ended while the settle was awaited captured its own
|
|
360
|
+
* write, which `root` predates.
|
|
361
|
+
*
|
|
362
|
+
* The parse-error status is the primary's as it stands now, which can be
|
|
363
|
+
* past `root`: a status taken from an older document would let an operation
|
|
364
|
+
* write into text that no longer parses.
|
|
365
|
+
*/
|
|
366
|
+
protected captureAndSubmit(rootUri: string, root: TRoot): Promise<Action[]>;
|
|
367
|
+
/**
|
|
368
|
+
* Set {@link DiagramStatus.PARSE_ERROR} to {@link parseErrorStatus} while any
|
|
369
|
+
* document the diagram writes is structurally broken, and withdraw it once
|
|
370
|
+
* they all parse. Answers the documents that are broken.
|
|
371
|
+
*
|
|
372
|
+
* The secondaries count as much as the primary: an operation writes them from
|
|
373
|
+
* the AST their parse recovered, which drops what the parser skipped, so a
|
|
374
|
+
* write into a broken secondary overwrites the user's text.
|
|
253
375
|
*/
|
|
254
|
-
protected
|
|
376
|
+
protected refreshParseErrorStatus(primary: AstDocument<AstNode>): AstDocument<AstNode>[];
|
|
377
|
+
/** The write-set secondaries that exist, other than `primaryUri`. */
|
|
378
|
+
protected secondaryDocuments(primaryUri: string): AstDocument<AstNode>[];
|
|
255
379
|
/**
|
|
256
380
|
* Seam: is the AST structurally broken (lexing/parsing errors)? Drives both
|
|
257
|
-
*
|
|
258
|
-
* instead of blanking it mid-typing.
|
|
259
|
-
*
|
|
260
|
-
*
|
|
381
|
+
* the {@link DiagramStatus.PARSE_ERROR} status and the GModel resubmit
|
|
382
|
+
* skip — keeping the last valid canvas instead of blanking it mid-typing.
|
|
383
|
+
* Default: the lexer and parser errors of
|
|
384
|
+
* the root's own parse, which exist from the parse on, so the answer does
|
|
385
|
+
* not wait for validation; for a root its document has since replaced, any
|
|
386
|
+
* error-severity diagnostic carrying a Langium `lexing-error` /
|
|
387
|
+
* `parsing-error` code. Adopters override to compose additional break
|
|
388
|
+
* reasons.
|
|
261
389
|
*/
|
|
262
|
-
protected isStructurallyBroken(document: AstDocument<AstNode
|
|
390
|
+
protected isStructurallyBroken(document: AstDocument<AstNode>): boolean;
|
|
263
391
|
/**
|
|
264
|
-
* Seam:
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
392
|
+
* Seam: the {@link DiagramStatus.PARSE_ERROR} status while `brokenDocuments`
|
|
393
|
+
* do not parse, the primary first when it is among them. Default: a read-only
|
|
394
|
+
* error whose {@link DIAGRAM_READONLY_PARSE_ERROR} message names the first.
|
|
395
|
+
*
|
|
396
|
+
* A read-only status needs a message. Read-only withdraws the tool palette,
|
|
397
|
+
* and without a message nothing on the canvas says why.
|
|
270
398
|
*/
|
|
271
|
-
protected
|
|
399
|
+
protected parseErrorStatus(brokenDocuments: AstDocument<AstNode>[]): DiagramStatusEntry;
|
|
272
400
|
/**
|
|
273
401
|
* Seam: extra actions to dispatch right after the initial settled root is
|
|
274
402
|
* captured (e.g. an adopter-specific status or palette refresh). Default: none.
|
|
275
403
|
*/
|
|
276
404
|
protected onSourceModelSettled(_document: AstDocument<AstNode, never>): Action[];
|
|
277
|
-
/** The effective {@link
|
|
278
|
-
protected get
|
|
279
|
-
/**
|
|
280
|
-
* Default save flow:
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
405
|
+
/** The effective {@link SaveDeliveryPolicy}: the bound option, or {@link DEFAULT_SAVE_DELIVERY_POLICY} when unbound. */
|
|
406
|
+
protected get saveDeliveryPolicy(): SaveDeliveryPolicy;
|
|
407
|
+
/**
|
|
408
|
+
* Default save flow: persist the store's current text for every document the
|
|
409
|
+
* diagram's session has open.
|
|
410
|
+
*
|
|
411
|
+
* **A save persists, it does not author.** Every diagram gesture already
|
|
412
|
+
* reached the store through the diagram's session, so the store holds the
|
|
413
|
+
* settled text and disk is the only thing behind. Re-serializing from the AST
|
|
414
|
+
* here cannot improve on that text and can only damage it: a serializer
|
|
415
|
+
* normalises formatting, and the comments the write path carries over keep
|
|
416
|
+
* none of the hand-formatting around them, so a save would reflow a document
|
|
417
|
+
* nothing changed — which is what a pure bounds drag does to the semantic
|
|
418
|
+
* file when only its layout moved.
|
|
419
|
+
*
|
|
420
|
+
* **What is saved is the primary, every tracked secondary
|
|
421
|
+
* (`AbstractHydraniumGlspState.trackSecondaryDocument`) and every document
|
|
422
|
+
* that left the write set since the last save**, so a document the diagram
|
|
423
|
+
* wrote is persisted whether or not it is the one the client named. One the
|
|
424
|
+
* diagram's session does not have open is skipped, even when another client
|
|
425
|
+
* has it open: that client's unsaved edits are not the diagram's to persist.
|
|
426
|
+
*
|
|
427
|
+
* **A save therefore names documents the gesture did not aim at**, which is
|
|
428
|
+
* why an unchanged one is not rewritten even though the user asked for a
|
|
429
|
+
* save: the mtime would move on a file they never touched. With the default
|
|
430
|
+
* session, `AstDocumentManager.save` decides that per document and
|
|
431
|
+
* announces the save either way.
|
|
285
432
|
*
|
|
286
|
-
* The configured {@link
|
|
287
|
-
* decides
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
* - `drop-and-log`: guard, fire-and-forget, log + swallow failures — a stale
|
|
293
|
-
* diagram save is dropped because a concurrent form/code edit already wrote
|
|
294
|
-
* the truth, and GLSP exposes no save-failure back-channel.
|
|
433
|
+
* The configured {@link SaveDeliveryPolicy} (see {@link saveDeliveryPolicy})
|
|
434
|
+
* decides await-vs-fire-and-forget and failure handling. The save persists
|
|
435
|
+
* at `'any'`: the base-version guard exists to stop a stale writer
|
|
436
|
+
* overwriting a newer document, and a flush persists the store — which
|
|
437
|
+
* already holds every other client's change, including the one that
|
|
438
|
+
* advanced the version.
|
|
295
439
|
*
|
|
296
440
|
* Returns `MaybePromise<void>` to match upstream `SourceModelStorage`:
|
|
297
|
-
* resolves with the
|
|
298
|
-
*
|
|
299
|
-
* `
|
|
441
|
+
* resolves with the flush under `await`, returns synchronously under
|
|
442
|
+
* `fire-and-forget`. To change how each document is written, override the
|
|
443
|
+
* session class's `persistDocument`; an override of this method that writes
|
|
444
|
+
* past the session skips that override.
|
|
300
445
|
*/
|
|
301
446
|
saveSourceModel(action: SaveModelAction): MaybePromise<void>;
|
|
447
|
+
/**
|
|
448
|
+
* Save the stored text of `primaryUri`, every tracked secondary and every
|
|
449
|
+
* document that left the write set since the last save, each only where
|
|
450
|
+
* the diagram's session has it open; then close those that left. Each goes
|
|
451
|
+
* through the session's `persist`, so an override of the session class's
|
|
452
|
+
* `persistDocument` applies to diagram saves too. Each saved document is
|
|
453
|
+
* then settled in the language client, so the save does not answer before
|
|
454
|
+
* that client has answered the push of what it wrote.
|
|
455
|
+
*
|
|
456
|
+
* Deduplicated, because a state that tracks its own primary as a secondary
|
|
457
|
+
* would otherwise save it twice and fire two save notifications for one
|
|
458
|
+
* save. Every save is called in one synchronous step, so each takes its text
|
|
459
|
+
* before anything can close a document of the set: saved one after another,
|
|
460
|
+
* a GLSP session ending during the first write closes the rest unsaved. A
|
|
461
|
+
* `persistDocument` override that awaits before calling the base gives that
|
|
462
|
+
* up, and a session ending during its await fails the rest with
|
|
463
|
+
* `DocumentNotOpenError`.
|
|
464
|
+
*/
|
|
465
|
+
protected flushWriteSet(primaryUri: string): Promise<void>;
|
|
302
466
|
/**
|
|
303
467
|
* Normalise GLSP's `sourceUri` — which may be a filesystem PATH or a URI
|
|
304
468
|
* string — to the URI string the workspace keys documents by.
|
|
@@ -329,10 +493,13 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
329
493
|
* A model request DOES carry a request id, so a throw here takes the
|
|
330
494
|
* client-request path rather than the toast path — and on that path `detail`
|
|
331
495
|
* comes from `cause?.toString?.()`. A single-argument throw therefore reaches
|
|
332
|
-
* neither the
|
|
333
|
-
* are addressed separately, as on the save path: `message`
|
|
334
|
-
* in the user's terms, `cause` names the
|
|
335
|
-
* missing.
|
|
496
|
+
* neither the server log nor the client console: both print `undefined`. So
|
|
497
|
+
* the two readers are addressed separately, as on the save path: `message`
|
|
498
|
+
* names what failed in the user's terms and is rendered, `cause` names the
|
|
499
|
+
* action and the option key that was missing and stays English. On THIS path
|
|
500
|
+
* the cause reaches only logs — `RejectAction.detail` is read by nothing but
|
|
501
|
+
* the client action-dispatcher's `logger.warn` — which is not what makes it
|
|
502
|
+
* English; its content is.
|
|
336
503
|
*/
|
|
337
504
|
protected getSourceUri(action: RequestModelAction): string;
|
|
338
505
|
/**
|
|
@@ -342,12 +509,18 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
342
509
|
* {@link AbstractHydraniumGlspState.setSourceRoot}.
|
|
343
510
|
*
|
|
344
511
|
* A save action carries no request id, so a throw here reaches the user as a
|
|
345
|
-
* toast built from `message`,
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
512
|
+
* toast built from `message`, while `cause` travels in
|
|
513
|
+
* `MessageAction.details` — **which a Theia host DOES put in front of a
|
|
514
|
+
* user**, as a "Show details" button on the toast opening a dialog. So the
|
|
515
|
+
* two are not split by reachability; they are split by AUDIENCE, which is
|
|
516
|
+
* the older rule and the one that holds here. The message names what failed
|
|
517
|
+
* in the user's terms and is rendered; the cause names which lookups came
|
|
518
|
+
* back empty for whom, and stays English because a wire action kind, an
|
|
519
|
+
* option key and a client id address whoever composes the system — a
|
|
520
|
+
* translated developer string is a worse outcome than an untranslated one.
|
|
521
|
+
* Neither can name the URI — not having one IS the failure, and both sources
|
|
522
|
+
* are written together, so the typed `sourceUri` is equally empty whenever
|
|
523
|
+
* this fires.
|
|
351
524
|
*/
|
|
352
525
|
protected getFileUri(action: SaveModelAction): string;
|
|
353
526
|
/**
|
|
@@ -362,15 +535,23 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
362
535
|
* set, so re-pushing the full set clears stale markers (an empty set clears
|
|
363
536
|
* all once the model is valid), and sharing the tool-palette validate
|
|
364
537
|
* command's `BATCH` reason means the two paths replace rather than duplicate.
|
|
538
|
+
*
|
|
539
|
+
* Never rejects: the update listener that calls it is not awaited. A
|
|
540
|
+
* validator that throws is logged as an error, markers that cannot be sent
|
|
541
|
+
* as a warning.
|
|
365
542
|
*/
|
|
366
543
|
refreshDiagnosticMarkers(): Promise<void>;
|
|
367
544
|
sessionDisposed(_clientSession: ClientSession): void;
|
|
368
545
|
/**
|
|
369
|
-
* Cancel any pending resubmit
|
|
546
|
+
* Cancel any pending resubmit, drain every subscription — those registered
|
|
370
547
|
* during {@link doLoadSourceModel} and the per-secondary ones, which live
|
|
371
|
-
* outside {@link toDispose} because they come and go with the write set
|
|
372
|
-
*
|
|
548
|
+
* outside {@link toDispose} because they come and go with the write set —
|
|
549
|
+
* and end the diagram's client session with `cause`, closing everything it
|
|
550
|
+
* has open. Idempotent.
|
|
551
|
+
*
|
|
552
|
+
* The session ends last, once the detach listener is gone: its closes would
|
|
553
|
+
* otherwise report this storage's own teardown as a client detaching.
|
|
373
554
|
*/
|
|
374
|
-
dispose(): void;
|
|
555
|
+
dispose(cause?: SessionEndCause): void;
|
|
375
556
|
}
|
|
376
557
|
//# sourceMappingURL=hydranium-glsp-storage.d.ts.map
|