@hydranium/glsp-server 1.0.0-next.316 → 1.0.0-next.317
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/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
|
@@ -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,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,C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;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,CAAC;AA0B9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEI,IAAM,iCAAiC,GAAvC,MAAM,iCAIV,SAAQ,0BAAiG;IAGzG;;;;OAIG;IACO,IAAI,CAAkE;IAEhF,qIAAqI;IAClH,eAAe,GAAG,IAAI,GAAG,EAA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,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC/C,iBAAiB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;YACzC,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAa,CAAC,EAAE,WAAW,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE,CAAC;IACtI,CAAC;IAED;;;;OAIG;IACO,eAAe,CAAC,GAAW;QAClC,MAAM,IAAI,GACP,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC;YAC/B,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;YACxB,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC;QAC/E,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACO,WAAW,CAAoB,IAAO;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAqC,CAAC;IACpH,CAAC;CACH,CAAA;AAzVY,iCAAiC;IAD7C,UAAU,EAAE;GACA,iCAAiC,CAyV7C;;AAED,SAAS,oBAAoB,CAAC,KAAa;IACxC,OAAO,aAAa,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,qCAAqC,CAC/C,KAAK,SAAS,OAAO,EACrB,YAAY,SAAS;KAAG,CAAC,IAAI,MAAM,YAAY,GAAG,eAAe;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAErG,SAAQ,0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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,CAAC;IACxH,CAAC;IAED,2FAA2F;IAClF,KAAK,CAAC,mBAAmB,CAC/B,UAAqE;QAErE,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;YACr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I,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydranium/glsp-server",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.317",
|
|
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.317",
|
|
74
|
+
"@hydranium/langium": "1.0.0-next.317",
|
|
75
|
+
"@hydranium/protocol": "1.0.0-next.317",
|
|
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.317",
|
|
86
|
+
"@hydranium/langium": "1.0.0-next.317",
|
|
87
|
+
"@hydranium/protocol": "1.0.0-next.317",
|
|
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 && {
|