@hydranium/glsp-server 1.0.0-next.317 → 1.0.0-next.319
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/command/hydranium-glsp-command-stack.d.ts +13 -2
- package/lib/command/hydranium-glsp-command-stack.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-command-stack.js +49 -2
- package/lib/command/hydranium-glsp-command-stack.js.map +1 -1
- package/lib/command/hydranium-glsp-operation-command.d.ts +21 -2
- package/lib/command/hydranium-glsp-operation-command.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-operation-command.js +29 -3
- package/lib/command/hydranium-glsp-operation-command.js.map +1 -1
- package/lib/command/hydranium-glsp-recording-command.d.ts +7 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-recording-command.js +12 -1
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -1
- package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts +58 -1
- package/lib/command/hydranium-glsp-undo-redo-action-handler.d.ts.map +1 -1
- package/lib/command/hydranium-glsp-undo-redo-action-handler.js +116 -1
- package/lib/command/hydranium-glsp-undo-redo-action-handler.js.map +1 -1
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts +11 -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 +22 -3
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js.map +1 -1
- package/lib/messages/index.d.ts +3 -0
- package/lib/messages/index.d.ts.map +1 -1
- package/lib/messages/index.js +3 -0
- package/lib/messages/index.js.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts +12 -1
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -1
- package/lib/state/abstract-hydranium-glsp-state.js +17 -1
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -1
- package/lib/status/diagram-status-reporter.d.ts +23 -3
- package/lib/status/diagram-status-reporter.d.ts.map +1 -1
- package/lib/status/diagram-status-reporter.js +28 -2
- package/lib/status/diagram-status-reporter.js.map +1 -1
- package/lib/submission/hydranium-glsp-submission-handler.d.ts +12 -1
- package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -1
- package/lib/submission/hydranium-glsp-submission-handler.js +30 -4
- package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -1
- package/package.json +7 -7
- package/src/command/hydranium-glsp-command-stack.ts +52 -2
- package/src/command/hydranium-glsp-operation-command.ts +42 -3
- package/src/command/hydranium-glsp-recording-command.ts +14 -1
- package/src/command/hydranium-glsp-undo-redo-action-handler.ts +146 -1
- package/src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts +21 -3
- package/src/messages/index.ts +12 -0
- package/src/state/abstract-hydranium-glsp-state.ts +19 -1
- package/src/status/diagram-status-reporter.ts +37 -4
- package/src/submission/hydranium-glsp-submission-handler.ts +26 -5
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
type Action,
|
|
12
|
+
ClientSessionManager,
|
|
12
13
|
type DirtyStateChangeReason,
|
|
13
14
|
type GModelRootSchema,
|
|
14
15
|
type LayoutOperation,
|
|
@@ -59,6 +60,7 @@ import { DiagramStatus } from '../state/diagram-status.js';
|
|
|
59
60
|
@injectable()
|
|
60
61
|
export class HydraniumGlspSubmissionHandler<TRoot extends AstNode, TSourceModel = string> extends ModelSubmissionHandler {
|
|
61
62
|
@inject(ModelState) declare protected modelState: AbstractHydraniumGlspState<TRoot, TSourceModel>;
|
|
63
|
+
@inject(ClientSessionManager) protected readonly sessionManager!: ClientSessionManager;
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
* Document-state gate awaited before {@link submitModel} delegates to
|
|
@@ -176,16 +178,26 @@ export class HydraniumGlspSubmissionHandler<TRoot extends AstNode, TSourceModel
|
|
|
176
178
|
* Never rejects: GLSP runs it from a debounce that drops the result, so a
|
|
177
179
|
* failure here would go unhandled. A validator that throws is logged as an
|
|
178
180
|
* error, markers that cannot be sent as a warning.
|
|
181
|
+
*
|
|
182
|
+
* GLSP does not cancel that debounce when the session ends, so it also runs
|
|
183
|
+
* for a diagram just closed: that run is skipped, and markers it could not
|
|
184
|
+
* send because the session ended meanwhile are logged for diagnosis only.
|
|
179
185
|
*/
|
|
180
186
|
protected override async performLiveValidation(validator: ModelValidator): Promise<void> {
|
|
187
|
+
if (this.sessionEnded()) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
181
190
|
this.modelState.setStatus(DiagramStatus.VALIDATION, { message: 'Validate Model...', severity: 'INFO' });
|
|
182
191
|
try {
|
|
183
192
|
const markers = await validator.validate([this.modelState.root], MarkersReason.LIVE);
|
|
184
|
-
await this.actionDispatcher
|
|
185
|
-
|
|
186
|
-
.
|
|
187
|
-
this.modelState.logger.
|
|
188
|
-
|
|
193
|
+
await this.actionDispatcher.dispatch(SetMarkersAction.create(markers, { reason: MarkersReason.LIVE })).catch((error: unknown) => {
|
|
194
|
+
const message = `Could not send the live-validation markers: ${describeErrorWithStack(error)}`;
|
|
195
|
+
if (this.sessionEnded()) {
|
|
196
|
+
this.modelState.logger.debug(message);
|
|
197
|
+
} else {
|
|
198
|
+
this.modelState.logger.warn(message);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
189
201
|
} catch (error: unknown) {
|
|
190
202
|
this.modelState.logger.error(`Live validation failed: ${describeErrorWithStack(error)}`);
|
|
191
203
|
} finally {
|
|
@@ -193,6 +205,15 @@ export class HydraniumGlspSubmissionHandler<TRoot extends AstNode, TSourceModel
|
|
|
193
205
|
}
|
|
194
206
|
}
|
|
195
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Whether the client session this handler serves has ended. By its
|
|
210
|
+
* dispatcher rather than its id: a client that reopens a diagram under the
|
|
211
|
+
* same id gets a new session, which this handler does not serve.
|
|
212
|
+
*/
|
|
213
|
+
protected sessionEnded(): boolean {
|
|
214
|
+
return this.sessionManager.getSession(this.modelState.clientId)?.actionDispatcher !== this.actionDispatcher;
|
|
215
|
+
}
|
|
216
|
+
|
|
196
217
|
/**
|
|
197
218
|
* Serialise the model-bearing actions of a submission into a comparable
|
|
198
219
|
* signature.
|