@hydranium/glsp-server 1.0.0-next.117 → 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/lib/command/hydranium-glsp-recording-command.d.ts +1 -1
- package/lib/command/hydranium-glsp-recording-command.js +1 -1
- package/lib/messages/index.d.ts +1 -1
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +1 -1
- package/lib/messages/index.js.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts +52 -8
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.js +77 -5
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.d.ts +4 -4
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.js +5 -10
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
- package/lib/state/reconcile-source-model-write.d.ts +2 -2
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
- package/lib/state/reconcile-source-model-write.js +1 -1
- package/lib/state/reconcile-source-model-write.js.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +54 -74
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.js +77 -102
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +16 -15
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +21 -25
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
- package/lib/storage/hydranium-glsp-storage.d.ts +103 -26
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
- package/lib/storage/hydranium-glsp-storage.js +199 -32
- package/lib/storage/hydranium-glsp-storage.js.map +1 -1
- package/package.json +7 -7
- package/src/command/hydranium-glsp-recording-command.ts +1 -1
- package/src/messages/index.ts +6 -1
- package/src/state/abstract-hydranium-glsp-state.ts +85 -8
- package/src/state/full-text-hydranium-glsp-state.ts +5 -10
- package/src/state/reconcile-source-model-write.ts +3 -3
- package/src/state/reconciling-multi-document-glsp-state.ts +78 -103
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +21 -25
- package/src/storage/hydranium-glsp-storage.ts +236 -33
|
@@ -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,12 +68,12 @@ 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.
|
|
@@ -88,7 +88,7 @@ let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGl
|
|
|
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
105
|
async persist(model, basedOn) {
|
|
105
|
-
const document = await this.
|
|
106
|
-
uri: this._sourceUri,
|
|
107
|
-
model,
|
|
108
|
-
clientId: this.clientId,
|
|
109
|
-
basedOn
|
|
110
|
-
});
|
|
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,oDAA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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
15
|
import { SaveDeliveryPolicy } from './save-delivery-policy.js';
|
|
@@ -52,6 +52,17 @@ export declare const SOURCE_URI_MISSING: import("@hydranium/protocol").MessageDe
|
|
|
52
52
|
* waiting on it.
|
|
53
53
|
*/
|
|
54
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.">;
|
|
55
66
|
/**
|
|
56
67
|
* GLSP source-model storage base shared by all hydranium adopters.
|
|
57
68
|
* Provides the DI signature, the {@link ClientSessionListener} +
|
|
@@ -75,11 +86,21 @@ export declare const DIAGRAM_READONLY_PARSE_ERROR: import("@hydranium/protocol")
|
|
|
75
86
|
* whole flow, and select a {@link SaveDeliveryPolicy} via the bound option to
|
|
76
87
|
* tune how {@link saveSourceModel} delivers its result.
|
|
77
88
|
*
|
|
78
|
-
* **
|
|
79
|
-
*
|
|
80
|
-
* the
|
|
81
|
-
*
|
|
82
|
-
*
|
|
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.
|
|
97
|
+
*
|
|
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.
|
|
83
104
|
*
|
|
84
105
|
* **tempId filter.** GLSP's `DefaultGlobalActionProvider` spins up a
|
|
85
106
|
* throwaway per-diagram-type container with upstream's {@link TEMPORARY_CLIENT_ID}
|
|
@@ -90,9 +111,9 @@ export declare const DIAGRAM_READONLY_PARSE_ERROR: import("@hydranium/protocol")
|
|
|
90
111
|
* **Lifecycle ordering.** `init` runs after DI resolution and parks the
|
|
91
112
|
* secondary-write-set watch, which outlives any single load.
|
|
92
113
|
* {@link sessionDisposed} calls {@link dispose}, which drains
|
|
93
|
-
* {@link toDispose} idempotently
|
|
94
|
-
* {@link doLoadSourceModel} is parked on
|
|
95
|
-
* 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.
|
|
96
117
|
*/
|
|
97
118
|
export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel = string> implements SourceModelStorage, ClientSessionListener, Disposable {
|
|
98
119
|
protected readonly logger: GlspLogger;
|
|
@@ -129,6 +150,22 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
129
150
|
* with it rather than linger until the client detaches.
|
|
130
151
|
*/
|
|
131
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;
|
|
132
169
|
/**
|
|
133
170
|
* Whether an external resubmit has ever been dispatched. Gates the
|
|
134
171
|
* keep-the-last-valid-GModel branch, which needs to know a canvas is already
|
|
@@ -148,6 +185,30 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
148
185
|
/** Latest event document awaiting the debounced resubmit; read by {@link flushResubmit} (last write wins). */
|
|
149
186
|
protected pendingResubmitDocument?: AstDocument<AstNode>;
|
|
150
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>;
|
|
151
212
|
/**
|
|
152
213
|
* Default load flow — {@link doLoadSourceModel}. Adopters whose load flow
|
|
153
214
|
* needs more than the seams allow override this method.
|
|
@@ -198,6 +259,14 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
198
259
|
* piece is a subscription, not an invalidation.
|
|
199
260
|
*/
|
|
200
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;
|
|
201
270
|
/**
|
|
202
271
|
* React to a rebuild of a SECONDARY document by resubmitting the diagram, so
|
|
203
272
|
* an external edit to (say) a layout file reaches the canvas.
|
|
@@ -334,23 +403,24 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
334
403
|
/** The effective {@link SaveDeliveryPolicy}: the bound option, or {@link DEFAULT_SAVE_DELIVERY_POLICY} when unbound. */
|
|
335
404
|
protected get saveDeliveryPolicy(): SaveDeliveryPolicy;
|
|
336
405
|
/**
|
|
337
|
-
* Default save flow: persist the store's current text for every document
|
|
338
|
-
* diagram
|
|
406
|
+
* Default save flow: persist the store's current text for every document the
|
|
407
|
+
* diagram's session has open.
|
|
339
408
|
*
|
|
340
409
|
* **A save persists, it does not author.** Every diagram gesture already
|
|
341
|
-
* reached the store through
|
|
410
|
+
* reached the store through the diagram's session, so the store holds the
|
|
342
411
|
* settled text and disk is the only thing behind. Re-serializing from the AST
|
|
343
412
|
* here cannot improve on that text and can only damage it: a serializer
|
|
344
|
-
* normalises formatting and
|
|
345
|
-
*
|
|
346
|
-
*
|
|
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.
|
|
347
417
|
*
|
|
348
|
-
* **
|
|
349
|
-
* (`AbstractHydraniumGlspState.trackSecondaryDocument`)
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* persist.
|
|
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.
|
|
354
424
|
*
|
|
355
425
|
* **A save therefore names documents the gesture did not aim at**, which is
|
|
356
426
|
* why an unchanged one is not rewritten even though the user asked for a
|
|
@@ -372,12 +442,15 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
372
442
|
*/
|
|
373
443
|
saveSourceModel(action: SaveModelAction): MaybePromise<void>;
|
|
374
444
|
/**
|
|
375
|
-
* Save the stored text of `primaryUri
|
|
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.
|
|
376
448
|
*
|
|
377
449
|
* Deduplicated, because a state that tracks its own primary as a secondary
|
|
378
450
|
* would otherwise save it twice and fire two save notifications for one
|
|
379
|
-
* save.
|
|
380
|
-
*
|
|
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.
|
|
381
454
|
*/
|
|
382
455
|
protected flushWriteSet(primaryUri: string): Promise<void>;
|
|
383
456
|
/**
|
|
@@ -456,10 +529,14 @@ export declare class HydraniumGlspStorage<TRoot extends AstNode, TSourceModel =
|
|
|
456
529
|
refreshDiagnosticMarkers(): Promise<void>;
|
|
457
530
|
sessionDisposed(_clientSession: ClientSession): void;
|
|
458
531
|
/**
|
|
459
|
-
* Cancel any pending resubmit
|
|
532
|
+
* Cancel any pending resubmit, drain every subscription — those registered
|
|
460
533
|
* during {@link doLoadSourceModel} and the per-secondary ones, which live
|
|
461
|
-
* 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.
|
|
462
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.
|
|
463
540
|
*/
|
|
464
541
|
dispose(): void;
|
|
465
542
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-glsp-storage.d.ts","sourceRoot":"","sources":["../../src/storage/hydranium-glsp-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EACJ,KAAK,MAAM,EACX,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,oBAAoB,EAEpB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAGf,MAAM,IAAI,UAAU,EACpB,KAAK,YAAY,EAGjB,cAAc,EACd,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-storage.d.ts","sourceRoot":"","sources":["../../src/storage/hydranium-glsp-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EACJ,KAAK,MAAM,EACX,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,oBAAoB,EAEpB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAGf,MAAM,IAAI,UAAU,EACpB,KAAK,YAAY,EAGjB,cAAc,EACd,KAAK,kBAAkB,EAEvB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACJ,SAAS,EAET,oBAAoB,EAItB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EACJ,WAAW,EACX,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,aAAa,IAAI,kBAAkB,EACxC,KAAK,oBAAoB,EAC3B,MAAM,iBAAiB,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