@hydranium/glsp-server 1.0.0-next.15 → 1.0.0-next.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -5
- package/lib/browser/start-glsp-server-in-worker.d.ts +30 -39
- package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -1
- package/lib/browser/start-glsp-server-in-worker.js +45 -11
- package/lib/browser/start-glsp-server-in-worker.js.map +1 -1
- package/lib/command/hydranium-glsp-command-stack.d.ts +27 -0
- package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-command-stack.js +53 -0
- package/lib/command/hydranium-glsp-command-stack.js.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts +22 -22
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-recording-command.js +25 -26
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
- package/lib/command/index.d.ts +1 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +1 -0
- package/lib/command/index.js.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +12 -3
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +18 -2
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -1
- package/lib/launcher/glsp-server-overrides.d.ts +10 -8
- package/lib/launcher/glsp-server-overrides.d.ts.map +1 -1
- package/lib/launcher/glsp-server-overrides.js +25 -11
- package/lib/launcher/glsp-server-overrides.js.map +1 -1
- package/lib/launcher/hydranium-glsp-server.d.ts +14 -10
- package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
- package/lib/launcher/hydranium-glsp-server.js +20 -10
- package/lib/launcher/hydranium-glsp-server.js.map +1 -1
- package/lib/messages/index.d.ts +24 -0
- package/lib/messages/index.d.ts.map +1 -0
- package/lib/messages/index.js +24 -0
- package/lib/messages/index.js.map +1 -0
- package/lib/node/start-glsp-server.d.ts +1 -1
- package/lib/node/start-glsp-server.d.ts.map +1 -1
- package/lib/node/start-glsp-server.js +3 -4
- package/lib/node/start-glsp-server.js.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts +110 -43
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.js +139 -60
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.d.ts +6 -6
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.js +6 -10
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
- package/lib/state/reconcile-source-model-write.d.ts +9 -8
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
- package/lib/state/reconcile-source-model-write.js +8 -8
- package/lib/state/reconcile-source-model-write.js.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +59 -59
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.js +84 -82
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +19 -18
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +26 -30
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts +30 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.d.ts.map +1 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.js +47 -0
- package/lib/storage/hydranium-glsp-request-save-model-action-handler.js.map +1 -0
- package/lib/storage/hydranium-glsp-storage.d.ts +313 -86
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
- package/lib/storage/hydranium-glsp-storage.js +456 -104
- package/lib/storage/hydranium-glsp-storage.js.map +1 -1
- package/lib/storage/index.d.ts +2 -1
- package/lib/storage/index.d.ts.map +1 -1
- package/lib/storage/index.js +2 -1
- package/lib/storage/index.js.map +1 -1
- package/lib/storage/save-delivery-policy.d.ts +46 -0
- package/lib/storage/save-delivery-policy.d.ts.map +1 -0
- package/lib/storage/{save-conflict-policy.js → save-delivery-policy.js} +7 -8
- package/lib/storage/save-delivery-policy.js.map +1 -0
- package/lib/testing/glsp-harness.js +4 -4
- package/lib/testing/glsp-harness.js.map +1 -1
- package/lib/validation/diagnostic-markers.d.ts +2 -2
- package/lib/validation/diagnostic-markers.d.ts.map +1 -1
- package/lib/validation/diagnostic-markers.js +7 -0
- package/lib/validation/diagnostic-markers.js.map +1 -1
- package/lib/validation/hydranium-glsp-model-validator.d.ts.map +1 -1
- package/lib/validation/hydranium-glsp-model-validator.js +1 -1
- package/lib/validation/hydranium-glsp-model-validator.js.map +1 -1
- package/package.json +17 -8
- package/src/browser/start-glsp-server-in-worker.ts +43 -47
- package/src/command/hydranium-glsp-command-stack.ts +36 -0
- package/src/command/hydranium-glsp-recording-command.ts +26 -26
- package/src/command/index.ts +1 -0
- package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +27 -3
- package/src/launcher/glsp-server-overrides.ts +27 -11
- package/src/launcher/hydranium-glsp-server.ts +20 -10
- package/src/messages/index.ts +30 -0
- package/src/node/start-glsp-server.ts +3 -5
- package/src/state/abstract-hydranium-glsp-state.ts +174 -73
- package/src/state/full-text-hydranium-glsp-state.ts +7 -11
- package/src/state/reconcile-source-model-write.ts +18 -15
- package/src/state/reconciling-multi-document-glsp-state.ts +86 -83
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +27 -31
- package/src/storage/hydranium-glsp-request-save-model-action-handler.ts +40 -0
- package/src/storage/hydranium-glsp-storage.ts +520 -113
- package/src/storage/index.ts +2 -1
- package/src/storage/save-delivery-policy.ts +44 -0
- package/src/testing/glsp-harness.ts +4 -4
- package/src/validation/diagnostic-markers.ts +10 -3
- package/src/validation/hydranium-glsp-model-validator.ts +3 -3
- package/lib/storage/save-conflict-policy.d.ts +0 -56
- package/lib/storage/save-conflict-policy.d.ts.map +0 -1
- package/lib/storage/save-conflict-policy.js.map +0 -1
- package/src/storage/save-conflict-policy.ts +0 -52
|
@@ -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;
|
|
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;AAIvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAmB9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEI,IAAM,iCAAiC,GAAvC,MAAM,iCACV,SAAQ,0BAAqE;IAG7E;;;;OAIG;IACO,IAAI,CAAsC;IAEpD;;;;;;;;;;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,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,CAA8C,IAAa;QAC7E,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAiB,CAAC;IAChG,CAAC;CACH,CAAA;AAzLY,iCAAiC;IAD7C,UAAU,EAAE;GACA,iCAAiC,CAyL7C"}
|
|
@@ -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 TransferElement } from '@hydranium/protocol';
|
|
11
|
+
import { type BasedOn, type TransferElement } from '@hydranium/protocol';
|
|
12
12
|
import { AbstractHydraniumGlspState } from './abstract-hydranium-glsp-state.js';
|
|
13
13
|
/**
|
|
14
14
|
* Editable GLSP state for adopters whose source model is a **structured
|
|
@@ -23,16 +23,16 @@ import { AbstractHydraniumGlspState } from './abstract-hydranium-glsp-state.js';
|
|
|
23
23
|
* field-level shape is what lets `fast-json-patch` diff per field, so undo /
|
|
24
24
|
* redo and forward-write reconcile act per field instead of clobbering the
|
|
25
25
|
* whole document.
|
|
26
|
-
* - {@link
|
|
26
|
+
* - {@link base} — the last in-sync projection, captured on every
|
|
27
27
|
* {@link setSourceRoot}. A forward-write conflict reconciles the user's
|
|
28
|
-
* intent (
|
|
28
|
+
* intent (base → ours) against the server's current root (theirs).
|
|
29
29
|
* - {@link updateSourceModel} — the concrete reconcile template: persist,
|
|
30
30
|
* and on a `ConflictError` consult the injected `conflictResolver` and act
|
|
31
31
|
* on the merged / no-op / conflict / unavailable outcome.
|
|
32
32
|
* - {@link persist} / {@link refetch} — the only I/O seams. Defaults route
|
|
33
|
-
* through `
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* through the diagram session's `update` and `ModelService.validated`;
|
|
34
|
+
* adopters whose document round-trip differs override these without
|
|
35
|
+
* touching the orchestration.
|
|
36
36
|
*
|
|
37
37
|
* Adopters whose source model is whole-document text (a bare `{ text }`
|
|
38
38
|
* source model) or that are read-only do NOT extend this class — they extend
|
|
@@ -44,12 +44,12 @@ import { AbstractHydraniumGlspState } from './abstract-hydranium-glsp-state.js';
|
|
|
44
44
|
export declare class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode, TSourceModel extends TransferElement> extends AbstractHydraniumGlspState<TRoot, TSourceModel> implements JsonModelState<TSourceModel> {
|
|
45
45
|
/**
|
|
46
46
|
* Last in-sync source-model projection, captured on every
|
|
47
|
-
* {@link setSourceRoot} (initial load + post-update). The
|
|
47
|
+
* {@link setSourceRoot} (initial load + post-update). The base a
|
|
48
48
|
* forward-write conflict reconciles against: it stays the pre-command
|
|
49
49
|
* state because operation handlers mutate `_sourceRoot` in place during
|
|
50
50
|
* `execute` while `setSourceRoot` only re-runs once the write commits.
|
|
51
51
|
*/
|
|
52
|
-
protected
|
|
52
|
+
protected base?: TSourceModel;
|
|
53
53
|
/**
|
|
54
54
|
* Persisted-shape projection of the current source root, consumed by GLSP's
|
|
55
55
|
* {@link JsonModelState} read side and recorded for field-level undo / redo.
|
|
@@ -63,28 +63,29 @@ export declare class ReconcilingTransferHydraniumGlspState<TRoot extends AstNode
|
|
|
63
63
|
/**
|
|
64
64
|
* Persist `model` back to the document store, then capture the resulting
|
|
65
65
|
* AST root. On a `ConflictError` (the based-on version was superseded),
|
|
66
|
-
* reconcile the user's intent against the
|
|
66
|
+
* reconcile the user's intent against the server's current root via the bound
|
|
67
67
|
* `conflictResolver` and act on the outcome — one declarative policy
|
|
68
68
|
* (force = last-writer-wins, reconciling = field-level merge) shared with
|
|
69
69
|
* undo / redo.
|
|
70
70
|
*/
|
|
71
|
-
updateSourceModel(model: TSourceModel,
|
|
71
|
+
updateSourceModel(model: TSourceModel, basedOn?: BasedOn): Promise<void>;
|
|
72
72
|
/**
|
|
73
73
|
* Persist hook — the only write-side I/O. Default routes the structured
|
|
74
|
-
* model through `
|
|
75
|
-
* the `ConflictError` gate
|
|
74
|
+
* model through the diagram session's `update` (serialize → reparse),
|
|
75
|
+
* opting into the `ConflictError` gate unless `basedOn` is `'anything'`,
|
|
76
|
+
* and throws without a session. Adopters whose document
|
|
76
77
|
* round-trip differs override this; the orchestration in
|
|
77
78
|
* {@link updateSourceModel} is unchanged.
|
|
78
79
|
*/
|
|
79
|
-
protected persist(model: TSourceModel,
|
|
80
|
+
protected persist(model: TSourceModel, basedOn: BasedOn): Promise<{
|
|
80
81
|
root: TRoot;
|
|
81
82
|
}>;
|
|
82
83
|
/**
|
|
83
|
-
* Refetch hook —
|
|
84
|
-
* projection (or `undefined` when unavailable)
|
|
85
|
-
* replays the user's intent
|
|
86
|
-
*
|
|
87
|
-
* adopters override alongside {@link persist}.
|
|
84
|
+
* Refetch hook — the stored text parsed afresh, as a persisted-shape
|
|
85
|
+
* projection (or `undefined` when unavailable): theirs, which the
|
|
86
|
+
* `conflictResolver` replays the user's intent onto. Default uses
|
|
87
|
+
* {@link AbstractHydraniumGlspState.readCurrentRoot} + the framework
|
|
88
|
+
* encoder's `'grammar'` mode; adopters override alongside {@link persist}.
|
|
88
89
|
*/
|
|
89
90
|
protected refetch(): Promise<TSourceModel | undefined>;
|
|
90
91
|
}
|
|
@@ -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,eAAe,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,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,qCAAqC,CAAC,KAAK,SAAS,OAAO,EAAE,YAAY,SAAS,eAAe,CAC3G,SAAQ,0BAA0B,CAAC,KAAK,EAAE,YAAY,CACtD,YAAW,cAAc,CAAC,YAAY,CAAC;IAEvC;;;;;;OAMG;IACH,SAAS,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAE9B;;;;;;;OAOG;IACH,IAAI,WAAW,IAAI,YAAY,CAE9B;IAEQ,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;IAKtD;;;;;;;OAOG;IACG,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,GAAE,OAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB5F;;;;;;;OAOG;cACa,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAKxF;;;;;;OAMG;cACa,OAAO,IAAI,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;CAI9D"}
|
|
@@ -28,16 +28,16 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
|
|
|
28
28
|
* field-level shape is what lets `fast-json-patch` diff per field, so undo /
|
|
29
29
|
* redo and forward-write reconcile act per field instead of clobbering the
|
|
30
30
|
* whole document.
|
|
31
|
-
* - {@link
|
|
31
|
+
* - {@link base} — the last in-sync projection, captured on every
|
|
32
32
|
* {@link setSourceRoot}. A forward-write conflict reconciles the user's
|
|
33
|
-
* intent (
|
|
33
|
+
* intent (base → ours) against the server's current root (theirs).
|
|
34
34
|
* - {@link updateSourceModel} — the concrete reconcile template: persist,
|
|
35
35
|
* and on a `ConflictError` consult the injected `conflictResolver` and act
|
|
36
36
|
* on the merged / no-op / conflict / unavailable outcome.
|
|
37
37
|
* - {@link persist} / {@link refetch} — the only I/O seams. Defaults route
|
|
38
|
-
* through `
|
|
39
|
-
*
|
|
40
|
-
*
|
|
38
|
+
* through the diagram session's `update` and `ModelService.validated`;
|
|
39
|
+
* adopters whose document round-trip differs override these without
|
|
40
|
+
* touching the orchestration.
|
|
41
41
|
*
|
|
42
42
|
* Adopters whose source model is whole-document text (a bare `{ text }`
|
|
43
43
|
* source model) or that are read-only do NOT extend this class — they extend
|
|
@@ -49,12 +49,12 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
|
|
|
49
49
|
let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGlspState extends AbstractHydraniumGlspState {
|
|
50
50
|
/**
|
|
51
51
|
* Last in-sync source-model projection, captured on every
|
|
52
|
-
* {@link setSourceRoot} (initial load + post-update). The
|
|
52
|
+
* {@link setSourceRoot} (initial load + post-update). The base a
|
|
53
53
|
* forward-write conflict reconciles against: it stays the pre-command
|
|
54
54
|
* state because operation handlers mutate `_sourceRoot` in place during
|
|
55
55
|
* `execute` while `setSourceRoot` only re-runs once the write commits.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
base;
|
|
58
58
|
/**
|
|
59
59
|
* Persisted-shape projection of the current source root, consumed by GLSP's
|
|
60
60
|
* {@link JsonModelState} read side and recorded for field-level undo / redo.
|
|
@@ -68,27 +68,27 @@ let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGl
|
|
|
68
68
|
}
|
|
69
69
|
setSourceRoot(uri, root) {
|
|
70
70
|
super.setSourceRoot(uri, root);
|
|
71
|
-
this.
|
|
71
|
+
this.base = this.sourceModel;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
* Persist `model` back to the document store, then capture the resulting
|
|
75
75
|
* AST root. On a `ConflictError` (the based-on version was superseded),
|
|
76
|
-
* reconcile the user's intent against the
|
|
76
|
+
* reconcile the user's intent against the server's current root via the bound
|
|
77
77
|
* `conflictResolver` and act on the outcome — one declarative policy
|
|
78
78
|
* (force = last-writer-wins, reconciling = field-level merge) shared with
|
|
79
79
|
* undo / redo.
|
|
80
80
|
*/
|
|
81
|
-
async updateSourceModel(model,
|
|
81
|
+
async updateSourceModel(model, basedOn = this.basedOn) {
|
|
82
82
|
// Orchestration lives in `reconcileSourceModelWrite` so the multi-document
|
|
83
83
|
// state gets the identical conflict handling; this method supplies only
|
|
84
84
|
// the single-document meaning of persist / project.
|
|
85
|
-
return reconcileSourceModelWrite(model,
|
|
86
|
-
persist: async (candidate,
|
|
87
|
-
const { root } = await this.persist(candidate,
|
|
85
|
+
return reconcileSourceModelWrite(model, basedOn, {
|
|
86
|
+
persist: async (candidate, candidateBasedOn) => {
|
|
87
|
+
const { root } = await this.persist(candidate, candidateBasedOn);
|
|
88
88
|
this.setSourceRoot(this._sourceUri, root);
|
|
89
89
|
},
|
|
90
90
|
refetch: () => this.refetch(),
|
|
91
|
-
|
|
91
|
+
base: this.base,
|
|
92
92
|
conflictResolver: this.conflictResolver,
|
|
93
93
|
logger: this.logger,
|
|
94
94
|
onConflictDropped: () => this.refreshSourceRoot()
|
|
@@ -96,30 +96,26 @@ let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGl
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Persist hook — the only write-side I/O. Default routes the structured
|
|
99
|
-
* model through `
|
|
100
|
-
* the `ConflictError` gate
|
|
99
|
+
* model through the diagram session's `update` (serialize → reparse),
|
|
100
|
+
* opting into the `ConflictError` gate unless `basedOn` is `'anything'`,
|
|
101
|
+
* and throws without a session. Adopters whose document
|
|
101
102
|
* round-trip differs override this; the orchestration in
|
|
102
103
|
* {@link updateSourceModel} is unchanged.
|
|
103
104
|
*/
|
|
104
|
-
async persist(model,
|
|
105
|
-
const document = await this.
|
|
106
|
-
uri: this._sourceUri,
|
|
107
|
-
model,
|
|
108
|
-
clientId: this.clientId,
|
|
109
|
-
baseVersion
|
|
110
|
-
});
|
|
105
|
+
async persist(model, basedOn) {
|
|
106
|
+
const document = await this.requireModelSession().update({ uri: this._sourceUri, model, basedOn });
|
|
111
107
|
return document;
|
|
112
108
|
}
|
|
113
109
|
/**
|
|
114
|
-
* Refetch hook —
|
|
115
|
-
* projection (or `undefined` when unavailable)
|
|
116
|
-
* replays the user's intent
|
|
117
|
-
*
|
|
118
|
-
* adopters override alongside {@link persist}.
|
|
110
|
+
* Refetch hook — the stored text parsed afresh, as a persisted-shape
|
|
111
|
+
* projection (or `undefined` when unavailable): theirs, which the
|
|
112
|
+
* `conflictResolver` replays the user's intent onto. Default uses
|
|
113
|
+
* {@link AbstractHydraniumGlspState.readCurrentRoot} + the framework
|
|
114
|
+
* encoder's `'grammar'` mode; adopters override alongside {@link persist}.
|
|
119
115
|
*/
|
|
120
116
|
async refetch() {
|
|
121
|
-
const
|
|
122
|
-
return
|
|
117
|
+
const theirs = await this.readCurrentRoot(this._sourceUri);
|
|
118
|
+
return theirs ? this.sharedServices.model.TransferEncoder.toTransfer(theirs, 'grammar') : undefined;
|
|
123
119
|
}
|
|
124
120
|
};
|
|
125
121
|
ReconcilingTransferHydraniumGlspState = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconciling-transfer-hydranium-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,qCACV,SAAQ,0BAA+C;IAGvD;;;;;;OAMG;IACO,
|
|
1
|
+
{"version":3,"file":"reconciling-transfer-hydranium-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,qCACV,SAAQ,0BAA+C;IAGvD;;;;;;OAMG;IACO,IAAI,CAAgB;IAE9B;;;;;;;OAOG;IACH,IAAI,WAAW;QACZ,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAA4B,CAAC;IACvH,CAAC;IAEQ,aAAa,CAAC,GAAW,EAAE,IAAW;QAC5C,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;IAChC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAmB,EAAE,UAAmB,IAAI,CAAC,OAAO;QACzE,2EAA2E;QAC3E,wEAAwE;QACxE,oDAAoD;QACpD,OAAO,yBAAyB,CAAe,KAAK,EAAE,OAAO,EAAE;YAC5D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE;gBAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;gBACjE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAC7C,CAAC;YACD,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE;SACnD,CAAC,CAAC;IACN,CAAC;IAED;;;;;;;OAOG;IACO,KAAK,CAAC,OAAO,CAAC,KAAmB,EAAE,OAAgB;QAC1D,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QACnG,OAAO,QAAsC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,OAAO;QACpB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,CAAC,CAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,CAA6B,CAAC,CAAC,CAAC,SAAS,CAAC;IACpI,CAAC;CACH,CAAA;AA/EY,qCAAqC;IADjD,UAAU,EAAE;GACA,qCAAqC,CA+EjD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import { type Action, SaveModelActionHandler } from '@eclipse-glsp/server';
|
|
10
|
+
/**
|
|
11
|
+
* Answers a {@link RequestSaveModelAction}: saves exactly as GLSP's
|
|
12
|
+
* {@link SaveModelActionHandler} saves a `SaveModelAction` carrying the same
|
|
13
|
+
* `fileUri`, dirty-state change included, then replies with a
|
|
14
|
+
* {@link ModelSavedAction}.
|
|
15
|
+
*
|
|
16
|
+
* A failed save throws, and the server turns the throw into a `RejectAction`
|
|
17
|
+
* for the request. The save handler's own `SaveModelAction` stays registered,
|
|
18
|
+
* so a client that sends it is unaffected.
|
|
19
|
+
*
|
|
20
|
+
* `AbstractHydraniumGlspDiagramModule` registers it. A diagram module that does
|
|
21
|
+
* not extend that base adds it in `configureActionHandlers`. Without it no
|
|
22
|
+
* handler is advertised for the request, and the Theia client saves as GLSP's
|
|
23
|
+
* saveable does: a save nothing answers, so a failed one surfaces only as a
|
|
24
|
+
* timeout, and a window can close over a save still under way.
|
|
25
|
+
*/
|
|
26
|
+
export declare class HydraniumGlspRequestSaveModelActionHandler extends SaveModelActionHandler {
|
|
27
|
+
actionKinds: string[];
|
|
28
|
+
execute(action: Action): Promise<Action[]>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=hydranium-glsp-request-save-model-action-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-request-save-model-action-handler.d.ts","sourceRoot":"","sources":["../../src/storage/hydranium-glsp-request-save-model-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAmB,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAI5F;;;;;;;;;;;;;;;GAeG;AACH,qBACa,0CAA2C,SAAQ,sBAAsB;IAC1E,WAAW,WAAiC;IAGtC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAK3D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 CrossBreeze, EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
import { SaveModelAction, SaveModelActionHandler } from '@eclipse-glsp/server';
|
|
16
|
+
import { ModelSavedAction, RequestSaveModelAction } from '@hydranium/protocol';
|
|
17
|
+
import { injectable } from 'inversify';
|
|
18
|
+
/**
|
|
19
|
+
* Answers a {@link RequestSaveModelAction}: saves exactly as GLSP's
|
|
20
|
+
* {@link SaveModelActionHandler} saves a `SaveModelAction` carrying the same
|
|
21
|
+
* `fileUri`, dirty-state change included, then replies with a
|
|
22
|
+
* {@link ModelSavedAction}.
|
|
23
|
+
*
|
|
24
|
+
* A failed save throws, and the server turns the throw into a `RejectAction`
|
|
25
|
+
* for the request. The save handler's own `SaveModelAction` stays registered,
|
|
26
|
+
* so a client that sends it is unaffected.
|
|
27
|
+
*
|
|
28
|
+
* `AbstractHydraniumGlspDiagramModule` registers it. A diagram module that does
|
|
29
|
+
* not extend that base adds it in `configureActionHandlers`. Without it no
|
|
30
|
+
* handler is advertised for the request, and the Theia client saves as GLSP's
|
|
31
|
+
* saveable does: a save nothing answers, so a failed one surfaces only as a
|
|
32
|
+
* timeout, and a window can close over a save still under way.
|
|
33
|
+
*/
|
|
34
|
+
let HydraniumGlspRequestSaveModelActionHandler = class HydraniumGlspRequestSaveModelActionHandler extends SaveModelActionHandler {
|
|
35
|
+
actionKinds = [RequestSaveModelAction.KIND];
|
|
36
|
+
// Typed `Action`, the one parameter type both this kind and the base's accept.
|
|
37
|
+
async execute(action) {
|
|
38
|
+
const fileUri = 'fileUri' in action && typeof action.fileUri === 'string' ? action.fileUri : undefined;
|
|
39
|
+
const actions = await super.execute(SaveModelAction.create({ fileUri }));
|
|
40
|
+
return [...actions, ModelSavedAction.create()];
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
HydraniumGlspRequestSaveModelActionHandler = __decorate([
|
|
44
|
+
injectable()
|
|
45
|
+
], HydraniumGlspRequestSaveModelActionHandler);
|
|
46
|
+
export { HydraniumGlspRequestSaveModelActionHandler };
|
|
47
|
+
//# sourceMappingURL=hydranium-glsp-request-save-model-action-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-request-save-model-action-handler.js","sourceRoot":"","sources":["../../src/storage/hydranium-glsp-request-save-model-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAElF,OAAO,EAAe,eAAe,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,0CAA0C,GAAhD,MAAM,0CAA2C,SAAQ,sBAAsB;IAC1E,WAAW,GAAG,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAErD,+EAA+E;IACtE,KAAK,CAAC,OAAO,CAAC,MAAc;QAClC,MAAM,OAAO,GAAG,SAAS,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QACvG,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,OAAO,EAAE,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;CACH,CAAA;AATY,0CAA0C;IADtD,UAAU,EAAE;GACA,0CAA0C,CAStD"}
|