@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,89 @@
|
|
|
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 { serviceIdentifier } from '../util/service-identifier.js';
|
|
10
|
+
/**
|
|
11
|
+
* Inversify service-identifier registry for the framework services the
|
|
12
|
+
* `@hydranium/glsp-server` runtime exposes to `@injectable()` GLSP
|
|
13
|
+
* components. Framework GLSP-side classes are `@injectable()` and need an
|
|
14
|
+
* Inversify token to receive the Langium-style services the rest of the
|
|
15
|
+
* framework hands around via plain constructor arguments.
|
|
16
|
+
*
|
|
17
|
+
* Every token here is a service whose value is **fixed for the container tier
|
|
18
|
+
* that binds it** — process-wide shared services, a per-session conflict
|
|
19
|
+
* policy, the grammar a diagram type edits. That is the whole membership rule,
|
|
20
|
+
* and it is why the registry is short: see below for what deliberately does
|
|
21
|
+
* NOT get a token.
|
|
22
|
+
*
|
|
23
|
+
* Grouped under one object (rather than top-level `Hydranium<Role>` consts)
|
|
24
|
+
* so the token identity is decoupled from the implementation class name.
|
|
25
|
+
* Mirrors GLSP's own `TYPES` registry idiom.
|
|
26
|
+
*
|
|
27
|
+
* Bound by the adopter from their services trees — the app-tier ones directly,
|
|
28
|
+
* the session-tier language by declaring a grammar on the diagram module.
|
|
29
|
+
* Inject with the real service type as the field type.
|
|
30
|
+
*
|
|
31
|
+
* **Split by tier, because GLSP has no language tier.** GLSP's containers are
|
|
32
|
+
* app (per process) -> server (per connection) -> session (per open diagram);
|
|
33
|
+
* Langium's are shared (per process) -> language (per grammar, routed by URI).
|
|
34
|
+
* Only the outermost pair line up. A per-language service therefore CANNOT be
|
|
35
|
+
* bound at the app tier — that container is built before any document exists,
|
|
36
|
+
* so it can only ever hold one grammar's services. The tokens below are split
|
|
37
|
+
* accordingly:
|
|
38
|
+
*
|
|
39
|
+
* - **SharedCoreServices** — the framework's Langium-style shared services
|
|
40
|
+
* tree ({@link ServerSharedServices}); the services-tree root that state /
|
|
41
|
+
* index classes inject. Bound once at the app tier. Carries
|
|
42
|
+
* `ServiceRegistry`, which is how everything below reaches a language.
|
|
43
|
+
* - **DiagramLanguage** — the {@link ServerLanguageServices} of the grammar a
|
|
44
|
+
* diagram type edits, bound at the SESSION tier by
|
|
45
|
+
* `AbstractHydraniumGlspDiagramModule` from its declared `declareLanguage()`.
|
|
46
|
+
* Static (a diagram type has one grammar), so it is safe for the eagerly
|
|
47
|
+
* constructed handlers GLSP builds at `InitializeClientSession`. Read it
|
|
48
|
+
* through `AbstractHydraniumGlspState.diagramLanguage`.
|
|
49
|
+
* - **ConflictResolver** — the policy the GLSP state consults when a write
|
|
50
|
+
* (forward-write, undo, redo, save) races a foreign edit.
|
|
51
|
+
* `HydraniumGlspAppModule` binds it to `options.conflictResolver`
|
|
52
|
+
* when supplied, else a default `ReconcilingConflictResolver` (field-level
|
|
53
|
+
* three-way merge) unless the adopter opts into `ForceConflictResolver`.
|
|
54
|
+
* - **Tracer** — the measure-and-emit observability handle (timing, memory,
|
|
55
|
+
* profiling). Bound per-request, auto-tagged with the requesting class name
|
|
56
|
+
* (mirroring GLSP's `LoggerFactory` caller-tagging), so an `@injectable()`
|
|
57
|
+
* GLSP class that times just injects it and its timing lines carry its own
|
|
58
|
+
* component — no manual `for(...)`. The non-injectable recording command,
|
|
59
|
+
* which can't inject, borrows the state's `tracer` getter instead.
|
|
60
|
+
*
|
|
61
|
+
* **No per-language SERVICE has a token — only the language does.** There is
|
|
62
|
+
* no `ElementKeyProvider`, `NameProvider`, `ScopeProvider` or
|
|
63
|
+
* `CandidateProvider` symbol, because every one of them is keyed by a document
|
|
64
|
+
* that the container cannot know: the target node's, for naming and keying;
|
|
65
|
+
* the one a reference is WRITTEN in, for scope and candidates. A GLSP
|
|
66
|
+
* component asks about several documents over its life — the diagram's own,
|
|
67
|
+
* the element it is editing, a drop target — so an injected provider instance
|
|
68
|
+
* answers as if there were one right answer and the routing decision vanishes
|
|
69
|
+
* from the call site. `this.candidateProvider` reads as language-neutral, and
|
|
70
|
+
* nothing prompts the author to ask which document the reference lives in;
|
|
71
|
+
* that is exactly how a foreign node ends up named under the diagram's
|
|
72
|
+
* grammar, producing a plausible string that matches nothing.
|
|
73
|
+
*
|
|
74
|
+
* So callers name the language they mean: `modelState.diagramLanguage` for a
|
|
75
|
+
* reference written on the canvas, `modelState.languageServicesFor(node)` for
|
|
76
|
+
* anything reached through a reference. `ServiceRegistry.getServicesFor(target)`
|
|
77
|
+
* serves the same purpose where no model state is at hand.
|
|
78
|
+
*
|
|
79
|
+
* The app-tier tokens are bound by `HydraniumGlspAppModule`, the
|
|
80
|
+
* session-tier one by `AbstractHydraniumGlspDiagramModule`. A multi-grammar
|
|
81
|
+
* adopter declares a language per diagram module and needs nothing else.
|
|
82
|
+
*/
|
|
83
|
+
export const HydraniumTypes = {
|
|
84
|
+
SharedCoreServices: serviceIdentifier('HydraniumSharedCoreServices'),
|
|
85
|
+
DiagramLanguage: serviceIdentifier('HydraniumDiagramLanguage'),
|
|
86
|
+
ConflictResolver: serviceIdentifier('HydraniumConflictResolver'),
|
|
87
|
+
Tracer: serviceIdentifier('HydraniumTracer')
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=hydranium-shared-core-services.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-shared-core-services.js","sourceRoot":"","sources":["../../src/state/hydranium-shared-core-services.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAIlF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC3B,kBAAkB,EAAE,iBAAiB,CAAuB,6BAA6B,CAAC;IAC1F,eAAe,EAAE,iBAAiB,CAAyB,0BAA0B,CAAC;IACtF,gBAAgB,EAAE,iBAAiB,CAAmB,2BAA2B,CAAC;IAClF,MAAM,EAAE,iBAAiB,CAAS,iBAAiB,CAAC;CAC7C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 './hydranium-glsp-index.js';
|
|
10
|
+
export * from './abstract-hydranium-glsp-state.js';
|
|
11
|
+
export * from './reconcile-source-model-write.js';
|
|
12
|
+
export * from './reconciling-transfer-hydranium-glsp-state.js';
|
|
13
|
+
export * from './reconciling-multi-document-glsp-state.js';
|
|
14
|
+
export * from './full-text-hydranium-glsp-state.js';
|
|
15
|
+
export * from './hydranium-shared-core-services.js';
|
|
16
|
+
export * from './model-ready-timeout-error.js';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 './hydranium-glsp-index.js';
|
|
10
|
+
export * from './abstract-hydranium-glsp-state.js';
|
|
11
|
+
export * from './reconcile-source-model-write.js';
|
|
12
|
+
export * from './reconciling-transfer-hydranium-glsp-state.js';
|
|
13
|
+
export * from './reconciling-multi-document-glsp-state.js';
|
|
14
|
+
export * from './full-text-hydranium-glsp-state.js';
|
|
15
|
+
export * from './hydranium-shared-core-services.js';
|
|
16
|
+
export * from './model-ready-timeout-error.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/state/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Thrown by `AbstractHydraniumGlspState.ready` when the wait for a document
|
|
11
|
+
* build state exceeds `AbstractHydraniumGlspState.readyTimeoutMs`. A dedicated
|
|
12
|
+
* error class so callers can distinguish a genuine hang from other failures
|
|
13
|
+
* via `instanceof`.
|
|
14
|
+
*
|
|
15
|
+
* The optional `diagnostic` carries a build-status snapshot so a captured log
|
|
16
|
+
* line is self-explanatory without correlating the timeout entry against
|
|
17
|
+
* earlier rebuild traces. `AbstractHydraniumGlspState.buildReadyTimeoutError`
|
|
18
|
+
* fills it from the document builder; a caller constructing the error directly
|
|
19
|
+
* may leave it empty.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ModelReadyTimeoutError extends Error {
|
|
22
|
+
readonly uri: string;
|
|
23
|
+
readonly targetState: string;
|
|
24
|
+
readonly elapsedMs: number;
|
|
25
|
+
readonly diagnostic: string;
|
|
26
|
+
constructor(uri: string, targetState: string, elapsedMs: number, diagnostic?: string);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=model-ready-timeout-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-ready-timeout-error.d.ts","sourceRoot":"","sources":["../../src/state/model-ready-timeout-error.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;GAWG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;aAE3B,GAAG,EAAE,MAAM;aACX,WAAW,EAAE,MAAM;aACnB,SAAS,EAAE,MAAM;aACjB,UAAU,EAAE,MAAM;gBAHlB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,GAAE,MAAW;CAM5C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Thrown by `AbstractHydraniumGlspState.ready` when the wait for a document
|
|
11
|
+
* build state exceeds `AbstractHydraniumGlspState.readyTimeoutMs`. A dedicated
|
|
12
|
+
* error class so callers can distinguish a genuine hang from other failures
|
|
13
|
+
* via `instanceof`.
|
|
14
|
+
*
|
|
15
|
+
* The optional `diagnostic` carries a build-status snapshot so a captured log
|
|
16
|
+
* line is self-explanatory without correlating the timeout entry against
|
|
17
|
+
* earlier rebuild traces. `AbstractHydraniumGlspState.buildReadyTimeoutError`
|
|
18
|
+
* fills it from the document builder; a caller constructing the error directly
|
|
19
|
+
* may leave it empty.
|
|
20
|
+
*/
|
|
21
|
+
export class ModelReadyTimeoutError extends Error {
|
|
22
|
+
uri;
|
|
23
|
+
targetState;
|
|
24
|
+
elapsedMs;
|
|
25
|
+
diagnostic;
|
|
26
|
+
constructor(uri, targetState, elapsedMs, diagnostic = '') {
|
|
27
|
+
const suffix = diagnostic ? ` ${diagnostic}` : '';
|
|
28
|
+
super(`Timed out after ${elapsedMs}ms waiting for state '${targetState}' on ${uri}.${suffix}`);
|
|
29
|
+
this.uri = uri;
|
|
30
|
+
this.targetState = targetState;
|
|
31
|
+
this.elapsedMs = elapsedMs;
|
|
32
|
+
this.diagnostic = diagnostic;
|
|
33
|
+
this.name = 'ModelReadyTimeoutError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=model-ready-timeout-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-ready-timeout-error.js","sourceRoot":"","sources":["../../src/state/model-ready-timeout-error.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAE3B;IACA;IACA;IACA;IAJnB,YACmB,GAAW,EACX,WAAmB,EACnB,SAAiB,EACjB,aAAqB,EAAE;QAEvC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,KAAK,CAAC,mBAAmB,SAAS,yBAAyB,WAAW,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC,CAAC;QAN/E,QAAG,GAAH,GAAG,CAAQ;QACX,gBAAW,GAAX,WAAW,CAAQ;QACnB,cAAS,GAAT,SAAS,CAAQ;QACjB,eAAU,GAAV,UAAU,CAAa;QAIvC,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACxC,CAAC;CACH"}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 ConflictResolver, type Logger } from '@hydranium/protocol';
|
|
10
|
+
/**
|
|
11
|
+
* The I/O and policy a {@link reconcileSourceModelWrite} call needs. Deliberately
|
|
12
|
+
* a plain record rather than a base class: the states that use it differ in what
|
|
13
|
+
* "persist" and "project" mean but not at all in how a conflict is handled, and
|
|
14
|
+
* pulling the orchestration out is what keeps that second half from being
|
|
15
|
+
* written once per state.
|
|
16
|
+
*/
|
|
17
|
+
export interface SourceModelWriteHooks<TModel> {
|
|
18
|
+
/**
|
|
19
|
+
* Write `model` and capture the resulting state. Called with a `baseVersion`
|
|
20
|
+
* on the first attempt (opting into the `ConflictError` gate) and without one
|
|
21
|
+
* on the merged / forced retries, where the point is to land the write.
|
|
22
|
+
*/
|
|
23
|
+
persist(model: TModel, baseVersion?: number): Promise<void>;
|
|
24
|
+
/** Current server-side projection, or `undefined` when unavailable. */
|
|
25
|
+
refetch(): Promise<TModel | undefined>;
|
|
26
|
+
/** Last in-sync projection the user's intent is measured against. */
|
|
27
|
+
readonly baseline: TModel | undefined;
|
|
28
|
+
readonly conflictResolver: ConflictResolver;
|
|
29
|
+
readonly logger: Logger;
|
|
30
|
+
/** Invoked when the edit is dropped, so the caller can resync its own state. */
|
|
31
|
+
onConflictDropped(): void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Persist `model`, and on a `ConflictError` reconcile the user's intent against
|
|
35
|
+
* the current server state via the injected policy and act on the outcome.
|
|
36
|
+
*
|
|
37
|
+
* One declarative policy shared by forward-write, undo and redo: force =
|
|
38
|
+
* last-writer-wins, reconciling = field-level merge. A non-conflict error is
|
|
39
|
+
* re-thrown untouched — this function only knows how to handle the specific
|
|
40
|
+
* failure of "the based-on version was superseded".
|
|
41
|
+
*/
|
|
42
|
+
export declare function reconcileSourceModelWrite<TModel extends object>(model: TModel, version: number | undefined, hooks: SourceModelWriteHooks<TModel>): Promise<void>;
|
|
43
|
+
//# sourceMappingURL=reconcile-source-model-write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile-source-model-write.d.ts","sourceRoot":"","sources":["../../src/state/reconcile-source-model-write.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAmB,MAAM,qBAAqB,CAAC;AAE1F;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB,CAAC,MAAM;IAC1C;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,uEAAuE;IACvE,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACvC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,iBAAiB,IAAI,IAAI,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,SAAS,MAAM,EAClE,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,KAAK,EAAE,qBAAqB,CAAC,MAAM,CAAC,GACpC,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|
|
@@ -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
|
+
import { isConflictError } from '@hydranium/protocol';
|
|
10
|
+
/**
|
|
11
|
+
* Persist `model`, and on a `ConflictError` reconcile the user's intent against
|
|
12
|
+
* the current server state via the injected policy and act on the outcome.
|
|
13
|
+
*
|
|
14
|
+
* One declarative policy shared by forward-write, undo and redo: force =
|
|
15
|
+
* last-writer-wins, reconciling = field-level merge. A non-conflict error is
|
|
16
|
+
* re-thrown untouched — this function only knows how to handle the specific
|
|
17
|
+
* failure of "the based-on version was superseded".
|
|
18
|
+
*/
|
|
19
|
+
export async function reconcileSourceModelWrite(model, version, hooks) {
|
|
20
|
+
try {
|
|
21
|
+
await hooks.persist(model, version);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
if (!isConflictError(err)) {
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
const outcome = await hooks.conflictResolver.resolve(hooks.baseline ?? model, model, () => hooks.refetch());
|
|
28
|
+
switch (outcome.status) {
|
|
29
|
+
case 'merged':
|
|
30
|
+
await hooks.persist(outcome.merged);
|
|
31
|
+
return;
|
|
32
|
+
case 'no-op':
|
|
33
|
+
hooks.logger.debug(`updateSourceModel no-op (v${err.expected} → v${err.actual}); already in sync`);
|
|
34
|
+
return;
|
|
35
|
+
case 'conflict':
|
|
36
|
+
hooks.logger.warn(`updateSourceModel conflict (v${err.expected} → v${err.actual}); dropping the diagram edit — ` +
|
|
37
|
+
'a foreign writer changed the same field');
|
|
38
|
+
hooks.onConflictDropped();
|
|
39
|
+
return;
|
|
40
|
+
case 'unavailable':
|
|
41
|
+
hooks.logger.warn(`updateSourceModel refetch unavailable (v${err.expected} → v${err.actual}); forcing without version`);
|
|
42
|
+
await hooks.persist(model);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=reconcile-source-model-write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile-source-model-write.js","sourceRoot":"","sources":["../../src/state/reconcile-source-model-write.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAsC,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA0B1F;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC5C,KAAa,EACb,OAA2B,EAC3B,KAAoC;IAEpC,IAAI,CAAC;QACF,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACZ,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,GAAG,CAAC;QACb,CAAC;QACD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5G,QAAQ,OAAO,CAAC,MAAM,EAAE,CAAC;YACtB,KAAK,QAAQ;gBACV,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACpC,OAAO;YACV,KAAK,OAAO;gBACT,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,GAAG,CAAC,QAAQ,OAAO,GAAG,CAAC,MAAM,oBAAoB,CAAC,CAAC;gBACnG,OAAO;YACV,KAAK,UAAU;gBACZ,KAAK,CAAC,MAAM,CAAC,IAAI,CACd,gCAAgC,GAAG,CAAC,QAAQ,OAAO,GAAG,CAAC,MAAM,iCAAiC;oBAC3F,yCAAyC,CAC9C,CAAC;gBACF,KAAK,CAAC,iBAAiB,EAAE,CAAC;gBAC1B,OAAO;YACV,KAAK,aAAa;gBACf,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,2CAA2C,GAAG,CAAC,QAAQ,OAAO,GAAG,CAAC,MAAM,4BAA4B,CAAC,CAAC;gBACxH,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAC3B,OAAO;QACb,CAAC;IACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
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 JsonModelState } from '@eclipse-glsp/server';
|
|
10
|
+
import { type AstNode } from '@hydranium/langium';
|
|
11
|
+
import { type TransferElement } from '@hydranium/protocol';
|
|
12
|
+
import { AbstractHydraniumGlspState } from './abstract-hydranium-glsp-state.js';
|
|
13
|
+
/**
|
|
14
|
+
* Source model spanning more than one document: the primary document's
|
|
15
|
+
* projection plus one per registered secondary, keyed by URI.
|
|
16
|
+
*
|
|
17
|
+
* Keyed by URI rather than held as an array so a recorded undo / redo patch
|
|
18
|
+
* still addresses the right document when the tracked set has changed since the
|
|
19
|
+
* patch was recorded — an array would re-apply by index and silently write the
|
|
20
|
+
* wrong file. The JSON-Pointer escaping that URI keys imply is the patch
|
|
21
|
+
* library's job, not the adopter's.
|
|
22
|
+
*/
|
|
23
|
+
export interface MultiDocumentSourceModel<TPrimary extends TransferElement = TransferElement> {
|
|
24
|
+
/** Projection of the primary (diagram) document — the one `sourceUri` names. */
|
|
25
|
+
primary: TPrimary;
|
|
26
|
+
/** Projection of each registered secondary document, keyed by its URI. */
|
|
27
|
+
secondaries: Record<string, TransferElement>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Editable GLSP state for a diagram whose edits span SEVERAL Langium documents —
|
|
31
|
+
* a diagram file plus the semantic file it references, say, where creating a node
|
|
32
|
+
* on the canvas writes both.
|
|
33
|
+
*
|
|
34
|
+
* The single-document `ReconcilingTransferHydraniumGlspState` cannot express
|
|
35
|
+
* that: its `sourceModel`, `persist` and `refetch` are all defined over
|
|
36
|
+
* `sourceUri` alone, so an adopter needing a second document had to override all
|
|
37
|
+
* three — i.e. the entire class. This subclass keeps the same three seams and the
|
|
38
|
+
* same conflict handling (both share {@link reconcileSourceModelWrite}) but
|
|
39
|
+
* defines them over the primary plus the secondary write set registered through
|
|
40
|
+
* {@link AbstractHydraniumGlspState.trackSecondaryDocument}.
|
|
41
|
+
*
|
|
42
|
+
* **Writes are NOT atomic, deliberately, and the window is real.** Each document
|
|
43
|
+
* goes through its own `ModelService.update`, so a failure after the first write
|
|
44
|
+
* has landed leaves the set inconsistent on disk. There is no multi-document
|
|
45
|
+
* transaction to lean on: `WorkspaceLock` serialises builds but does not roll
|
|
46
|
+
* back, and the document store commits per URI. An adopter that cannot accept the
|
|
47
|
+
* window should not span documents in one operation.
|
|
48
|
+
*
|
|
49
|
+
* **What makes the window tolerable is write ORDER, and the rule is
|
|
50
|
+
* referenced-before-referencing** — not "secondaries first" as such. Write the
|
|
51
|
+
* document whose content the others point AT before the documents that point at
|
|
52
|
+
* it, so a partial write leaves an unreferenced element (inert, and the direction
|
|
53
|
+
* an integrity rule can repair) rather than a reference to something that does
|
|
54
|
+
* not exist (a linking error). {@link persist} implements that as
|
|
55
|
+
* secondaries-then-primary, which is correct for the common shape where the
|
|
56
|
+
* primary is the DIAGRAM and the semantics it references are secondaries: the
|
|
57
|
+
* user opened the diagram, so it is also the document the conflict gate should
|
|
58
|
+
* guard. **An adopter whose primary is the referenced document — a semantic file
|
|
59
|
+
* as the diagram source, with layout in a secondary — has the ordering backwards
|
|
60
|
+
* and must override {@link persist} to write the primary first.** Overriding it
|
|
61
|
+
* is the supported route; the base order is a default for the common case, not an
|
|
62
|
+
* invariant of the class.
|
|
63
|
+
*
|
|
64
|
+
* **The conflict gate covers the primary only.** Secondaries are written without
|
|
65
|
+
* a based-on version, so a concurrent foreign edit to one is overwritten rather
|
|
66
|
+
* than reconciled. Gating them too would need a per-document reconcile whose
|
|
67
|
+
* outcomes can disagree (merge one, conflict another) with no way to un-write the
|
|
68
|
+
* merged one — the atomicity problem again, one layer up. The captured versions
|
|
69
|
+
* ARE available via {@link AbstractHydraniumGlspState.capturedVersionOf}, so an
|
|
70
|
+
* adopter that wants a coarser check can compare before writing.
|
|
71
|
+
*/
|
|
72
|
+
export declare class ReconcilingMultiDocumentGlspState<TRoot extends AstNode, TPrimary extends TransferElement = TransferElement> extends AbstractHydraniumGlspState<TRoot, MultiDocumentSourceModel<TPrimary>> implements JsonModelState<MultiDocumentSourceModel<TPrimary>> {
|
|
73
|
+
/**
|
|
74
|
+
* Last in-sync projection across the whole write set, captured on every
|
|
75
|
+
* {@link setSourceRoot}. Same role as the single-document baseline: the state a
|
|
76
|
+
* forward-write conflict reconciles the user's intent against.
|
|
77
|
+
*/
|
|
78
|
+
protected baseline?: MultiDocumentSourceModel<TPrimary>;
|
|
79
|
+
/**
|
|
80
|
+
* Projection of the primary plus every registered secondary, in the framework
|
|
81
|
+
* encoder's `'grammar'` mode (authored state only — cross-references as
|
|
82
|
+
* `$refText`, computed / synthetic properties excluded), so `fast-json-patch`
|
|
83
|
+
* diffs per field across all of them at once.
|
|
84
|
+
*
|
|
85
|
+
* A secondary that is not currently loaded is OMITTED rather than represented
|
|
86
|
+
* as `undefined`: an absent key produces no patch operations for that
|
|
87
|
+
* document, whereas an explicit `undefined` would diff as a removal and
|
|
88
|
+
* persist as a deletion of content the state simply could not see.
|
|
89
|
+
*/
|
|
90
|
+
get sourceModel(): MultiDocumentSourceModel<TPrimary>;
|
|
91
|
+
setSourceRoot(uri: string, root: TRoot): void;
|
|
92
|
+
/**
|
|
93
|
+
* Register the secondary documents that belong to the primary at `uri`, via
|
|
94
|
+
* {@link AbstractHydraniumGlspState.trackSecondaryDocument}. Called on every
|
|
95
|
+
* {@link setSourceRoot}, after the primary is captured (so `sourceUri` is
|
|
96
|
+
* current) and BEFORE the baseline is taken (so the baseline includes them).
|
|
97
|
+
* Default: no secondaries.
|
|
98
|
+
*
|
|
99
|
+
* This hook exists because that ordering is a trap an adopter would otherwise
|
|
100
|
+
* hit silently. Registering from an overridden `setSourceRoot` *after*
|
|
101
|
+
* `super.setSourceRoot(...)` runs too late — the baseline has already been
|
|
102
|
+
* captured without the secondaries, so the first conflict reconcile measures
|
|
103
|
+
* the user's intent against a baseline missing half the write set and the
|
|
104
|
+
* secondary edits look like foreign changes. Registering *before* the super
|
|
105
|
+
* call is too early for a URI derived from the new primary. Overriding this
|
|
106
|
+
* instead removes the choice.
|
|
107
|
+
*/
|
|
108
|
+
protected trackWriteSet(_uri: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Persist the whole write set, then capture the resulting primary root. On a
|
|
111
|
+
* `ConflictError` from the primary, reconcile via the injected policy exactly
|
|
112
|
+
* as the single-document state does — the orchestration is shared.
|
|
113
|
+
*/
|
|
114
|
+
updateSourceModel(model: MultiDocumentSourceModel<TPrimary>, version?: number): Promise<void>;
|
|
115
|
+
/**
|
|
116
|
+
* Write hook — secondaries first (ungated), primary last (gated on
|
|
117
|
+
* `baseVersion`). The order is the failure-mode choice documented on the
|
|
118
|
+
* class, not incidental: override this when the primary is the document the
|
|
119
|
+
* others REFERENCE, since then this order writes the references first.
|
|
120
|
+
*/
|
|
121
|
+
protected persist(model: MultiDocumentSourceModel<TPrimary>, baseVersion?: number): Promise<{
|
|
122
|
+
root: TRoot;
|
|
123
|
+
}>;
|
|
124
|
+
/**
|
|
125
|
+
* Whether `candidate` differs from the baseline projection of the same
|
|
126
|
+
* document, and therefore needs writing.
|
|
127
|
+
*
|
|
128
|
+
* **Skipping unchanged documents is correctness, not an optimisation.** A
|
|
129
|
+
* write goes through `ModelService.update`, which re-serializes from the AST —
|
|
130
|
+
* so writing a document that did not change still rewrites its text, and a
|
|
131
|
+
* serializer is free to normalise formatting and cannot preserve comments.
|
|
132
|
+
* Persisting the whole write set unconditionally therefore means a pure layout
|
|
133
|
+
* drag reflows the semantic file and strips its comments, which is a data
|
|
134
|
+
* loss the user never asked for and would struggle to attribute.
|
|
135
|
+
*
|
|
136
|
+
* Compared by serialised form. Both sides come from the same encoder walking
|
|
137
|
+
* the same shape, so key order is stable and a string compare is sound here;
|
|
138
|
+
* it is also cheap enough to run per document per write.
|
|
139
|
+
*/
|
|
140
|
+
protected hasChanged(baseline: object | undefined, candidate: object): boolean;
|
|
141
|
+
/** Write the primary document, opting into the conflict gate when `baseVersion` is given. */
|
|
142
|
+
protected persistPrimary(model: TPrimary, baseVersion?: number): Promise<{
|
|
143
|
+
root: TRoot;
|
|
144
|
+
}>;
|
|
145
|
+
/**
|
|
146
|
+
* Write one secondary document. Ungated by design (see the class doc); override
|
|
147
|
+
* alongside {@link persistPrimary} when the round-trip differs per document
|
|
148
|
+
* role — a layout file and a semantic file need not share a serializer.
|
|
149
|
+
*/
|
|
150
|
+
protected persistSecondary(uri: string, model: TransferElement): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Refetch hook — the current settled projection across the write set, used by
|
|
153
|
+
* the conflict resolver to replay the user's intent against fresh state.
|
|
154
|
+
* Returns `undefined` when the PRIMARY cannot be read, since a reconcile
|
|
155
|
+
* without it has nothing to merge into; an unreadable secondary is omitted the
|
|
156
|
+
* same way {@link sourceModel} omits one.
|
|
157
|
+
*/
|
|
158
|
+
protected refetch(): Promise<MultiDocumentSourceModel<TPrimary> | undefined>;
|
|
159
|
+
/** Project a currently-loaded document's root, or `undefined` when it is not loaded. */
|
|
160
|
+
protected projectDocument(uri: string): TransferElement | undefined;
|
|
161
|
+
/** Grammar-mode transfer projection of one AST root. The single projection seam. */
|
|
162
|
+
protected projectRoot<T extends TransferElement = TransferElement>(root: AstNode): T;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=reconciling-multi-document-glsp-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconciling-multi-document-glsp-state.d.ts","sourceRoot":"","sources":["../../src/state/reconciling-multi-document-glsp-state.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGhF;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB,CAAC,QAAQ,SAAS,eAAe,GAAG,eAAe;IACzF,gFAAgF;IAChF,OAAO,EAAE,QAAQ,CAAC;IAClB,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBACa,iCAAiC,CAAC,KAAK,SAAS,OAAO,EAAE,QAAQ,SAAS,eAAe,GAAG,eAAe,CACrH,SAAQ,0BAA0B,CAAC,KAAK,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAC5E,YAAW,cAAc,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAE7D;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAExD;;;;;;;;;;OAUG;IACH,IAAI,WAAW,IAAI,wBAAwB,CAAC,QAAQ,CAAC,CASpD;IAEQ,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI;IAMtD;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI3C;;;;OAIG;IACG,iBAAiB,CAAC,KAAK,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcnG;;;;;OAKG;cACa,OAAO,CAAC,KAAK,EAAE,wBAAwB,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAclH;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAI9E,6FAA6F;cAC7E,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAU/F;;;;OAIG;cACa,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpF;;;;;;OAMG;cACa,OAAO,IAAI,OAAO,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAelF,wFAAwF;IACxF,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAKnE,oFAAoF;IACpF,SAAS,CAAC,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,CAAC;CAGtF"}
|