@hydranium/glsp-server 1.0.0-next.10
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/LICENSE +21 -0
- package/README.md +97 -0
- package/lib/browser/index.d.ts +10 -0
- package/lib/browser/index.d.ts.map +1 -0
- package/lib/browser/index.js +15 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/start-glsp-server-in-worker.d.ts +121 -0
- package/lib/browser/start-glsp-server-in-worker.d.ts.map +1 -0
- package/lib/browser/start-glsp-server-in-worker.js +102 -0
- package/lib/browser/start-glsp-server-in-worker.js.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts +132 -0
- package/lib/command/hydranium-glsp-recording-command.d.ts.map +1 -0
- package/lib/command/hydranium-glsp-recording-command.js +159 -0
- package/lib/command/hydranium-glsp-recording-command.js.map +1 -0
- package/lib/command/index.d.ts +10 -0
- package/lib/command/index.d.ts.map +1 -0
- package/lib/command/index.js +10 -0
- package/lib/command/index.js.map +1 -0
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts +61 -0
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.d.ts.map +1 -0
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js +93 -0
- package/lib/computed-bounds/hydranium-glsp-computed-bounds-action-handler.js.map +1 -0
- package/lib/computed-bounds/index.d.ts +10 -0
- package/lib/computed-bounds/index.d.ts.map +1 -0
- package/lib/computed-bounds/index.js +10 -0
- package/lib/computed-bounds/index.js.map +1 -0
- package/lib/dispatcher/index.d.ts +10 -0
- package/lib/dispatcher/index.d.ts.map +1 -0
- package/lib/dispatcher/index.js +10 -0
- package/lib/dispatcher/index.js.map +1 -0
- package/lib/dispatcher/server-action-dispatcher.d.ts +52 -0
- package/lib/dispatcher/server-action-dispatcher.d.ts.map +1 -0
- package/lib/dispatcher/server-action-dispatcher.js +79 -0
- package/lib/dispatcher/server-action-dispatcher.js.map +1 -0
- package/lib/index.d.ts +19 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -0
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts +75 -0
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.d.ts.map +1 -0
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js +100 -0
- package/lib/launcher/abstract-hydranium-glsp-diagram-module.js.map +1 -0
- package/lib/launcher/glsp-app-module.d.ts +87 -0
- package/lib/launcher/glsp-app-module.d.ts.map +1 -0
- package/lib/launcher/glsp-app-module.js +71 -0
- package/lib/launcher/glsp-app-module.js.map +1 -0
- package/lib/launcher/glsp-framework-overrides.d.ts +32 -0
- package/lib/launcher/glsp-framework-overrides.d.ts.map +1 -0
- package/lib/launcher/glsp-framework-overrides.js +49 -0
- package/lib/launcher/glsp-framework-overrides.js.map +1 -0
- package/lib/launcher/glsp-server-overrides.d.ts +39 -0
- package/lib/launcher/glsp-server-overrides.d.ts.map +1 -0
- package/lib/launcher/glsp-server-overrides.js +45 -0
- package/lib/launcher/glsp-server-overrides.js.map +1 -0
- package/lib/launcher/hydranium-glsp-server.d.ts +62 -0
- package/lib/launcher/hydranium-glsp-server.d.ts.map +1 -0
- package/lib/launcher/hydranium-glsp-server.js +101 -0
- package/lib/launcher/hydranium-glsp-server.js.map +1 -0
- package/lib/launcher/index.d.ts +12 -0
- package/lib/launcher/index.d.ts.map +1 -0
- package/lib/launcher/index.js +22 -0
- package/lib/launcher/index.js.map +1 -0
- package/lib/logging/glsp-client-logger.d.ts +110 -0
- package/lib/logging/glsp-client-logger.d.ts.map +1 -0
- package/lib/logging/glsp-client-logger.js +151 -0
- package/lib/logging/glsp-client-logger.js.map +1 -0
- package/lib/logging/index.d.ts +10 -0
- package/lib/logging/index.d.ts.map +1 -0
- package/lib/logging/index.js +10 -0
- package/lib/logging/index.js.map +1 -0
- package/lib/node/index.d.ts +10 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +13 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/start-glsp-server.d.ts +122 -0
- package/lib/node/start-glsp-server.d.ts.map +1 -0
- package/lib/node/start-glsp-server.js +103 -0
- package/lib/node/start-glsp-server.js.map +1 -0
- package/lib/state/abstract-hydranium-glsp-state.d.ts +333 -0
- package/lib/state/abstract-hydranium-glsp-state.d.ts.map +1 -0
- package/lib/state/abstract-hydranium-glsp-state.js +451 -0
- package/lib/state/abstract-hydranium-glsp-state.js.map +1 -0
- package/lib/state/full-text-hydranium-glsp-state.d.ts +43 -0
- package/lib/state/full-text-hydranium-glsp-state.d.ts.map +1 -0
- package/lib/state/full-text-hydranium-glsp-state.js +60 -0
- package/lib/state/full-text-hydranium-glsp-state.js.map +1 -0
- package/lib/state/hydranium-glsp-index.d.ts +220 -0
- package/lib/state/hydranium-glsp-index.d.ts.map +1 -0
- package/lib/state/hydranium-glsp-index.js +320 -0
- package/lib/state/hydranium-glsp-index.js.map +1 -0
- package/lib/state/hydranium-shared-core-services.d.ts +90 -0
- package/lib/state/hydranium-shared-core-services.d.ts.map +1 -0
- package/lib/state/hydranium-shared-core-services.js +89 -0
- package/lib/state/hydranium-shared-core-services.js.map +1 -0
- package/lib/state/index.d.ts +17 -0
- package/lib/state/index.d.ts.map +1 -0
- package/lib/state/index.js +17 -0
- package/lib/state/index.js.map +1 -0
- package/lib/state/model-ready-timeout-error.d.ts +28 -0
- package/lib/state/model-ready-timeout-error.d.ts.map +1 -0
- package/lib/state/model-ready-timeout-error.js +36 -0
- package/lib/state/model-ready-timeout-error.js.map +1 -0
- package/lib/state/reconcile-source-model-write.d.ts +43 -0
- package/lib/state/reconcile-source-model-write.d.ts.map +1 -0
- package/lib/state/reconcile-source-model-write.js +47 -0
- package/lib/state/reconcile-source-model-write.js.map +1 -0
- package/lib/state/reconciling-multi-document-glsp-state.d.ts +164 -0
- package/lib/state/reconciling-multi-document-glsp-state.d.ts.map +1 -0
- package/lib/state/reconciling-multi-document-glsp-state.js +222 -0
- package/lib/state/reconciling-multi-document-glsp-state.js.map +1 -0
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts +91 -0
- package/lib/state/reconciling-transfer-hydranium-glsp-state.d.ts.map +1 -0
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js +129 -0
- package/lib/state/reconciling-transfer-hydranium-glsp-state.js.map +1 -0
- package/lib/storage/hydranium-glsp-storage.d.ts +348 -0
- package/lib/storage/hydranium-glsp-storage.d.ts.map +1 -0
- package/lib/storage/hydranium-glsp-storage.js +634 -0
- package/lib/storage/hydranium-glsp-storage.js.map +1 -0
- package/lib/storage/index.d.ts +11 -0
- package/lib/storage/index.d.ts.map +1 -0
- package/lib/storage/index.js +11 -0
- package/lib/storage/index.js.map +1 -0
- package/lib/storage/save-conflict-policy.d.ts +56 -0
- package/lib/storage/save-conflict-policy.d.ts.map +1 -0
- package/lib/storage/save-conflict-policy.js +19 -0
- package/lib/storage/save-conflict-policy.js.map +1 -0
- package/lib/submission/hydranium-glsp-submission-handler.d.ts +109 -0
- package/lib/submission/hydranium-glsp-submission-handler.d.ts.map +1 -0
- package/lib/submission/hydranium-glsp-submission-handler.js +157 -0
- package/lib/submission/hydranium-glsp-submission-handler.js.map +1 -0
- package/lib/submission/index.d.ts +10 -0
- package/lib/submission/index.d.ts.map +1 -0
- package/lib/submission/index.js +10 -0
- package/lib/submission/index.js.map +1 -0
- package/lib/testing/glsp-harness.d.ts +170 -0
- package/lib/testing/glsp-harness.d.ts.map +1 -0
- package/lib/testing/glsp-harness.js +231 -0
- package/lib/testing/glsp-harness.js.map +1 -0
- package/lib/testing/index.d.ts +11 -0
- package/lib/testing/index.d.ts.map +1 -0
- package/lib/testing/index.js +13 -0
- package/lib/testing/index.js.map +1 -0
- package/lib/testing/make-noop-glsp-logger.d.ts +42 -0
- package/lib/testing/make-noop-glsp-logger.d.ts.map +1 -0
- package/lib/testing/make-noop-glsp-logger.js +47 -0
- package/lib/testing/make-noop-glsp-logger.js.map +1 -0
- package/lib/util/index.d.ts +10 -0
- package/lib/util/index.d.ts.map +1 -0
- package/lib/util/index.js +10 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/service-identifier.d.ts +46 -0
- package/lib/util/service-identifier.d.ts.map +1 -0
- package/lib/util/service-identifier.js +47 -0
- package/lib/util/service-identifier.js.map +1 -0
- package/lib/validation/diagnostic-markers.d.ts +48 -0
- package/lib/validation/diagnostic-markers.d.ts.map +1 -0
- package/lib/validation/diagnostic-markers.js +68 -0
- package/lib/validation/diagnostic-markers.js.map +1 -0
- package/lib/validation/hydranium-glsp-model-validator.d.ts +51 -0
- package/lib/validation/hydranium-glsp-model-validator.d.ts.map +1 -0
- package/lib/validation/hydranium-glsp-model-validator.js +118 -0
- package/lib/validation/hydranium-glsp-model-validator.js.map +1 -0
- package/lib/validation/index.d.ts +11 -0
- package/lib/validation/index.d.ts.map +1 -0
- package/lib/validation/index.js +11 -0
- package/lib/validation/index.js.map +1 -0
- package/package.json +111 -0
- package/src/browser/index.ts +15 -0
- package/src/browser/start-glsp-server-in-worker.ts +202 -0
- package/src/command/hydranium-glsp-recording-command.ts +183 -0
- package/src/command/index.ts +10 -0
- package/src/computed-bounds/hydranium-glsp-computed-bounds-action-handler.ts +103 -0
- package/src/computed-bounds/index.ts +10 -0
- package/src/dispatcher/index.ts +10 -0
- package/src/dispatcher/server-action-dispatcher.ts +72 -0
- package/src/index.ts +20 -0
- package/src/launcher/abstract-hydranium-glsp-diagram-module.ts +117 -0
- package/src/launcher/glsp-app-module.ts +106 -0
- package/src/launcher/glsp-framework-overrides.ts +51 -0
- package/src/launcher/glsp-server-overrides.ts +46 -0
- package/src/launcher/hydranium-glsp-server.ts +104 -0
- package/src/launcher/index.ts +22 -0
- package/src/logging/glsp-client-logger.ts +184 -0
- package/src/logging/index.ts +10 -0
- package/src/node/index.ts +13 -0
- package/src/node/start-glsp-server.ts +214 -0
- package/src/state/abstract-hydranium-glsp-state.ts +503 -0
- package/src/state/full-text-hydranium-glsp-state.ts +63 -0
- package/src/state/hydranium-glsp-index.ts +337 -0
- package/src/state/hydranium-shared-core-services.ts +92 -0
- package/src/state/index.ts +17 -0
- package/src/state/model-ready-timeout-error.ts +33 -0
- package/src/state/reconcile-source-model-write.ts +77 -0
- package/src/state/reconciling-multi-document-glsp-state.ts +248 -0
- package/src/state/reconciling-transfer-hydranium-glsp-state.ts +132 -0
- package/src/storage/hydranium-glsp-storage.ts +660 -0
- package/src/storage/index.ts +11 -0
- package/src/storage/save-conflict-policy.ts +52 -0
- package/src/submission/hydranium-glsp-submission-handler.ts +170 -0
- package/src/submission/index.ts +10 -0
- package/src/testing/glsp-harness.ts +422 -0
- package/src/testing/index.ts +14 -0
- package/src/testing/make-noop-glsp-logger.ts +66 -0
- package/src/util/index.ts +10 -0
- package/src/util/service-identifier.ts +49 -0
- package/src/validation/diagnostic-markers.ts +93 -0
- package/src/validation/hydranium-glsp-model-validator.ts +105 -0
- package/src/validation/index.ts +11 -0
|
@@ -0,0 +1,75 @@
|
|
|
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 { DiagramModule } from '@eclipse-glsp/server';
|
|
10
|
+
import { type interfaces } from 'inversify';
|
|
11
|
+
import type { LanguageMetaData } from '@hydranium/langium';
|
|
12
|
+
/**
|
|
13
|
+
* Bind {@link HydraniumTypes}.DiagramLanguage on a GLSP **session** container
|
|
14
|
+
* to the services of `metadata`'s grammar.
|
|
15
|
+
*
|
|
16
|
+
* Exported separately from {@link AbstractHydraniumGlspDiagramModule} for adopters
|
|
17
|
+
* whose diagram module already extends an intermediate base of their own and
|
|
18
|
+
* cannot take the framework base class; call it from `configure` after
|
|
19
|
+
* `super.configure(...)`. The base class is the preferred entry point because
|
|
20
|
+
* it makes the declaration non-optional.
|
|
21
|
+
*
|
|
22
|
+
* **Why the session tier.** GLSP builds its app container once per process,
|
|
23
|
+
* before any document exists, so a per-language service bound there can only
|
|
24
|
+
* ever be one grammar's. The session container is created per open diagram
|
|
25
|
+
* with its `diagramType` known, and a diagram type has exactly one grammar —
|
|
26
|
+
* so the language is a static fact about the module, resolvable with no URI
|
|
27
|
+
* and no ordering hazard. That last part is load-bearing: GLSP's
|
|
28
|
+
* `OperationHandlerRegistryInitializer` constructs every operation handler at
|
|
29
|
+
* `InitializeClientSession`, i.e. BEFORE `RequestModelAction` supplies the
|
|
30
|
+
* source URI, so anything derived from `ModelState.sourceUri` at injection
|
|
31
|
+
* time would throw on every diagram open.
|
|
32
|
+
*
|
|
33
|
+
* **The whole language, not pre-resolved providers.** There is deliberately no
|
|
34
|
+
* token for an individual per-language provider; see {@link HydraniumTypes} for
|
|
35
|
+
* why. Callers reach `modelState.diagramLanguage` or
|
|
36
|
+
* `modelState.languageServicesFor(node)` instead, which name the choice.
|
|
37
|
+
*
|
|
38
|
+
* Resolution is `toDynamicValue` + `inSingletonScope` — deferred so the parent
|
|
39
|
+
* container's `SharedCoreServices` is available, then resolved once per
|
|
40
|
+
* session rather than per injection.
|
|
41
|
+
*/
|
|
42
|
+
export declare function bindDiagramLanguage(bind: interfaces.Bind, metadata: LanguageMetaData): void;
|
|
43
|
+
/**
|
|
44
|
+
* GLSP {@link DiagramModule} base that declares which grammar its diagram type
|
|
45
|
+
* edits, and binds that language's per-language services on the session
|
|
46
|
+
* container.
|
|
47
|
+
*
|
|
48
|
+
* Subclass instead of `DiagramModule` and implement {@link declareLanguage}
|
|
49
|
+
* alongside `diagramType`; the two are the same kind of fact about a diagram
|
|
50
|
+
* type, and pairing them is what lets one GLSP head serve N grammars.
|
|
51
|
+
*
|
|
52
|
+
* Adopter GLSP components then read the language they mean:
|
|
53
|
+
* `modelState.diagramLanguage.references.CandidateProvider` for a reference
|
|
54
|
+
* written on the canvas, `modelState.languageServicesFor(node).references.X`
|
|
55
|
+
* for anything reached through a reference. No per-language service is bound
|
|
56
|
+
* to a token of its own — see {@link bindDiagramLanguage} for why.
|
|
57
|
+
*/
|
|
58
|
+
export declare abstract class AbstractHydraniumGlspDiagramModule extends DiagramModule {
|
|
59
|
+
/**
|
|
60
|
+
* The `LanguageMetaData` of the grammar this diagram type edits — pass the
|
|
61
|
+
* generated `<Grammar>LanguageMetaData` constant directly.
|
|
62
|
+
*
|
|
63
|
+
* Abstract rather than optional so a new diagram module cannot silently
|
|
64
|
+
* omit it: a missing declaration is a compile error here, where the fix is
|
|
65
|
+
* obvious, instead of an unbound-token failure at the first diagram open.
|
|
66
|
+
*
|
|
67
|
+
* NOT named `bindLanguage`: every `bindX()` on GLSP's `DiagramModule`
|
|
68
|
+
* returns a `BindingTarget<T>` that GLSP's own `configure` consumes, and a
|
|
69
|
+
* method in that family returning a `LanguageMetaData` invites
|
|
70
|
+
* `{ service: … }`. This one states a fact; the framework does the binding.
|
|
71
|
+
*/
|
|
72
|
+
protected abstract declareLanguage(): LanguageMetaData;
|
|
73
|
+
protected configure(bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind): void;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=abstract-hydranium-glsp-diagram-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-hydranium-glsp-diagram-module.d.ts","sourceRoot":"","sources":["../../src/launcher/abstract-hydranium-glsp-diagram-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAI3F;AA0BD;;;;;;;;;;;;;;GAcG;AACH,8BACsB,kCAAmC,SAAQ,aAAa;IAC3E;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,gBAAgB;cAEnC,SAAS,CACzB,IAAI,EAAE,UAAU,CAAC,IAAI,EACrB,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,OAAO,EAAE,UAAU,CAAC,OAAO,EAC3B,MAAM,EAAE,UAAU,CAAC,MAAM,GACzB,IAAI;CAIT"}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 { DiagramModule } from '@eclipse-glsp/server';
|
|
16
|
+
import { injectable } from 'inversify';
|
|
17
|
+
import { typedMetadata } from '@hydranium/core';
|
|
18
|
+
import { HydraniumTypes } from '../state/hydranium-shared-core-services.js';
|
|
19
|
+
/**
|
|
20
|
+
* Bind {@link HydraniumTypes}.DiagramLanguage on a GLSP **session** container
|
|
21
|
+
* to the services of `metadata`'s grammar.
|
|
22
|
+
*
|
|
23
|
+
* Exported separately from {@link AbstractHydraniumGlspDiagramModule} for adopters
|
|
24
|
+
* whose diagram module already extends an intermediate base of their own and
|
|
25
|
+
* cannot take the framework base class; call it from `configure` after
|
|
26
|
+
* `super.configure(...)`. The base class is the preferred entry point because
|
|
27
|
+
* it makes the declaration non-optional.
|
|
28
|
+
*
|
|
29
|
+
* **Why the session tier.** GLSP builds its app container once per process,
|
|
30
|
+
* before any document exists, so a per-language service bound there can only
|
|
31
|
+
* ever be one grammar's. The session container is created per open diagram
|
|
32
|
+
* with its `diagramType` known, and a diagram type has exactly one grammar —
|
|
33
|
+
* so the language is a static fact about the module, resolvable with no URI
|
|
34
|
+
* and no ordering hazard. That last part is load-bearing: GLSP's
|
|
35
|
+
* `OperationHandlerRegistryInitializer` constructs every operation handler at
|
|
36
|
+
* `InitializeClientSession`, i.e. BEFORE `RequestModelAction` supplies the
|
|
37
|
+
* source URI, so anything derived from `ModelState.sourceUri` at injection
|
|
38
|
+
* time would throw on every diagram open.
|
|
39
|
+
*
|
|
40
|
+
* **The whole language, not pre-resolved providers.** There is deliberately no
|
|
41
|
+
* token for an individual per-language provider; see {@link HydraniumTypes} for
|
|
42
|
+
* why. Callers reach `modelState.diagramLanguage` or
|
|
43
|
+
* `modelState.languageServicesFor(node)` instead, which name the choice.
|
|
44
|
+
*
|
|
45
|
+
* Resolution is `toDynamicValue` + `inSingletonScope` — deferred so the parent
|
|
46
|
+
* container's `SharedCoreServices` is available, then resolved once per
|
|
47
|
+
* session rather than per injection.
|
|
48
|
+
*/
|
|
49
|
+
export function bindDiagramLanguage(bind, metadata) {
|
|
50
|
+
bind(HydraniumTypes.DiagramLanguage)
|
|
51
|
+
.toDynamicValue(context => resolveDiagramLanguage(context.container, metadata))
|
|
52
|
+
.inSingletonScope();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The registered services for `metadata`'s language, or a throw naming both
|
|
56
|
+
* the declared id and the registered ones.
|
|
57
|
+
*
|
|
58
|
+
* Failing loudly is the point: the declared language is the one fact this
|
|
59
|
+
* module states that the grammar does not, so it can drift. An unregistered id
|
|
60
|
+
* means the adopter declared a language they never registered — a wiring
|
|
61
|
+
* mistake whose silent form (falling back to some other grammar's providers)
|
|
62
|
+
* would surface much later as references that resolve against the wrong scope.
|
|
63
|
+
*/
|
|
64
|
+
function resolveDiagramLanguage(container, metadata) {
|
|
65
|
+
const registry = container.get(HydraniumTypes.SharedCoreServices).ServiceRegistry;
|
|
66
|
+
const language = registry.getServices(typedMetadata(metadata));
|
|
67
|
+
if (!language) {
|
|
68
|
+
const registered = registry.all.map(candidate => candidate.LanguageMetaData.languageId);
|
|
69
|
+
throw new Error(`Diagram module declares language '${metadata.languageId}', which is not registered on the ServiceRegistry. ` +
|
|
70
|
+
`Registered languages: ${registered.length > 0 ? registered.join(', ') : '(none)'}. ` +
|
|
71
|
+
'Declare the languageId of a grammar passed to bootstrapLangiumLanguages.');
|
|
72
|
+
}
|
|
73
|
+
return language;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* GLSP {@link DiagramModule} base that declares which grammar its diagram type
|
|
77
|
+
* edits, and binds that language's per-language services on the session
|
|
78
|
+
* container.
|
|
79
|
+
*
|
|
80
|
+
* Subclass instead of `DiagramModule` and implement {@link declareLanguage}
|
|
81
|
+
* alongside `diagramType`; the two are the same kind of fact about a diagram
|
|
82
|
+
* type, and pairing them is what lets one GLSP head serve N grammars.
|
|
83
|
+
*
|
|
84
|
+
* Adopter GLSP components then read the language they mean:
|
|
85
|
+
* `modelState.diagramLanguage.references.CandidateProvider` for a reference
|
|
86
|
+
* written on the canvas, `modelState.languageServicesFor(node).references.X`
|
|
87
|
+
* for anything reached through a reference. No per-language service is bound
|
|
88
|
+
* to a token of its own — see {@link bindDiagramLanguage} for why.
|
|
89
|
+
*/
|
|
90
|
+
let AbstractHydraniumGlspDiagramModule = class AbstractHydraniumGlspDiagramModule extends DiagramModule {
|
|
91
|
+
configure(bind, unbind, isBound, rebind) {
|
|
92
|
+
super.configure(bind, unbind, isBound, rebind);
|
|
93
|
+
bindDiagramLanguage(bind, this.declareLanguage());
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
AbstractHydraniumGlspDiagramModule = __decorate([
|
|
97
|
+
injectable()
|
|
98
|
+
], AbstractHydraniumGlspDiagramModule);
|
|
99
|
+
export { AbstractHydraniumGlspDiagramModule };
|
|
100
|
+
//# sourceMappingURL=abstract-hydranium-glsp-diagram-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-hydranium-glsp-diagram-module.js","sourceRoot":"","sources":["../../src/launcher/abstract-hydranium-glsp-diagram-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAmB,MAAM,WAAW,CAAC;AAExD,OAAO,EAA0D,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAqB,EAAE,QAA0B;IAClF,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC;SAChC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;SAC9E,gBAAgB,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,sBAAsB,CAAC,SAA+B,EAAE,QAA0B;IACxF,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAuB,cAAc,CAAC,kBAAkB,CAAC,CAAC,eAAe,CAAC;IACxG,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAyB,QAAQ,CAAC,CAAC,CAAC;IACvF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACb,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QACxF,MAAM,IAAI,KAAK,CACZ,qCAAqC,QAAQ,CAAC,UAAU,qDAAqD;YAC1G,yBAAyB,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI;YACrF,0EAA0E,CAC/E,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AAEI,IAAe,kCAAkC,GAAjD,MAAe,kCAAmC,SAAQ,aAAa;IAgBxD,SAAS,CACzB,IAAqB,EACrB,MAAyB,EACzB,OAA2B,EAC3B,MAAyB;QAEzB,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC/C,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IACrD,CAAC;CACH,CAAA;AAzBqB,kCAAkC;IADvD,UAAU,EAAE;GACS,kCAAkC,CAyBvD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { GLSPModule } from '@eclipse-glsp/server';
|
|
10
|
+
import type { BindingContext } from '@eclipse-glsp/protocol/lib/di/inversify-util.js';
|
|
11
|
+
import type { ServerSharedServices } from '@hydranium/core';
|
|
12
|
+
import { type ConflictResolver } from '@hydranium/protocol';
|
|
13
|
+
import { type interfaces } from 'inversify';
|
|
14
|
+
/**
|
|
15
|
+
* Configuration accepted by {@link HydraniumGlspAppModule}. Bundles the
|
|
16
|
+
* framework-defined Inversify bindings every adopter wires verbatim in their
|
|
17
|
+
* GLSP server app-module (the `appModules` argument to `startGlspServer`).
|
|
18
|
+
*
|
|
19
|
+
* **App tier only, so nothing per-language belongs here.** This module is
|
|
20
|
+
* loaded into the one-per-process app container, built before any document
|
|
21
|
+
* exists — it cannot know which grammar a request concerns. Per-language
|
|
22
|
+
* services are declared per diagram type instead; see
|
|
23
|
+
* `AbstractHydraniumGlspDiagramModule`.
|
|
24
|
+
*/
|
|
25
|
+
export interface HydraniumGlspAppModuleOptions<TShared extends ServerSharedServices = ServerSharedServices> {
|
|
26
|
+
/**
|
|
27
|
+
* The framework's Langium-style shared services tree. Bound to the
|
|
28
|
+
* `HydraniumTypes.SharedCoreServices` symbol that framework state /
|
|
29
|
+
* index classes (`AbstractHydraniumGlspState`, `HydraniumGlspIndex`) `@inject`.
|
|
30
|
+
*
|
|
31
|
+
* Generic over `TShared` so adopters with their own narrower
|
|
32
|
+
* shared-services type (an adopter-specific type extending
|
|
33
|
+
* `ServerSharedServices` with extra slots) preserve that
|
|
34
|
+
* type at `this.options.shared` inside subclass methods without an
|
|
35
|
+
* explicit cast. The Inversify symbol binding still types `@inject`
|
|
36
|
+
* sites as the wider `ServerSharedServices`; specialise the binding
|
|
37
|
+
* with an adopter-specific symbol where injected components want the
|
|
38
|
+
* narrower view.
|
|
39
|
+
*/
|
|
40
|
+
readonly shared: TShared;
|
|
41
|
+
/**
|
|
42
|
+
* Optional {@link ConflictResolver} policy bound to the
|
|
43
|
+
* `HydraniumTypes.ConflictResolver` symbol that `AbstractHydraniumGlspState`
|
|
44
|
+
* injects. Omit to get the framework default
|
|
45
|
+
* ({@link ReconcilingConflictResolver} — field-level three-way merge);
|
|
46
|
+
* pass a `ForceConflictResolver` for
|
|
47
|
+
* last-writer-wins, or a custom resolver. Applies uniformly to every
|
|
48
|
+
* conflict site (forward-write, undo, redo, save).
|
|
49
|
+
*/
|
|
50
|
+
readonly conflictResolver?: ConflictResolver;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* DI module that provides the framework-level Inversify bindings every
|
|
54
|
+
* `@hydranium/glsp-server` adopter needs. Pass instances (or instances of
|
|
55
|
+
* subclasses with additional bindings) into `startGlspServer`'s
|
|
56
|
+
* `appModules` array.
|
|
57
|
+
*
|
|
58
|
+
* Bindings provided:
|
|
59
|
+
* - `HydraniumTypes.SharedCoreServices` (constant value)
|
|
60
|
+
* - `HydraniumTypes.ConflictResolver` (constant value — `options.conflictResolver` or a default {@link ReconcilingConflictResolver})
|
|
61
|
+
*
|
|
62
|
+
* Both are language-independent, which is what makes them app-tier. The
|
|
63
|
+
* per-language providers (`ScopeProvider`, `CandidateProvider`) are bound one
|
|
64
|
+
* tier down by `AbstractHydraniumGlspDiagramModule`, from the grammar each
|
|
65
|
+
* diagram type declares.
|
|
66
|
+
*
|
|
67
|
+
* Concrete and usable as-is: adopters that need no extra bindings
|
|
68
|
+
* instantiate {@link HydraniumGlspAppModule} directly. Adopters that do
|
|
69
|
+
* subclass it and override {@link configureAdditionalBindings} to add their
|
|
70
|
+
* own service-identifier carriers.
|
|
71
|
+
*
|
|
72
|
+
* A conventional GLSP module (cf. `@eclipse-glsp/server`'s `GLSPModule`
|
|
73
|
+
* subclasses); the empty `configureAdditionalBindings` hook is the single
|
|
74
|
+
* extension point, so no separate abstract base is needed.
|
|
75
|
+
*/
|
|
76
|
+
export declare class HydraniumGlspAppModule<TShared extends ServerSharedServices = ServerSharedServices> extends GLSPModule {
|
|
77
|
+
protected readonly options: HydraniumGlspAppModuleOptions<TShared>;
|
|
78
|
+
constructor(options: HydraniumGlspAppModuleOptions<TShared>);
|
|
79
|
+
protected configure(bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind): void;
|
|
80
|
+
/**
|
|
81
|
+
* Extension point for adopter-specific bindings (service-identifier
|
|
82
|
+
* carriers for the adopter's own language services).
|
|
83
|
+
* Default implementation is empty.
|
|
84
|
+
*/
|
|
85
|
+
protected configureAdditionalBindings(_context: BindingContext): void;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=glsp-app-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-app-module.d.ts","sourceRoot":"","sources":["../../src/launcher/glsp-app-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,KAAK,gBAAgB,EAA+B,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAGxD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,6BAA6B,CAAC,OAAO,SAAS,oBAAoB,GAAG,oBAAoB;IACvG;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IAEzB;;;;;;;;OAQG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBACa,sBAAsB,CAAC,OAAO,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,SAAQ,UAAU;IACpG,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,6BAA6B,CAAC,OAAO,CAAC;gBAA/C,OAAO,EAAE,6BAA6B,CAAC,OAAO,CAAC;cAI3D,SAAS,CACzB,IAAI,EAAE,UAAU,CAAC,IAAI,EACrB,MAAM,EAAE,UAAU,CAAC,MAAM,EACzB,OAAO,EAAE,UAAU,CAAC,OAAO,EAC3B,MAAM,EAAE,UAAU,CAAC,MAAM,GACzB,IAAI;IAMP;;;;OAIG;IACH,SAAS,CAAC,2BAA2B,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;CAGvE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 { GLSPModule } from '@eclipse-glsp/server';
|
|
19
|
+
import { ReconcilingConflictResolver } from '@hydranium/protocol';
|
|
20
|
+
import { injectable } from 'inversify';
|
|
21
|
+
import { HydraniumTypes } from '../state/hydranium-shared-core-services.js';
|
|
22
|
+
/**
|
|
23
|
+
* DI module that provides the framework-level Inversify bindings every
|
|
24
|
+
* `@hydranium/glsp-server` adopter needs. Pass instances (or instances of
|
|
25
|
+
* subclasses with additional bindings) into `startGlspServer`'s
|
|
26
|
+
* `appModules` array.
|
|
27
|
+
*
|
|
28
|
+
* Bindings provided:
|
|
29
|
+
* - `HydraniumTypes.SharedCoreServices` (constant value)
|
|
30
|
+
* - `HydraniumTypes.ConflictResolver` (constant value — `options.conflictResolver` or a default {@link ReconcilingConflictResolver})
|
|
31
|
+
*
|
|
32
|
+
* Both are language-independent, which is what makes them app-tier. The
|
|
33
|
+
* per-language providers (`ScopeProvider`, `CandidateProvider`) are bound one
|
|
34
|
+
* tier down by `AbstractHydraniumGlspDiagramModule`, from the grammar each
|
|
35
|
+
* diagram type declares.
|
|
36
|
+
*
|
|
37
|
+
* Concrete and usable as-is: adopters that need no extra bindings
|
|
38
|
+
* instantiate {@link HydraniumGlspAppModule} directly. Adopters that do
|
|
39
|
+
* subclass it and override {@link configureAdditionalBindings} to add their
|
|
40
|
+
* own service-identifier carriers.
|
|
41
|
+
*
|
|
42
|
+
* A conventional GLSP module (cf. `@eclipse-glsp/server`'s `GLSPModule`
|
|
43
|
+
* subclasses); the empty `configureAdditionalBindings` hook is the single
|
|
44
|
+
* extension point, so no separate abstract base is needed.
|
|
45
|
+
*/
|
|
46
|
+
let HydraniumGlspAppModule = class HydraniumGlspAppModule extends GLSPModule {
|
|
47
|
+
options;
|
|
48
|
+
constructor(options) {
|
|
49
|
+
super();
|
|
50
|
+
this.options = options;
|
|
51
|
+
}
|
|
52
|
+
configure(bind, unbind, isBound, rebind) {
|
|
53
|
+
bind(HydraniumTypes.SharedCoreServices).toConstantValue(this.options.shared);
|
|
54
|
+
bind(HydraniumTypes.ConflictResolver).toConstantValue(this.options.conflictResolver ?? new ReconcilingConflictResolver());
|
|
55
|
+
this.configureAdditionalBindings({ bind, unbind, isBound, rebind });
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Extension point for adopter-specific bindings (service-identifier
|
|
59
|
+
* carriers for the adopter's own language services).
|
|
60
|
+
* Default implementation is empty.
|
|
61
|
+
*/
|
|
62
|
+
configureAdditionalBindings(_context) {
|
|
63
|
+
// empty by default
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
HydraniumGlspAppModule = __decorate([
|
|
67
|
+
injectable(),
|
|
68
|
+
__metadata("design:paramtypes", [Object])
|
|
69
|
+
], HydraniumGlspAppModule);
|
|
70
|
+
export { HydraniumGlspAppModule };
|
|
71
|
+
//# sourceMappingURL=glsp-app-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-app-module.js","sourceRoot":"","sources":["../../src/launcher/glsp-app-module.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;;;;;;;;;;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EAAyB,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,UAAU,EAAmB,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AA0C5E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAoF,SAAQ,UAAU;IACjF;IAA/B,YAA+B,OAA+C;QAC3E,KAAK,EAAE,CAAC;QADoB,YAAO,GAAP,OAAO,CAAwC;IAE9E,CAAC;IAEkB,SAAS,CACzB,IAAqB,EACrB,MAAyB,EACzB,OAA2B,EAC3B,MAAyB;QAEzB,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7E,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,IAAI,2BAA2B,EAAE,CAAC,CAAC;QAC1H,IAAI,CAAC,2BAA2B,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACO,2BAA2B,CAAC,QAAwB;QAC3D,mBAAmB;IACtB,CAAC;CACH,CAAA;AAxBY,sBAAsB;IADlC,UAAU,EAAE;;GACA,sBAAsB,CAwBlC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { Logger as GlspLogger } from '@eclipse-glsp/server';
|
|
10
|
+
import { ContainerModule } from 'inversify';
|
|
11
|
+
/**
|
|
12
|
+
* The framework bindings layered on top of GLSP's own app module, shared by
|
|
13
|
+
* every bringup regardless of transport.
|
|
14
|
+
*
|
|
15
|
+
* Two things happen here. GLSP's `Logger` / `LoggerFactory` are replaced with
|
|
16
|
+
* the adopter's — unbind-then-bind, the same pattern `createAppModule` uses
|
|
17
|
+
* internally — so GLSP server logs leave through the adopter's sink rather than
|
|
18
|
+
* a console the host may not own. And `HydraniumTypes.Tracer` is added,
|
|
19
|
+
* caller-tagged the same way the logger is, so an injected tracer's timing lines
|
|
20
|
+
* carry the requesting class's component without every call site naming itself.
|
|
21
|
+
*
|
|
22
|
+
* **Shared rather than written once per launcher, because the two would drift
|
|
23
|
+
* silently.** A transport-specific copy that fell behind would still bind
|
|
24
|
+
* something for each symbol, so nothing would fail — the head would merely log
|
|
25
|
+
* or trace differently depending on how it was started, which no test asks
|
|
26
|
+
* about.
|
|
27
|
+
*
|
|
28
|
+
* `createLogger` is called once per Inversify resolution, with `caller` set to
|
|
29
|
+
* the requesting parent's class name, and once per `LoggerFactory` invocation.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createGlspFrameworkOverrides(createLogger: (caller?: string) => GlspLogger): ContainerModule;
|
|
32
|
+
//# sourceMappingURL=glsp-framework-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-framework-overrides.d.ts","sourceRoot":"","sources":["../../src/launcher/glsp-framework-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAuC,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,UAAU,GAAG,eAAe,CAgB3G"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { Logger as GlspLogger, LoggerFactory, getRequestParentName } from '@eclipse-glsp/server';
|
|
10
|
+
import { ContainerModule } from 'inversify';
|
|
11
|
+
import { HydraniumTypes } from '../state/hydranium-shared-core-services.js';
|
|
12
|
+
/**
|
|
13
|
+
* The framework bindings layered on top of GLSP's own app module, shared by
|
|
14
|
+
* every bringup regardless of transport.
|
|
15
|
+
*
|
|
16
|
+
* Two things happen here. GLSP's `Logger` / `LoggerFactory` are replaced with
|
|
17
|
+
* the adopter's — unbind-then-bind, the same pattern `createAppModule` uses
|
|
18
|
+
* internally — so GLSP server logs leave through the adopter's sink rather than
|
|
19
|
+
* a console the host may not own. And `HydraniumTypes.Tracer` is added,
|
|
20
|
+
* caller-tagged the same way the logger is, so an injected tracer's timing lines
|
|
21
|
+
* carry the requesting class's component without every call site naming itself.
|
|
22
|
+
*
|
|
23
|
+
* **Shared rather than written once per launcher, because the two would drift
|
|
24
|
+
* silently.** A transport-specific copy that fell behind would still bind
|
|
25
|
+
* something for each symbol, so nothing would fail — the head would merely log
|
|
26
|
+
* or trace differently depending on how it was started, which no test asks
|
|
27
|
+
* about.
|
|
28
|
+
*
|
|
29
|
+
* `createLogger` is called once per Inversify resolution, with `caller` set to
|
|
30
|
+
* the requesting parent's class name, and once per `LoggerFactory` invocation.
|
|
31
|
+
*/
|
|
32
|
+
export function createGlspFrameworkOverrides(createLogger) {
|
|
33
|
+
return new ContainerModule((bind, unbind, isBound) => {
|
|
34
|
+
if (isBound(GlspLogger)) {
|
|
35
|
+
unbind(GlspLogger);
|
|
36
|
+
}
|
|
37
|
+
if (isBound(LoggerFactory)) {
|
|
38
|
+
unbind(LoggerFactory);
|
|
39
|
+
}
|
|
40
|
+
bind(GlspLogger).toDynamicValue(ctx => createLogger(getRequestParentName(ctx)));
|
|
41
|
+
bind(LoggerFactory).toFactory(() => (caller) => createLogger(caller));
|
|
42
|
+
bind(HydraniumTypes.Tracer).toDynamicValue(ctx => {
|
|
43
|
+
const tracer = ctx.container.get(HydraniumTypes.SharedCoreServices).Tracer;
|
|
44
|
+
const caller = getRequestParentName(ctx);
|
|
45
|
+
return caller ? tracer.for(caller) : tracer;
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=glsp-framework-overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-framework-overrides.js","sourceRoot":"","sources":["../../src/launcher/glsp-framework-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,4BAA4B,CAAC,YAA6C;IACvF,OAAO,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAClD,IAAI,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YACvB,MAAM,CAAC,UAAU,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;YAC1B,MAAM,CAAC,aAAa,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAChF,IAAI,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YAC9C,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAuB,cAAc,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC;YACjG,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC;YACzC,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/C,CAAC,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { ContainerModule } from 'inversify';
|
|
10
|
+
/**
|
|
11
|
+
* The framework bindings layered on top of the adopter's `ServerModule`, in the
|
|
12
|
+
* SERVER container — one per connected application, a child of the app
|
|
13
|
+
* container every bringup composes.
|
|
14
|
+
*
|
|
15
|
+
* **The tier matters, and the app container cannot stand in for it.** GLSP's
|
|
16
|
+
* launcher creates the server container as a child and loads the adopter's
|
|
17
|
+
* `ServerModule` into it, so a `GLSPServer` binding made further up is shadowed
|
|
18
|
+
* rather than consulted, and inversify refuses to rebind a parent's binding
|
|
19
|
+
* from a child at all. The framework's app-tier overrides therefore cannot
|
|
20
|
+
* reach this symbol.
|
|
21
|
+
*
|
|
22
|
+
* **Load this AFTER the adopter's `ServerModule`, never beside it.** Both bind
|
|
23
|
+
* `GLSPServer`, so a plain second binding resolves to an ambiguous-match error
|
|
24
|
+
* rather than to either one; `rebind` needs the first binding to already be
|
|
25
|
+
* present.
|
|
26
|
+
*
|
|
27
|
+
* Keeping this out of the adopter's hands is the point: an adopter passes their
|
|
28
|
+
* own `ServerModule` in, so anything they must add themselves is a fix the
|
|
29
|
+
* adopters who most need it will not have.
|
|
30
|
+
*
|
|
31
|
+
* **It also decides what GLSP's own log lines are tagged with.** GLSP resolves
|
|
32
|
+
* a logger per injecting class and labels it with the bound implementation's
|
|
33
|
+
* name, so every line upstream's server logs carries
|
|
34
|
+
* {@link HydraniumGlspServer} rather than `DefaultGLSPServer`. Anything keyed
|
|
35
|
+
* on that label — a log filter, an assertion — reads the class bound here, and
|
|
36
|
+
* a further adopter subclass moves it again.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createGlspServerOverrides(): ContainerModule;
|
|
39
|
+
//# sourceMappingURL=glsp-server-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-server-overrides.d.ts","sourceRoot":"","sources":["../../src/launcher/glsp-server-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,yBAAyB,IAAI,eAAe,CAI3D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { GLSPServer } from '@eclipse-glsp/server';
|
|
10
|
+
import { ContainerModule } from 'inversify';
|
|
11
|
+
import { HydraniumGlspServer } from './hydranium-glsp-server.js';
|
|
12
|
+
/**
|
|
13
|
+
* The framework bindings layered on top of the adopter's `ServerModule`, in the
|
|
14
|
+
* SERVER container — one per connected application, a child of the app
|
|
15
|
+
* container every bringup composes.
|
|
16
|
+
*
|
|
17
|
+
* **The tier matters, and the app container cannot stand in for it.** GLSP's
|
|
18
|
+
* launcher creates the server container as a child and loads the adopter's
|
|
19
|
+
* `ServerModule` into it, so a `GLSPServer` binding made further up is shadowed
|
|
20
|
+
* rather than consulted, and inversify refuses to rebind a parent's binding
|
|
21
|
+
* from a child at all. The framework's app-tier overrides therefore cannot
|
|
22
|
+
* reach this symbol.
|
|
23
|
+
*
|
|
24
|
+
* **Load this AFTER the adopter's `ServerModule`, never beside it.** Both bind
|
|
25
|
+
* `GLSPServer`, so a plain second binding resolves to an ambiguous-match error
|
|
26
|
+
* rather than to either one; `rebind` needs the first binding to already be
|
|
27
|
+
* present.
|
|
28
|
+
*
|
|
29
|
+
* Keeping this out of the adopter's hands is the point: an adopter passes their
|
|
30
|
+
* own `ServerModule` in, so anything they must add themselves is a fix the
|
|
31
|
+
* adopters who most need it will not have.
|
|
32
|
+
*
|
|
33
|
+
* **It also decides what GLSP's own log lines are tagged with.** GLSP resolves
|
|
34
|
+
* a logger per injecting class and labels it with the bound implementation's
|
|
35
|
+
* name, so every line upstream's server logs carries
|
|
36
|
+
* {@link HydraniumGlspServer} rather than `DefaultGLSPServer`. Anything keyed
|
|
37
|
+
* on that label — a log filter, an assertion — reads the class bound here, and
|
|
38
|
+
* a further adopter subclass moves it again.
|
|
39
|
+
*/
|
|
40
|
+
export function createGlspServerOverrides() {
|
|
41
|
+
return new ContainerModule((_bind, _unbind, _isBound, rebind) => {
|
|
42
|
+
rebind(GLSPServer).to(HydraniumGlspServer).inSingletonScope();
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=glsp-server-overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-server-overrides.js","sourceRoot":"","sources":["../../src/launcher/glsp-server-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,UAAU,yBAAyB;IACtC,OAAO,IAAI,eAAe,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;QAC7D,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACjE,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 ClientSession, DefaultGLSPServer, type RequestAction, type ResponseAction } from '@eclipse-glsp/server';
|
|
10
|
+
/**
|
|
11
|
+
* The GLSP server the framework binds in place of upstream's
|
|
12
|
+
* {@link DefaultGLSPServer}, so a failed REQUEST reaches its reader with the
|
|
13
|
+
* text the thrower wrote.
|
|
14
|
+
*
|
|
15
|
+
* **What breaks without it.** Upstream projects a failing request's detail as
|
|
16
|
+
* `error.cause?.toString()` whenever the error is a {@link GLSPServerError},
|
|
17
|
+
* and that one value feeds both the server log and the client's
|
|
18
|
+
* {@link RejectAction}. A {@link GLSPServerError} carrying no `cause` therefore
|
|
19
|
+
* reaches no reader at all — not the toast, not the details pane, not the log —
|
|
20
|
+
* while a plain `Error` survives, because the other branch reads the error
|
|
21
|
+
* itself. The typed error is the trap, and it is the one upstream's own
|
|
22
|
+
* `getOrThrow` helper raises: that helper's signature cannot pass a `cause`, so
|
|
23
|
+
* an adopter using the sanctioned helper has no fix available on their side.
|
|
24
|
+
* Restating the cause at each throw site is the alternative, and it costs
|
|
25
|
+
* every adopter a rule they must know and cannot apply to `getOrThrow`.
|
|
26
|
+
*
|
|
27
|
+
* Only the REQUEST path needs this. Non-request actions fail through
|
|
28
|
+
* upstream's `handleProcessError`, which reads `message` directly.
|
|
29
|
+
*
|
|
30
|
+
* Adopters who bind their own GLSP server should extend this class rather than
|
|
31
|
+
* {@link DefaultGLSPServer}; the framework's server-container override replaces
|
|
32
|
+
* whatever the adopter's `ServerModule` bound, so a subclass of upstream's
|
|
33
|
+
* server would be discarded.
|
|
34
|
+
*/
|
|
35
|
+
export declare class HydraniumGlspServer extends DefaultGLSPServer {
|
|
36
|
+
/**
|
|
37
|
+
* The detail projected into the client's {@link RejectAction} and the server
|
|
38
|
+
* log when a request fails.
|
|
39
|
+
*
|
|
40
|
+
* A {@link GLSPServerError} with no `cause` falls back to its `message`; a
|
|
41
|
+
* nullish `cause` counts as absent, matching the optional chaining upstream
|
|
42
|
+
* applies. Anything else stringifies as upstream does, so a plain `Error`
|
|
43
|
+
* keeps its `"Error: …"` prefix and callers that match on it still match.
|
|
44
|
+
*/
|
|
45
|
+
protected requestFailureDetail(error: unknown): string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Lifted verbatim from `@eclipse-glsp/server` 2.7.0's
|
|
48
|
+
* {@link DefaultGLSPServer.handleClientRequest}, with the detail computation
|
|
49
|
+
* delegated to {@link requestFailureDetail}. Nothing else here — the
|
|
50
|
+
* timeout branch, the response dispatch, the nested send-failure handling —
|
|
51
|
+
* relates to that fallback.
|
|
52
|
+
*
|
|
53
|
+
* **This body does not track upstream.** A release that changes request
|
|
54
|
+
* handling would silently not apply, on the path every request takes. There
|
|
55
|
+
* is no narrower seam to override: upstream computes the detail inline. The
|
|
56
|
+
* accompanying test pins upstream's own source for this method, so a bump
|
|
57
|
+
* that changes it fails rather than diverging quietly; re-lift the body when
|
|
58
|
+
* it does.
|
|
59
|
+
*/
|
|
60
|
+
protected handleClientRequest(clientSession: ClientSession, action: RequestAction<ResponseAction>, clientId: string): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=hydranium-glsp-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-glsp-server.d.ts","sourceRoot":"","sources":["../../src/launcher/hydranium-glsp-server.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EACJ,KAAK,aAAa,EAClB,iBAAiB,EAGjB,KAAK,aAAa,EAClB,KAAK,cAAc,EACrB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBACa,mBAAoB,SAAQ,iBAAiB;IACvD;;;;;;;;OAQG;IACH,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAOlE;;;;;;;;;;;;;OAaG;cACsB,mBAAmB,CACzC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,aAAa,CAAC,cAAc,CAAC,EACrC,QAAQ,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;CAuBlB"}
|