@hydranium/glsp-server 1.0.0-next.76 → 1.0.0-next.79

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.
@@ -65,9 +65,10 @@ export interface MultiDocumentSourceModel<TPrimary extends TransferElement = Tra
65
65
  * a based-on version, so a concurrent foreign edit to one is overwritten rather
66
66
  * than reconciled. Gating them too would need a per-document reconcile whose
67
67
  * outcomes can disagree (merge one, conflict another) with no way to un-write the
68
- * merged one — the atomicity problem again, one layer up. The captured versions
69
- * ARE available via {@link AbstractHydraniumGlspState.capturedVersionOf}, so an
70
- * adopter that wants a coarser check can compare before writing.
68
+ * merged one — the atomicity problem again, one layer up. An adopter that wants
69
+ * a coarser check overrides {@link secondaryBaseVersion} to return the version
70
+ * {@link AbstractHydraniumGlspState.capturedVersionOf} already holds, and takes
71
+ * on the partial-write window named there.
71
72
  */
72
73
  export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary extends TransferElement = TransferElement> extends AbstractHydraniumGlspState<TRoot, MultiDocumentSourceModel<TPrimary>> implements JsonModelState<MultiDocumentSourceModel<TPrimary>> {
73
74
  /**
@@ -143,11 +144,29 @@ export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TP
143
144
  root: TRoot;
144
145
  }>;
145
146
  /**
146
- * Write one secondary document. Ungated by design (see the class doc); override
147
- * alongside {@link persistPrimary} when the round-trip differs per document
148
- * role — a layout file and a semantic file need not share a serializer.
147
+ * Write one secondary document, gated on whatever {@link secondaryBaseVersion}
148
+ * returns. Override alongside {@link persistPrimary} when the round-trip
149
+ * differs per document role — a layout file and a semantic file need not
150
+ * share a serializer.
149
151
  */
150
152
  protected persistSecondary(uri: string, model: TransferElement): Promise<void>;
153
+ /**
154
+ * Based-on version for a secondary write. Default `undefined` — ungated, for
155
+ * the reason given under the conflict-gate note on the class doc.
156
+ *
157
+ * **The hook exists so that opting in is an override rather than a
158
+ * reimplementation.** The state already captures what such a check needs
159
+ * ({@link AbstractHydraniumGlspState.capturedVersionOf}), and returning that
160
+ * value here is the whole opt-in; without it the only place to put the
161
+ * comparison is a copy of {@link persistSecondary}, which then has to be kept
162
+ * in step with the framework's write call.
163
+ *
164
+ * **Opting in buys a conflict report and costs atomicity.** A gated secondary
165
+ * throws mid-set, after earlier secondaries have already been written, and if
166
+ * the reconcile then drops the edit those writes stay. Weigh that against the
167
+ * default, which lets a foreign edit to a secondary be overwritten silently.
168
+ */
169
+ protected secondaryBaseVersion(_uri: string): number | undefined;
151
170
  /**
152
171
  * Refetch hook — the current settled projection across the write set, used by
153
172
  * the conflict resolver to replay the user's intent against fresh state.
@@ -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,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGhF;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBACa,iCAAiC,CAAC,KAAK,SAAS,OAAO,EAAE,QAAQ,SAAS,eAAe,GAAG,eAAe,CACrH,SAAQ,0BAA0B,CAAC,KAAK,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAC5E,YAAW,cAAc,CAAC,wBAAwB,CAAC,QAAQ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MAAM,GAAG,IAAI;IAI3C;;;;OAIG;IACG,iBAAiB,CAAC,KAAK,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcnG;;;;;OAKG;cACa,OAAO,CAAC,KAAK,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAclH;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAI9E,6FAA6F;cAC7E,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAU/F;;;;;OAKG;cACa,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IASpF;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIhE;;;;;;OAMG;cACa,OAAO,IAAI,OAAO,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAelF,wFAAwF;IACxF,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAKnE,oFAAoF;IACpF,SAAS,CAAC,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,CAAC;CAGtF"}
@@ -54,9 +54,10 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
54
54
  * a based-on version, so a concurrent foreign edit to one is overwritten rather
55
55
  * than reconciled. Gating them too would need a per-document reconcile whose
56
56
  * outcomes can disagree (merge one, conflict another) with no way to un-write the
57
- * merged one — the atomicity problem again, one layer up. The captured versions
58
- * ARE available via {@link AbstractHydraniumGlspState.capturedVersionOf}, so an
59
- * adopter that wants a coarser check can compare before writing.
57
+ * merged one — the atomicity problem again, one layer up. An adopter that wants
58
+ * a coarser check overrides {@link secondaryBaseVersion} to return the version
59
+ * {@link AbstractHydraniumGlspState.capturedVersionOf} already holds, and takes
60
+ * on the partial-write window named there.
60
61
  */
61
62
  let ReconcilingMultiDocumentGlspState = class ReconcilingMultiDocumentGlspState extends AbstractHydraniumGlspState {
62
63
  /**
@@ -177,12 +178,37 @@ let ReconcilingMultiDocumentGlspState = class ReconcilingMultiDocumentGlspState
177
178
  return document;
178
179
  }
179
180
  /**
180
- * Write one secondary document. Ungated by design (see the class doc); override
181
- * alongside {@link persistPrimary} when the round-trip differs per document
182
- * role — a layout file and a semantic file need not share a serializer.
181
+ * Write one secondary document, gated on whatever {@link secondaryBaseVersion}
182
+ * returns. Override alongside {@link persistPrimary} when the round-trip
183
+ * differs per document role — a layout file and a semantic file need not
184
+ * share a serializer.
183
185
  */
184
186
  async persistSecondary(uri, model) {
185
- await this.sharedServices.model.ModelService.update({ uri, model, clientId: this.clientId });
187
+ await this.sharedServices.model.ModelService.update({
188
+ uri,
189
+ model,
190
+ clientId: this.clientId,
191
+ baseVersion: this.secondaryBaseVersion(uri)
192
+ });
193
+ }
194
+ /**
195
+ * Based-on version for a secondary write. Default `undefined` — ungated, for
196
+ * the reason given under the conflict-gate note on the class doc.
197
+ *
198
+ * **The hook exists so that opting in is an override rather than a
199
+ * reimplementation.** The state already captures what such a check needs
200
+ * ({@link AbstractHydraniumGlspState.capturedVersionOf}), and returning that
201
+ * value here is the whole opt-in; without it the only place to put the
202
+ * comparison is a copy of {@link persistSecondary}, which then has to be kept
203
+ * in step with the framework's write call.
204
+ *
205
+ * **Opting in buys a conflict report and costs atomicity.** A gated secondary
206
+ * throws mid-set, after earlier secondaries have already been written, and if
207
+ * the reconcile then drops the edit those writes stay. Weigh that against the
208
+ * default, which lets a foreign edit to a secondary be overwritten silently.
209
+ */
210
+ secondaryBaseVersion(_uri) {
211
+ return undefined;
186
212
  }
187
213
  /**
188
214
  * Refetch hook — the current settled projection across the write set, used by
@@ -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,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAmB9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEI,IAAM,iCAAiC,GAAvC,MAAM,iCACV,SAAQ,0BAAqE;IAG7E;;;;OAIG;IACO,QAAQ,CAAsC;IAExD;;;;;;;;;;OAUG;IACH,IAAI,WAAW;QACZ,MAAM,WAAW,GAAoC,EAAE,CAAC;QACxD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACpC,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAC7C,IAAI,UAAU,EAAE,CAAC;gBACd,WAAW,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACjC,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IACvE,CAAC;IAEQ,aAAa,CAAC,GAAW,EAAE,IAAW;QAC5C,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CA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AAW,GAAoC,EAAE,CAAC;QACxD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACnG,IAAI,OAAO,EAAE,CAAC;gBACX,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAA0B,CAAC,CAAC;YAC3E,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAA0B,CAAa,EAAE,WAAW,EAAE,CAAC;IACnG,CAAC;IAED,wFAAwF;IAC9E,eAAe,CAAC,GAAW;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC;QACzF,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IAED,oFAAoF;IAC1E,WAAW,CAA8C,IAAa;QAC7E,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAiB,CAAC;IAChG,CAAC;CACH,CAAA;AA1KY,iCAAiC;IAD7C,UAAU,EAAE;GACA,iCAAiC,CA0K7C"}
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,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,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,CAAC;gBACX,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAA0B,CAAC,CAAC;YAC3E,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAA0B,CAAa,EAAE,WAAW,EAAE,CAAC;IACnG,CAAC;IAED,wFAAwF;IAC9E,eAAe,CAAC,GAAW;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC;QACzF,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpD,CAAC;IAED,oFAAoF;IAC1E,WAAW,CAA8C,IAAa;QAC7E,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAiB,CAAC;IAChG,CAAC;CACH,CAAA;AApMY,iCAAiC;IAD7C,UAAU,EAAE;GACA,iCAAiC,CAoM7C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hydranium/glsp-server",
3
- "version": "1.0.0-next.76",
3
+ "version": "1.0.0-next.79",
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
  "hydranium",
@@ -87,9 +87,9 @@
87
87
  "devDependencies": {
88
88
  "@eclipse-glsp/protocol": "2.7.0",
89
89
  "@eclipse-glsp/server": "2.7.0",
90
- "@hydranium/core": "1.0.0-next.76",
91
- "@hydranium/langium": "1.0.0-next.76",
92
- "@hydranium/protocol": "1.0.0-next.76",
90
+ "@hydranium/core": "1.0.0-next.79",
91
+ "@hydranium/langium": "1.0.0-next.79",
92
+ "@hydranium/protocol": "1.0.0-next.79",
93
93
  "inversify": "6.2.2",
94
94
  "reflect-metadata": "0.2.2",
95
95
  "rimraf": "^5.0.0",
@@ -100,9 +100,9 @@
100
100
  "peerDependencies": {
101
101
  "@eclipse-glsp/protocol": "^2.6.0",
102
102
  "@eclipse-glsp/server": "^2.6.0",
103
- "@hydranium/core": "1.0.0-next.76",
104
- "@hydranium/langium": "1.0.0-next.76",
105
- "@hydranium/protocol": "1.0.0-next.76",
103
+ "@hydranium/core": "1.0.0-next.79",
104
+ "@hydranium/langium": "1.0.0-next.79",
105
+ "@hydranium/protocol": "1.0.0-next.79",
106
106
  "inversify": "^6.0.0",
107
107
  "reflect-metadata": "^0.2.2",
108
108
  "vscode-jsonrpc": "9.0.1",
@@ -70,9 +70,10 @@ export interface MultiDocumentSourceModel<TPrimary extends TransferElement = Tra
70
70
  * a based-on version, so a concurrent foreign edit to one is overwritten rather
71
71
  * than reconciled. Gating them too would need a per-document reconcile whose
72
72
  * outcomes can disagree (merge one, conflict another) with no way to un-write the
73
- * merged one — the atomicity problem again, one layer up. The captured versions
74
- * ARE available via {@link AbstractHydraniumGlspState.capturedVersionOf}, so an
75
- * adopter that wants a coarser check can compare before writing.
73
+ * merged one — the atomicity problem again, one layer up. An adopter that wants
74
+ * a coarser check overrides {@link secondaryBaseVersion} to return the version
75
+ * {@link AbstractHydraniumGlspState.capturedVersionOf} already holds, and takes
76
+ * on the partial-write window named there.
76
77
  */
77
78
  @injectable()
78
79
  export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary extends TransferElement = TransferElement>
@@ -205,12 +206,38 @@ export class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary e
205
206
  }
206
207
 
207
208
  /**
208
- * Write one secondary document. Ungated by design (see the class doc); override
209
- * alongside {@link persistPrimary} when the round-trip differs per document
210
- * role — a layout file and a semantic file need not share a serializer.
209
+ * Write one secondary document, gated on whatever {@link secondaryBaseVersion}
210
+ * returns. Override alongside {@link persistPrimary} when the round-trip
211
+ * differs per document role — a layout file and a semantic file need not
212
+ * share a serializer.
211
213
  */
212
214
  protected async persistSecondary(uri: string, model: TransferElement): Promise<void> {
213
- await this.sharedServices.model.ModelService.update({ uri, model, clientId: this.clientId });
215
+ await this.sharedServices.model.ModelService.update({
216
+ uri,
217
+ model,
218
+ clientId: this.clientId,
219
+ baseVersion: this.secondaryBaseVersion(uri)
220
+ });
221
+ }
222
+
223
+ /**
224
+ * Based-on version for a secondary write. Default `undefined` — ungated, for
225
+ * the reason given under the conflict-gate note on the class doc.
226
+ *
227
+ * **The hook exists so that opting in is an override rather than a
228
+ * reimplementation.** The state already captures what such a check needs
229
+ * ({@link AbstractHydraniumGlspState.capturedVersionOf}), and returning that
230
+ * value here is the whole opt-in; without it the only place to put the
231
+ * comparison is a copy of {@link persistSecondary}, which then has to be kept
232
+ * in step with the framework's write call.
233
+ *
234
+ * **Opting in buys a conflict report and costs atomicity.** A gated secondary
235
+ * throws mid-set, after earlier secondaries have already been written, and if
236
+ * the reconcile then drops the edit those writes stay. Weigh that against the
237
+ * default, which lets a foreign edit to a secondary be overwritten silently.
238
+ */
239
+ protected secondaryBaseVersion(_uri: string): number | undefined {
240
+ return undefined;
214
241
  }
215
242
 
216
243
  /**