@hydranium/glsp-server 1.0.0-next.12 → 1.0.0-next.123
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 +13 -2
- package/lib/command/hydranium-glsp-recording-command.d.ts +22 -22
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-recording-command.js +25 -26
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
- package/lib/launcher/hydranium-glsp-server.d.ts +4 -3
- package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
- package/lib/launcher/hydranium-glsp-server.js +4 -3
- package/lib/launcher/hydranium-glsp-server.js.map +1 -1
- package/lib/messages/index.d.ts +24 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +24 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/node/start-glsp-server.js +1 -1
- package/lib/node/start-glsp-server.js.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts +110 -43
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.js +130 -41
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.d.ts +6 -6
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.js +6 -10
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
- package/lib/state/reconcile-source-model-write.d.ts +9 -8
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
- package/lib/state/reconcile-source-model-write.js +8 -8
- package/lib/state/reconcile-source-model-write.js.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +59 -59
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.js +84 -82
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +19 -18
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +26 -30
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
- package/lib/storage/hydranium-glsp-storage.d.ts +271 -76
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
- package/lib/storage/hydranium-glsp-storage.js +383 -87
- package/lib/storage/hydranium-glsp-storage.js.map +1 -1
- package/lib/storage/index.d.ts +1 -1
- package/lib/storage/index.js +1 -1
- package/lib/storage/save-delivery-policy.d.ts +46 -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/validation/diagnostic-markers.d.ts +2 -2
- package/lib/validation/diagnostic-markers.d.ts.map +1 -1
- package/lib/validation/diagnostic-markers.js +7 -0
- package/lib/validation/diagnostic-markers.js.map +1 -1
- 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 +17 -8
- package/src/command/hydranium-glsp-recording-command.ts +26 -26
- package/src/launcher/hydranium-glsp-server.ts +4 -3
- package/src/messages/index.ts +30 -0
- package/src/node/start-glsp-server.ts +1 -1
- package/src/state/abstract-hydranium-glsp-state.ts +162 -51
- package/src/state/full-text-hydranium-glsp-state.ts +7 -11
- package/src/state/reconcile-source-model-write.ts +18 -15
- package/src/state/reconciling-multi-document-glsp-state.ts +86 -83
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +27 -31
- package/src/storage/hydranium-glsp-storage.ts +445 -97
- package/src/storage/index.ts +1 -1
- package/src/storage/save-delivery-policy.ts +44 -0
- package/src/validation/diagnostic-markers.ts +10 -3
- package/src/validation/hydranium-glsp-model-validator.ts +3 -3
- 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
|
@@ -28,16 +28,16 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
|
|
|
28
28
|
* field-level shape is what lets `fast-json-patch` diff per field, so undo /
|
|
29
29
|
* redo and forward-write reconcile act per field instead of clobbering the
|
|
30
30
|
* whole document.
|
|
31
|
-
* - {@link
|
|
31
|
+
* - {@link base} — the last in-sync projection, captured on every
|
|
32
32
|
* {@link setSourceRoot}. A forward-write conflict reconciles the user's
|
|
33
|
-
* intent (
|
|
33
|
+
* intent (base → ours) against the server's current root (theirs).
|
|
34
34
|
* - {@link updateSourceModel} — the concrete reconcile template: persist,
|
|
35
35
|
* and on a `ConflictError` consult the injected `conflictResolver` and act
|
|
36
36
|
* on the merged / no-op / conflict / unavailable outcome.
|
|
37
37
|
* - {@link persist} / {@link refetch} — the only I/O seams. Defaults route
|
|
38
|
-
* through `
|
|
39
|
-
*
|
|
40
|
-
*
|
|
38
|
+
* through the diagram session's `update` and `ModelService.validated`;
|
|
39
|
+
* adopters whose document round-trip differs override these without
|
|
40
|
+
* touching the orchestration.
|
|
41
41
|
*
|
|
42
42
|
* Adopters whose source model is whole-document text (a bare `{ text }`
|
|
43
43
|
* source model) or that are read-only do NOT extend this class — they extend
|
|
@@ -49,12 +49,12 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
|
|
|
49
49
|
let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGlspState extends AbstractHydraniumGlspState {
|
|
50
50
|
/**
|
|
51
51
|
* Last in-sync source-model projection, captured on every
|
|
52
|
-
* {@link setSourceRoot} (initial load + post-update). The
|
|
52
|
+
* {@link setSourceRoot} (initial load + post-update). The base a
|
|
53
53
|
* forward-write conflict reconciles against: it stays the pre-command
|
|
54
54
|
* state because operation handlers mutate `_sourceRoot` in place during
|
|
55
55
|
* `execute` while `setSourceRoot` only re-runs once the write commits.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
base;
|
|
58
58
|
/**
|
|
59
59
|
* Persisted-shape projection of the current source root, consumed by GLSP's
|
|
60
60
|
* {@link JsonModelState} read side and recorded for field-level undo / redo.
|
|
@@ -68,27 +68,27 @@ let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGl
|
|
|
68
68
|
}
|
|
69
69
|
setSourceRoot(uri, root) {
|
|
70
70
|
super.setSourceRoot(uri, root);
|
|
71
|
-
this.
|
|
71
|
+
this.base = this.sourceModel;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Persist `model` back to the document store, then capture the resulting
|
|
75
75
|
* AST root. On a `ConflictError` (the based-on version was superseded),
|
|
76
|
-
* reconcile the user's intent against the
|
|
76
|
+
* reconcile the user's intent against the server's current root via the bound
|
|
77
77
|
* `conflictResolver` and act on the outcome — one declarative policy
|
|
78
78
|
* (force = last-writer-wins, reconciling = field-level merge) shared with
|
|
79
79
|
* undo / redo.
|
|
80
80
|
*/
|
|
81
|
-
async updateSourceModel(model,
|
|
81
|
+
async updateSourceModel(model, basedOn = this.basedOn) {
|
|
82
82
|
// Orchestration lives in `reconcileSourceModelWrite` so the multi-document
|
|
83
83
|
// state gets the identical conflict handling; this method supplies only
|
|
84
84
|
// the single-document meaning of persist / project.
|
|
85
|
-
return reconcileSourceModelWrite(model,
|
|
86
|
-
persist: async (candidate,
|
|
87
|
-
const { root } = await this.persist(candidate,
|
|
85
|
+
return reconcileSourceModelWrite(model, basedOn, {
|
|
86
|
+
persist: async (candidate, candidateBasedOn) => {
|
|
87
|
+
const { root } = await this.persist(candidate, candidateBasedOn);
|
|
88
88
|
this.setSourceRoot(this._sourceUri, root);
|
|
89
89
|
},
|
|
90
90
|
refetch: () => this.refetch(),
|
|
91
|
-
|
|
91
|
+
base: this.base,
|
|
92
92
|
conflictResolver: this.conflictResolver,
|
|
93
93
|
logger: this.logger,
|
|
94
94
|
onConflictDropped: () => this.refreshSourceRoot()
|
|
@@ -96,30 +96,26 @@ let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGl
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Persist hook — the only write-side I/O. Default routes the structured
|
|
99
|
-
* model through `
|
|
100
|
-
* the `ConflictError` gate
|
|
99
|
+
* model through the diagram session's `update` (serialize → reparse),
|
|
100
|
+
* opting into the `ConflictError` gate unless `basedOn` is `'anything'`,
|
|
101
|
+
* and throws without a session. Adopters whose document
|
|
101
102
|
* round-trip differs override this; the orchestration in
|
|
102
103
|
* {@link updateSourceModel} is unchanged.
|
|
103
104
|
*/
|
|
104
|
-
async persist(model,
|
|
105
|
-
const document = await this.
|
|
106
|
-
uri: this._sourceUri,
|
|
107
|
-
model,
|
|
108
|
-
clientId: this.clientId,
|
|
109
|
-
baseVersion
|
|
110
|
-
});
|
|
105
|
+
async persist(model, basedOn) {
|
|
106
|
+
const document = await this.requireModelSession().update({ uri: this._sourceUri, model, basedOn });
|
|
111
107
|
return document;
|
|
112
108
|
}
|
|
113
109
|
/**
|
|
114
|
-
* Refetch hook —
|
|
115
|
-
* projection (or `undefined` when unavailable)
|
|
116
|
-
* replays the user's intent
|
|
117
|
-
*
|
|
118
|
-
* adopters override alongside {@link persist}.
|
|
110
|
+
* Refetch hook — the stored text parsed afresh, as a persisted-shape
|
|
111
|
+
* projection (or `undefined` when unavailable): theirs, which the
|
|
112
|
+
* `conflictResolver` replays the user's intent onto. Default uses
|
|
113
|
+
* {@link AbstractHydraniumGlspState.readCurrentRoot} + the framework
|
|
114
|
+
* encoder's `'grammar'` mode; adopters override alongside {@link persist}.
|
|
119
115
|
*/
|
|
120
116
|
async refetch() {
|
|
121
|
-
const
|
|
122
|
-
return
|
|
117
|
+
const theirs = await this.readCurrentRoot(this._sourceUri);
|
|
118
|
+
return theirs ? this.sharedServices.model.TransferEncoder.toTransfer(theirs, 'grammar') : undefined;
|
|
123
119
|
}
|
|
124
120
|
};
|
|
125
121
|
ReconcilingTransferHydraniumGlspState = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconciling-transfer-hydranium-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,qCACV,SAAQ,0BAA+C;IAGvD;;;;;;OAMG;IACO,
|
|
1
|
+
{"version":3,"file":"reconciling-transfer-hydranium-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,qCACV,SAAQ,0BAA+C;IAGvD;;;;;;OAMG;IACO,IAAI,CAAgB;IAE9B;;;;;;;OAOG;IACH,IAAI,WAAW;QACZ,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAA4B,CAAC;IACvH,CAAC;IAEQ,aAAa,CAAC,GAAW,EAAE,IAAW;QAC5C,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAmB,EAAE,UAAmB,IAAI,CAAC,OAAO;QACzE,2EAA2E;QAC3E,wEAAwE;QACxE,oDAAoD;QACpD,OAAO,yBAAyB,CAAe,KAAK,EAAE,OAAO,EAAE;YAC5D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE;gBAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;gBACjE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC7C,CAAC;YACD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE;SACnD,CAAC,CAAC;IACN,CAAC;IAED;;;;;;;OAOG;IACO,KAAK,CAAC,OAAO,CAAC,KAAmB,EAAE,OAAgB;QAC1D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACnG,OAAO,QAAsC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,OAAO;QACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,CAAC,CAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAA6B,CAAC,CAAC,CAAC,SAAS,CAAC;IACpI,CAAC;CACH,CAAA;AA/EY,qCAAqC;IADjD,UAAU,EAAE;GACA,qCAAqC,CA+EjD"}
|
|
@@ -9,10 +9,60 @@
|
|
|
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 { AstDocument, type AstDocumentSavedEvent, type AstDocumentUpdatedEvent, type ClientSession as ModelClientSession, type ServerSharedServices } from '@hydranium/core';
|
|
13
13
|
import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
|
|
14
14
|
import { type HydraniumGlspSubmissionHandler } from '../submission/hydranium-glsp-submission-handler.js';
|
|
15
|
-
import {
|
|
15
|
+
import { SaveDeliveryPolicy } from './save-delivery-policy.js';
|
|
16
|
+
/**
|
|
17
|
+
* A save action arrived with nowhere to write to. A save action carries no
|
|
18
|
+
* request id, so it falls through to the error handler and `message` becomes
|
|
19
|
+
* the toast text.
|
|
20
|
+
*
|
|
21
|
+
* Rendered at the raise site rather than by a carrier method, because GLSP's
|
|
22
|
+
* action protocol has no slot for an identity anywhere — every member of its
|
|
23
|
+
* message, status and reject actions is prose or an enum, and
|
|
24
|
+
* `MessageAction.details` is not a substitute since it is prose populated from
|
|
25
|
+
* `cause?.toString?.()`, and a Theia host shows it to a user on demand. So the
|
|
26
|
+
* throw is the last place that still knows which message this is.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SAVE_TARGET_UNKNOWN: import("@hydranium/protocol").MessageDefinition<"Could not determine where to save this model">;
|
|
29
|
+
/**
|
|
30
|
+
* A model request arrived without the source URI it is required to carry.
|
|
31
|
+
* Rendered at the raise site, like its save-path sibling and for the same
|
|
32
|
+
* reason.
|
|
33
|
+
*/
|
|
34
|
+
export declare const SOURCE_URI_MISSING: import("@hydranium/protocol").MessageDefinition<"Could not open this model: the request did not say which document to load">;
|
|
35
|
+
/**
|
|
36
|
+
* Why the canvas has stopped accepting edits.
|
|
37
|
+
*
|
|
38
|
+
* **A READONLY canvas is otherwise indistinguishable from a broken one.** The
|
|
39
|
+
* client's answer to {@link SetEditModeAction} is to withdraw the tool palette,
|
|
40
|
+
* so the surface a reader was working in silently loses the only control it had,
|
|
41
|
+
* with the cause — a syntax error in a document that may not even be open —
|
|
42
|
+
* nowhere on screen. The mode flip is the mechanism; this is the only part of it
|
|
43
|
+
* a user can see.
|
|
44
|
+
*
|
|
45
|
+
* Rendered at the raise site, like its two siblings above and for the same
|
|
46
|
+
* reason: every member of GLSP's status action is prose or an enum.
|
|
47
|
+
*
|
|
48
|
+
* It names the recovery rather than the fault, because the fault already has a
|
|
49
|
+
* surface — the squiggle and the problems list, both of which say WHICH
|
|
50
|
+
* character — and repeating it here would put a second, less precise account of
|
|
51
|
+
* the same error on screen. What no other surface says is that the diagram is
|
|
52
|
+
* waiting on it.
|
|
53
|
+
*/
|
|
54
|
+
export declare const DIAGRAM_READONLY_PARSE_ERROR: import("@hydranium/protocol").MessageDefinition<"Read-only: this document has a syntax error. Fix it to edit the diagram again.">;
|
|
55
|
+
/**
|
|
56
|
+
* The diagram's GLSP client id is still live as another participant's client
|
|
57
|
+
* id once the load has waited for it to free, so the diagram does not load.
|
|
58
|
+
*
|
|
59
|
+
* Rendered at the raise site, as {@link SAVE_TARGET_UNKNOWN} is and for the
|
|
60
|
+
* same reason, and dispatched to the client as a message of its own: a model
|
|
61
|
+
* request fails as a rejection whose detail is the English cause, which no user
|
|
62
|
+
* sees. It names the recovery: a host that numbers its diagram clients gives a
|
|
63
|
+
* reopened diagram a fresh id.
|
|
64
|
+
*/
|
|
65
|
+
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.">;
|
|
16
66
|
/**
|
|
17
67
|
* GLSP source-model storage base shared by all hydranium adopters.
|
|
18
68
|
* Provides the DI signature, the {@link ClientSessionListener} +
|
|
@@ -33,17 +83,24 @@ import { SaveConflictPolicy } from './save-conflict-policy.js';
|
|
|
33
83
|
*
|
|
34
84
|
* Adopters with richer needs override the seams ({@link isStructurallyBroken},
|
|
35
85
|
* {@link onParseErrorChanged}, {@link onSourceModelSettled}) rather than the
|
|
36
|
-
* whole flow, and select a {@link
|
|
37
|
-
* tune how {@link saveSourceModel}
|
|
86
|
+
* whole flow, and select a {@link SaveDeliveryPolicy} via the bound option to
|
|
87
|
+
* tune how {@link saveSourceModel} delivers its result.
|
|
88
|
+
*
|
|
89
|
+
* **One client session per GLSP client session.** `init` registers the GLSP
|
|
90
|
+
* client id as a client session ({@link registerModelSession}) and hands it to
|
|
91
|
+
* the state as `modelSession`. The primary is opened through it on load, and
|
|
92
|
+
* every document that joins the write set as it joins
|
|
93
|
+
* ({@link openSecondary}); a document that leaves the write set stays open
|
|
94
|
+
* until the next save, so leaving never reverts the diagram's unsaved edits to
|
|
95
|
+
* it. Disposing the storage ends the session, which closes everything it has
|
|
96
|
+
* open.
|
|
38
97
|
*
|
|
39
|
-
* **Default `saveSourceModel` flow.**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* `overwrite`) decides the based-on-version guard, await-vs-fire-and-forget, and
|
|
46
|
-
* failure handling.
|
|
98
|
+
* **Default `saveSourceModel` flow.** Flushes the stored text of every
|
|
99
|
+
* document the diagram's session has open via `AstDocumentManager.save`, with
|
|
100
|
+
* no serializer in the path — the update path already put the settled text in
|
|
101
|
+
* the store. The bound {@link SaveDeliveryPolicy} (default
|
|
102
|
+
* {@link DEFAULT_SAVE_DELIVERY_POLICY}, `await`) decides
|
|
103
|
+
* await-vs-fire-and-forget and failure handling.
|
|
47
104
|
*
|
|
48
105
|
* **tempId filter.** GLSP's `DefaultGlobalActionProvider` spins up a
|
|
49
106
|
* throwaway per-diagram-type container with upstream's {@link TEMPORARY_CLIENT_ID}
|
|
@@ -54,9 +111,9 @@ import { SaveConflictPolicy } from './save-conflict-policy.js';
|
|
|
54
111
|
* **Lifecycle ordering.** `init` runs after DI resolution and parks the
|
|
55
112
|
* secondary-write-set watch, which outlives any single load.
|
|
56
113
|
* {@link sessionDisposed} calls {@link dispose}, which drains
|
|
57
|
-
* {@link toDispose} idempotently
|
|
58
|
-
* {@link doLoadSourceModel} is parked on
|
|
59
|
-
* them on client-detach.
|
|
114
|
+
* {@link toDispose} idempotently and then ends the client session. Every
|
|
115
|
+
* transient subscription created in {@link doLoadSourceModel} is parked on
|
|
116
|
+
* {@link toDispose} so the drain catches them on client-detach.
|
|
60
117
|
*/
|
|
61
118
|
export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel = string> implements SourceModelStorage, ClientSessionListener, Disposable {
|
|
62
119
|
protected readonly logger: GlspLogger;
|
|
@@ -75,14 +132,13 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
75
132
|
*/
|
|
76
133
|
protected readonly modelValidator?: ModelValidator;
|
|
77
134
|
/**
|
|
78
|
-
* Selected {@link
|
|
79
|
-
* {@link
|
|
80
|
-
* left unbound it resolves to {@link
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* `@optional()` member.
|
|
135
|
+
* Selected {@link SaveDeliveryPolicy} for {@link saveSourceModel}. Bind the
|
|
136
|
+
* {@link SaveDeliveryPolicy} token in a `DiagramModule` to choose a policy;
|
|
137
|
+
* left unbound it resolves to {@link DEFAULT_SAVE_DELIVERY_POLICY}. Read via
|
|
138
|
+
* {@link saveDeliveryPolicy} so the fallback is applied even when inversify
|
|
139
|
+
* injects `undefined` for an unbound `@optional()` member.
|
|
84
140
|
*/
|
|
85
|
-
protected readonly
|
|
141
|
+
protected readonly boundSaveDeliveryPolicy?: SaveDeliveryPolicy;
|
|
86
142
|
/** Disposables created during {@link doLoadSourceModel}; drained on session disposal. */
|
|
87
143
|
protected toDispose: DisposableCollection;
|
|
88
144
|
/**
|
|
@@ -94,6 +150,22 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
94
150
|
* with it rather than linger until the client detaches.
|
|
95
151
|
*/
|
|
96
152
|
protected readonly secondarySubscriptions: Map<string, Disposable>;
|
|
153
|
+
/**
|
|
154
|
+
* Documents that left the write set since the last save. They stay open in
|
|
155
|
+
* the diagram's session until that save has persisted them, and are closed
|
|
156
|
+
* after it: closing a document as it leaves would revert the diagram's
|
|
157
|
+
* unsaved edits to it where the diagram was its last client.
|
|
158
|
+
*/
|
|
159
|
+
protected readonly departedSecondaries: Set<string>;
|
|
160
|
+
/**
|
|
161
|
+
* How long a load waits for a client id another participant holds to free
|
|
162
|
+
* before refusing. A reloaded client can reconnect under its old id before
|
|
163
|
+
* the server has noticed the old connection close, which ends that
|
|
164
|
+
* connection's sessions a moment later.
|
|
165
|
+
*/
|
|
166
|
+
protected readonly sessionWaitMs: number;
|
|
167
|
+
/** Set by {@link dispose}; a disposed storage registers no session again. */
|
|
168
|
+
protected disposed: boolean;
|
|
97
169
|
/**
|
|
98
170
|
* Whether an external resubmit has ever been dispatched. Gates the
|
|
99
171
|
* keep-the-last-valid-GModel branch, which needs to know a canvas is already
|
|
@@ -111,8 +183,32 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
111
183
|
*/
|
|
112
184
|
protected resubmitDebouncer: Debouncer;
|
|
113
185
|
/** Latest event document awaiting the debounced resubmit; read by {@link flushResubmit} (last write wins). */
|
|
114
|
-
protected pendingResubmitDocument?: AstDocument<AstNode
|
|
186
|
+
protected pendingResubmitDocument?: AstDocument<AstNode>;
|
|
115
187
|
protected init(): void;
|
|
188
|
+
/**
|
|
189
|
+
* Register the diagram's client session under the GLSP client id, or
|
|
190
|
+
* `undefined` when another participant holds that id, which is logged.
|
|
191
|
+
*
|
|
192
|
+
* The diagram then refuses to load ({@link requireModelSession}). Taking
|
|
193
|
+
* the id over would end the other participant's session under it, and
|
|
194
|
+
* working without a session would share that participant's opens and
|
|
195
|
+
* echoes, so its close would take the diagram's documents with it.
|
|
196
|
+
*/
|
|
197
|
+
protected registerModelSession(): ModelClientSession<AstNode> | undefined;
|
|
198
|
+
/**
|
|
199
|
+
* The diagram's client session, registering it again when the id was held
|
|
200
|
+
* earlier. Throws `SessionClosedError` once the storage is disposed, and the
|
|
201
|
+
* refusal when the id is still held.
|
|
202
|
+
*/
|
|
203
|
+
protected requireModelSession(): ModelClientSession<AstNode>;
|
|
204
|
+
/**
|
|
205
|
+
* {@link requireModelSession} for the load: while the id is held, wait up to
|
|
206
|
+
* {@link sessionWaitMs} for its holder to end before refusing, and tell the
|
|
207
|
+
* user when it does not.
|
|
208
|
+
*/
|
|
209
|
+
protected awaitModelSession(): Promise<ModelClientSession<AstNode>>;
|
|
210
|
+
/** Resolve once the client session under `clientId` ends, or after `timeoutMs`. */
|
|
211
|
+
protected waitForSessionEnd(clientId: string, timeoutMs: number): Promise<void>;
|
|
116
212
|
/**
|
|
117
213
|
* Default load flow — {@link doLoadSourceModel}. Adopters whose load flow
|
|
118
214
|
* needs more than the seams allow override this method.
|
|
@@ -120,12 +216,29 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
120
216
|
loadSourceModel(action: RequestModelAction): MaybePromise<void>;
|
|
121
217
|
protected doLoadSourceModel(action: RequestModelAction): Promise<void>;
|
|
122
218
|
/**
|
|
123
|
-
* Capture the initial settled root and apply the initial edit mode.
|
|
124
|
-
*
|
|
125
|
-
* the first {@link handleModelUpdated} (at `Validated`, with diagnostics) flips
|
|
126
|
-
* it READONLY if the document has structural parse errors. Edit-mode +
|
|
127
|
-
* settle-hook actions are dispatched on a macrotask so the initial
|
|
219
|
+
* Capture the initial settled root and apply the initial edit mode. Edit-mode
|
|
220
|
+
* + settle-hook actions are dispatched on a macrotask so the initial
|
|
128
221
|
* `requestModel → setModel` handshake isn't perturbed.
|
|
222
|
+
*
|
|
223
|
+
* **Whether the settled document carries diagnostics depends on how far it
|
|
224
|
+
* had already got, so the initial edit mode has two correct outcomes rather
|
|
225
|
+
* than one.** `settled()` strips nothing: it resolves AT OR ABOVE the
|
|
226
|
+
* integrity landmark and hands back the live document's own array. Its
|
|
227
|
+
* `AstDocument<TAst, never>` return type asserts emptiness for a document the
|
|
228
|
+
* wait had to DRIVE to that landmark, which is pre-validation — and for that
|
|
229
|
+
* one the mode here is `EDITABLE` and the flip to READONLY arrives with the
|
|
230
|
+
* first {@link handleModelUpdated}. A document already past `Validated` when
|
|
231
|
+
* the session opened resolves immediately with its diagnostics intact, and is
|
|
232
|
+
* decided correctly here with no later update owed. Any host that validates
|
|
233
|
+
* its workspace before a diagram is opened produces the second case, so
|
|
234
|
+
* neither is exceptional.
|
|
235
|
+
*
|
|
236
|
+
* **A correct decision is not a delivered one.** This dispatch happens inside
|
|
237
|
+
* the initial `requestModel`, before the client has the model — so the UI
|
|
238
|
+
* extensions that answer {@link onParseErrorChanged}'s actions are not yet
|
|
239
|
+
* constructed, and a canvas that opens READONLY over a broken document shows
|
|
240
|
+
* none of that feedback. The same timer carries {@link onSourceModelSettled},
|
|
241
|
+
* so an adopter's own initial actions have it too.
|
|
129
242
|
*/
|
|
130
243
|
protected captureSettledRoot(rootUri: string, document: AstDocument<AstNode, never>): Promise<void>;
|
|
131
244
|
/**
|
|
@@ -146,6 +259,14 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
146
259
|
* piece is a subscription, not an invalidation.
|
|
147
260
|
*/
|
|
148
261
|
protected reconcileSecondarySubscriptions(): void;
|
|
262
|
+
/**
|
|
263
|
+
* Open a document that joined the write set through the diagram's session,
|
|
264
|
+
* where it stays open until the diagram's next save after it leaves the set,
|
|
265
|
+
* or the diagram's end. A document that does not exist yet is left to the
|
|
266
|
+
* write that creates it, and a failed open is logged: the write that needs
|
|
267
|
+
* the document opens it again and fails there.
|
|
268
|
+
*/
|
|
269
|
+
protected openSecondary(uri: string): void;
|
|
149
270
|
/**
|
|
150
271
|
* React to a rebuild of a SECONDARY document by resubmitting the diagram, so
|
|
151
272
|
* an external edit to (say) a layout file reaches the canvas.
|
|
@@ -171,18 +292,19 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
171
292
|
* drag this client authors — the guard above gates the resubmit, not the
|
|
172
293
|
* markers.
|
|
173
294
|
*/
|
|
174
|
-
protected handleSecondaryUpdated(uri: string, event: AstDocumentUpdatedEvent<AstNode
|
|
295
|
+
protected handleSecondaryUpdated(uri: string, event: AstDocumentUpdatedEvent<AstNode>): void;
|
|
175
296
|
/**
|
|
176
297
|
* The primary document's current state, or `undefined` when it is not
|
|
177
298
|
* registered.
|
|
178
299
|
*
|
|
179
300
|
* Synchronous by construction — the phase-agnostic lookup door plus the shared
|
|
180
301
|
* projection — so reacting to a secondary neither waits nor can force a build.
|
|
181
|
-
* `settled()` is not an alternative:
|
|
182
|
-
*
|
|
183
|
-
*
|
|
302
|
+
* `settled()` is not an alternative: besides being asynchronous, it cannot be
|
|
303
|
+
* relied on to carry diagnostics — a document it has to drive to the landmark
|
|
304
|
+
* arrives pre-validation with an empty array — and diagnostics are the reason
|
|
305
|
+
* {@link doUpdateAndSubmit} takes a separate event document at all.
|
|
184
306
|
*/
|
|
185
|
-
protected currentPrimaryDocument(): AstDocument<AstNode
|
|
307
|
+
protected currentPrimaryDocument(): AstDocument<AstNode> | undefined;
|
|
186
308
|
/**
|
|
187
309
|
* React to an external rebuild reaching `Validated`. Self-cleans if the
|
|
188
310
|
* session has vanished but this listener leaked (neither `sessionDisposed`
|
|
@@ -191,7 +313,7 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
191
313
|
* diagnostic markers for every update — including own edits, which skip
|
|
192
314
|
* the resubmit but can still change diagnostics.
|
|
193
315
|
*/
|
|
194
|
-
protected handleModelUpdated(rootUri: string, event: AstDocumentUpdatedEvent<AstNode
|
|
316
|
+
protected handleModelUpdated(rootUri: string, event: AstDocumentUpdatedEvent<AstNode>): Promise<void>;
|
|
195
317
|
/**
|
|
196
318
|
* Whether this storage has outlived its session — disposing it as a side
|
|
197
319
|
* effect when so. Checked from every subscription entry point because GLSP's
|
|
@@ -206,7 +328,7 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
206
328
|
* {@link resubmitDebouncer}, so a burst of rebuilds runs
|
|
207
329
|
* {@link doUpdateAndSubmit} once with the most recent document.
|
|
208
330
|
*/
|
|
209
|
-
protected scheduleUpdateAndSubmit(document: AstDocument<AstNode
|
|
331
|
+
protected scheduleUpdateAndSubmit(document: AstDocument<AstNode>): void;
|
|
210
332
|
/**
|
|
211
333
|
* Debouncer callback: run the resubmit for the latest pending document
|
|
212
334
|
* against this storage's (invariant) source URI and dispatch the result.
|
|
@@ -218,20 +340,22 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
218
340
|
* mark our stack clean so the editor doesn't prompt to re-save identical
|
|
219
341
|
* content. Our own saves already settle the stack through the save flow.
|
|
220
342
|
*/
|
|
221
|
-
protected handleModelSaved(event: AstDocumentSavedEvent<AstNode
|
|
343
|
+
protected handleModelSaved(event: AstDocumentSavedEvent<AstNode>): void;
|
|
222
344
|
/**
|
|
223
345
|
* Re-settle to a guaranteed fully-linked + reprojected root, capture it, and
|
|
224
346
|
* (unless suppressed) resubmit a deduped external GModel. Diagnostics for the
|
|
225
|
-
* edit-mode decision come from the event document
|
|
226
|
-
*
|
|
347
|
+
* edit-mode decision come from the event document, because the re-settled one
|
|
348
|
+
* cannot be relied on to have any: a document driven to the landmark arrives
|
|
349
|
+
* pre-validation, and this path re-settles precisely to escape a transient
|
|
350
|
+
* mid-rebuild snapshot.
|
|
227
351
|
*/
|
|
228
|
-
protected doUpdateAndSubmit(rootUri: string, eventDocument: AstDocument<AstNode
|
|
352
|
+
protected doUpdateAndSubmit(rootUri: string, eventDocument: AstDocument<AstNode>): Promise<Action[]>;
|
|
229
353
|
/**
|
|
230
354
|
* Recompute the desired edit mode from the document's structural-error state,
|
|
231
355
|
* flip {@link AbstractHydraniumGlspState.editMode}, and — only on a transition —
|
|
232
356
|
* return the {@link onParseErrorChanged} actions. No transition → no actions.
|
|
233
357
|
*/
|
|
234
|
-
protected refreshEditMode(document: AstDocument<AstNode
|
|
358
|
+
protected refreshEditMode(document: AstDocument<AstNode>): Action[];
|
|
235
359
|
/**
|
|
236
360
|
* Seam: is the AST structurally broken (lexing/parsing errors)? Drives both
|
|
237
361
|
* READONLY mode and the GModel resubmit skip — keeping the last valid canvas
|
|
@@ -239,46 +363,96 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
239
363
|
* carrying a Langium `lexing-error` / `parsing-error` code. Adopters override
|
|
240
364
|
* to compose additional break reasons.
|
|
241
365
|
*/
|
|
242
|
-
protected isStructurallyBroken(document: AstDocument<AstNode
|
|
366
|
+
protected isStructurallyBroken(document: AstDocument<AstNode>): boolean;
|
|
243
367
|
/**
|
|
244
|
-
* Seam: actions to emit when the structural-broken state transitions.
|
|
245
|
-
* a
|
|
246
|
-
* disabled while the syntax is broken but re-enabled once it parses, a
|
|
247
|
-
* generic for any Langium-backed diagram
|
|
248
|
-
*
|
|
249
|
-
*
|
|
368
|
+
* Seam: actions to emit when the structural-broken state transitions.
|
|
369
|
+
* Default: a {@link SetEditModeAction} toggling READONLY ↔ EDITABLE — editing
|
|
370
|
+
* is disabled while the syntax is broken but re-enabled once it parses, a
|
|
371
|
+
* sound generic for any Langium-backed diagram — plus the
|
|
372
|
+
* {@link DIAGRAM_READONLY_PARSE_ERROR} band that says why, cleared on the way
|
|
373
|
+
* back. Adopters override to add or replace the transition feedback. The
|
|
374
|
+
* {@link AbstractHydraniumGlspState.editMode} flip itself is owned by
|
|
375
|
+
* {@link refreshEditMode}.
|
|
376
|
+
*
|
|
377
|
+
* **Both actions or neither, which is why they are one seam rather than
|
|
378
|
+
* two.** The mode flip removes the tool palette and the band is the only
|
|
379
|
+
* account of that, so an override that keeps one and drops the other produces
|
|
380
|
+
* either an unexplained loss of the palette or a warning about a restriction
|
|
381
|
+
* that is not in force.
|
|
382
|
+
*
|
|
383
|
+
* **The status is dispatched with no `timeout`, so it persists** — a
|
|
384
|
+
* time-limited band would describe a condition that outlasts it.
|
|
385
|
+
*
|
|
386
|
+
* **The slot is SHARED, and the other writer wins on one path.**
|
|
387
|
+
* `ModelSubmissionHandler`'s live validation writes the same slot, clearing
|
|
388
|
+
* it with `severity: 'NONE'` when it finishes, and an adopter dispatching its
|
|
389
|
+
* own `StatusAction` replaces this one too. Nothing re-asserts it. That is
|
|
390
|
+
* harmless while a document is being edited, because a resubmit is skipped
|
|
391
|
+
* once the AST is broken (see {@link doUpdateAndSubmit}) — but NOT at load:
|
|
392
|
+
* the initial `requestModel` submit is not that skipped path, so a diagram
|
|
393
|
+
* opened on an already-broken document shows this band and then loses it to
|
|
394
|
+
* the validation clear a moment later. Measured on a browser host, polling the
|
|
395
|
+
* overlay: no element, empty, the sentence, empty again.
|
|
250
396
|
*/
|
|
251
|
-
protected onParseErrorChanged(_document: AstDocument<AstNode
|
|
397
|
+
protected onParseErrorChanged(_document: AstDocument<AstNode>, broken: boolean): Action[];
|
|
252
398
|
/**
|
|
253
399
|
* Seam: extra actions to dispatch right after the initial settled root is
|
|
254
400
|
* captured (e.g. an adopter-specific status or palette refresh). Default: none.
|
|
255
401
|
*/
|
|
256
402
|
protected onSourceModelSettled(_document: AstDocument<AstNode, never>): Action[];
|
|
257
|
-
/** The effective {@link
|
|
258
|
-
protected get
|
|
259
|
-
/**
|
|
260
|
-
* Default save flow:
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
403
|
+
/** The effective {@link SaveDeliveryPolicy}: the bound option, or {@link DEFAULT_SAVE_DELIVERY_POLICY} when unbound. */
|
|
404
|
+
protected get saveDeliveryPolicy(): SaveDeliveryPolicy;
|
|
405
|
+
/**
|
|
406
|
+
* Default save flow: persist the store's current text for every document the
|
|
407
|
+
* diagram's session has open.
|
|
408
|
+
*
|
|
409
|
+
* **A save persists, it does not author.** Every diagram gesture already
|
|
410
|
+
* reached the store through the diagram's session, so the store holds the
|
|
411
|
+
* settled text and disk is the only thing behind. Re-serializing from the AST
|
|
412
|
+
* here cannot improve on that text and can only damage it: a serializer
|
|
413
|
+
* normalises formatting, and the comments the write path carries over keep
|
|
414
|
+
* none of the hand-formatting around them, so a save would reflow a document
|
|
415
|
+
* nothing changed — which is what a pure bounds drag does to the semantic
|
|
416
|
+
* file when only its layout moved.
|
|
417
|
+
*
|
|
418
|
+
* **What is saved is the primary, every tracked secondary
|
|
419
|
+
* (`AbstractHydraniumGlspState.trackSecondaryDocument`) and every document
|
|
420
|
+
* that left the write set since the last save**, so a document the diagram
|
|
421
|
+
* wrote is persisted whether or not it is the one the client named. One the
|
|
422
|
+
* diagram's session does not have open is skipped, even when another client
|
|
423
|
+
* has it open: that client's unsaved edits are not the diagram's to persist.
|
|
424
|
+
*
|
|
425
|
+
* **A save therefore names documents the gesture did not aim at**, which is
|
|
426
|
+
* why an unchanged one is not rewritten even though the user asked for a
|
|
427
|
+
* save: the mtime would move on a file they never touched.
|
|
428
|
+
* `AstDocumentManager.save` decides that per document and announces the save
|
|
429
|
+
* either way.
|
|
265
430
|
*
|
|
266
|
-
* The configured {@link
|
|
267
|
-
* decides
|
|
268
|
-
* -
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
* `ConflictError` (and any other failure) to the GLSP save action.
|
|
272
|
-
* - `drop-and-log`: guard, fire-and-forget, log + swallow failures — a stale
|
|
273
|
-
* diagram save is dropped because a concurrent form/code edit already wrote
|
|
274
|
-
* the truth, and GLSP exposes no save-failure back-channel.
|
|
431
|
+
* The configured {@link SaveDeliveryPolicy} (see {@link saveDeliveryPolicy})
|
|
432
|
+
* decides await-vs-fire-and-forget and failure handling. It carries no
|
|
433
|
+
* based-on guard: the guard exists to stop a stale writer overwriting a newer
|
|
434
|
+
* document, and a flush persists the store — which already holds every other
|
|
435
|
+
* client's change, including the one that advanced the version.
|
|
275
436
|
*
|
|
276
437
|
* Returns `MaybePromise<void>` to match upstream `SourceModelStorage`:
|
|
277
|
-
* resolves with the
|
|
278
|
-
*
|
|
279
|
-
* `WritableFileSystemProvider` directly) still override the whole
|
|
438
|
+
* resolves with the flush under `await`, returns synchronously under
|
|
439
|
+
* `fire-and-forget`. Adopters that bypass `AstDocumentManager` (writing
|
|
440
|
+
* through `WritableFileSystemProvider` directly) still override the whole
|
|
441
|
+
* method.
|
|
280
442
|
*/
|
|
281
443
|
saveSourceModel(action: SaveModelAction): MaybePromise<void>;
|
|
444
|
+
/**
|
|
445
|
+
* Save the stored text of `primaryUri`, every tracked secondary and every
|
|
446
|
+
* document that left the write set since the last save, each only where
|
|
447
|
+
* the diagram's session has it open; then close those that left.
|
|
448
|
+
*
|
|
449
|
+
* Deduplicated, because a state that tracks its own primary as a secondary
|
|
450
|
+
* would otherwise save it twice and fire two save notifications for one
|
|
451
|
+
* save. Every save is called in one synchronous step, so each takes its text
|
|
452
|
+
* before anything can close a document of the set: saved one after another,
|
|
453
|
+
* a GLSP session ending during the first write closes the rest unsaved.
|
|
454
|
+
*/
|
|
455
|
+
protected flushWriteSet(primaryUri: string): Promise<void>;
|
|
282
456
|
/**
|
|
283
457
|
* Normalise GLSP's `sourceUri` — which may be a filesystem PATH or a URI
|
|
284
458
|
* string — to the URI string the workspace keys documents by.
|
|
@@ -305,6 +479,17 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
305
479
|
*
|
|
306
480
|
* Returns it VERBATIM, in whatever form the client sent;
|
|
307
481
|
* {@link toSourceModelUri} is what normalises it.
|
|
482
|
+
*
|
|
483
|
+
* A model request DOES carry a request id, so a throw here takes the
|
|
484
|
+
* client-request path rather than the toast path — and on that path `detail`
|
|
485
|
+
* comes from `cause?.toString?.()`. A single-argument throw therefore reaches
|
|
486
|
+
* neither the server log nor the client console: both print `undefined`. So
|
|
487
|
+
* the two readers are addressed separately, as on the save path: `message`
|
|
488
|
+
* names what failed in the user's terms and is rendered, `cause` names the
|
|
489
|
+
* action and the option key that was missing and stays English. On THIS path
|
|
490
|
+
* the cause reaches only logs — `RejectAction.detail` is read by nothing but
|
|
491
|
+
* the client action-dispatcher's `logger.warn` — which is not what makes it
|
|
492
|
+
* English; its content is.
|
|
308
493
|
*/
|
|
309
494
|
protected getSourceUri(action: RequestModelAction): string;
|
|
310
495
|
/**
|
|
@@ -314,12 +499,18 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
314
499
|
* {@link AbstractHydraniumGlspState.setSourceRoot}.
|
|
315
500
|
*
|
|
316
501
|
* A save action carries no request id, so a throw here reaches the user as a
|
|
317
|
-
* toast built from `message`,
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
502
|
+
* toast built from `message`, while `cause` travels in
|
|
503
|
+
* `MessageAction.details` — **which a Theia host DOES put in front of a
|
|
504
|
+
* user**, as a "Show details" button on the toast opening a dialog. So the
|
|
505
|
+
* two are not split by reachability; they are split by AUDIENCE, which is
|
|
506
|
+
* the older rule and the one that holds here. The message names what failed
|
|
507
|
+
* in the user's terms and is rendered; the cause names which lookups came
|
|
508
|
+
* back empty for whom, and stays English because a wire action kind, an
|
|
509
|
+
* option key and a client id address whoever composes the system — a
|
|
510
|
+
* translated developer string is a worse outcome than an untranslated one.
|
|
511
|
+
* Neither can name the URI — not having one IS the failure, and both sources
|
|
512
|
+
* are written together, so the typed `sourceUri` is equally empty whenever
|
|
513
|
+
* this fires.
|
|
323
514
|
*/
|
|
324
515
|
protected getFileUri(action: SaveModelAction): string;
|
|
325
516
|
/**
|
|
@@ -338,10 +529,14 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
338
529
|
refreshDiagnosticMarkers(): Promise<void>;
|
|
339
530
|
sessionDisposed(_clientSession: ClientSession): void;
|
|
340
531
|
/**
|
|
341
|
-
* Cancel any pending resubmit
|
|
532
|
+
* Cancel any pending resubmit, drain every subscription — those registered
|
|
342
533
|
* during {@link doLoadSourceModel} and the per-secondary ones, which live
|
|
343
|
-
* outside {@link toDispose} because they come and go with the write set
|
|
534
|
+
* outside {@link toDispose} because they come and go with the write set —
|
|
535
|
+
* and end the diagram's client session, closing everything it has open.
|
|
344
536
|
* Idempotent.
|
|
537
|
+
*
|
|
538
|
+
* The session ends last, once the detach listener is gone: its closes would
|
|
539
|
+
* otherwise report this storage's own teardown as a client detaching.
|
|
345
540
|
*/
|
|
346
541
|
dispose(): void;
|
|
347
542
|
}
|