@hydranium/glsp-server 1.0.0-next.31 → 1.0.0-next.315
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 +80 -88
- package/lib/browser/start-glsp-server-in-worker.d.ts +43 -42
- package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -1
- package/lib/browser/start-glsp-server-in-worker.js +62 -13
- package/lib/browser/start-glsp-server-in-worker.js.map +1 -1
- package/lib/command/diagram-edit-dropped-error.d.ts +31 -0
- package/lib/command/diagram-edit-dropped-error.d.ts.map +1 -0
- package/lib/command/diagram-edit-dropped-error.js +48 -0
- package/lib/command/diagram-edit-dropped-error.js.map +1 -0
- package/lib/command/hydranium-glsp-command-stack.d.ts +33 -0
- package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-command-stack.js +63 -0
- package/lib/command/hydranium-glsp-command-stack.js.map +1 -0
- package/lib/command/hydranium-glsp-operation-action-handler.d.ts +64 -0
- package/lib/command/hydranium-glsp-operation-action-handler.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-operation-action-handler.js +142 -0
- package/lib/command/hydranium-glsp-operation-action-handler.js.map +1 -0
- package/lib/command/hydranium-glsp-operation-command.d.ts +250 -0
- package/lib/command/hydranium-glsp-operation-command.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-operation-command.js +491 -0
- package/lib/command/hydranium-glsp-operation-command.js.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts +26 -87
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-recording-command.js +40 -117
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
- package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts +23 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.js +41 -0
- package/lib/command/hydranium-glsp-undo-redo-action-handler.js.map +1 -0
- package/lib/command/index.d.ts +5 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +5 -0
- package/lib/command/index.js.map +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts.map +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js +2 -2
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js.map +1 -1
- package/lib/dispatcher/server-action-dispatcher.d.ts +25 -24
- package/lib/dispatcher/server-action-dispatcher.d.ts.map +1 -1
- package/lib/dispatcher/server-action-dispatcher.js +38 -26
- package/lib/dispatcher/server-action-dispatcher.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +35 -59
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -1
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +60 -71
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -1
- package/lib/launcher/drop-notifications-to-gone-client.d.ts +23 -0
- package/lib/launcher/drop-notifications-to-gone-client.d.ts.map +1 -0
- package/lib/launcher/drop-notifications-to-gone-client.js +43 -0
- package/lib/launcher/drop-notifications-to-gone-client.js.map +1 -0
- package/lib/launcher/glsp-app-module.d.ts +1 -2
- package/lib/launcher/glsp-app-module.d.ts.map +1 -1
- package/lib/launcher/glsp-app-module.js.map +1 -1
- package/lib/launcher/glsp-connection-logger.d.ts +19 -0
- package/lib/launcher/glsp-connection-logger.d.ts.map +1 -0
- package/lib/launcher/glsp-connection-logger.js +24 -0
- package/lib/launcher/glsp-connection-logger.js.map +1 -0
- 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 +60 -15
- package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -1
- package/lib/launcher/hydranium-glsp-server.js +145 -22
- package/lib/launcher/hydranium-glsp-server.js.map +1 -1
- package/lib/launcher/index.d.ts +2 -0
- package/lib/launcher/index.d.ts.map +1 -1
- package/lib/launcher/index.js +5 -4
- package/lib/launcher/index.js.map +1 -1
- package/lib/logging/glsp-client-logger.d.ts +10 -6
- package/lib/logging/glsp-client-logger.d.ts.map +1 -1
- package/lib/logging/glsp-client-logger.js +14 -7
- package/lib/logging/glsp-client-logger.js.map +1 -1
- package/lib/messages/index.d.ts +11 -6
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +11 -6
- package/lib/messages/index.js.map +1 -1
- package/lib/node/start-glsp-server.d.ts +50 -15
- package/lib/node/start-glsp-server.d.ts.map +1 -1
- package/lib/node/start-glsp-server.js +97 -30
- package/lib/node/start-glsp-server.js.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts +326 -102
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.js +529 -139
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
- package/lib/state/diagram-status.d.ts +38 -0
- package/lib/state/diagram-status.d.ts.map +1 -0
- package/lib/state/diagram-status.js +27 -0
- package/lib/state/diagram-status.js.map +1 -0
- package/lib/state/full-text-hydranium-glsp-state.d.ts +22 -9
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/full-text-hydranium-glsp-state.js +45 -18
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -1
- package/lib/state/hydranium-glsp-index.d.ts +40 -29
- package/lib/state/hydranium-glsp-index.d.ts.map +1 -1
- package/lib/state/hydranium-glsp-index.js +82 -45
- package/lib/state/hydranium-glsp-index.js.map +1 -1
- package/lib/state/hydranium-shared-core-services.d.ts +16 -29
- package/lib/state/hydranium-shared-core-services.d.ts.map +1 -1
- package/lib/state/hydranium-shared-core-services.js +15 -28
- package/lib/state/hydranium-shared-core-services.js.map +1 -1
- package/lib/state/index.d.ts +1 -0
- package/lib/state/index.d.ts.map +1 -1
- package/lib/state/index.js +1 -0
- package/lib/state/index.js.map +1 -1
- package/lib/state/model-ready-timeout-error.d.ts.map +1 -1
- package/lib/state/model-ready-timeout-error.js.map +1 -1
- package/lib/state/reconcile-source-model-write.d.ts +13 -27
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -1
- package/lib/state/reconcile-source-model-write.js +44 -32
- package/lib/state/reconcile-source-model-write.js.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +125 -69
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-multi-document-glsp-state.js +242 -100
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +36 -28
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +59 -42
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -1
- package/lib/status/diagram-status-reporter.d.ts +44 -0
- package/lib/status/diagram-status-reporter.d.ts.map +1 -0
- package/lib/status/diagram-status-reporter.js +88 -0
- package/lib/status/diagram-status-reporter.js.map +1 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.d.ts +27 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.d.ts.map +1 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.js +52 -0
- package/lib/status/hydranium-glsp-request-model-action-handler.js.map +1 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts +27 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.d.ts.map +1 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js +53 -0
- package/lib/status/hydranium-glsp-set-edit-mode-action-handler.js.map +1 -0
- package/lib/status/index.d.ts +12 -0
- package/lib/status/index.d.ts.map +1 -0
- package/lib/status/index.js +12 -0
- package/lib/status/index.js.map +1 -0
- 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 +324 -143
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -1
- package/lib/storage/hydranium-glsp-storage.js +569 -213
- 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 +51 -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/submission/hydranium-glsp-submission-handler.d.ts +44 -4
- package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -1
- package/lib/submission/hydranium-glsp-submission-handler.js +82 -6
- package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -1
- package/lib/testing/glsp-harness.d.ts +34 -7
- package/lib/testing/glsp-harness.d.ts.map +1 -1
- package/lib/testing/glsp-harness.js +47 -19
- package/lib/testing/glsp-harness.js.map +1 -1
- package/lib/validation/diagnostic-markers.d.ts +3 -3
- package/lib/validation/diagnostic-markers.d.ts.map +1 -1
- package/lib/validation/diagnostic-markers.js +1 -1
- package/lib/validation/diagnostic-markers.js.map +1 -1
- package/lib/validation/hydranium-glsp-model-validator.d.ts +1 -2
- 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 +31 -52
- package/src/browser/start-glsp-server-in-worker.ts +79 -51
- package/src/command/diagram-edit-dropped-error.ts +51 -0
- package/src/command/hydranium-glsp-command-stack.ts +47 -0
- package/src/command/hydranium-glsp-operation-action-handler.ts +141 -0
- package/src/command/hydranium-glsp-operation-command.ts +602 -0
- package/src/command/hydranium-glsp-recording-command.ts +40 -121
- package/src/command/hydranium-glsp-undo-redo-action-handler.ts +29 -0
- package/src/command/index.ts +10 -0
- package/src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts +2 -2
- package/src/dispatcher/server-action-dispatcher.ts +39 -31
- package/src/index.ts +1 -0
- package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +79 -91
- package/src/launcher/drop-notifications-to-gone-client.ts +47 -0
- package/src/launcher/glsp-app-module.ts +1 -2
- package/src/launcher/glsp-connection-logger.ts +27 -0
- package/src/launcher/glsp-server-overrides.ts +27 -11
- package/src/launcher/hydranium-glsp-server.ts +153 -23
- package/src/launcher/index.ts +5 -4
- package/src/logging/glsp-client-logger.ts +16 -9
- package/src/messages/index.ts +16 -6
- package/src/node/start-glsp-server.ts +133 -40
- package/src/state/abstract-hydranium-glsp-state.ts +609 -154
- package/src/state/diagram-status.ts +41 -0
- package/src/state/full-text-hydranium-glsp-state.ts +46 -18
- package/src/state/hydranium-glsp-index.ts +85 -41
- package/src/state/hydranium-shared-core-services.ts +16 -29
- package/src/state/index.ts +1 -0
- package/src/state/reconcile-source-model-write.ts +51 -53
- package/src/state/reconciling-multi-document-glsp-state.ts +276 -102
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +67 -45
- package/src/status/diagram-status-reporter.ts +106 -0
- package/src/status/hydranium-glsp-request-model-action-handler.ts +43 -0
- package/src/status/hydranium-glsp-set-edit-mode-action-handler.ts +38 -0
- package/src/status/index.ts +12 -0
- package/src/storage/hydranium-glsp-request-save-model-action-handler.ts +40 -0
- package/src/storage/hydranium-glsp-storage.ts +647 -223
- package/src/storage/index.ts +2 -1
- package/src/storage/save-delivery-policy.ts +49 -0
- package/src/submission/hydranium-glsp-submission-handler.ts +91 -5
- package/src/testing/glsp-harness.ts +67 -25
- package/src/validation/diagnostic-markers.ts +3 -3
- package/src/validation/hydranium-glsp-model-validator.ts +4 -5
- 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
|
@@ -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
|
|
32
|
-
*
|
|
33
|
-
* intent (
|
|
31
|
+
* - {@link base} — the last in-sync projection, taken on every capture of
|
|
32
|
+
* the built root. A forward-write conflict reconciles the user's
|
|
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
|
-
* on
|
|
36
|
+
* on its 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
|
|
@@ -48,13 +48,10 @@ import { reconcileSourceModelWrite } from './reconcile-source-model-write.js';
|
|
|
48
48
|
*/
|
|
49
49
|
let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGlspState extends AbstractHydraniumGlspState {
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* forward-write conflict reconciles against: it stays the pre-command
|
|
54
|
-
* state because operation handlers mutate `_sourceRoot` in place during
|
|
55
|
-
* `execute` while `setSourceRoot` only re-runs once the write commits.
|
|
51
|
+
* The projection a forward-write conflict reconciles the user's intent
|
|
52
|
+
* from, taken from the built root on every capture.
|
|
56
53
|
*/
|
|
57
|
-
|
|
54
|
+
base;
|
|
58
55
|
/**
|
|
59
56
|
* Persisted-shape projection of the current source root, consumed by GLSP's
|
|
60
57
|
* {@link JsonModelState} read side and recorded for field-level undo / redo.
|
|
@@ -64,62 +61,82 @@ let ReconcilingTransferHydraniumGlspState = class ReconcilingTransferHydraniumGl
|
|
|
64
61
|
* Synchronous — the encoder walks the in-memory AST without serialising.
|
|
65
62
|
*/
|
|
66
63
|
get sourceModel() {
|
|
67
|
-
return this.
|
|
64
|
+
return this.projectRoot(this.sourceRoot);
|
|
68
65
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
/**
|
|
67
|
+
* The source model of `root`. The single projection seam: the source
|
|
68
|
+
* model, the refetch and {@link normalizeTransition} all project through it.
|
|
69
|
+
*/
|
|
70
|
+
projectRoot(root) {
|
|
71
|
+
return this.sharedServices.model.TransferEncoder.toTransfer(root, 'grammar');
|
|
72
|
+
}
|
|
73
|
+
/** Both ends serialized for the source document and parsed back, unless they are equal. */
|
|
74
|
+
async normalizeTransition(transition) {
|
|
75
|
+
if (JSON.stringify(transition.from) === JSON.stringify(transition.to)) {
|
|
76
|
+
return transition;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
from: this.projectRoot(await this.roundTrip(this._sourceUri, transition.from)),
|
|
80
|
+
to: this.projectRoot(await this.roundTrip(this._sourceUri, transition.to))
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
captureSourceRoot(uri, root) {
|
|
84
|
+
super.captureSourceRoot(uri, root);
|
|
85
|
+
this.base = this.sourceModel;
|
|
72
86
|
}
|
|
73
87
|
/**
|
|
74
88
|
* Persist `model` back to the document store, then capture the resulting
|
|
75
|
-
* AST root. On a `ConflictError` (the
|
|
76
|
-
* reconcile the user's intent against the
|
|
89
|
+
* AST root. On a `ConflictError` (the base version was superseded),
|
|
90
|
+
* reconcile the user's intent against the server's current root via the bound
|
|
77
91
|
* `conflictResolver` and act on the outcome — one declarative policy
|
|
78
92
|
* (force = last-writer-wins, reconciling = field-level merge) shared with
|
|
79
93
|
* undo / redo.
|
|
80
94
|
*/
|
|
81
|
-
async updateSourceModel(model,
|
|
95
|
+
async updateSourceModel(model, baseVersion = this.baseVersion) {
|
|
82
96
|
// Orchestration lives in `reconcileSourceModelWrite` so the multi-document
|
|
83
97
|
// state gets the identical conflict handling; this method supplies only
|
|
84
98
|
// the single-document meaning of persist / project.
|
|
85
|
-
return reconcileSourceModelWrite(model,
|
|
86
|
-
persist: async (candidate,
|
|
87
|
-
const { root } = await this.persist(candidate,
|
|
88
|
-
this.
|
|
99
|
+
return reconcileSourceModelWrite(model, baseVersion, {
|
|
100
|
+
persist: async (candidate, candidateBaseVersion) => {
|
|
101
|
+
const { root } = await this.persist(candidate, candidateBaseVersion);
|
|
102
|
+
this.captureWrittenRoot(root);
|
|
89
103
|
},
|
|
90
104
|
refetch: () => this.refetch(),
|
|
91
|
-
|
|
105
|
+
base: this.base,
|
|
92
106
|
conflictResolver: this.conflictResolver,
|
|
93
107
|
logger: this.logger,
|
|
94
|
-
onConflictDropped: () => this.
|
|
108
|
+
onConflictDropped: () => this.writeDropped(),
|
|
109
|
+
onAlreadyApplied: () => this.captureBuiltRoot(),
|
|
110
|
+
maxWrites: this.maxSourceModelWrites
|
|
95
111
|
});
|
|
96
112
|
}
|
|
97
113
|
/**
|
|
98
114
|
* Persist hook — the only write-side I/O. Default routes the structured
|
|
99
|
-
* model through `
|
|
100
|
-
* the `ConflictError` gate
|
|
101
|
-
*
|
|
115
|
+
* model through the diagram session's `update` (serialize → reparse),
|
|
116
|
+
* opting into the `ConflictError` gate unless `baseVersion` is `'any'`,
|
|
117
|
+
* and throws without a session. Adopters whose document
|
|
118
|
+
* round-trip differs override this, and {@link normalizeTransition}
|
|
119
|
+
* alongside so undo compares what this writes; the orchestration in
|
|
102
120
|
* {@link updateSourceModel} is unchanged.
|
|
103
121
|
*/
|
|
104
122
|
async persist(model, baseVersion) {
|
|
105
|
-
const document = await this.
|
|
106
|
-
uri: this._sourceUri,
|
|
107
|
-
model,
|
|
108
|
-
clientId: this.clientId,
|
|
109
|
-
baseVersion
|
|
110
|
-
});
|
|
123
|
+
const document = await this.requireModelSession().update({ uri: this._sourceUri, model, baseVersion });
|
|
111
124
|
return document;
|
|
112
125
|
}
|
|
113
126
|
/**
|
|
114
|
-
* Refetch hook —
|
|
115
|
-
* projection (or `undefined` when
|
|
116
|
-
* replays the user's
|
|
117
|
-
*
|
|
118
|
-
* adopters override alongside
|
|
127
|
+
* Refetch hook — the stored text parsed afresh, as a persisted-shape
|
|
128
|
+
* projection with the version of that text (or `undefined` when
|
|
129
|
+
* unavailable): theirs, which the `conflictResolver` replays the user's
|
|
130
|
+
* intent onto. Default uses {@link AbstractHydraniumGlspState.readCurrentRoot}
|
|
131
|
+
* + the framework encoder's `'grammar'` mode; adopters override alongside
|
|
132
|
+
* {@link persist}.
|
|
119
133
|
*/
|
|
120
134
|
async refetch() {
|
|
121
|
-
const
|
|
122
|
-
return
|
|
135
|
+
const theirs = await this.readCurrentRoot(this._sourceUri);
|
|
136
|
+
return (theirs && {
|
|
137
|
+
model: this.projectRoot(theirs.root),
|
|
138
|
+
baseVersion: theirs.version
|
|
139
|
+
});
|
|
123
140
|
}
|
|
124
141
|
};
|
|
125
142
|
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;
|
|
1
|
+
{"version":3,"file":"reconciling-transfer-hydranium-glsp-state.js","sourceRoot":"","sources":["../../src/state/reconciling-transfer-hydranium-glsp-state.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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, ActionDispatcher, type ClientSession, type ClientSessionInitializer, type ClientSessionListener, ClientSessionManager, EditMode } from '@eclipse-glsp/server';
|
|
10
|
+
import { type AstNode } from '@hydranium/langium';
|
|
11
|
+
import { DisposableCollection } from '@hydranium/protocol';
|
|
12
|
+
import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
|
|
13
|
+
/**
|
|
14
|
+
* Sends the client what {@link AbstractHydraniumGlspState.onStatusChanged}
|
|
15
|
+
* announces: the current status for its status overlay and the edit mode.
|
|
16
|
+
*
|
|
17
|
+
* The only sender of either action. A status or edit mode dispatched from
|
|
18
|
+
* anywhere else is overwritten by the next change, and the state's account of
|
|
19
|
+
* why the diagram is read-only no longer matches the client's.
|
|
20
|
+
*/
|
|
21
|
+
export interface DiagramStatusReporter extends ClientSessionInitializer {
|
|
22
|
+
/**
|
|
23
|
+
* The client switched itself to `editMode`, as GLSP's client does before it
|
|
24
|
+
* forwards an edit-mode request. Sends the effective mode back if it differs.
|
|
25
|
+
*/
|
|
26
|
+
clientEditModeChanged(editMode: EditMode): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const DiagramStatusReporter: unique symbol;
|
|
29
|
+
export declare class DefaultDiagramStatusReporter implements DiagramStatusReporter, ClientSessionListener {
|
|
30
|
+
protected readonly state: AbstractHydraniumGlspState<AstNode, unknown>;
|
|
31
|
+
protected readonly actionDispatcher: ActionDispatcher;
|
|
32
|
+
protected readonly sessionManager: ClientSessionManager;
|
|
33
|
+
protected readonly toDispose: DisposableCollection;
|
|
34
|
+
/** What the client shows; it starts editable with an empty overlay. */
|
|
35
|
+
protected sentStatus: string;
|
|
36
|
+
protected sentEditMode: string;
|
|
37
|
+
initialize(): void;
|
|
38
|
+
clientEditModeChanged(editMode: EditMode): void;
|
|
39
|
+
protected send(): void;
|
|
40
|
+
/** The actions that bring the client up to date, recording them as sent. */
|
|
41
|
+
protected changedActions(): Action[];
|
|
42
|
+
sessionDisposed(_clientSession: ClientSession): void;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=diagram-status-reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagram-status-reporter.d.ts","sourceRoot":"","sources":["../../src/status/diagram-status-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,MAAM,EACX,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,QAAQ,EAIV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAA0B,MAAM,qBAAqB,CAAC;AAEnF,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAG5F;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB;IACpE;;;OAGG;IACH,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CAClD;AACD,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AAErE,qBACa,4BAA6B,YAAW,qBAAqB,EAAE,qBAAqB;IAC1E,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAG,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAG,gBAAgB,CAAC;IACnD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAG,oBAAoB,CAAC;IAEvF,SAAS,CAAC,QAAQ,CAAC,SAAS,uBAA8B;IAC1D,uEAAuE;IACvE,SAAS,CAAC,UAAU,SAAwB;IAC5C,SAAS,CAAC,YAAY,EAAE,MAAM,CAAqB;IAEnD,UAAU,IAAI,IAAI,CAGjB;IAED,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAG9C;IAED,SAAS,CAAC,IAAI,IAAI,IAAI,CAIrB;IAED,4EAA4E;IAC5E,SAAS,CAAC,cAAc,IAAI,MAAM,EAAE,CAwBnC;IAED,eAAe,CAAC,cAAc,EAAE,aAAa,GAAG,IAAI,CAEnD;CACH"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
17
|
+
};
|
|
18
|
+
import { ActionDispatcher, ClientSessionManager, EditMode, ModelState, SetEditModeAction, StatusAction } from '@eclipse-glsp/server';
|
|
19
|
+
import { DisposableCollection, describeErrorWithStack } from '@hydranium/protocol';
|
|
20
|
+
import { inject, injectable } from 'inversify';
|
|
21
|
+
export const DiagramStatusReporter = Symbol('DiagramStatusReporter');
|
|
22
|
+
let DefaultDiagramStatusReporter = class DefaultDiagramStatusReporter {
|
|
23
|
+
state;
|
|
24
|
+
actionDispatcher;
|
|
25
|
+
sessionManager;
|
|
26
|
+
toDispose = new DisposableCollection();
|
|
27
|
+
/** What the client shows; it starts editable with an empty overlay. */
|
|
28
|
+
sentStatus = statusKey(undefined);
|
|
29
|
+
sentEditMode = EditMode.EDITABLE;
|
|
30
|
+
initialize() {
|
|
31
|
+
this.sessionManager.addListener(this, this.state.clientId);
|
|
32
|
+
this.toDispose.push(this.state.onStatusChanged(() => this.send()));
|
|
33
|
+
}
|
|
34
|
+
clientEditModeChanged(editMode) {
|
|
35
|
+
this.sentEditMode = editMode;
|
|
36
|
+
this.send();
|
|
37
|
+
}
|
|
38
|
+
send() {
|
|
39
|
+
this.actionDispatcher
|
|
40
|
+
.dispatchAll(this.changedActions())
|
|
41
|
+
.catch((error) => this.state.logger.warn(`Could not send the diagram status: ${describeErrorWithStack(error)}`));
|
|
42
|
+
}
|
|
43
|
+
/** The actions that bring the client up to date, recording them as sent. */
|
|
44
|
+
changedActions() {
|
|
45
|
+
const actions = [];
|
|
46
|
+
const current = this.state.currentStatus;
|
|
47
|
+
if (statusKey(current) !== this.sentStatus) {
|
|
48
|
+
this.sentStatus = statusKey(current);
|
|
49
|
+
actions.push(current?.message === undefined
|
|
50
|
+
? // `NONE` is the client's spelling for "clear": an empty message at any
|
|
51
|
+
// other severity leaves an empty band with an icon on the canvas.
|
|
52
|
+
StatusAction.create('', { severity: 'NONE' })
|
|
53
|
+
: StatusAction.create(current.message, { severity: current.severity ?? 'INFO' }));
|
|
54
|
+
}
|
|
55
|
+
if (this.state.editMode !== this.sentEditMode) {
|
|
56
|
+
this.sentEditMode = this.state.editMode;
|
|
57
|
+
actions.push(SetEditModeAction.create(this.state.editMode));
|
|
58
|
+
}
|
|
59
|
+
if (actions.length > 0) {
|
|
60
|
+
this.state.logger.debug(`Sending status ${this.sentStatus} (from ${this.state.currentStatusSource ?? 'none'}); ` +
|
|
61
|
+
`edit mode ${this.sentEditMode} (held by ${this.state.readonlyStatuses.join(', ') || 'none'})`);
|
|
62
|
+
}
|
|
63
|
+
return actions;
|
|
64
|
+
}
|
|
65
|
+
sessionDisposed(_clientSession) {
|
|
66
|
+
this.toDispose.dispose();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
__decorate([
|
|
70
|
+
inject(ModelState),
|
|
71
|
+
__metadata("design:type", Function)
|
|
72
|
+
], DefaultDiagramStatusReporter.prototype, "state", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
inject(ActionDispatcher),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], DefaultDiagramStatusReporter.prototype, "actionDispatcher", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
inject(ClientSessionManager),
|
|
79
|
+
__metadata("design:type", Object)
|
|
80
|
+
], DefaultDiagramStatusReporter.prototype, "sessionManager", void 0);
|
|
81
|
+
DefaultDiagramStatusReporter = __decorate([
|
|
82
|
+
injectable()
|
|
83
|
+
], DefaultDiagramStatusReporter);
|
|
84
|
+
export { DefaultDiagramStatusReporter };
|
|
85
|
+
function statusKey(entry) {
|
|
86
|
+
return entry?.message === undefined ? 'none' : `${entry.severity ?? 'INFO'} "${entry.message}"`;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=diagram-status-reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagram-status-reporter.js","sourceRoot":"","sources":["../../src/status/diagram-status-reporter.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAEJ,gBAAgB,EAIhB,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,YAAY,EACd,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAmB/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAG9D,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACC,KAAK,CAAgD;IAC/C,gBAAgB,CAAoB;IAChC,cAAc,CAAwB;IAEpE,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC1D,uEAAuE;IAC7D,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,YAAY,GAAW,QAAQ,CAAC,QAAQ,CAAC;IAEnD,UAAU;QACP,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,qBAAqB,CAAC,QAAkB;QACrC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;QAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;IACf,CAAC;IAES,IAAI;QACX,IAAI,CAAC,gBAAgB;aACjB,WAAW,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;aAClC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAChI,CAAC;IAED,4EAA4E;IAClE,cAAc;QACrB,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;QACzC,IAAI,SAAS,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YAC1C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;YACrC,OAAO,CAAC,IAAI,CACT,OAAO,EAAE,OAAO,KAAK,SAAS;gBAC3B,CAAC,CAAC,uEAAuE;oBACvE,kEAAkE;oBAClE,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;gBAC/C,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,MAAM,EAAE,CAAC,CACrF,CAAC;QACL,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CACpB,kBAAkB,IAAI,CAAC,UAAU,UAAU,IAAI,CAAC,KAAK,CAAC,mBAAmB,IAAI,MAAM,KAAK;gBACrF,aAAa,IAAI,CAAC,YAAY,aAAa,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,CACnG,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IAClB,CAAC;IAED,eAAe,CAAC,cAA6B;QAC1C,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACH,CAAA;AAvDyC;IAAtC,MAAM,CAAC,UAAU,CAAC;;2DAAyE;AAC/C;IAA5C,MAAM,CAAC,gBAAgB,CAAC;;sEAAwD;AAChC;IAAhD,MAAM,CAAC,oBAAoB,CAAC;;oEAA0D;AAH7E,4BAA4B;IADxC,UAAU,EAAE;GACA,4BAA4B,CAwDxC;;AAED,SAAS,SAAS,CAAC,KAAqC;IACrD,OAAO,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,MAAM,KAAK,KAAK,CAAC,OAAO,GAAG,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 ProgressMonitor, RequestModelActionHandler } from '@eclipse-glsp/server';
|
|
10
|
+
import { type AstNode } from '@hydranium/langium';
|
|
11
|
+
import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
|
|
12
|
+
/**
|
|
13
|
+
* Reports model loading as {@link DiagramStatus.MODEL_LOAD} rather than
|
|
14
|
+
* writing the client's status overlay directly, whose closing clear would
|
|
15
|
+
* erase a status set while the model loaded.
|
|
16
|
+
*
|
|
17
|
+
* The status is withdrawn on a failed load as well: GLSP rethrows from
|
|
18
|
+
* `handleModelLoadingError` before it reports the load finished, which would
|
|
19
|
+
* leave the loading message standing.
|
|
20
|
+
*/
|
|
21
|
+
export declare class HydraniumGlspRequestModelActionHandler extends RequestModelActionHandler {
|
|
22
|
+
protected modelState: AbstractHydraniumGlspState<AstNode, unknown>;
|
|
23
|
+
protected reportModelLoading(message: string): ProgressMonitor | undefined;
|
|
24
|
+
protected reportModelLoadingFinished(monitor?: ProgressMonitor): void;
|
|
25
|
+
protected handleModelLoadingError(error: unknown, monitor?: ProgressMonitor): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=hydranium-glsp-request-model-action-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-request-model-action-handler.d.ts","sourceRoot":"","sources":["../../src/status/hydranium-glsp-request-model-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAc,KAAK,eAAe,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAG5F;;;;;;;;GAQG;AACH,qBACa,sCAAuC,SAAQ,yBAAyB;IAClF,UAAsC,UAAU,EAAE,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE/F,UAAmB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAGlF;IAED,UAAmB,0BAA0B,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAG7E;IAED,UAAmB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,IAAI,CAG1F;CACH"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
17
|
+
};
|
|
18
|
+
import { ModelState, RequestModelActionHandler } from '@eclipse-glsp/server';
|
|
19
|
+
import { inject, injectable } from 'inversify';
|
|
20
|
+
import { DiagramStatus } from '../state/diagram-status.js';
|
|
21
|
+
/**
|
|
22
|
+
* Reports model loading as {@link DiagramStatus.MODEL_LOAD} rather than
|
|
23
|
+
* writing the client's status overlay directly, whose closing clear would
|
|
24
|
+
* erase a status set while the model loaded.
|
|
25
|
+
*
|
|
26
|
+
* The status is withdrawn on a failed load as well: GLSP rethrows from
|
|
27
|
+
* `handleModelLoadingError` before it reports the load finished, which would
|
|
28
|
+
* leave the loading message standing.
|
|
29
|
+
*/
|
|
30
|
+
let HydraniumGlspRequestModelActionHandler = class HydraniumGlspRequestModelActionHandler extends RequestModelActionHandler {
|
|
31
|
+
reportModelLoading(message) {
|
|
32
|
+
this.modelState.setStatus(DiagramStatus.MODEL_LOAD, { message, severity: 'INFO' });
|
|
33
|
+
return this.progressService.start(message);
|
|
34
|
+
}
|
|
35
|
+
reportModelLoadingFinished(monitor) {
|
|
36
|
+
this.modelState.setStatus(DiagramStatus.MODEL_LOAD, undefined);
|
|
37
|
+
monitor?.end();
|
|
38
|
+
}
|
|
39
|
+
handleModelLoadingError(error, monitor) {
|
|
40
|
+
this.modelState.setStatus(DiagramStatus.MODEL_LOAD, undefined);
|
|
41
|
+
super.handleModelLoadingError(error, monitor);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
__decorate([
|
|
45
|
+
inject(ModelState),
|
|
46
|
+
__metadata("design:type", Function)
|
|
47
|
+
], HydraniumGlspRequestModelActionHandler.prototype, "modelState", void 0);
|
|
48
|
+
HydraniumGlspRequestModelActionHandler = __decorate([
|
|
49
|
+
injectable()
|
|
50
|
+
], HydraniumGlspRequestModelActionHandler);
|
|
51
|
+
export { HydraniumGlspRequestModelActionHandler };
|
|
52
|
+
//# sourceMappingURL=hydranium-glsp-request-model-action-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-request-model-action-handler.js","sourceRoot":"","sources":["../../src/status/hydranium-glsp-request-model-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAAE,UAAU,EAAwB,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;;;;;;GAQG;AAEI,IAAM,sCAAsC,GAA5C,MAAM,sCAAuC,SAAQ,yBAAyB;IAG/D,kBAAkB,CAAC,OAAe;QAClD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAEkB,0BAA0B,CAAC,OAAyB;QACpE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC/D,OAAO,EAAE,GAAG,EAAE,CAAC;IAClB,CAAC;IAEkB,uBAAuB,CAAC,KAAc,EAAE,OAAyB;QACjF,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC/D,KAAK,CAAC,uBAAuB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACH,CAAA;AAhBwC;IAArC,MAAM,CAAC,UAAU,CAAC;;0EAA4E;AADrF,sCAAsC;IADlD,UAAU,EAAE;GACA,sCAAsC,CAiBlD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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, type SetEditModeAction, SetEditModeActionHandler } from '@eclipse-glsp/server';
|
|
10
|
+
import { type AstNode } from '@hydranium/langium';
|
|
11
|
+
import { type AbstractHydraniumGlspState } from '../state/abstract-hydranium-glsp-state.js';
|
|
12
|
+
import { DiagramStatusReporter } from './diagram-status-reporter.js';
|
|
13
|
+
/**
|
|
14
|
+
* Records a client's request for a read-only diagram as
|
|
15
|
+
* {@link DiagramStatus.CLIENT_REQUEST}, instead of assigning the edit mode
|
|
16
|
+
* over every other status that holds it.
|
|
17
|
+
*
|
|
18
|
+
* Only an action the client sent counts. GLSP also runs this handler for the
|
|
19
|
+
* edit mode the server itself sends, and recording that as a request would
|
|
20
|
+
* keep the diagram read-only after its own reason has gone.
|
|
21
|
+
*/
|
|
22
|
+
export declare class HydraniumGlspSetEditModeActionHandler extends SetEditModeActionHandler {
|
|
23
|
+
protected modelState: AbstractHydraniumGlspState<AstNode, unknown>;
|
|
24
|
+
protected readonly reporter: DiagramStatusReporter;
|
|
25
|
+
execute(action: SetEditModeAction): Promise<Action[]>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=hydranium-glsp-set-edit-mode-action-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-set-edit-mode-action-handler.d.ts","sourceRoot":"","sources":["../../src/status/hydranium-glsp-set-edit-mode-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,MAAM,EAAsC,KAAK,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACzI,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,KAAK,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAE5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;;;GAQG;AACH,qBACa,qCAAsC,SAAQ,wBAAwB;IAChF,UAAsC,UAAU,EAAE,0BAA0B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChE,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAG,qBAAqB,CAAC;IAEpE,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAMnE;CACH"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
17
|
+
};
|
|
18
|
+
import { ClientAction, EditMode, ModelState, SetEditModeActionHandler } from '@eclipse-glsp/server';
|
|
19
|
+
import { inject, injectable } from 'inversify';
|
|
20
|
+
import { DiagramStatus } from '../state/diagram-status.js';
|
|
21
|
+
import { DiagramStatusReporter } from './diagram-status-reporter.js';
|
|
22
|
+
/**
|
|
23
|
+
* Records a client's request for a read-only diagram as
|
|
24
|
+
* {@link DiagramStatus.CLIENT_REQUEST}, instead of assigning the edit mode
|
|
25
|
+
* over every other status that holds it.
|
|
26
|
+
*
|
|
27
|
+
* Only an action the client sent counts. GLSP also runs this handler for the
|
|
28
|
+
* edit mode the server itself sends, and recording that as a request would
|
|
29
|
+
* keep the diagram read-only after its own reason has gone.
|
|
30
|
+
*/
|
|
31
|
+
let HydraniumGlspSetEditModeActionHandler = class HydraniumGlspSetEditModeActionHandler extends SetEditModeActionHandler {
|
|
32
|
+
reporter;
|
|
33
|
+
async execute(action) {
|
|
34
|
+
if (ClientAction.is(action)) {
|
|
35
|
+
this.modelState.setStatus(DiagramStatus.CLIENT_REQUEST, action.editMode === EditMode.READONLY ? { readonly: true } : undefined);
|
|
36
|
+
this.reporter.clientEditModeChanged(action.editMode);
|
|
37
|
+
}
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
inject(ModelState),
|
|
43
|
+
__metadata("design:type", Function)
|
|
44
|
+
], HydraniumGlspSetEditModeActionHandler.prototype, "modelState", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
inject(DiagramStatusReporter),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], HydraniumGlspSetEditModeActionHandler.prototype, "reporter", void 0);
|
|
49
|
+
HydraniumGlspSetEditModeActionHandler = __decorate([
|
|
50
|
+
injectable()
|
|
51
|
+
], HydraniumGlspSetEditModeActionHandler);
|
|
52
|
+
export { HydraniumGlspSetEditModeActionHandler };
|
|
53
|
+
//# sourceMappingURL=hydranium-glsp-set-edit-mode-action-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-set-edit-mode-action-handler.js","sourceRoot":"","sources":["../../src/status/hydranium-glsp-set-edit-mode-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAAe,YAAY,EAAE,QAAQ,EAAE,UAAU,EAA0B,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEzI,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;;;GAQG;AAEI,IAAM,qCAAqC,GAA3C,MAAM,qCAAsC,SAAQ,wBAAwB;IAE9B,QAAQ,CAAyB;IAE1E,KAAK,CAAC,OAAO,CAAC,MAAyB;QAC7C,IAAI,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,EAAE,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAChI,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,EAAE,CAAC;IACb,CAAC;CACH,CAAA;AAVwC;IAArC,MAAM,CAAC,UAAU,CAAC;;yEAA4E;AAC7C;IAAjD,MAAM,CAAC,qBAAqB,CAAC;;uEAAqD;AAFzE,qCAAqC;IADjD,UAAU,EAAE;GACA,qCAAqC,CAWjD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export * from './diagram-status-reporter.js';
|
|
10
|
+
export * from './hydranium-glsp-request-model-action-handler.js';
|
|
11
|
+
export * from './hydranium-glsp-set-edit-mode-action-handler.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/status/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kDAAkD,CAAC;AACjE,cAAc,kDAAkD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
export * from './diagram-status-reporter.js';
|
|
10
|
+
export * from './hydranium-glsp-request-model-action-handler.js';
|
|
11
|
+
export * from './hydranium-glsp-set-edit-mode-action-handler.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/status/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kDAAkD,CAAC;AACjE,cAAc,kDAAkD,CAAC"}
|
|
@@ -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,CAIxD;CACH"}
|
|
@@ -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"}
|