@hydranium/glsp-server 1.0.0-next.316 → 1.0.0-next.318
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/state/reconciling-multi-document-glsp-state.d.ts +19 -10
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.js +10 -3
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +11 -9
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
- package/lib/submission/hydranium-glsp-submission-handler.d.ts +12 -1
- package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -1
- package/lib/submission/hydranium-glsp-submission-handler.js +30 -4
- package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -1
- package/package.json +7 -7
- package/src/state/reconciling-multi-document-glsp-state.ts +31 -17
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +18 -13
- package/src/submission/hydranium-glsp-submission-handler.ts +26 -5
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { type JsonModelState } from '@eclipse-glsp/server';
|
|
10
10
|
import { type AstNode } from '@hydranium/langium';
|
|
11
11
|
import { type ClientSession } from '@hydranium/core';
|
|
12
|
-
import { type BaseVersion, type ModelVersion, type TextVersion, type TransferElement, type VersionedModel } from '@hydranium/protocol';
|
|
12
|
+
import { type BaseVersion, type ModelVersion, type TextVersion, type TransferElement, type TransferTypeFor, type VersionedModel } from '@hydranium/protocol';
|
|
13
13
|
import { AbstractHydraniumGlspState } from './abstract-hydranium-glsp-state.js';
|
|
14
14
|
import { type OperationTransition } from '../command/hydranium-glsp-operation-command.js';
|
|
15
15
|
/**
|
|
@@ -62,14 +62,19 @@ export interface VersionedMultiDocumentSourceModel<TPrimary extends TransferElem
|
|
|
62
62
|
* again before each write; an adopter whose write set can name a document that
|
|
63
63
|
* does not exist yet overrides {@link openForWrite} to create it through
|
|
64
64
|
* {@link createSecondaryDocument}.
|
|
65
|
+
*
|
|
66
|
+
* `TTransferMap` is the transfer model's `$type` → interface map, the generated
|
|
67
|
+
* `<LanguageId>TransferTypes`; the primary's projection is typed through it.
|
|
65
68
|
*/
|
|
66
|
-
export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode,
|
|
69
|
+
export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TTransferMap extends {
|
|
70
|
+
[K in keyof TTransferMap]: TransferElement;
|
|
71
|
+
} = Record<string, TransferElement>> extends AbstractHydraniumGlspState<TRoot, MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>> implements JsonModelState<MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>> {
|
|
67
72
|
/**
|
|
68
73
|
* The projection across the whole write set that a forward-write conflict
|
|
69
74
|
* reconciles the user's intent from, taken from the built roots on every
|
|
70
75
|
* capture.
|
|
71
76
|
*/
|
|
72
|
-
protected base: MultiDocumentSourceModel<
|
|
77
|
+
protected base: MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>;
|
|
73
78
|
/** The documents {@link createSecondaryDocument} created for the {@link persist} under way, with the version each was created at. */
|
|
74
79
|
protected readonly createdForWrite: Map<string, number>;
|
|
75
80
|
/**
|
|
@@ -83,14 +88,14 @@ export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TP
|
|
|
83
88
|
* document, whereas an explicit `undefined` would diff as a removal and
|
|
84
89
|
* persist as a deletion of content the state simply could not see.
|
|
85
90
|
*/
|
|
86
|
-
get sourceModel(): MultiDocumentSourceModel<
|
|
91
|
+
get sourceModel(): MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>;
|
|
87
92
|
protected captureSourceRoot(uri: string, root: TRoot): void;
|
|
88
93
|
/**
|
|
89
94
|
* Each document whose ends differ, either end serialized for its URI and
|
|
90
95
|
* parsed back; a document equal on both ends is left as it is, since it
|
|
91
96
|
* stays out of the transition's patch anyway.
|
|
92
97
|
*/
|
|
93
|
-
normalizeTransition(transition: OperationTransition<MultiDocumentSourceModel<
|
|
98
|
+
normalizeTransition(transition: OperationTransition<MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>>): Promise<OperationTransition<MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>>>;
|
|
94
99
|
/**
|
|
95
100
|
* Also takes a secondary first tracked during an operation into the base
|
|
96
101
|
* and into the operation's projection from before its command, both from
|
|
@@ -129,7 +134,7 @@ export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TP
|
|
|
129
134
|
* policy exactly as the single-document state does — the orchestration is
|
|
130
135
|
* shared.
|
|
131
136
|
*/
|
|
132
|
-
updateSourceModel(model: MultiDocumentSourceModel<
|
|
137
|
+
updateSourceModel(model: MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>, baseVersion?: BaseVersion): Promise<void>;
|
|
133
138
|
/**
|
|
134
139
|
* Write hook — every document of `model` that changed, opened first through
|
|
135
140
|
* {@link openForWrite}, in one `updateAll` on the diagram's session: the
|
|
@@ -145,7 +150,7 @@ export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TP
|
|
|
145
150
|
* A write that fails closes every document {@link createSecondaryDocument}
|
|
146
151
|
* created for it that {@link closesCreatedDocument} accepts.
|
|
147
152
|
*/
|
|
148
|
-
protected persist(model: MultiDocumentSourceModel<
|
|
153
|
+
protected persist(model: MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>, baseVersion: BaseVersion, secondaryVersions?: Readonly<Record<string, ModelVersion>>): Promise<{
|
|
149
154
|
root: TRoot;
|
|
150
155
|
}>;
|
|
151
156
|
/**
|
|
@@ -207,14 +212,18 @@ export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TP
|
|
|
207
212
|
* since a reconcile without it has nothing to merge into; an unreadable
|
|
208
213
|
* secondary is omitted the same way {@link sourceModel} omits one.
|
|
209
214
|
*/
|
|
210
|
-
protected refetch(): Promise<VersionedMultiDocumentSourceModel<
|
|
215
|
+
protected refetch(): Promise<VersionedMultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>> | undefined>;
|
|
211
216
|
/**
|
|
212
217
|
* Project a currently-loaded document's root, or `undefined` when it is not
|
|
213
218
|
* loaded: the open operation's copy of it when there is one, which is where
|
|
214
219
|
* a handler's edit of it is, else the root its version was read from.
|
|
215
220
|
*/
|
|
216
221
|
protected projectDocument(uri: string): TransferElement | undefined;
|
|
217
|
-
/**
|
|
218
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Grammar-mode transfer projection of one AST root. The single projection
|
|
224
|
+
* seam. The encoder slot answers the structural base, so the map's type is
|
|
225
|
+
* asserted here, once.
|
|
226
|
+
*/
|
|
227
|
+
protected projectRoot<T extends AstNode>(root: T): TransferTypeFor<T, TTransferMap>;
|
|
219
228
|
}
|
|
220
229
|
//# sourceMappingURL=reconciling-multi-document-glsp-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconciling-multi-document-glsp-state.d.ts","sourceRoot":"","sources":["../../src/state/reconciling-multi-document-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,aAAa,EAA+B,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAEJ,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,EAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,KAAK,mBAAmB,EAAmB,MAAM,gDAAgD,CAAC;AAG3G;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,eAAe,GAAG,eAAe;IACzF,gFAAgF;IAChF,OAAO,EAAE,QAAQ,CAAC;IAClB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC/C;AAED,kGAAkG;AAClG,MAAM,WAAW,iCAAiC,CAAC,QAAQ,SAAS,eAAe,GAAG,eAAe,CAAE,SAAQ,cAAc,CAC1H,wBAAwB,CAAC,QAAQ,CAAC,CACpC;IACE,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CACrE;AAED
|
|
1
|
+
{"version":3,"file":"reconciling-multi-document-glsp-state.d.ts","sourceRoot":"","sources":["../../src/state/reconciling-multi-document-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,aAAa,EAA+B,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAEJ,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EAErB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,KAAK,mBAAmB,EAAmB,MAAM,gDAAgD,CAAC;AAG3G;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,eAAe,GAAG,eAAe;IACzF,gFAAgF;IAChF,OAAO,EAAE,QAAQ,CAAC;IAClB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC/C;AAED,kGAAkG;AAClG,MA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BAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAEvD;IAED;;;;;;;OAOG;IACH,UAAgB,OAAO,IAAI,OAAO,CAAC,iCAAiC,CAAC,eAAe,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,GAAG,SAAS,CAAC,CAetH;IAED;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAMlE;IAED;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,YAAY,CAAC,CAElF;CACH"}
|
|
@@ -47,6 +47,9 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
|
|
|
47
47
|
* again before each write; an adopter whose write set can name a document that
|
|
48
48
|
* does not exist yet overrides {@link openForWrite} to create it through
|
|
49
49
|
* {@link createSecondaryDocument}.
|
|
50
|
+
*
|
|
51
|
+
* `TTransferMap` is the transfer model's `$type` → interface map, the generated
|
|
52
|
+
* `<LanguageId>TransferTypes`; the primary's projection is typed through it.
|
|
50
53
|
*/
|
|
51
54
|
let ReconcilingMultiDocumentGlspState = class ReconcilingMultiDocumentGlspState extends AbstractHydraniumGlspState {
|
|
52
55
|
/**
|
|
@@ -92,8 +95,8 @@ let ReconcilingMultiDocumentGlspState = class ReconcilingMultiDocumentGlspState
|
|
|
92
95
|
const from = { primary: transition.from.primary, secondaries: { ...transition.from.secondaries } };
|
|
93
96
|
const to = { primary: transition.to.primary, secondaries: { ...transition.to.secondaries } };
|
|
94
97
|
if (JSON.stringify(from.primary) !== JSON.stringify(to.primary)) {
|
|
95
|
-
from.primary = this.projectRoot(await this.roundTrip(this._sourceUri, from.primary));
|
|
96
|
-
to.primary = this.projectRoot(await this.roundTrip(this._sourceUri, to.primary));
|
|
98
|
+
from.primary = this.projectRoot((await this.roundTrip(this._sourceUri, from.primary)));
|
|
99
|
+
to.primary = this.projectRoot((await this.roundTrip(this._sourceUri, to.primary)));
|
|
97
100
|
}
|
|
98
101
|
for (const uri of new Set([...Object.keys(from.secondaries), ...Object.keys(to.secondaries)])) {
|
|
99
102
|
if (JSON.stringify(from.secondaries[uri]) === JSON.stringify(to.secondaries[uri])) {
|
|
@@ -349,7 +352,11 @@ let ReconcilingMultiDocumentGlspState = class ReconcilingMultiDocumentGlspState
|
|
|
349
352
|
this.sharedServices.model.ModelService.getDocument(uri)?.parseResult?.value;
|
|
350
353
|
return root ? this.projectRoot(root) : undefined;
|
|
351
354
|
}
|
|
352
|
-
/**
|
|
355
|
+
/**
|
|
356
|
+
* Grammar-mode transfer projection of one AST root. The single projection
|
|
357
|
+
* seam. The encoder slot answers the structural base, so the map's type is
|
|
358
|
+
* asserted here, once.
|
|
359
|
+
*/
|
|
353
360
|
projectRoot(root) {
|
|
354
361
|
return this.sharedServices.model.TransferEncoder.toTransfer(root, 'grammar');
|
|
355
362
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconciling-multi-document-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-multi-document-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EACJ,cAAc,
|
|
1
|
+
{"version":3,"file":"reconciling-multi-document-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-multi-document-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EACJ,cAAc,EAOd,sBAAsB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAA4B,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CA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AK,QAAQ,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC;AACxG,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
********************************************************************************/
|
|
9
9
|
import { type JsonModelState } from '@eclipse-glsp/server';
|
|
10
10
|
import { type AstNode } from '@hydranium/langium';
|
|
11
|
-
import { type BaseVersion, type TransferElement, type VersionedModel } from '@hydranium/protocol';
|
|
11
|
+
import { type BaseVersion, type TransferElement, type TransferTypeFor, type VersionedModel } from '@hydranium/protocol';
|
|
12
12
|
import { type OperationTransition } from '../command/hydranium-glsp-operation-command.js';
|
|
13
13
|
import { AbstractHydraniumGlspState } from './abstract-hydranium-glsp-state.js';
|
|
14
14
|
/**
|
|
@@ -42,12 +42,14 @@ import { AbstractHydraniumGlspState } from './abstract-hydranium-glsp-state.js';
|
|
|
42
42
|
* the base's injected `conflictResolver`; this class owns the forward-write
|
|
43
43
|
* *orchestration* that consults it.
|
|
44
44
|
*/
|
|
45
|
-
export declare class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode,
|
|
45
|
+
export declare class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode, TTransferMap extends {
|
|
46
|
+
[K in keyof TTransferMap]: TransferElement;
|
|
47
|
+
} = Record<string, TransferElement>> extends AbstractHydraniumGlspState<TRoot, TransferTypeFor<TRoot, TTransferMap>> implements JsonModelState<TransferTypeFor<TRoot, TTransferMap>> {
|
|
46
48
|
/**
|
|
47
49
|
* The projection a forward-write conflict reconciles the user's intent
|
|
48
50
|
* from, taken from the built root on every capture.
|
|
49
51
|
*/
|
|
50
|
-
protected base:
|
|
52
|
+
protected base: TransferTypeFor<TRoot, TTransferMap>;
|
|
51
53
|
/**
|
|
52
54
|
* Persisted-shape projection of the current source root, consumed by GLSP's
|
|
53
55
|
* {@link JsonModelState} read side and recorded for field-level undo / redo.
|
|
@@ -56,14 +58,14 @@ export declare class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode
|
|
|
56
58
|
* properties excluded), so the diff reflects only authored state.
|
|
57
59
|
* Synchronous — the encoder walks the in-memory AST without serialising.
|
|
58
60
|
*/
|
|
59
|
-
get sourceModel():
|
|
61
|
+
get sourceModel(): TransferTypeFor<TRoot, TTransferMap>;
|
|
60
62
|
/**
|
|
61
63
|
* The source model of `root`. The single projection seam: the source
|
|
62
64
|
* model, the refetch and {@link normalizeTransition} all project through it.
|
|
63
65
|
*/
|
|
64
|
-
protected projectRoot(root: AstNode):
|
|
66
|
+
protected projectRoot(root: AstNode): TransferTypeFor<TRoot, TTransferMap>;
|
|
65
67
|
/** Both ends serialized for the source document and parsed back, unless they are equal. */
|
|
66
|
-
normalizeTransition(transition: OperationTransition<
|
|
68
|
+
normalizeTransition(transition: OperationTransition<TransferTypeFor<TRoot, TTransferMap>>): Promise<OperationTransition<TransferTypeFor<TRoot, TTransferMap>>>;
|
|
67
69
|
protected captureSourceRoot(uri: string, root: TRoot): void;
|
|
68
70
|
/**
|
|
69
71
|
* Persist `model` back to the document store, then capture the resulting
|
|
@@ -73,7 +75,7 @@ export declare class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode
|
|
|
73
75
|
* (force = last-writer-wins, reconciling = field-level merge) shared with
|
|
74
76
|
* undo / redo.
|
|
75
77
|
*/
|
|
76
|
-
updateSourceModel(model:
|
|
78
|
+
updateSourceModel(model: TransferTypeFor<TRoot, TTransferMap>, baseVersion?: BaseVersion): Promise<void>;
|
|
77
79
|
/**
|
|
78
80
|
* Persist hook — the only write-side I/O. Default routes the structured
|
|
79
81
|
* model through the diagram session's `update` (serialize → reparse),
|
|
@@ -83,7 +85,7 @@ export declare class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode
|
|
|
83
85
|
* alongside so undo compares what this writes; the orchestration in
|
|
84
86
|
* {@link updateSourceModel} is unchanged.
|
|
85
87
|
*/
|
|
86
|
-
protected persist(model:
|
|
88
|
+
protected persist(model: TransferTypeFor<TRoot, TTransferMap>, baseVersion: BaseVersion): Promise<{
|
|
87
89
|
root: TRoot;
|
|
88
90
|
}>;
|
|
89
91
|
/**
|
|
@@ -94,6 +96,6 @@ export declare class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode
|
|
|
94
96
|
* + the framework encoder's `'grammar'` mode; adopters override alongside
|
|
95
97
|
* {@link persist}.
|
|
96
98
|
*/
|
|
97
|
-
protected refetch(): Promise<VersionedModel<
|
|
99
|
+
protected refetch(): Promise<VersionedModel<TransferTypeFor<TRoot, TTransferMap>> | undefined>;
|
|
98
100
|
}
|
|
99
101
|
//# sourceMappingURL=reconciling-transfer-hydranium-glsp-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconciling-transfer-hydranium-glsp-state.d.ts","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"reconciling-transfer-hydranium-glsp-state.d.ts","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACxH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAC1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGhF;;;;;;;;;;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;;OAOG;IACH,UAAgB,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,GAAG,SAAS,CAAC,CAQnG;CACH"}
|
|
@@ -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;AAIvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,
|
|
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;AAIvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,qCAIV,SAAQ,0BAAuE;IAG/E;;;OAGG;IACO,IAAI,CAAwC;IAEtD;;;;;;;OAOG;IACH,IAAI,WAAW;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACO,WAAW,CAAC,IAAa;QAChC,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAyC,CAA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C,gBAAgB;YACvC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;YAC5C,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC/C,SAAS,EAAE,IAAI,CAAC,oBAAoB;SACtC,CAAC,CAAC;IACN,CAAC;IAED;;;;;;;;OAQG;IACO,KAAK,CAAC,OAAO,CAAC,KAA2C,EAAE,WAAwB;QAC1F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QACvG,OAAO,QAAsC,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACO,KAAK,CAAC,OAAO;QACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,OAAO,CACJ,MAAM,IAAI;YACP,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC;YACpC,WAAW,EAAE,MAAM,CAAC,OAAO;SAC7B,CACH,CAAC;IACL,CAAC;CACH,CAAA;AA7GY,qCAAqC;IADjD,UAAU,EAAE;GACA,qCAAqC,CA6GjD"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
********************************************************************************/
|
|
9
|
-
import { type Action, type DirtyStateChangeReason, type GModelRootSchema, type LayoutOperation, ModelSubmissionHandler, type ModelValidator, type SetModelAction } from '@eclipse-glsp/server';
|
|
9
|
+
import { type Action, ClientSessionManager, type DirtyStateChangeReason, type GModelRootSchema, type LayoutOperation, ModelSubmissionHandler, type ModelValidator, type SetModelAction } from '@eclipse-glsp/server';
|
|
10
10
|
import { type AstNode, type DocumentState } from '@hydranium/langium';
|
|
11
11
|
import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
|
|
12
12
|
/**
|
|
@@ -40,6 +40,7 @@ import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-gls
|
|
|
40
40
|
*/
|
|
41
41
|
export declare class HydraniumGlspSubmissionHandler<TRoot extends AstNode, TSourceModel = string> extends ModelSubmissionHandler {
|
|
42
42
|
protected modelState: AbstractHydraniumGlspState<TRoot, TSourceModel>;
|
|
43
|
+
protected readonly sessionManager: ClientSessionManager;
|
|
43
44
|
/**
|
|
44
45
|
* Document-state gate awaited before {@link submitModel} delegates to
|
|
45
46
|
* `super.submitModel`. Default {@link IntegrityService.SettledState} so the
|
|
@@ -109,8 +110,18 @@ export declare class HydraniumGlspSubmissionHandler<TRoot extends AstNode, TSour
|
|
|
109
110
|
* Never rejects: GLSP runs it from a debounce that drops the result, so a
|
|
110
111
|
* failure here would go unhandled. A validator that throws is logged as an
|
|
111
112
|
* error, markers that cannot be sent as a warning.
|
|
113
|
+
*
|
|
114
|
+
* GLSP does not cancel that debounce when the session ends, so it also runs
|
|
115
|
+
* for a diagram just closed: that run is skipped, and markers it could not
|
|
116
|
+
* send because the session ended meanwhile are logged for diagnosis only.
|
|
112
117
|
*/
|
|
113
118
|
protected performLiveValidation(validator: ModelValidator): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Whether the client session this handler serves has ended. By its
|
|
121
|
+
* dispatcher rather than its id: a client that reopens a diagram under the
|
|
122
|
+
* same id gets a new session, which this handler does not serve.
|
|
123
|
+
*/
|
|
124
|
+
protected sessionEnded(): boolean;
|
|
114
125
|
/**
|
|
115
126
|
* Serialise the model-bearing actions of a submission into a comparable
|
|
116
127
|
* signature.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-glsp-submission-handler.d.ts","sourceRoot":"","sources":["../../src/submission/hydranium-glsp-submission-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,EACX,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAGpB,sBAAsB,EACtB,KAAK,cAAc,EAGnB,KAAK,cAAc,EACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAG5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBACa,8BAA8B,CAAC,KAAK,SAAS,OAAO,EAAE,YAAY,GAAG,MAAM,CAAE,SAAQ,sBAAsB;IACrH,UAAsC,UAAU,EAAE,0BAA0B,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-submission-handler.d.ts","sourceRoot":"","sources":["../../src/submission/hydranium-glsp-submission-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,EACX,oBAAoB,EACpB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAGpB,sBAAsB,EACtB,KAAK,cAAc,EAGnB,KAAK,cAAc,EACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAG5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBACa,8BAA8B,CAAC,KAAK,SAAS,OAAO,EAAE,YAAY,GAAG,MAAM,CAAE,SAAQ,sBAAsB;IACrH,UAAsC,UAAU,EAAE,0BAA0B,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IACpE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAG,oBAAoB,CAAC;IAEvF;;;;;;OAMG;I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,EAAE,MAAM,EAAE,GAAG,IAAI,CAUvF;IAED;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAE1D;CACH"}
|
|
@@ -15,7 +15,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
15
15
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
16
16
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
17
17
|
};
|
|
18
|
-
import { MarkersReason, ModelState, ModelSubmissionHandler, SetDirtyStateAction, SetMarkersAction } from '@eclipse-glsp/server';
|
|
18
|
+
import { ClientSessionManager, MarkersReason, ModelState, ModelSubmissionHandler, SetDirtyStateAction, SetMarkersAction } from '@eclipse-glsp/server';
|
|
19
19
|
import { IntegrityService } from '@hydranium/core';
|
|
20
20
|
import { inject, injectable } from 'inversify';
|
|
21
21
|
import { describeErrorWithStack } from '@hydranium/protocol';
|
|
@@ -50,6 +50,7 @@ import { DiagramStatus } from '../state/diagram-status.js';
|
|
|
50
50
|
* URI-tagged tracer), so it carries no log-label field of its own.
|
|
51
51
|
*/
|
|
52
52
|
let HydraniumGlspSubmissionHandler = class HydraniumGlspSubmissionHandler extends ModelSubmissionHandler {
|
|
53
|
+
sessionManager;
|
|
53
54
|
/**
|
|
54
55
|
* Document-state gate awaited before {@link submitModel} delegates to
|
|
55
56
|
* `super.submitModel`. Default {@link IntegrityService.SettledState} so the
|
|
@@ -155,14 +156,27 @@ let HydraniumGlspSubmissionHandler = class HydraniumGlspSubmissionHandler extend
|
|
|
155
156
|
* Never rejects: GLSP runs it from a debounce that drops the result, so a
|
|
156
157
|
* failure here would go unhandled. A validator that throws is logged as an
|
|
157
158
|
* error, markers that cannot be sent as a warning.
|
|
159
|
+
*
|
|
160
|
+
* GLSP does not cancel that debounce when the session ends, so it also runs
|
|
161
|
+
* for a diagram just closed: that run is skipped, and markers it could not
|
|
162
|
+
* send because the session ended meanwhile are logged for diagnosis only.
|
|
158
163
|
*/
|
|
159
164
|
async performLiveValidation(validator) {
|
|
165
|
+
if (this.sessionEnded()) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
160
168
|
this.modelState.setStatus(DiagramStatus.VALIDATION, { message: 'Validate Model...', severity: 'INFO' });
|
|
161
169
|
try {
|
|
162
170
|
const markers = await validator.validate([this.modelState.root], MarkersReason.LIVE);
|
|
163
|
-
await this.actionDispatcher
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
await this.actionDispatcher.dispatch(SetMarkersAction.create(markers, { reason: MarkersReason.LIVE })).catch((error) => {
|
|
172
|
+
const message = `Could not send the live-validation markers: ${describeErrorWithStack(error)}`;
|
|
173
|
+
if (this.sessionEnded()) {
|
|
174
|
+
this.modelState.logger.debug(message);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
this.modelState.logger.warn(message);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
166
180
|
}
|
|
167
181
|
catch (error) {
|
|
168
182
|
this.modelState.logger.error(`Live validation failed: ${describeErrorWithStack(error)}`);
|
|
@@ -171,6 +185,14 @@ let HydraniumGlspSubmissionHandler = class HydraniumGlspSubmissionHandler extend
|
|
|
171
185
|
this.modelState.setStatus(DiagramStatus.VALIDATION, undefined);
|
|
172
186
|
}
|
|
173
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Whether the client session this handler serves has ended. By its
|
|
190
|
+
* dispatcher rather than its id: a client that reopens a diagram under the
|
|
191
|
+
* same id gets a new session, which this handler does not serve.
|
|
192
|
+
*/
|
|
193
|
+
sessionEnded() {
|
|
194
|
+
return this.sessionManager.getSession(this.modelState.clientId)?.actionDispatcher !== this.actionDispatcher;
|
|
195
|
+
}
|
|
174
196
|
/**
|
|
175
197
|
* Serialise the model-bearing actions of a submission into a comparable
|
|
176
198
|
* signature.
|
|
@@ -226,6 +248,10 @@ __decorate([
|
|
|
226
248
|
inject(ModelState),
|
|
227
249
|
__metadata("design:type", Function)
|
|
228
250
|
], HydraniumGlspSubmissionHandler.prototype, "modelState", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
inject(ClientSessionManager),
|
|
253
|
+
__metadata("design:type", Object)
|
|
254
|
+
], HydraniumGlspSubmissionHandler.prototype, "sessionManager", void 0);
|
|
229
255
|
HydraniumGlspSubmissionHandler = __decorate([
|
|
230
256
|
injectable()
|
|
231
257
|
], HydraniumGlspSubmissionHandler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydranium-glsp-submission-handler.js","sourceRoot":"","sources":["../../src/submission/hydranium-glsp-submission-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-submission-handler.js","sourceRoot":"","sources":["../../src/submission/hydranium-glsp-submission-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAEJ,oBAAoB,EAIpB,aAAa,EACb,UAAU,EACV,sBAAsB,EAEtB,mBAAmB,EACnB,gBAAgB,EAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEI,IAAM,8BAA8B,GAApC,MAAM,8BAA6E,SAAQ,sBAAsB;IAEpE,cAAc,CAAwB;IAEvF;;;;;;OAMG;IACO,UAAU,GAA8B,gBAAgB,CAAC,YAAY,CAAC;IAEhF;;;;;;;;;OASG;IACH,wBAAwB;QACrB,OAAO,IAAI,CAAC,kBAAkB,KAAK,SAAS,CAAC;IAChD,CAAC;IAEQ,KAAK,CAA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
|
3
|
+
"version": "1.0.0-next.318",
|
|
4
4
|
"description": "GLSP protocol head for the hydranium framework. Peer of @hydranium/core/lsp and @hydranium/data-server; built on @hydranium/core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"diagram",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@eclipse-glsp/server": "2.7.0",
|
|
73
|
-
"@hydranium/core": "1.0.0-next.
|
|
74
|
-
"@hydranium/langium": "1.0.0-next.
|
|
75
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
73
|
+
"@hydranium/core": "1.0.0-next.318",
|
|
74
|
+
"@hydranium/langium": "1.0.0-next.318",
|
|
75
|
+
"@hydranium/protocol": "1.0.0-next.318",
|
|
76
76
|
"inversify": "6.2.2",
|
|
77
77
|
"reflect-metadata": "0.2.2",
|
|
78
78
|
"rimraf": "^5.0.0",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"@eclipse-glsp/server": "^2.6.0",
|
|
85
|
-
"@hydranium/core": "1.0.0-next.
|
|
86
|
-
"@hydranium/langium": "1.0.0-next.
|
|
87
|
-
"@hydranium/protocol": "1.0.0-next.
|
|
85
|
+
"@hydranium/core": "1.0.0-next.318",
|
|
86
|
+
"@hydranium/langium": "1.0.0-next.318",
|
|
87
|
+
"@hydranium/protocol": "1.0.0-next.318",
|
|
88
88
|
"inversify": "^6.0.0",
|
|
89
89
|
"reflect-metadata": "^0.2.2",
|
|
90
90
|
"vscode-jsonrpc": "^9.0.0",
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
type ModelVersion,
|
|
18
18
|
type TextVersion,
|
|
19
19
|
type TransferElement,
|
|
20
|
+
type TransferTypeFor,
|
|
20
21
|
type VersionedModel,
|
|
21
22
|
describeErrorWithStack
|
|
22
23
|
} from '@hydranium/protocol';
|
|
@@ -78,18 +79,24 @@ export interface VersionedMultiDocumentSourceModel<TPrimary extends TransferElem
|
|
|
78
79
|
* again before each write; an adopter whose write set can name a document that
|
|
79
80
|
* does not exist yet overrides {@link openForWrite} to create it through
|
|
80
81
|
* {@link createSecondaryDocument}.
|
|
82
|
+
*
|
|
83
|
+
* `TTransferMap` is the transfer model's `$type` → interface map, the generated
|
|
84
|
+
* `<LanguageId>TransferTypes`; the primary's projection is typed through it.
|
|
81
85
|
*/
|
|
82
86
|
@injectable()
|
|
83
|
-
export class ReconcilingMultiDocumentGlspState<
|
|
84
|
-
extends
|
|
85
|
-
|
|
87
|
+
export class ReconcilingMultiDocumentGlspState<
|
|
88
|
+
TRoot extends AstNode,
|
|
89
|
+
TTransferMap extends { [K in keyof TTransferMap]: TransferElement } = Record<string, TransferElement>
|
|
90
|
+
>
|
|
91
|
+
extends AbstractHydraniumGlspState<TRoot, MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>>
|
|
92
|
+
implements JsonModelState<MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>>
|
|
86
93
|
{
|
|
87
94
|
/**
|
|
88
95
|
* The projection across the whole write set that a forward-write conflict
|
|
89
96
|
* reconciles the user's intent from, taken from the built roots on every
|
|
90
97
|
* capture.
|
|
91
98
|
*/
|
|
92
|
-
protected base!: MultiDocumentSourceModel<
|
|
99
|
+
protected base!: MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>;
|
|
93
100
|
|
|
94
101
|
/** The documents {@link createSecondaryDocument} created for the {@link persist} under way, with the version each was created at. */
|
|
95
102
|
protected readonly createdForWrite = new Map<string, TextVersion>();
|
|
@@ -105,7 +112,7 @@ export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary e
|
|
|
105
112
|
* document, whereas an explicit `undefined` would diff as a removal and
|
|
106
113
|
* persist as a deletion of content the state simply could not see.
|
|
107
114
|
*/
|
|
108
|
-
get sourceModel(): MultiDocumentSourceModel<
|
|
115
|
+
get sourceModel(): MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>> {
|
|
109
116
|
const secondaries: Record<string, TransferElement> = {};
|
|
110
117
|
for (const uri of this.secondaryUris) {
|
|
111
118
|
const projection = this.projectDocument(uri);
|
|
@@ -128,13 +135,13 @@ export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary e
|
|
|
128
135
|
* stays out of the transition's patch anyway.
|
|
129
136
|
*/
|
|
130
137
|
override async normalizeTransition(
|
|
131
|
-
transition: OperationTransition<MultiDocumentSourceModel<
|
|
132
|
-
): Promise<OperationTransition<MultiDocumentSourceModel<
|
|
138
|
+
transition: OperationTransition<MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>>
|
|
139
|
+
): Promise<OperationTransition<MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>>> {
|
|
133
140
|
const from = { primary: transition.from.primary, secondaries: { ...transition.from.secondaries } };
|
|
134
141
|
const to = { primary: transition.to.primary, secondaries: { ...transition.to.secondaries } };
|
|
135
142
|
if (JSON.stringify(from.primary) !== JSON.stringify(to.primary)) {
|
|
136
|
-
from.primary = this.projectRoot
|
|
137
|
-
to.primary = this.projectRoot
|
|
143
|
+
from.primary = this.projectRoot((await this.roundTrip(this._sourceUri, from.primary)) as TRoot);
|
|
144
|
+
to.primary = this.projectRoot((await this.roundTrip(this._sourceUri, to.primary)) as TRoot);
|
|
138
145
|
}
|
|
139
146
|
for (const uri of new Set([...Object.keys(from.secondaries), ...Object.keys(to.secondaries)])) {
|
|
140
147
|
if (JSON.stringify(from.secondaries[uri]) === JSON.stringify(to.secondaries[uri])) {
|
|
@@ -217,9 +224,12 @@ export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary e
|
|
|
217
224
|
* policy exactly as the single-document state does — the orchestration is
|
|
218
225
|
* shared.
|
|
219
226
|
*/
|
|
220
|
-
async updateSourceModel(
|
|
227
|
+
async updateSourceModel(
|
|
228
|
+
model: MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>,
|
|
229
|
+
baseVersion: BaseVersion = this.baseVersion
|
|
230
|
+
): Promise<void> {
|
|
221
231
|
let secondaryVersions: Readonly<Record<string, ModelVersion>> | undefined;
|
|
222
|
-
return reconcileSourceModelWrite<MultiDocumentSourceModel<
|
|
232
|
+
return reconcileSourceModelWrite<MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>>(model, baseVersion, {
|
|
223
233
|
persist: async (candidate, candidateBaseVersion) => {
|
|
224
234
|
const { root } = await this.persist(candidate, candidateBaseVersion, secondaryVersions);
|
|
225
235
|
this.captureWrittenRoot(root);
|
|
@@ -254,7 +264,7 @@ export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary e
|
|
|
254
264
|
* created for it that {@link closesCreatedDocument} accepts.
|
|
255
265
|
*/
|
|
256
266
|
protected async persist(
|
|
257
|
-
model: MultiDocumentSourceModel<
|
|
267
|
+
model: MultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>>,
|
|
258
268
|
baseVersion: BaseVersion,
|
|
259
269
|
secondaryVersions?: Readonly<Record<string, ModelVersion>>
|
|
260
270
|
): Promise<{ root: TRoot }> {
|
|
@@ -381,7 +391,7 @@ export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary e
|
|
|
381
391
|
* since a reconcile without it has nothing to merge into; an unreadable
|
|
382
392
|
* secondary is omitted the same way {@link sourceModel} omits one.
|
|
383
393
|
*/
|
|
384
|
-
protected async refetch(): Promise<VersionedMultiDocumentSourceModel<
|
|
394
|
+
protected async refetch(): Promise<VersionedMultiDocumentSourceModel<TransferTypeFor<TRoot, TTransferMap>> | undefined> {
|
|
385
395
|
const theirs = await this.readCurrentRoot(this._sourceUri);
|
|
386
396
|
if (!theirs) {
|
|
387
397
|
return undefined;
|
|
@@ -395,7 +405,7 @@ export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary e
|
|
|
395
405
|
secondaryVersions[uri] = read.version;
|
|
396
406
|
}
|
|
397
407
|
}
|
|
398
|
-
return { model: { primary: this.projectRoot
|
|
408
|
+
return { model: { primary: this.projectRoot(theirs.root as TRoot), secondaries }, baseVersion: theirs.version, secondaryVersions };
|
|
399
409
|
}
|
|
400
410
|
|
|
401
411
|
/**
|
|
@@ -411,9 +421,13 @@ export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary e
|
|
|
411
421
|
return root ? this.projectRoot(root) : undefined;
|
|
412
422
|
}
|
|
413
423
|
|
|
414
|
-
/**
|
|
415
|
-
|
|
416
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Grammar-mode transfer projection of one AST root. The single projection
|
|
426
|
+
* seam. The encoder slot answers the structural base, so the map's type is
|
|
427
|
+
* asserted here, once.
|
|
428
|
+
*/
|
|
429
|
+
protected projectRoot<T extends AstNode>(root: T): TransferTypeFor<T, TTransferMap> {
|
|
430
|
+
return this.sharedServices.model.TransferEncoder.toTransfer(root, 'grammar') as TransferTypeFor<T, TTransferMap>;
|
|
417
431
|
}
|
|
418
432
|
}
|
|
419
433
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { type JsonModelState } from '@eclipse-glsp/server';
|
|
11
11
|
import { injectable } from 'inversify';
|
|
12
12
|
import { type AstNode } from '@hydranium/langium';
|
|
13
|
-
import { type BaseVersion, type TransferElement, type VersionedModel } from '@hydranium/protocol';
|
|
13
|
+
import { type BaseVersion, type TransferElement, type TransferTypeFor, type VersionedModel } from '@hydranium/protocol';
|
|
14
14
|
import { type OperationTransition } from '../command/hydranium-glsp-operation-command.js';
|
|
15
15
|
import { AbstractHydraniumGlspState } from './abstract-hydranium-glsp-state.js';
|
|
16
16
|
import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
|
|
@@ -47,15 +47,18 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
|
|
|
47
47
|
* *orchestration* that consults it.
|
|
48
48
|
*/
|
|
49
49
|
@injectable()
|
|
50
|
-
export class ReconcilingTransferHydraniumGlspState<
|
|
51
|
-
extends
|
|
52
|
-
|
|
50
|
+
export class ReconcilingTransferHydraniumGlspState<
|
|
51
|
+
TRoot extends AstNode,
|
|
52
|
+
TTransferMap extends { [K in keyof TTransferMap]: TransferElement } = Record<string, TransferElement>
|
|
53
|
+
>
|
|
54
|
+
extends AbstractHydraniumGlspState<TRoot, TransferTypeFor<TRoot, TTransferMap>>
|
|
55
|
+
implements JsonModelState<TransferTypeFor<TRoot, TTransferMap>>
|
|
53
56
|
{
|
|
54
57
|
/**
|
|
55
58
|
* The projection a forward-write conflict reconciles the user's intent
|
|
56
59
|
* from, taken from the built root on every capture.
|
|
57
60
|
*/
|
|
58
|
-
protected base!:
|
|
61
|
+
protected base!: TransferTypeFor<TRoot, TTransferMap>;
|
|
59
62
|
|
|
60
63
|
/**
|
|
61
64
|
* Persisted-shape projection of the current source root, consumed by GLSP's
|
|
@@ -65,7 +68,7 @@ export class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode, TSourc
|
|
|
65
68
|
* properties excluded), so the diff reflects only authored state.
|
|
66
69
|
* Synchronous — the encoder walks the in-memory AST without serialising.
|
|
67
70
|
*/
|
|
68
|
-
get sourceModel():
|
|
71
|
+
get sourceModel(): TransferTypeFor<TRoot, TTransferMap> {
|
|
69
72
|
return this.projectRoot(this.sourceRoot);
|
|
70
73
|
}
|
|
71
74
|
|
|
@@ -73,12 +76,14 @@ export class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode, TSourc
|
|
|
73
76
|
* The source model of `root`. The single projection seam: the source
|
|
74
77
|
* model, the refetch and {@link normalizeTransition} all project through it.
|
|
75
78
|
*/
|
|
76
|
-
protected projectRoot(root: AstNode):
|
|
77
|
-
return this.sharedServices.model.TransferEncoder.toTransfer(root, 'grammar') as
|
|
79
|
+
protected projectRoot(root: AstNode): TransferTypeFor<TRoot, TTransferMap> {
|
|
80
|
+
return this.sharedServices.model.TransferEncoder.toTransfer(root, 'grammar') as TransferTypeFor<TRoot, TTransferMap>;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
/** Both ends serialized for the source document and parsed back, unless they are equal. */
|
|
81
|
-
override async normalizeTransition(
|
|
84
|
+
override async normalizeTransition(
|
|
85
|
+
transition: OperationTransition<TransferTypeFor<TRoot, TTransferMap>>
|
|
86
|
+
): Promise<OperationTransition<TransferTypeFor<TRoot, TTransferMap>>> {
|
|
82
87
|
if (JSON.stringify(transition.from) === JSON.stringify(transition.to)) {
|
|
83
88
|
return transition;
|
|
84
89
|
}
|
|
@@ -101,11 +106,11 @@ export class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode, TSourc
|
|
|
101
106
|
* (force = last-writer-wins, reconciling = field-level merge) shared with
|
|
102
107
|
* undo / redo.
|
|
103
108
|
*/
|
|
104
|
-
async updateSourceModel(model:
|
|
109
|
+
async updateSourceModel(model: TransferTypeFor<TRoot, TTransferMap>, baseVersion: BaseVersion = this.baseVersion): Promise<void> {
|
|
105
110
|
// Orchestration lives in `reconcileSourceModelWrite` so the multi-document
|
|
106
111
|
// state gets the identical conflict handling; this method supplies only
|
|
107
112
|
// the single-document meaning of persist / project.
|
|
108
|
-
return reconcileSourceModelWrite<
|
|
113
|
+
return reconcileSourceModelWrite<TransferTypeFor<TRoot, TTransferMap>>(model, baseVersion, {
|
|
109
114
|
persist: async (candidate, candidateBaseVersion) => {
|
|
110
115
|
const { root } = await this.persist(candidate, candidateBaseVersion);
|
|
111
116
|
this.captureWrittenRoot(root);
|
|
@@ -129,7 +134,7 @@ export class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode, TSourc
|
|
|
129
134
|
* alongside so undo compares what this writes; the orchestration in
|
|
130
135
|
* {@link updateSourceModel} is unchanged.
|
|
131
136
|
*/
|
|
132
|
-
protected async persist(model:
|
|
137
|
+
protected async persist(model: TransferTypeFor<TRoot, TTransferMap>, baseVersion: BaseVersion): Promise<{ root: TRoot }> {
|
|
133
138
|
const document = await this.requireModelSession().update({ uri: this._sourceUri, model, baseVersion });
|
|
134
139
|
return document as unknown as { root: TRoot };
|
|
135
140
|
}
|
|
@@ -142,7 +147,7 @@ export class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode, TSourc
|
|
|
142
147
|
* + the framework encoder's `'grammar'` mode; adopters override alongside
|
|
143
148
|
* {@link persist}.
|
|
144
149
|
*/
|
|
145
|
-
protected async refetch(): Promise<VersionedModel<
|
|
150
|
+
protected async refetch(): Promise<VersionedModel<TransferTypeFor<TRoot, TTransferMap>> | undefined> {
|
|
146
151
|
const theirs = await this.readCurrentRoot(this._sourceUri);
|
|
147
152
|
return (
|
|
148
153
|
theirs && {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
type Action,
|
|
12
|
+
ClientSessionManager,
|
|
12
13
|
type DirtyStateChangeReason,
|
|
13
14
|
type GModelRootSchema,
|
|
14
15
|
type LayoutOperation,
|
|
@@ -59,6 +60,7 @@ import { DiagramStatus } from '../state/diagram-status.js';
|
|
|
59
60
|
@injectable()
|
|
60
61
|
export class HydraniumGlspSubmissionHandler<TRoot extends AstNode, TSourceModel = string> extends ModelSubmissionHandler {
|
|
61
62
|
@inject(ModelState) declare protected modelState: AbstractHydraniumGlspState<TRoot, TSourceModel>;
|
|
63
|
+
@inject(ClientSessionManager) protected readonly sessionManager!: ClientSessionManager;
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
* Document-state gate awaited before {@link submitModel} delegates to
|
|
@@ -176,16 +178,26 @@ export class HydraniumGlspSubmissionHandler<TRoot extends AstNode, TSourceModel
|
|
|
176
178
|
* Never rejects: GLSP runs it from a debounce that drops the result, so a
|
|
177
179
|
* failure here would go unhandled. A validator that throws is logged as an
|
|
178
180
|
* error, markers that cannot be sent as a warning.
|
|
181
|
+
*
|
|
182
|
+
* GLSP does not cancel that debounce when the session ends, so it also runs
|
|
183
|
+
* for a diagram just closed: that run is skipped, and markers it could not
|
|
184
|
+
* send because the session ended meanwhile are logged for diagnosis only.
|
|
179
185
|
*/
|
|
180
186
|
protected override async performLiveValidation(validator: ModelValidator): Promise<void> {
|
|
187
|
+
if (this.sessionEnded()) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
181
190
|
this.modelState.setStatus(DiagramStatus.VALIDATION, { message: 'Validate Model...', severity: 'INFO' });
|
|
182
191
|
try {
|
|
183
192
|
const markers = await validator.validate([this.modelState.root], MarkersReason.LIVE);
|
|
184
|
-
await this.actionDispatcher
|
|
185
|
-
|
|
186
|
-
.
|
|
187
|
-
this.modelState.logger.
|
|
188
|
-
|
|
193
|
+
await this.actionDispatcher.dispatch(SetMarkersAction.create(markers, { reason: MarkersReason.LIVE })).catch((error: unknown) => {
|
|
194
|
+
const message = `Could not send the live-validation markers: ${describeErrorWithStack(error)}`;
|
|
195
|
+
if (this.sessionEnded()) {
|
|
196
|
+
this.modelState.logger.debug(message);
|
|
197
|
+
} else {
|
|
198
|
+
this.modelState.logger.warn(message);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
189
201
|
} catch (error: unknown) {
|
|
190
202
|
this.modelState.logger.error(`Live validation failed: ${describeErrorWithStack(error)}`);
|
|
191
203
|
} finally {
|
|
@@ -193,6 +205,15 @@ export class HydraniumGlspSubmissionHandler<TRoot extends AstNode, TSourceModel
|
|
|
193
205
|
}
|
|
194
206
|
}
|
|
195
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Whether the client session this handler serves has ended. By its
|
|
210
|
+
* dispatcher rather than its id: a client that reopens a diagram under the
|
|
211
|
+
* same id gets a new session, which this handler does not serve.
|
|
212
|
+
*/
|
|
213
|
+
protected sessionEnded(): boolean {
|
|
214
|
+
return this.sessionManager.getSession(this.modelState.clientId)?.actionDispatcher !== this.actionDispatcher;
|
|
215
|
+
}
|
|
216
|
+
|
|
196
217
|
/**
|
|
197
218
|
* Serialise the model-bearing actions of a submission into a comparable
|
|
198
219
|
* signature.
|