@oh-just-another/versioning 0.57.0
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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/diff.d.ts +26 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +37 -0
- package/dist/diff.js.map +1 -0
- package/dist/editor-bridge.d.ts +36 -0
- package/dist/editor-bridge.d.ts.map +1 -0
- package/dist/editor-bridge.js +24 -0
- package/dist/editor-bridge.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/merge.d.ts +61 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +180 -0
- package/dist/merge.js.map +1 -0
- package/dist/serialize.d.ts +46 -0
- package/dist/serialize.d.ts.map +1 -0
- package/dist/serialize.js +69 -0
- package/dist/serialize.js.map +1 -0
- package/dist/store.d.ts +95 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +172 -0
- package/dist/store.js.map +1 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @oh-just-another/versioning
|
|
2
|
+
|
|
3
|
+
## 0.57.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Version bump just for publishing.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @oh-just-another/scene@0.57.0
|
|
13
|
+
- @oh-just-another/serialization@0.57.0
|
|
14
|
+
- @oh-just-another/types@0.57.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rustam Garifulin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @oh-just-another/versioning
|
|
2
|
+
|
|
3
|
+
L3 snapshot history + branch tree + diff/merge utilities for diagram scenes. Depends on `@oh-just-another/types`, `@oh-just-another/scene` and `@oh-just-another/serialization`.
|
|
4
|
+
|
|
5
|
+
A `SnapshotStore` is the system-of-record for a git-like version tree: every snapshot is an immutable copy of a `Scene` with author / timestamp / message, branches fork from any snapshot, and three-way merge resolves divergent heads.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @oh-just-another/versioning
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {
|
|
17
|
+
SnapshotStore,
|
|
18
|
+
diffScenes,
|
|
19
|
+
isEmptyDiff,
|
|
20
|
+
serializeStore,
|
|
21
|
+
} from "@oh-just-another/versioning";
|
|
22
|
+
|
|
23
|
+
const store = new SnapshotStore(); // starts on the "main" branch
|
|
24
|
+
|
|
25
|
+
const v1 = store.capture({ scene, author: { id: "u1", name: "Ada" }, message: "init" });
|
|
26
|
+
const feature = store.branch({ name: "feature", fromVersion: v1.id });
|
|
27
|
+
|
|
28
|
+
const diff = diffScenes(sceneA, sceneB);
|
|
29
|
+
if (!isEmptyDiff(diff)) console.log(diff.elements.added);
|
|
30
|
+
|
|
31
|
+
const json = serializeStore(store); // persist via the host's storage of choice
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API surface
|
|
35
|
+
|
|
36
|
+
| Area | Highlights |
|
|
37
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
+
| Store | `SnapshotStore` (capture / branch / restore / listeners), `CaptureRequest`, `BranchRequest`. |
|
|
39
|
+
| Types | `Snapshot`, `Branch`, branded `VersionId` / `BranchId` (+ `versionId()` / `branchId()`), `DEFAULT_BRANCH_ID`. |
|
|
40
|
+
| Diff | `diffScenes`, `isEmptyDiff`, `SceneDiff`, `DiffCategory`. |
|
|
41
|
+
| Merge | `findCommonAncestor`, `threeWayMerge`, `mergeBranchHeads`, `resolveConflict`, `Conflict` / `MergeReport` types. |
|
|
42
|
+
| Editor bridge | `captureFromEditor`, `restoreSnapshot`, `EditorLike`, `CaptureOptions`. |
|
|
43
|
+
| Serialization | `serializeStore` / `stringifyStore` / `importStoreJson` / `importIntoStore`, `serializeSnapshot` / `deserializeSnapshot`. |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../types/dist/vec2.d.ts","../../types/dist/bounds.d.ts","../../types/dist/transform.d.ts","../../types/dist/color.d.ts","../../types/dist/ids.d.ts","../../types/dist/events.d.ts","../../types/dist/index.d.ts","../../scene/dist/style.d.ts","../../scene/dist/constants.d.ts","../../../node_modules/.pnpm/fractional-keys@0.1.1/node_modules/fractional-keys/dist/types.d.ts","../../../node_modules/.pnpm/fractional-keys@0.1.1/node_modules/fractional-keys/dist/generate.d.ts","../../../node_modules/.pnpm/fractional-keys@0.1.1/node_modules/fractional-keys/dist/jitter.d.ts","../../../node_modules/.pnpm/fractional-keys@0.1.1/node_modules/fractional-keys/dist/digits.d.ts","../../../node_modules/.pnpm/fractional-keys@0.1.1/node_modules/fractional-keys/dist/errors.d.ts","../../../node_modules/.pnpm/fractional-keys@0.1.1/node_modules/fractional-keys/dist/index.d.ts","../../scene/dist/edge.d.ts","../../scene/dist/shape.d.ts","../../scene/dist/edge-curve.d.ts","../../scene/dist/annotation.d.ts","../../scene/dist/file.d.ts","../../scene/dist/layer.d.ts","../../scene/dist/viewport.d.ts","../../scene/dist/patch.d.ts","../../scene/dist/scene.d.ts","../../scene/dist/edge-geometry.d.ts","../../scene/dist/operations.d.ts","../../scene/dist/render-bounds.d.ts","../../scene/dist/text-measure.d.ts","../../scene/dist/anchors.d.ts","../../scene/dist/snap.d.ts","../../scene/dist/outline.d.ts","../../scene/dist/annotation-geometry.d.ts","../../scene/dist/spatial.d.ts","../../scene/dist/queries.d.ts","../../scene/dist/a11y.d.ts","../../scene/dist/layout.d.ts","../../scene/dist/layout-registry.d.ts","../../scene/dist/elbow-router.d.ts","../../scene/dist/elbow-link.d.ts","../../scene/dist/heading.d.ts","../../scene/dist/diff.d.ts","../../scene/dist/three-way-merge.d.ts","../../scene/dist/container.d.ts","../../scene/dist/index.d.ts","../src/diff.ts","../src/types.ts","../src/store.ts","../src/editor-bridge.ts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/typealiases.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/index.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/zoderror.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseutil.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/enumutil.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorutil.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/partialutil.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/standard-schema.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.d.cts","../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/index.d.cts","../../serialization/dist/schema.d.ts","../../serialization/dist/serialize.d.ts","../../serialization/dist/deserialize.d.ts","../../serialization/dist/migrations.d.ts","../../serialization/dist/files.d.ts","../../serialization/dist/index.d.ts","../src/serialize.ts","../src/merge.ts","../src/index.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/compatibility/disposable.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/compatibility/indexable.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/compatibility/iterators.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/compatibility/index.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/globals.typedarray.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/buffer.buffer.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/globals.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/web-globals/abortcontroller.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/web-globals/domexception.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/web-globals/events.d.ts","../../../node_modules/.pnpm/buffer@5.7.1/node_modules/buffer/index.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/header.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/readable.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/file.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/fetch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/formdata.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/connector.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-dispatcher.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/global-origin.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool-stats.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/handlers.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/balanced-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-interceptor.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-client.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-pool.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/mock-errors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/env-http-proxy-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-handler.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/retry-agent.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/api.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/interceptors.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/util.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cookies.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/patch.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/websocket.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/eventsource.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/filereader.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/diagnostics-channel.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/content-type.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/cache.d.ts","../../../node_modules/.pnpm/undici-types@6.21.0/node_modules/undici-types/index.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/web-globals/fetch.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/web-globals/navigator.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/web-globals/storage.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/assert.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/assert/strict.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/async_hooks.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/buffer.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/child_process.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/cluster.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/console.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/constants.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/crypto.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/dgram.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/dns.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/dns/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/domain.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/events.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/fs.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/fs/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/http.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/http2.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/https.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/inspector.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/inspector.generated.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/module.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/net.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/os.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/path.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/process.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/punycode.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/querystring.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/readline.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/readline/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/repl.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/sea.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/sqlite.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/stream.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/stream/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/stream/web.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/string_decoder.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/test.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/timers.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/timers/promises.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/tls.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/trace_events.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/tty.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/url.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/util.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/v8.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/vm.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/wasi.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/worker_threads.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/zlib.d.ts","../../../node_modules/.pnpm/@types+node@22.19.19/node_modules/@types/node/index.d.ts"],"fileIdsList":[[134,180,181,183,200,201],[134,182,183,200,201],[183,200,201],[134,183,188,200,201,218],[134,183,184,189,194,200,201,203,215,226],[134,183,184,185,194,200,201,203],[134,183,200,201],[129,130,131,134,183,200,201],[134,183,186,200,201,227],[134,183,187,188,195,200,201,204],[134,183,188,200,201,215,223],[134,183,189,191,194,200,201,203],[134,182,183,190,200,201],[134,183,191,192,200,201],[134,183,193,194,200,201],[134,182,183,194,200,201],[134,183,194,195,196,200,201,215,226],[134,183,194,195,196,200,201,210,215,218],[134,176,183,191,194,197,200,201,203,215,226],[134,183,194,195,197,198,200,201,203,215,223,226],[134,183,197,199,200,201,215,223,226],[132,133,134,135,136,137,138,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232],[134,183,194,200,201],[134,183,200,201,202,226],[134,183,191,194,200,201,203,215],[134,183,200,201,204],[134,183,200,201,205],[134,182,183,200,201,206],[134,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232],[134,183,200,201,208],[134,183,200,201,209],[134,183,194,200,201,210,211],[134,183,200,201,210,212,227,229],[134,183,195,200,201],[134,183,194,200,201,215,216,218],[134,183,200,201,217,218],[134,183,200,201,215,216],[134,183,200,201,218],[134,183,200,201,219],[134,180,183,200,201,215,220,226],[134,183,194,200,201,221,222],[134,183,200,201,221,222],[134,183,188,200,201,203,215,223],[134,183,200,201,224],[134,183,200,201,203,225],[134,183,197,200,201,209,226],[134,183,188,200,201,227],[134,183,200,201,215,228],[134,183,200,201,202,229],[134,183,200,201,230],[134,176,183,200,201],[134,176,183,194,196,200,201,206,215,218,226,228,229,231],[134,183,200,201,215,232],[67,134,183,200,201],[67,68,69,70,71,134,183,200,201],[134,148,152,183,200,201,226],[134,148,183,200,201,215,226],[134,143,183,200,201],[134,145,148,183,200,201,223,226],[134,183,200,201,203,223],[134,183,200,201,233],[134,143,183,200,201,233],[134,145,148,183,200,201,203,226],[134,140,141,144,147,183,194,200,201,215,226],[134,148,155,183,200,201],[134,140,146,183,200,201],[134,148,169,170,183,200,201],[134,144,148,183,200,201,218,226,233],[134,169,183,200,201,233],[134,142,143,183,200,201,233],[134,148,183,200,201],[134,142,143,144,145,146,147,148,149,150,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,170,171,172,173,174,175,183,200,201],[134,148,163,183,200,201],[134,148,155,156,183,200,201],[134,146,148,156,157,183,200,201],[134,147,183,200,201],[134,140,143,148,183,200,201],[134,148,152,156,157,183,200,201],[134,152,183,200,201],[134,146,148,151,183,200,201,226],[134,140,145,148,155,183,200,201],[134,183,200,201,215],[134,143,148,169,183,200,201,231,233],[118,134,183,200,201],[109,110,134,183,200,201],[106,107,109,111,112,117,134,183,200,201],[107,109,134,183,200,201],[117,134,183,200,201],[109,134,183,200,201],[106,107,109,112,113,114,115,116,134,183,200,201],[106,107,108,134,183,200,201],[74,134,183,200,201],[64,73,74,134,183,200,201],[64,76,81,134,183,200,201],[64,134,183,200,201],[64,74,81,134,183,200,201],[64,81,134,183,200,201],[64,73,75,81,134,183,200,201],[64,65,72,134,183,200,201],[64,73,81,134,183,200,201],[64,74,134,183,200,201],[65,66,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,134,183,200,201],[64,72,134,183,200,201],[64,80,81,134,183,200,201],[64,74,80,81,134,183,200,201],[64,73,74,76,78,79,80,81,134,183,200,201],[64,73,74,76,77,78,79,134,183,200,201],[64,73,74,78,81,90,134,183,200,201],[64,72,73,74,76,77,78,79,80,134,183,200,201],[64,65,72,73,134,183,200,201],[101,134,183,200,201],[64,101,134,183,200,201],[120,121,122,123,124,134,183,200,201],[119,134,183,200,201],[101,120,134,183,200,201],[58,134,183,200,201],[58,59,60,61,62,63,134,183,200,201],[101,103,104,134,183,200,201],[102,103,104,105,126,127,134,183,200,201],[64,101,103,104,134,183,200,201],[103,104,125,134,183,200,201],[101,103,134,183,200,201]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},"a9dc2e59fb40b94411bd995a0013c15385b99599a18b7141cf3eafd80c7f0f96","4015dc819b09b93f989d4df8f1f0f36cb99cb2aad8102ab8b4b27fb6020beb5f","ed06a7b359e2125c375f6bada6631fd038473dd624309b8a43a824693a6f6c89","46fa0b276ad58dc963c574f72bb9456b881f3d61bc0fe6827c24f3f02baa6038","1f0260dbafda11af88b11f1b6d662ee45517d44c8cc9a7248bd61d2d8ab1f880","502657b9a54e290098ba4f955efa476b91648b24d5310b8c6e7aa0d4cf8945ae","90755de39a18e2894ad3cced6cdf4cb670e09868b01a6f6465af558d865bf848","b8e3c1f3a85e05bcbc56fa28558cffc68ac40e4158afdc2d702ea825ce21d14d","c196961c4aa13e3bf28a7e56ac7fa0b0cbfc668eca4496292d629dd18f43296b",{"version":"bce89d3ef847715b91ffd525a157c779be8fafebe823671815f7ce96f27afcda","impliedFormat":99},{"version":"c67f9d85070618f586d632cf184b986eb604f426b90aa68ecdad1ac68ca3151c","impliedFormat":99},{"version":"c656cc6ded557aff87a6c823142852e3548c6a14f84bb48ee35c3e57b6ebc03b","impliedFormat":99},{"version":"0e34130243c29d8d826f868c4e00ff586b349627cb241b3d89f0459a6cdeff4d","impliedFormat":99},{"version":"d555c6cb465cc5cf8127adbbc496720d5200c9dfafa777bbf9dfdea74ebfe3a3","impliedFormat":99},{"version":"27a6936a863edf777150af3ebc65939fa34f51d68385f8a7f198d8ea53685a4d","impliedFormat":99},"17ee722c53770caad5479081a3db9f0df8135a8f061ea9ce57a507ca0c424cce","78bde316dcb094df77d06b893e0b965d318ac5708d09e7cf6206931263be32e6","d081374b0bf74e2748138e8b0a56458e12e2ee7bd07fb239b92c97a33bba8d70","b85f83aa4b7fb1abc375a73cb706295a146b9f22cf9fa5ec89105fcff6ea1495","fd0cd0a179e95f7d4d5f7370209f6b413006242a045137d33ca230ae015ba760","fa716666e5bedc99e38d37def5182924b9dd9e6298c2751f8cebe0fc631ef697","48280d2635c39dd226b7e5bb71d0519f355b60d4d92e9f6b5b4a427aa28412f8","8bdcd8a58fead736e81808193884907482c8d354f13a0516e9b236a07622c727","8ebfa15cb2e79b885a21ae5f92507b5b9dd9b01041143554903c163f86611849","4233c4d8ac9cb79b3b71e4923eb486f08f5f2c6508fc177192081a402bee38b3","dfa88df7638cc24634255691d0a3fb72a4910b73211da89fab8f2362730cb3b2","75ea946ee4d31489f494b0def56b2db669c3aac052713387d6edc51dc2ca86db","26ce9aa6f798212e39770c45142239f3a54fa63697ba90bae90c6d7ac7da825a","eceda86937454d399a4e4cd4a3e25835a4ac80ab930f399b20f53d8f1c772457","8b12bcaa49f76ee1ce7f77943a297078dba53abedd344da6d370012eab482c07","ebfed381c5296dbb1ebae8265ca08dbce33929fa829f6ac11f2f591beb1f4485","ae557ba7a3d28e8909ac395365eb5f8ff63bc28eb2eaace61650ed51f1bc1808","95784f449b26dbdf4aadd2f99a5c2f6c419d80f993ececa6c0c3e0159b452aa5","89c0f7c64772fcb38eda1e15b26da3e53e4101c968a0eeb14954f154aee4dac1","6e7e44d7615d2899c2dd6be4e15bbb2cd0b7f4afec2379c08db14b9eac5c9b43","a1f5b4a129cd4b8f013533f200baf74615d690c41f1ef2147bd40ef6110c4a1b","d1b901b618ec72bff0fcb657edf03d83e2bcbb2687a9cddadea48a24ab23faf2","9a02cb3cccc3eeb3fea9327c47dbda2076e21f3da7b2eb659871dc91b8572f42","1778dfd35a7d5885896c436792662c8d602ea8cf03aeed97b0381b6e82c4e980","f730ff4577c8d45cb4a587d078ee5b692613c3de57f26a27a4be74c183adc226","60bd456f1b63861f880c386ddf1b3916098bbafbf4b5a46a5e5ebc4fcb9434c4","f2c0b5b634eed4010d9396710281a7fdc7019fe47507e8bcb706a58af985548a","baeb8f9be968778478ffa26099ec4211dd28c6dea1633fd8fd1560c34fdd0269","5df76ca2d799039334a825b621129061b89022808e0943397e045bc6feec894c",{"version":"66d829b3c8beccce2cb5cddb6c60097d6d921fcd36455071b1812dd3e2a441cd","signature":"8b17da6c1f68b9c4ecce0330a1f47a27a98f4b7b57736f64d3cc49115b0b5a18"},{"version":"709e1df8d39f772ea94126aba941e33ed7bb91c6a9934740b68004f24dcd02f6","signature":"961cf4ebd7375fc2f2f18882eb5836692d16195cb21f89d65730c08f1fba0a16"},{"version":"876a2dde05c81f47dd995fc166e45374b78ca90df9e394f08e307a51264f60cf","signature":"8c6c0c9ea44f050c18c15fc4bd69256676f63a2192e0861379c94538270fb388"},{"version":"a0ef8e526f1eaf3a40d4b2befab0f6e3582f14b7d20b85971a2957c8ec51df77","signature":"1d8eafdd1e8df40487c9622f9e94c2a356c74dcad5130d73b9e36977b696969e"},{"version":"d3cfde44f8089768ebb08098c96d01ca260b88bccf238d55eee93f1c620ff5a5","impliedFormat":1},{"version":"293eadad9dead44c6fd1db6de552663c33f215c55a1bfa2802a1bceed88ff0ec","impliedFormat":1},{"version":"833e92c058d033cde3f29a6c7603f517001d1ddd8020bc94d2067a3bc69b2a8e","impliedFormat":1},{"version":"08b2fae7b0f553ad9f79faec864b179fc58bc172e295a70943e8585dd85f600c","impliedFormat":1},{"version":"f12edf1672a94c578eca32216839604f1e1c16b40a1896198deabf99c882b340","impliedFormat":1},{"version":"e3498cf5e428e6c6b9e97bd88736f26d6cf147dedbfa5a8ad3ed8e05e059af8a","impliedFormat":1},{"version":"dba3f34531fd9b1b6e072928b6f885aa4d28dd6789cbd0e93563d43f4b62da53","impliedFormat":1},{"version":"f672c876c1a04a223cf2023b3d91e8a52bb1544c576b81bf64a8fec82be9969c","impliedFormat":1},{"version":"e4b03ddcf8563b1c0aee782a185286ed85a255ce8a30df8453aade2188bbc904","impliedFormat":1},{"version":"2329d90062487e1eaca87b5e06abcbbeeecf80a82f65f949fd332cfcf824b87b","impliedFormat":1},{"version":"25b3f581e12ede11e5739f57a86e8668fbc0124f6649506def306cad2c59d262","impliedFormat":1},{"version":"4fdb529707247a1a917a4626bfb6a293d52cd8ee57ccf03830ec91d39d606d6d","impliedFormat":1},{"version":"a9ebb67d6bbead6044b43714b50dcb77b8f7541ffe803046fdec1714c1eba206","impliedFormat":1},{"version":"5780b706cece027f0d4444fbb4e1af62dc51e19da7c3d3719f67b22b033859b9","impliedFormat":1},"fabffe8163cb796911400ca0c9b16eb5254365df1327053a47f0b61606f91556","43c88c7da4f2fa63d6c384389d800eec434c87634631234e6689f9e1b66286c7","b8a77950ffef9eeba0134b6eb0d66d9b29b50631c9ed83926cfc68c60b4dacc6","7db2302e2dc9d8e8946f1f3f1c95e102842074c5fd630bc1d22d57c2c5c1e2ac","1217640af9bd12e58da3db7936121c85b3f2427bd6d234907954d9fc61b09166","fafa8a0cab8927c5d19b2f38e0f32c3427e7ea5468c5dc252ddcec3c085abc18",{"version":"60011918d55abcf19dcb4c1a4aa912faae9ad0f1b4a2c9de07a5d09f95fbd1a8","signature":"ccc7f852a12a4dd30aa8b0dc0575af446f2de6df7ce42fe09759ed7f2f318fa7"},{"version":"f7e3e90101f0aa7badd06a30b293e328e90ae320fb01199faa656d3028254bc4","signature":"224fd7c63e01564060400974934622a7f04aa4cf4c446a36033e0295f000720a"},{"version":"bdc689ae715594384dee41146c99093bb4a386de1a24da48ef133bd3ade5d334","signature":"71e0b7c84786a69ad532ea6d5359efb9115cd0e5c625607cfc030a0678cfddba"},{"version":"6c7176368037af28cb72f2392010fa1cef295d6d6744bca8cfb54985f3a18c3e","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab41ef1f2cdafb8df48be20cd969d875602483859dc194e9c97c8a576892c052","affectsGlobalScope":true,"impliedFormat":1},{"version":"437e20f2ba32abaeb7985e0afe0002de1917bc74e949ba585e49feba65da6ca1","affectsGlobalScope":true,"impliedFormat":1},{"version":"21d819c173c0cf7cc3ce57c3276e77fd9a8a01d35a06ad87158781515c9a438a","impliedFormat":1},{"version":"98cffbf06d6bab333473c70a893770dbe990783904002c4f1a960447b4b53dca","affectsGlobalScope":true,"impliedFormat":1},{"version":"3af97acf03cc97de58a3a4bc91f8f616408099bc4233f6d0852e72a8ffb91ac9","affectsGlobalScope":true,"impliedFormat":1},{"version":"808069bba06b6768b62fd22429b53362e7af342da4a236ed2d2e1c89fcca3b4a","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"5929864ce17fba74232584d90cb721a89b7ad277220627cc97054ba15a98ea8f","impliedFormat":1},{"version":"763fe0f42b3d79b440a9b6e51e9ba3f3f91352469c1e4b3b67bfa4ff6352f3f4","impliedFormat":1},{"version":"25c8056edf4314820382a5fdb4bb7816999acdcb929c8f75e3f39473b87e85bc","impliedFormat":1},{"version":"c464d66b20788266e5353b48dc4aa6bc0dc4a707276df1e7152ab0c9ae21fad8","impliedFormat":1},{"version":"78d0d27c130d35c60b5e5566c9f1e5be77caf39804636bc1a40133919a949f21","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"1d6e127068ea8e104a912e42fc0a110e2aa5a66a356a917a163e8cf9a65e4a75","impliedFormat":1},{"version":"5ded6427296cdf3b9542de4471d2aa8d3983671d4cac0f4bf9c637208d1ced43","impliedFormat":1},{"version":"7f182617db458e98fc18dfb272d40aa2fff3a353c44a89b2c0ccb3937709bfb5","impliedFormat":1},{"version":"cadc8aced301244057c4e7e73fbcae534b0f5b12a37b150d80e5a45aa4bebcbd","impliedFormat":1},{"version":"385aab901643aa54e1c36f5ef3107913b10d1b5bb8cbcd933d4263b80a0d7f20","impliedFormat":1},{"version":"9670d44354bab9d9982eca21945686b5c24a3f893db73c0dae0fd74217a4c219","impliedFormat":1},{"version":"0b8a9268adaf4da35e7fa830c8981cfa22adbbe5b3f6f5ab91f6658899e657a7","impliedFormat":1},{"version":"11396ed8a44c02ab9798b7dca436009f866e8dae3c9c25e8c1fbc396880bf1bb","impliedFormat":1},{"version":"ba7bc87d01492633cb5a0e5da8a4a42a1c86270e7b3d2dea5d156828a84e4882","impliedFormat":1},{"version":"4893a895ea92c85345017a04ed427cbd6a1710453338df26881a6019432febdd","impliedFormat":1},{"version":"c21dc52e277bcfc75fac0436ccb75c204f9e1b3fa5e12729670910639f27343e","impliedFormat":1},{"version":"13f6f39e12b1518c6650bbb220c8985999020fe0f21d818e28f512b7771d00f9","impliedFormat":1},{"version":"9b5369969f6e7175740bf51223112ff209f94ba43ecd3bb09eefff9fd675624a","impliedFormat":1},{"version":"4fe9e626e7164748e8769bbf74b538e09607f07ed17c2f20af8d680ee49fc1da","impliedFormat":1},{"version":"24515859bc0b836719105bb6cc3d68255042a9f02a6022b3187948b204946bd2","impliedFormat":1},{"version":"ea0148f897b45a76544ae179784c95af1bd6721b8610af9ffa467a518a086a43","impliedFormat":1},{"version":"24c6a117721e606c9984335f71711877293a9651e44f59f3d21c1ea0856f9cc9","impliedFormat":1},{"version":"dd3273ead9fbde62a72949c97dbec2247ea08e0c6952e701a483d74ef92d6a17","impliedFormat":1},{"version":"405822be75ad3e4d162e07439bac80c6bcc6dbae1929e179cf467ec0b9ee4e2e","impliedFormat":1},{"version":"0db18c6e78ea846316c012478888f33c11ffadab9efd1cc8bcc12daded7a60b6","impliedFormat":1},{"version":"e61be3f894b41b7baa1fbd6a66893f2579bfad01d208b4ff61daef21493ef0a8","impliedFormat":1},{"version":"bd0532fd6556073727d28da0edfd1736417a3f9f394877b6d5ef6ad88fba1d1a","impliedFormat":1},{"version":"89167d696a849fce5ca508032aabfe901c0868f833a8625d5a9c6e861ef935d2","impliedFormat":1},{"version":"615ba88d0128ed16bf83ef8ccbb6aff05c3ee2db1cc0f89ab50a4939bfc1943f","impliedFormat":1},{"version":"a4d551dbf8746780194d550c88f26cf937caf8d56f102969a110cfaed4b06656","impliedFormat":1},{"version":"8bd86b8e8f6a6aa6c49b71e14c4ffe1211a0e97c80f08d2c8cc98838006e4b88","impliedFormat":1},{"version":"317e63deeb21ac07f3992f5b50cdca8338f10acd4fbb7257ebf56735bf52ab00","impliedFormat":1},{"version":"4732aec92b20fb28c5fe9ad99521fb59974289ed1e45aecb282616202184064f","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"bf67d53d168abc1298888693338cb82854bdb2e69ef83f8a0092093c2d562107","impliedFormat":1},{"version":"b52476feb4a0cbcb25e5931b930fc73cb6643fb1a5060bf8a3dda0eeae5b4b68","affectsGlobalScope":true,"impliedFormat":1},{"version":"f9501cc13ce624c72b61f12b3963e84fad210fbdf0ffbc4590e08460a3f04eba","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0fa06ada475b910e2106c98c68b10483dc8811d0c14a8a8dd36efb2672485b29","impliedFormat":1},{"version":"33e5e9aba62c3193d10d1d33ae1fa75c46a1171cf76fef750777377d53b0303f","impliedFormat":1},{"version":"2b06b93fd01bcd49d1a6bd1f9b65ddcae6480b9a86e9061634d6f8e354c1468f","impliedFormat":1},{"version":"6a0cd27e5dc2cfbe039e731cf879d12b0e2dded06d1b1dedad07f7712de0d7f4","affectsGlobalScope":true,"impliedFormat":1},{"version":"13f5c844119c43e51ce777c509267f14d6aaf31eafb2c2b002ca35584cd13b29","impliedFormat":1},{"version":"e60477649d6ad21542bd2dc7e3d9ff6853d0797ba9f689ba2f6653818999c264","impliedFormat":1},{"version":"c2510f124c0293ab80b1777c44d80f812b75612f297b9857406468c0f4dafe29","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"4c829ab315f57c5442c6667b53769975acbf92003a66aef19bce151987675bd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"b2ade7657e2db96d18315694789eff2ddd3d8aea7215b181f8a0b303277cc579","impliedFormat":1},{"version":"9855e02d837744303391e5623a531734443a5f8e6e8755e018c41d63ad797db2","impliedFormat":1},{"version":"4d631b81fa2f07a0e63a9a143d6a82c25c5f051298651a9b69176ba28930756d","impliedFormat":1},{"version":"836a356aae992ff3c28a0212e3eabcb76dd4b0cc06bcb9607aeef560661b860d","impliedFormat":1},{"version":"1e0d1f8b0adfa0b0330e028c7941b5a98c08b600efe7f14d2d2a00854fb2f393","impliedFormat":1},{"version":"41670ee38943d9cbb4924e436f56fc19ee94232bc96108562de1a734af20dc2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c906fb15bd2aabc9ed1e3f44eb6a8661199d6c320b3aa196b826121552cb3695","impliedFormat":1},{"version":"22295e8103f1d6d8ea4b5d6211e43421fe4564e34d0dd8e09e520e452d89e659","impliedFormat":1},{"version":"58647d85d0f722a1ce9de50955df60a7489f0593bf1a7015521efe901c06d770","impliedFormat":1},{"version":"73b5fa37db36eeac90c4d752e39586f1b57187400c4f5280fd05f16437287a45","impliedFormat":1},{"version":"a10f0e1854f3316d7ee437b79649e5a6ae3ae14ffe6322b02d4987071a95362e","impliedFormat":1},{"version":"e208f73ef6a980104304b0d2ca5f6bf1b85de6009d2c7e404028b875020fa8f2","impliedFormat":1},{"version":"d163b6bc2372b4f07260747cbc6c0a6405ab3fbcea3852305e98ac43ca59f5bc","impliedFormat":1},{"version":"e6fa9ad47c5f71ff733744a029d1dc472c618de53804eae08ffc243b936f87ff","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6f137d651076822d4fe884287e68fd61785a0d3d1fdb250a5059b691fa897db","impliedFormat":1},{"version":"24826ed94a78d5c64bd857570fdbd96229ad41b5cb654c08d75a9845e3ab7dde","impliedFormat":1},{"version":"8b479a130ccb62e98f11f136d3ac80f2984fdc07616516d29881f3061f2dd472","impliedFormat":1},{"version":"928af3d90454bf656a52a48679f199f64c1435247d6189d1caf4c68f2eaf921f","affectsGlobalScope":true,"impliedFormat":1},{"version":"bceb58df66ab8fb00170df20cd813978c5ab84be1d285710c4eb005d8e9d8efb","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f16a7e4deafa527ed9995a772bb380eb7d3c2c0fd4ae178c5263ed18394db2c","impliedFormat":1},{"version":"933921f0bb0ec12ef45d1062a1fc0f27635318f4d294e4d99de9a5493e618ca2","impliedFormat":1},{"version":"71a0f3ad612c123b57239a7749770017ecfe6b66411488000aba83e4546fde25","impliedFormat":1},{"version":"77fbe5eecb6fac4b6242bbf6eebfc43e98ce5ccba8fa44e0ef6a95c945ff4d98","impliedFormat":1},{"version":"4f9d8ca0c417b67b69eeb54c7ca1bedd7b56034bb9bfd27c5d4f3bc4692daca7","impliedFormat":1},{"version":"814118df420c4e38fe5ae1b9a3bafb6e9c2aa40838e528cde908381867be6466","impliedFormat":1},{"version":"a3fc63c0d7b031693f665f5494412ba4b551fe644ededccc0ab5922401079c95","impliedFormat":1},{"version":"80523c00b8544a2000ae0143e4a90a00b47f99823eb7926c1e03c494216fc363","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"746911b62b329587939560deb5c036aca48aece03147b021fa680223255d5183","affectsGlobalScope":true,"impliedFormat":1},{"version":"18fd40412d102c5564136f29735e5d1c3b455b8a37f920da79561f1fde068208","impliedFormat":1},{"version":"c8d3e5a18ba35629954e48c4cc8f11dc88224650067a172685c736b27a34a4dc","impliedFormat":1},{"version":"f0be1b8078cd549d91f37c30c222c2a187ac1cf981d994fb476a1adc61387b14","affectsGlobalScope":true,"impliedFormat":1},{"version":"0aaed1d72199b01234152f7a60046bc947f1f37d78d182e9ae09c4289e06a592","impliedFormat":1},{"version":"2b55d426ff2b9087485e52ac4bc7cfafe1dc420fc76dad926cd46526567c501a","impliedFormat":1},{"version":"66ba1b2c3e3a3644a1011cd530fb444a96b1b2dfe2f5e837a002d41a1a799e60","impliedFormat":1},{"version":"7e514f5b852fdbc166b539fdd1f4e9114f29911592a5eb10a94bb3a13ccac3c4","impliedFormat":1},{"version":"5b7aa3c4c1a5d81b411e8cb302b45507fea9358d3569196b27eb1a27ae3a90ef","affectsGlobalScope":true,"impliedFormat":1},{"version":"5987a903da92c7462e0b35704ce7da94d7fdc4b89a984871c0e2b87a8aae9e69","affectsGlobalScope":true,"impliedFormat":1},{"version":"ea08a0345023ade2b47fbff5a76d0d0ed8bff10bc9d22b83f40858a8e941501c","impliedFormat":1},{"version":"47613031a5a31510831304405af561b0ffaedb734437c595256bb61a90f9311b","impliedFormat":1},{"version":"ae062ce7d9510060c5d7e7952ae379224fb3f8f2dd74e88959878af2057c143b","impliedFormat":1},{"version":"8a1a0d0a4a06a8d278947fcb66bf684f117bf147f89b06e50662d79a53be3e9f","affectsGlobalScope":true,"impliedFormat":1},{"version":"358765d5ea8afd285d4fd1532e78b88273f18cb3f87403a9b16fef61ac9fdcfe","impliedFormat":1},{"version":"9f55299850d4f0921e79b6bf344b47c420ce0f507b9dcf593e532b09ea7eeea1","impliedFormat":1}],"root":[[102,105],[126,128]],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationMap":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noPropertyAccessFromIndexSignature":false,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[180,1],[181,1],[182,2],[134,3],[183,4],[184,5],[185,6],[129,7],[132,8],[130,7],[131,7],[186,9],[187,10],[188,11],[189,12],[190,13],[191,14],[192,14],[193,15],[194,16],[195,17],[196,18],[135,7],[133,7],[197,19],[198,20],[199,21],[233,22],[200,23],[201,7],[202,24],[203,25],[204,26],[205,27],[206,28],[207,29],[208,30],[209,31],[210,32],[211,32],[212,33],[213,7],[214,34],[215,35],[217,36],[216,37],[218,38],[219,39],[220,40],[221,41],[222,42],[223,43],[224,44],[225,45],[226,46],[227,47],[228,48],[229,49],[230,50],[136,7],[137,7],[138,7],[177,51],[178,7],[179,7],[231,52],[232,53],[139,7],[70,7],[71,7],[68,54],[72,55],[69,54],[67,7],[56,7],[57,7],[11,7],[10,7],[2,7],[12,7],[13,7],[14,7],[15,7],[16,7],[17,7],[18,7],[19,7],[3,7],[20,7],[21,7],[4,7],[22,7],[26,7],[23,7],[24,7],[25,7],[27,7],[28,7],[29,7],[5,7],[30,7],[31,7],[32,7],[33,7],[6,7],[37,7],[34,7],[35,7],[36,7],[38,7],[7,7],[39,7],[44,7],[45,7],[40,7],[41,7],[42,7],[43,7],[8,7],[49,7],[46,7],[47,7],[48,7],[50,7],[9,7],[51,7],[52,7],[53,7],[55,7],[54,7],[1,7],[155,56],[165,57],[154,56],[175,58],[146,59],[145,60],[174,61],[168,62],[173,63],[148,64],[162,65],[147,66],[171,67],[143,68],[142,61],[172,69],[144,70],[149,71],[150,7],[153,71],[140,7],[176,72],[166,73],[157,74],[158,75],[160,76],[156,77],[159,78],[169,61],[151,79],[152,80],[161,81],[141,82],[164,73],[163,71],[167,7],[170,83],[119,84],[111,85],[118,86],[113,7],[114,7],[112,87],[115,88],[106,7],[107,7],[108,84],[110,89],[116,7],[117,90],[109,91],[92,92],[86,93],[89,94],[76,95],[66,7],[100,96],[98,97],[75,95],[82,98],[73,99],[96,100],[95,95],[77,95],[97,101],[101,102],[78,103],[94,104],[93,105],[83,106],[88,101],[80,107],[91,108],[84,101],[81,109],[74,110],[87,97],[90,95],[65,95],[85,7],[99,96],[79,95],[122,111],[124,112],[125,113],[123,7],[120,114],[121,115],[59,7],[61,7],[63,116],[62,7],[64,117],[60,7],[58,7],[102,112],[105,118],[128,119],[127,120],[126,121],[104,122],[103,111]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}
|
package/dist/diff.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AnnotationId, LinkId, LayerId, ElementId } from "@oh-just-another/types";
|
|
2
|
+
import type { Scene } from "@oh-just-another/scene";
|
|
3
|
+
/**
|
|
4
|
+
* Cheap structural diff between two scenes. Reports ids per category
|
|
5
|
+
* (shapes / edges / layers / annotations) split into `added`, `removed`,
|
|
6
|
+
* and `modified` (same id, different value).
|
|
7
|
+
*
|
|
8
|
+
* Identity comparison (`!==`) is enough because scene ops always return new
|
|
9
|
+
* objects on change. If two snapshots have identical content but the host
|
|
10
|
+
* re-built shape objects, those shapes appear as "modified".
|
|
11
|
+
*/
|
|
12
|
+
export interface SceneDiff {
|
|
13
|
+
readonly elements: DiffCategory<ElementId>;
|
|
14
|
+
readonly links: DiffCategory<LinkId>;
|
|
15
|
+
readonly layers: DiffCategory<LayerId>;
|
|
16
|
+
readonly annotations: DiffCategory<AnnotationId>;
|
|
17
|
+
}
|
|
18
|
+
export interface DiffCategory<Id> {
|
|
19
|
+
readonly added: readonly Id[];
|
|
20
|
+
readonly removed: readonly Id[];
|
|
21
|
+
readonly modified: readonly Id[];
|
|
22
|
+
}
|
|
23
|
+
export declare const diffScenes: (before: Scene, after: Scene) => SceneDiff;
|
|
24
|
+
/** True when the diff has zero changes across every category. */
|
|
25
|
+
export declare const isEmptyDiff: (d: SceneDiff) => boolean;
|
|
26
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,YAAY,CAAC,EAAE;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,CAAC;CAClC;AAED,eAAO,MAAM,UAAU,GAAI,QAAQ,KAAK,EAAE,OAAO,KAAK,KAAG,SAKvD,CAAC;AAiBH,iEAAiE;AACjE,eAAO,MAAM,WAAW,GAAI,GAAG,SAAS,KAAG,OAYN,CAAC"}
|
package/dist/diff.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const diffScenes = (before, after) => ({
|
|
2
|
+
elements: diffMap(before.elements, after.elements),
|
|
3
|
+
links: diffMap(before.links, after.links),
|
|
4
|
+
layers: diffMap(before.layers, after.layers),
|
|
5
|
+
annotations: diffMap(before.annotations, after.annotations),
|
|
6
|
+
});
|
|
7
|
+
const diffMap = (before, after) => {
|
|
8
|
+
const added = [];
|
|
9
|
+
const removed = [];
|
|
10
|
+
const modified = [];
|
|
11
|
+
for (const [id, value] of after) {
|
|
12
|
+
const prev = before.get(id);
|
|
13
|
+
if (prev === undefined)
|
|
14
|
+
added.push(id);
|
|
15
|
+
else if (prev !== value)
|
|
16
|
+
modified.push(id);
|
|
17
|
+
}
|
|
18
|
+
for (const [id] of before) {
|
|
19
|
+
if (!after.has(id))
|
|
20
|
+
removed.push(id);
|
|
21
|
+
}
|
|
22
|
+
return { added, removed, modified };
|
|
23
|
+
};
|
|
24
|
+
/** True when the diff has zero changes across every category. */
|
|
25
|
+
export const isEmptyDiff = (d) => d.elements.added.length === 0 &&
|
|
26
|
+
d.elements.removed.length === 0 &&
|
|
27
|
+
d.elements.modified.length === 0 &&
|
|
28
|
+
d.links.added.length === 0 &&
|
|
29
|
+
d.links.removed.length === 0 &&
|
|
30
|
+
d.links.modified.length === 0 &&
|
|
31
|
+
d.layers.added.length === 0 &&
|
|
32
|
+
d.layers.removed.length === 0 &&
|
|
33
|
+
d.layers.modified.length === 0 &&
|
|
34
|
+
d.annotations.added.length === 0 &&
|
|
35
|
+
d.annotations.removed.length === 0 &&
|
|
36
|
+
d.annotations.modified.length === 0;
|
|
37
|
+
//# sourceMappingURL=diff.js.map
|
package/dist/diff.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAyBA,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAa,EAAE,KAAY,EAAa,EAAE,CAAC,CAAC;IACrE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;IAClD,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACzC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC;CAC5D,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,CAAO,MAAyB,EAAE,KAAwB,EAAmB,EAAE;IAC7F,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,MAAM,OAAO,GAAQ,EAAE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K,CAAC;IAC9B,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;IAChC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;IAClC,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Scene } from "@oh-just-another/scene";
|
|
2
|
+
import { type SnapshotStore } from "./store.js";
|
|
3
|
+
import type { Snapshot, VersionId } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Minimal slice of the `Editor` interface this package needs. Hosts pass
|
|
6
|
+
* their `Editor` instance — the bridge stays decoupled from `@state`,
|
|
7
|
+
* preserving the layered dependency graph (`@versioning` → `@scene` only).
|
|
8
|
+
*/
|
|
9
|
+
export interface EditorLike {
|
|
10
|
+
readonly scene: Scene;
|
|
11
|
+
loadScene(scene: Scene, options?: {
|
|
12
|
+
preserveHistory?: boolean;
|
|
13
|
+
}): void;
|
|
14
|
+
}
|
|
15
|
+
export interface CaptureOptions {
|
|
16
|
+
readonly message: string;
|
|
17
|
+
readonly author: {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read the editor's current scene, push a new snapshot into the store on the
|
|
24
|
+
* current branch, and return the snapshot.
|
|
25
|
+
*/
|
|
26
|
+
export declare const captureFromEditor: (store: SnapshotStore, editor: EditorLike, options: CaptureOptions) => Snapshot;
|
|
27
|
+
/**
|
|
28
|
+
* Restore a snapshot into the editor. Clears local history by default — the
|
|
29
|
+
* snapshot is treated as a new starting point. Pass `{ preserveHistory: true }`
|
|
30
|
+
* to keep the existing undo stack (for collab-style restore where remote peers
|
|
31
|
+
* should not lose their local history).
|
|
32
|
+
*/
|
|
33
|
+
export declare const restoreSnapshot: (store: SnapshotStore, editor: EditorLike, versionId: VersionId, options?: {
|
|
34
|
+
preserveHistory?: boolean;
|
|
35
|
+
}) => boolean;
|
|
36
|
+
//# sourceMappingURL=editor-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-bridge.d.ts","sourceRoot":"","sources":["../src/editor-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACxE;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,OAAO,aAAa,EACpB,QAAQ,UAAU,EAClB,SAAS,cAAc,KACtB,QAKC,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,aAAa,EACpB,QAAQ,UAAU,EAClB,WAAW,SAAS,EACpB,UAAS;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAO,KAC1C,OAKF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {} from "./store.js";
|
|
2
|
+
/**
|
|
3
|
+
* Read the editor's current scene, push a new snapshot into the store on the
|
|
4
|
+
* current branch, and return the snapshot.
|
|
5
|
+
*/
|
|
6
|
+
export const captureFromEditor = (store, editor, options) => store.capture({
|
|
7
|
+
scene: editor.scene,
|
|
8
|
+
author: options.author,
|
|
9
|
+
message: options.message,
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Restore a snapshot into the editor. Clears local history by default — the
|
|
13
|
+
* snapshot is treated as a new starting point. Pass `{ preserveHistory: true }`
|
|
14
|
+
* to keep the existing undo stack (for collab-style restore where remote peers
|
|
15
|
+
* should not lose their local history).
|
|
16
|
+
*/
|
|
17
|
+
export const restoreSnapshot = (store, editor, versionId, options = {}) => {
|
|
18
|
+
const snap = store.get(versionId);
|
|
19
|
+
if (!snap)
|
|
20
|
+
return false;
|
|
21
|
+
editor.loadScene(snap.scene, { preserveHistory: options.preserveHistory ?? false });
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=editor-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-bridge.js","sourceRoot":"","sources":["../src/editor-bridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,MAAM,YAAY,CAAC;AAkBhD;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAoB,EACpB,MAAkB,EAClB,OAAuB,EACb,EAAE,CACZ,KAAK,CAAC,OAAO,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,KAAK;IACnB,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,OAAO,EAAE,OAAO,CAAC,OAAO;CACzB,CAAC,CAAC;AAEL;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAoB,EACpB,MAAkB,EAClB,SAAoB,EACpB,UAAyC,EAAE,EAClC,EAAE;IACX,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,KAAK,EAAE,CAAC,CAAC;IACpF,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { type VersionId, type BranchId, type Snapshot, type Branch, versionId, branchId, DEFAULT_BRANCH_ID, } from "./types.js";
|
|
2
|
+
export { SnapshotStore, type CaptureRequest, type BranchRequest } from "./store.js";
|
|
3
|
+
export { diffScenes, isEmptyDiff, type SceneDiff, type DiffCategory } from "./diff.js";
|
|
4
|
+
export { captureFromEditor, restoreSnapshot, type EditorLike, type CaptureOptions, } from "./editor-bridge.js";
|
|
5
|
+
export { serializeSnapshot, deserializeSnapshot, serializeStore, stringifyStore, importIntoStore, importStoreJson, type SerializedSnapshot, type SerializedBranch, type SerializedStore, } from "./serialize.js";
|
|
6
|
+
export { findCommonAncestor, threeWayMerge, resolveConflict, mergeBranchHeads, type Conflict, type SceneConflict, type MergeReport, type ConflictResolution, } from "./merge.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,SAAS,EACT,QAAQ,EACR,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACvF,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,KAAK,UAAU,EACf,KAAK,cAAc,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { versionId, branchId, DEFAULT_BRANCH_ID, } from "./types.js";
|
|
2
|
+
export { SnapshotStore } from "./store.js";
|
|
3
|
+
export { diffScenes, isEmptyDiff } from "./diff.js";
|
|
4
|
+
export { captureFromEditor, restoreSnapshot, } from "./editor-bridge.js";
|
|
5
|
+
export { serializeSnapshot, deserializeSnapshot, serializeStore, stringifyStore, importIntoStore, importStoreJson, } from "./serialize.js";
|
|
6
|
+
export { findCommonAncestor, threeWayMerge, resolveConflict, mergeBranchHeads, } from "./merge.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,SAAS,EACT,QAAQ,EACR,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAqC,MAAM,WAAW,CAAC;AACvF,OAAO,EACL,iBAAiB,EACjB,eAAe,GAGhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,GAIhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,gBAAgB,GAKjB,MAAM,YAAY,CAAC"}
|
package/dist/merge.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AnnotationId, LinkId, LayerId, ElementId } from "@oh-just-another/types";
|
|
2
|
+
import type { Annotation, Link, Layer, Patch, Scene, Element } from "@oh-just-another/scene";
|
|
3
|
+
import type { Snapshot, VersionId } from "./types.js";
|
|
4
|
+
import type { SnapshotStore } from "./store.js";
|
|
5
|
+
/**
|
|
6
|
+
* One conflicting item produced by `threeWayMerge`. Both `source` and
|
|
7
|
+
* `target` mutated the same id (or one mutated while the other deleted),
|
|
8
|
+
* so the merger cannot auto-resolve. UI surfaces these to the user, who
|
|
9
|
+
* picks one side or supplies its own resolution via `resolve`.
|
|
10
|
+
*/
|
|
11
|
+
export type ConflictResolution = "source" | "target" | "both";
|
|
12
|
+
export interface Conflict<Id, V> {
|
|
13
|
+
readonly kind: "element" | "link" | "layer" | "annotation";
|
|
14
|
+
readonly id: Id;
|
|
15
|
+
readonly base: V | null;
|
|
16
|
+
readonly source: V | null;
|
|
17
|
+
readonly target: V | null;
|
|
18
|
+
}
|
|
19
|
+
export type SceneConflict = Conflict<ElementId, Element> | Conflict<LinkId, Link> | Conflict<LayerId, Layer> | Conflict<AnnotationId, Annotation>;
|
|
20
|
+
export interface MergeReport {
|
|
21
|
+
/** Auto-applied patches that landed on `target` without conflict. */
|
|
22
|
+
readonly applied: readonly Patch[];
|
|
23
|
+
/** Items requiring user resolution. */
|
|
24
|
+
readonly conflicts: readonly SceneConflict[];
|
|
25
|
+
/** Resulting scene after auto-merge (conflicts left as `target` values). */
|
|
26
|
+
readonly mergedScene: Scene;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Common ancestor of two snapshot chains. Walks `parentId` backwards through
|
|
30
|
+
* `b1` collecting ids, then walks `b2` until it hits one of them. Returns
|
|
31
|
+
* `null` when the chains never converge (e.g. one of the branches was rooted
|
|
32
|
+
* independently).
|
|
33
|
+
*/
|
|
34
|
+
export declare const findCommonAncestor: (store: SnapshotStore, v1: VersionId, v2: VersionId) => Snapshot | null;
|
|
35
|
+
/**
|
|
36
|
+
* Three-way merge of `source` into `target` over their common `base`.
|
|
37
|
+
* Returns a merged scene plus the list of conflicts that need user input.
|
|
38
|
+
* Auto-resolvable changes are applied directly; conflicting changes keep the
|
|
39
|
+
* `target` value (callers can re-apply preferred resolutions via
|
|
40
|
+
* `resolveConflict` and then re-emit a patch).
|
|
41
|
+
*
|
|
42
|
+
* The returned `mergedScene` keeps `target`'s viewport — viewport is
|
|
43
|
+
* per-session UI state, not part of the merge contract.
|
|
44
|
+
*/
|
|
45
|
+
export declare const threeWayMerge: (base: Scene, source: Scene, target: Scene) => MergeReport;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve a single conflict by picking a side. Returns the new scene with the
|
|
48
|
+
* chosen value applied on top of `mergedScene`. `"both"` keeps the target
|
|
49
|
+
* value and re-adds source as a copy with a new id — that path is the
|
|
50
|
+
* responsibility of the host (it needs to generate the duplicate id), so this
|
|
51
|
+
* helper only handles the single-pick cases.
|
|
52
|
+
*/
|
|
53
|
+
export declare const resolveConflict: (mergedScene: Scene, conflict: SceneConflict, pick: Exclude<ConflictResolution, "both">) => Scene;
|
|
54
|
+
/**
|
|
55
|
+
* High-level branch merger. Looks up the two branches' head snapshots and
|
|
56
|
+
* their common ancestor and runs `threeWayMerge`. Returns the merge report
|
|
57
|
+
* and the source/target snapshots so callers can `capture` the merged result
|
|
58
|
+
* back into the target branch.
|
|
59
|
+
*/
|
|
60
|
+
export declare const mergeBranchHeads: (store: SnapshotStore, sourceHead: VersionId, targetHead: VersionId) => MergeReport;
|
|
61
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EACV,UAAU,EAC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,MAAM,aAAa,GAAI,MAAM,KAAK,EAAE,QAAQ,KAAK,EAAE,QAAQ,KAAK,KAAG,WA8BzE,CAAC;AAoBF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAC1B,aAAa,KAAK,EAClB,UAAU,aAAa,EACvB,MAAM,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC,KACxC,KAWF,CAAC;AAeF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,aAAa,EACpB,YAAY,SAAS,EACrB,YAAY,SAAS,KACpB,WAaF,CAAC"}
|
package/dist/merge.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { apply } from "@oh-just-another/scene";
|
|
2
|
+
/**
|
|
3
|
+
* Common ancestor of two snapshot chains. Walks `parentId` backwards through
|
|
4
|
+
* `b1` collecting ids, then walks `b2` until it hits one of them. Returns
|
|
5
|
+
* `null` when the chains never converge (e.g. one of the branches was rooted
|
|
6
|
+
* independently).
|
|
7
|
+
*/
|
|
8
|
+
export const findCommonAncestor = (store, v1, v2) => {
|
|
9
|
+
const chain1 = new Set();
|
|
10
|
+
let cursor = v1;
|
|
11
|
+
while (cursor) {
|
|
12
|
+
chain1.add(cursor);
|
|
13
|
+
cursor = parentChainNext(store, cursor);
|
|
14
|
+
}
|
|
15
|
+
cursor = v2;
|
|
16
|
+
while (cursor) {
|
|
17
|
+
if (chain1.has(cursor))
|
|
18
|
+
return store.get(cursor) ?? null;
|
|
19
|
+
cursor = parentChainNext(store, cursor);
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Walk one step backward through the version chain. When the snapshot has an
|
|
25
|
+
* in-branch `parentId`, follow it; otherwise cross to the parent branch via
|
|
26
|
+
* `Branch.parentVersionId` so the chain reaches the shared root rather than
|
|
27
|
+
* stopping at every branch boundary.
|
|
28
|
+
*/
|
|
29
|
+
const parentChainNext = (store, current) => {
|
|
30
|
+
const snap = store.get(current);
|
|
31
|
+
if (!snap)
|
|
32
|
+
return null;
|
|
33
|
+
if (snap.parentId)
|
|
34
|
+
return snap.parentId;
|
|
35
|
+
const branch = store.branches().find((b) => b.id === snap.branchId);
|
|
36
|
+
return branch?.parentVersionId ?? null;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Per-category three-way merge. Rules per id:
|
|
40
|
+
*
|
|
41
|
+
* - `source === target` → no change.
|
|
42
|
+
* - `source === base` → take `target` (target moved, source didn't).
|
|
43
|
+
* - `target === base` → take `source` (source moved, target didn't).
|
|
44
|
+
* - both differ from `base` → conflict.
|
|
45
|
+
* - one side deleted, the other modified → conflict.
|
|
46
|
+
* - one side added an id absent from `base` → take that side; both
|
|
47
|
+
* added the same id → conflict (unless identical).
|
|
48
|
+
*
|
|
49
|
+
* Identity comparison is enough because scene ops always return new objects
|
|
50
|
+
* on change.
|
|
51
|
+
*/
|
|
52
|
+
const mergeMap = (kind, base, source, target, out) => {
|
|
53
|
+
const merged = new Map(target);
|
|
54
|
+
const ids = new Set([...base.keys(), ...source.keys(), ...target.keys()]);
|
|
55
|
+
for (const id of ids) {
|
|
56
|
+
const b = base.get(id) ?? null;
|
|
57
|
+
const s = source.get(id) ?? null;
|
|
58
|
+
const t = target.get(id) ?? null;
|
|
59
|
+
if (s === t)
|
|
60
|
+
continue;
|
|
61
|
+
if (s === b)
|
|
62
|
+
continue; // target took the change
|
|
63
|
+
if (t === b) {
|
|
64
|
+
// source took the change — apply it
|
|
65
|
+
if (s === null)
|
|
66
|
+
merged.delete(id);
|
|
67
|
+
else
|
|
68
|
+
merged.set(id, s);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
// both diverged from base → conflict
|
|
72
|
+
out.conflicts.push({
|
|
73
|
+
kind,
|
|
74
|
+
id,
|
|
75
|
+
base: b,
|
|
76
|
+
source: s,
|
|
77
|
+
target: t,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return merged;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Three-way merge of `source` into `target` over their common `base`.
|
|
84
|
+
* Returns a merged scene plus the list of conflicts that need user input.
|
|
85
|
+
* Auto-resolvable changes are applied directly; conflicting changes keep the
|
|
86
|
+
* `target` value (callers can re-apply preferred resolutions via
|
|
87
|
+
* `resolveConflict` and then re-emit a patch).
|
|
88
|
+
*
|
|
89
|
+
* The returned `mergedScene` keeps `target`'s viewport — viewport is
|
|
90
|
+
* per-session UI state, not part of the merge contract.
|
|
91
|
+
*/
|
|
92
|
+
export const threeWayMerge = (base, source, target) => {
|
|
93
|
+
const conflicts = [];
|
|
94
|
+
const out = { conflicts };
|
|
95
|
+
const elements = mergeMap("element", base.elements, source.elements, target.elements, out);
|
|
96
|
+
const links = mergeMap("link", base.links, source.links, target.links, out);
|
|
97
|
+
const layers = mergeMap("layer", base.layers, source.layers, target.layers, out);
|
|
98
|
+
const annotations = mergeMap("annotation", base.annotations, source.annotations, target.annotations, out);
|
|
99
|
+
const mergedScene = {
|
|
100
|
+
...target,
|
|
101
|
+
elements,
|
|
102
|
+
links,
|
|
103
|
+
layers,
|
|
104
|
+
annotations,
|
|
105
|
+
};
|
|
106
|
+
const applied = [];
|
|
107
|
+
pushPatches(applied, "element", target.elements, elements);
|
|
108
|
+
pushPatches(applied, "link", target.links, links);
|
|
109
|
+
pushPatches(applied, "layer", target.layers, layers);
|
|
110
|
+
pushPatches(applied, "annotation", target.annotations, annotations);
|
|
111
|
+
return { applied, conflicts, mergedScene };
|
|
112
|
+
};
|
|
113
|
+
const pushPatches = (out, kind, before, after) => {
|
|
114
|
+
for (const [id, value] of after) {
|
|
115
|
+
const prev = before.get(id);
|
|
116
|
+
if (prev === value)
|
|
117
|
+
continue;
|
|
118
|
+
out.push({ kind, id, before: prev ?? null, after: value });
|
|
119
|
+
}
|
|
120
|
+
for (const [id, value] of before) {
|
|
121
|
+
if (!after.has(id)) {
|
|
122
|
+
out.push({ kind, id, before: value, after: null });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Resolve a single conflict by picking a side. Returns the new scene with the
|
|
128
|
+
* chosen value applied on top of `mergedScene`. `"both"` keeps the target
|
|
129
|
+
* value and re-adds source as a copy with a new id — that path is the
|
|
130
|
+
* responsibility of the host (it needs to generate the duplicate id), so this
|
|
131
|
+
* helper only handles the single-pick cases.
|
|
132
|
+
*/
|
|
133
|
+
export const resolveConflict = (mergedScene, conflict, pick) => {
|
|
134
|
+
const value = pick === "source" ? conflict.source : conflict.target;
|
|
135
|
+
const before = mergedScene[mapName(conflict.kind)].get(conflict.id) ?? null;
|
|
136
|
+
if (value === before)
|
|
137
|
+
return mergedScene;
|
|
138
|
+
const patch = {
|
|
139
|
+
kind: conflict.kind,
|
|
140
|
+
id: conflict.id,
|
|
141
|
+
before: before ?? null,
|
|
142
|
+
after: value,
|
|
143
|
+
};
|
|
144
|
+
return apply(mergedScene, patch);
|
|
145
|
+
};
|
|
146
|
+
const mapName = (kind) => {
|
|
147
|
+
switch (kind) {
|
|
148
|
+
case "element":
|
|
149
|
+
return "elements";
|
|
150
|
+
case "link":
|
|
151
|
+
return "links";
|
|
152
|
+
case "layer":
|
|
153
|
+
return "layers";
|
|
154
|
+
case "annotation":
|
|
155
|
+
return "annotations";
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* High-level branch merger. Looks up the two branches' head snapshots and
|
|
160
|
+
* their common ancestor and runs `threeWayMerge`. Returns the merge report
|
|
161
|
+
* and the source/target snapshots so callers can `capture` the merged result
|
|
162
|
+
* back into the target branch.
|
|
163
|
+
*/
|
|
164
|
+
export const mergeBranchHeads = (store, sourceHead, targetHead) => {
|
|
165
|
+
const source = store.get(sourceHead);
|
|
166
|
+
const target = store.get(targetHead);
|
|
167
|
+
if (!source)
|
|
168
|
+
throw new Error(`Unknown source snapshot: ${sourceHead}`);
|
|
169
|
+
if (!target)
|
|
170
|
+
throw new Error(`Unknown target snapshot: ${targetHead}`);
|
|
171
|
+
const ancestor = findCommonAncestor(store, sourceHead, targetHead);
|
|
172
|
+
if (!ancestor) {
|
|
173
|
+
// No shared ancestor: treat the divergence point as an empty scene, so
|
|
174
|
+
// every shape in source counts as "added" relative to base. Use target as
|
|
175
|
+
// the base so target wins on every prior change.
|
|
176
|
+
return threeWayMerge(target.scene, source.scene, target.scene);
|
|
177
|
+
}
|
|
178
|
+
return threeWayMerge(ancestor.scene, source.scene, target.scene);
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAmC/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAoB,EACpB,EAAa,EACb,EAAa,EACI,EAAE;IACnB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAa,CAAC;IACpC,IAAI,MAAM,GAAqB,EAAE,CAAC;IAClC,OAAO,MAAM,EAAE,CAAC;QACd,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnB,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,MAAM,GAAG,EAAE,CAAC;IACZ,OAAO,MAAM,EAAE,CAAC;QACd,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;QACzD,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CAAC,KAAoB,EAAE,OAAkB,EAAoB,EAAE;IACrF,MAAM,IAAI,GAAG,KAAK,CAAC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E,MAAM,QAAQ,GAAG,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACnE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,uEAAuE;QACvE,0EAA0E;QAC1E,iDAAiD;QACjD,OAAO,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type SceneDocument } from "@oh-just-another/serialization";
|
|
2
|
+
import { type Snapshot } from "./types.js";
|
|
3
|
+
import type { SnapshotStore } from "./store.js";
|
|
4
|
+
/**
|
|
5
|
+
* Wire-format for a snapshot dump. Embeds the scene document inline
|
|
6
|
+
* so the file is fully self-contained — no separate scene-file refs.
|
|
7
|
+
*/
|
|
8
|
+
export interface SerializedSnapshot {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly branchId: string;
|
|
11
|
+
readonly parentId: string | null;
|
|
12
|
+
readonly scene: SceneDocument;
|
|
13
|
+
readonly author: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
readonly timestamp: string;
|
|
18
|
+
readonly message: string;
|
|
19
|
+
}
|
|
20
|
+
export interface SerializedBranch {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly parentBranchId: string | null;
|
|
24
|
+
readonly parentVersionId: string | null;
|
|
25
|
+
readonly head: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface SerializedStore {
|
|
28
|
+
readonly format: "oh-just-another/versioning";
|
|
29
|
+
readonly version: 1;
|
|
30
|
+
readonly snapshots: readonly SerializedSnapshot[];
|
|
31
|
+
readonly branches: readonly SerializedBranch[];
|
|
32
|
+
}
|
|
33
|
+
export declare const serializeSnapshot: (snap: Snapshot) => SerializedSnapshot;
|
|
34
|
+
export declare const deserializeSnapshot: (raw: SerializedSnapshot) => Snapshot;
|
|
35
|
+
/** Serialise the whole store (snapshots + branches) into a plain object. */
|
|
36
|
+
export declare const serializeStore: (store: SnapshotStore) => SerializedStore;
|
|
37
|
+
/** JSON-stringify shortcut. */
|
|
38
|
+
export declare const stringifyStore: (store: SnapshotStore, indent?: number | null) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Load a previously-serialised dump into a `SnapshotStore`. Throws
|
|
41
|
+
* via `parseScene` if any embedded scene is malformed.
|
|
42
|
+
*/
|
|
43
|
+
export declare const importIntoStore: (store: SnapshotStore, dump: SerializedStore) => void;
|
|
44
|
+
/** Parse a JSON string + import. */
|
|
45
|
+
export declare const importStoreJson: (store: SnapshotStore, json: string) => void;
|
|
46
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAoC,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,4BAA4B,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAClD,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;CAChD;AAED,eAAO,MAAM,iBAAiB,GAAI,MAAM,QAAQ,KAAG,kBAQjD,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAAI,KAAK,kBAAkB,KAAG,QAQ5D,CAAC;AAkBH,4EAA4E;AAC5E,eAAO,MAAM,cAAc,GAAI,OAAO,aAAa,KAAG,eAKpD,CAAC;AAEH,+BAA+B;AAC/B,eAAO,MAAM,cAAc,GAAI,OAAO,aAAa,EAAE,SAAQ,MAAM,GAAG,IAAW,KAAG,MAClB,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,aAAa,EAAE,MAAM,eAAe,KAAG,IAS7E,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,eAAe,GAAI,OAAO,aAAa,EAAE,MAAM,MAAM,KAAG,IASpE,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { deserializeScene, parseScene, serializeScene, stringifyScene, } from "@oh-just-another/serialization";
|
|
2
|
+
import { branchId, versionId } from "./types.js";
|
|
3
|
+
export const serializeSnapshot = (snap) => ({
|
|
4
|
+
id: snap.id,
|
|
5
|
+
branchId: snap.branchId,
|
|
6
|
+
parentId: snap.parentId,
|
|
7
|
+
scene: serializeScene(snap.scene),
|
|
8
|
+
author: snap.author,
|
|
9
|
+
timestamp: snap.timestamp,
|
|
10
|
+
message: snap.message,
|
|
11
|
+
});
|
|
12
|
+
export const deserializeSnapshot = (raw) => ({
|
|
13
|
+
id: versionId(raw.id),
|
|
14
|
+
branchId: branchId(raw.branchId),
|
|
15
|
+
parentId: raw.parentId === null ? null : versionId(raw.parentId),
|
|
16
|
+
scene: deserializeScene(raw.scene),
|
|
17
|
+
author: raw.author,
|
|
18
|
+
timestamp: raw.timestamp,
|
|
19
|
+
message: raw.message,
|
|
20
|
+
});
|
|
21
|
+
const serializeBranch = (b) => ({
|
|
22
|
+
id: b.id,
|
|
23
|
+
name: b.name,
|
|
24
|
+
parentBranchId: b.parentBranchId,
|
|
25
|
+
parentVersionId: b.parentVersionId,
|
|
26
|
+
head: b.head,
|
|
27
|
+
});
|
|
28
|
+
const deserializeBranch = (raw) => ({
|
|
29
|
+
id: branchId(raw.id),
|
|
30
|
+
name: raw.name,
|
|
31
|
+
parentBranchId: raw.parentBranchId === null ? null : branchId(raw.parentBranchId),
|
|
32
|
+
parentVersionId: raw.parentVersionId === null ? null : versionId(raw.parentVersionId),
|
|
33
|
+
head: raw.head === null ? null : versionId(raw.head),
|
|
34
|
+
});
|
|
35
|
+
/** Serialise the whole store (snapshots + branches) into a plain object. */
|
|
36
|
+
export const serializeStore = (store) => ({
|
|
37
|
+
format: "oh-just-another/versioning",
|
|
38
|
+
version: 1,
|
|
39
|
+
snapshots: store.list().map(serializeSnapshot),
|
|
40
|
+
branches: store.branches().map(serializeBranch),
|
|
41
|
+
});
|
|
42
|
+
/** JSON-stringify shortcut. */
|
|
43
|
+
export const stringifyStore = (store, indent = null) => JSON.stringify(serializeStore(store), null, indent ?? undefined);
|
|
44
|
+
/**
|
|
45
|
+
* Load a previously-serialised dump into a `SnapshotStore`. Throws
|
|
46
|
+
* via `parseScene` if any embedded scene is malformed.
|
|
47
|
+
*/
|
|
48
|
+
export const importIntoStore = (store, dump) => {
|
|
49
|
+
const format = dump.format;
|
|
50
|
+
if (format !== "oh-just-another/versioning") {
|
|
51
|
+
throw new Error(`Unknown versioning format: ${format}`);
|
|
52
|
+
}
|
|
53
|
+
store.import({
|
|
54
|
+
snapshots: dump.snapshots.map(deserializeSnapshot),
|
|
55
|
+
branches: dump.branches.map(deserializeBranch),
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
/** Parse a JSON string + import. */
|
|
59
|
+
export const importStoreJson = (store, json) => {
|
|
60
|
+
const raw = JSON.parse(json);
|
|
61
|
+
// Validate embedded scenes by running them through `parseScene`
|
|
62
|
+
// (the rest of the dump is plain JSON; zod-validating the wrapper
|
|
63
|
+
// would be overkill — host parses + trusts).
|
|
64
|
+
for (const s of raw.snapshots) {
|
|
65
|
+
parseScene(stringifyScene(deserializeScene(s.scene)));
|
|
66
|
+
}
|
|
67
|
+
importIntoStore(store, raw);
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,cAAc,GAEf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAA8B,MAAM,YAAY,CAAC;AAgC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAc,EAAsB,EAAE,CAAC,CAAC;IACxE,EAAE,EAAE,IAAI,CAAC,EAAE;IACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;IACvB,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC;IACjC,MAAM,EAAE,IAAI,CAAC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EAAE;IAC1E,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAoB,CAAC;IAChD,gEAAgE;IAChE,kEAAkE;IAClE,6CAA6C;IAC7C,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QAC9B,UAAU,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IACD,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAC"}
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Scene } from "@oh-just-another/scene";
|
|
2
|
+
import { type Branch, type BranchId, type Snapshot, type VersionId } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Input to `SnapshotStore.capture` — everything the caller knows.
|
|
5
|
+
* Store generates `id`, `parentId` (from branch head), `timestamp`.
|
|
6
|
+
*/
|
|
7
|
+
export interface CaptureRequest {
|
|
8
|
+
readonly scene: Scene;
|
|
9
|
+
readonly author: {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
readonly message: string;
|
|
14
|
+
/** Defaults to the store's current branch. */
|
|
15
|
+
readonly branchId?: BranchId;
|
|
16
|
+
}
|
|
17
|
+
export interface BranchRequest {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly fromVersion: VersionId;
|
|
20
|
+
/** Override the auto-generated id (useful for tests). */
|
|
21
|
+
readonly id?: BranchId;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* In-memory snapshot store. The store is the system-of-record for the
|
|
25
|
+
* version tree; hosts that want persistence wrap `export()` / `import()`
|
|
26
|
+
* with their own storage (localStorage, IndexedDB, server API).
|
|
27
|
+
*
|
|
28
|
+
* Branch model: the "main" branch is created on construction. Any
|
|
29
|
+
* snapshot can be the basis for a new branch via `branch({ fromVersion,
|
|
30
|
+
* name })`; the new branch's first capture chains back to the source
|
|
31
|
+
* snapshot via `Branch.parentVersionId`.
|
|
32
|
+
*
|
|
33
|
+
* Listeners observe both `capture` and `branch` events so UIs (tree
|
|
34
|
+
* view) re-render without polling.
|
|
35
|
+
*/
|
|
36
|
+
export declare class SnapshotStore {
|
|
37
|
+
private readonly snapshots;
|
|
38
|
+
private readonly branchesMap;
|
|
39
|
+
private readonly listeners;
|
|
40
|
+
private idCounter;
|
|
41
|
+
private _currentBranchId;
|
|
42
|
+
constructor();
|
|
43
|
+
/** Active branch — new captures land here unless overridden. */
|
|
44
|
+
get currentBranchId(): BranchId;
|
|
45
|
+
/**
|
|
46
|
+
* Switch the active branch. Throws if the branch is unknown. Does
|
|
47
|
+
* not mutate snapshots — only changes which branch new captures
|
|
48
|
+
* append to.
|
|
49
|
+
*/
|
|
50
|
+
setCurrentBranch(id: BranchId): void;
|
|
51
|
+
/**
|
|
52
|
+
* Capture a new snapshot. `parentId` is set to the target branch's
|
|
53
|
+
* current head; the new snapshot becomes the branch's new head.
|
|
54
|
+
*/
|
|
55
|
+
capture(req: CaptureRequest): Snapshot;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new branch rooted at an existing snapshot. The branch
|
|
58
|
+
* starts empty (no captures yet); its `parentVersionId` records
|
|
59
|
+
* the divergence point so UIs can render the tree.
|
|
60
|
+
*/
|
|
61
|
+
branch(req: BranchRequest): Branch;
|
|
62
|
+
/** Look up a snapshot by id. */
|
|
63
|
+
get(id: VersionId): Snapshot | undefined;
|
|
64
|
+
/** All snapshots, in insertion order. */
|
|
65
|
+
list(): readonly Snapshot[];
|
|
66
|
+
/**
|
|
67
|
+
* Snapshots on a specific branch, ordered ancestor → descendant.
|
|
68
|
+
* Walks parent links from `branch.head` back to the branch root
|
|
69
|
+
* (snapshot whose `parentId` belongs to a different branch).
|
|
70
|
+
*/
|
|
71
|
+
listBranch(id: BranchId): readonly Snapshot[];
|
|
72
|
+
/** All branches, in insertion order. */
|
|
73
|
+
branches(): readonly Branch[];
|
|
74
|
+
/**
|
|
75
|
+
* Replace store state from a serialised dump. Wipes any existing
|
|
76
|
+
* snapshots / branches. Used by hosts implementing persistence.
|
|
77
|
+
*/
|
|
78
|
+
import(dump: {
|
|
79
|
+
readonly snapshots: readonly Snapshot[];
|
|
80
|
+
readonly branches: readonly Branch[];
|
|
81
|
+
}): void;
|
|
82
|
+
/** Snapshot the store's state for persistence. */
|
|
83
|
+
export(): {
|
|
84
|
+
snapshots: readonly Snapshot[];
|
|
85
|
+
branches: readonly Branch[];
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Subscribe to capture / branch / setCurrentBranch / import events.
|
|
89
|
+
* Returns an unsubscribe fn.
|
|
90
|
+
*/
|
|
91
|
+
subscribe(fn: () => void): () => void;
|
|
92
|
+
private notify;
|
|
93
|
+
private uniqueId;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAA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AAM;IAId,OAAO,CAAC,QAAQ;CAGjB"}
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { branchId as castBranchId, versionId as castVersionId, DEFAULT_BRANCH_ID, } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* In-memory snapshot store. The store is the system-of-record for the
|
|
4
|
+
* version tree; hosts that want persistence wrap `export()` / `import()`
|
|
5
|
+
* with their own storage (localStorage, IndexedDB, server API).
|
|
6
|
+
*
|
|
7
|
+
* Branch model: the "main" branch is created on construction. Any
|
|
8
|
+
* snapshot can be the basis for a new branch via `branch({ fromVersion,
|
|
9
|
+
* name })`; the new branch's first capture chains back to the source
|
|
10
|
+
* snapshot via `Branch.parentVersionId`.
|
|
11
|
+
*
|
|
12
|
+
* Listeners observe both `capture` and `branch` events so UIs (tree
|
|
13
|
+
* view) re-render without polling.
|
|
14
|
+
*/
|
|
15
|
+
export class SnapshotStore {
|
|
16
|
+
snapshots = new Map();
|
|
17
|
+
branchesMap = new Map();
|
|
18
|
+
listeners = new Set();
|
|
19
|
+
idCounter = 0;
|
|
20
|
+
_currentBranchId;
|
|
21
|
+
constructor() {
|
|
22
|
+
const main = {
|
|
23
|
+
id: DEFAULT_BRANCH_ID,
|
|
24
|
+
name: "main",
|
|
25
|
+
parentBranchId: null,
|
|
26
|
+
parentVersionId: null,
|
|
27
|
+
head: null,
|
|
28
|
+
};
|
|
29
|
+
this.branchesMap.set(main.id, main);
|
|
30
|
+
this._currentBranchId = main.id;
|
|
31
|
+
}
|
|
32
|
+
/** Active branch — new captures land here unless overridden. */
|
|
33
|
+
get currentBranchId() {
|
|
34
|
+
return this._currentBranchId;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Switch the active branch. Throws if the branch is unknown. Does
|
|
38
|
+
* not mutate snapshots — only changes which branch new captures
|
|
39
|
+
* append to.
|
|
40
|
+
*/
|
|
41
|
+
setCurrentBranch(id) {
|
|
42
|
+
if (!this.branchesMap.has(id)) {
|
|
43
|
+
throw new Error(`Unknown branch: ${id}`);
|
|
44
|
+
}
|
|
45
|
+
if (this._currentBranchId === id)
|
|
46
|
+
return;
|
|
47
|
+
this._currentBranchId = id;
|
|
48
|
+
this.notify();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Capture a new snapshot. `parentId` is set to the target branch's
|
|
52
|
+
* current head; the new snapshot becomes the branch's new head.
|
|
53
|
+
*/
|
|
54
|
+
capture(req) {
|
|
55
|
+
const targetBranchId = req.branchId ?? this._currentBranchId;
|
|
56
|
+
const branch = this.branchesMap.get(targetBranchId);
|
|
57
|
+
if (!branch)
|
|
58
|
+
throw new Error(`Unknown branch: ${targetBranchId}`);
|
|
59
|
+
const snapshot = {
|
|
60
|
+
id: castVersionId(this.uniqueId("v")),
|
|
61
|
+
branchId: targetBranchId,
|
|
62
|
+
parentId: branch.head,
|
|
63
|
+
scene: req.scene,
|
|
64
|
+
author: req.author,
|
|
65
|
+
message: req.message,
|
|
66
|
+
timestamp: new Date().toISOString(),
|
|
67
|
+
};
|
|
68
|
+
this.snapshots.set(snapshot.id, snapshot);
|
|
69
|
+
this.branchesMap.set(targetBranchId, { ...branch, head: snapshot.id });
|
|
70
|
+
this.notify();
|
|
71
|
+
return snapshot;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a new branch rooted at an existing snapshot. The branch
|
|
75
|
+
* starts empty (no captures yet); its `parentVersionId` records
|
|
76
|
+
* the divergence point so UIs can render the tree.
|
|
77
|
+
*/
|
|
78
|
+
branch(req) {
|
|
79
|
+
const parent = this.snapshots.get(req.fromVersion);
|
|
80
|
+
if (!parent)
|
|
81
|
+
throw new Error(`Unknown source snapshot: ${req.fromVersion}`);
|
|
82
|
+
const id = req.id ?? castBranchId(this.uniqueId("br"));
|
|
83
|
+
if (this.branchesMap.has(id)) {
|
|
84
|
+
throw new Error(`Branch already exists: ${id}`);
|
|
85
|
+
}
|
|
86
|
+
const next = {
|
|
87
|
+
id,
|
|
88
|
+
name: req.name,
|
|
89
|
+
parentBranchId: parent.branchId,
|
|
90
|
+
parentVersionId: req.fromVersion,
|
|
91
|
+
head: null,
|
|
92
|
+
};
|
|
93
|
+
this.branchesMap.set(id, next);
|
|
94
|
+
this.notify();
|
|
95
|
+
return next;
|
|
96
|
+
}
|
|
97
|
+
/** Look up a snapshot by id. */
|
|
98
|
+
get(id) {
|
|
99
|
+
return this.snapshots.get(id);
|
|
100
|
+
}
|
|
101
|
+
/** All snapshots, in insertion order. */
|
|
102
|
+
list() {
|
|
103
|
+
return [...this.snapshots.values()];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Snapshots on a specific branch, ordered ancestor → descendant.
|
|
107
|
+
* Walks parent links from `branch.head` back to the branch root
|
|
108
|
+
* (snapshot whose `parentId` belongs to a different branch).
|
|
109
|
+
*/
|
|
110
|
+
listBranch(id) {
|
|
111
|
+
const branch = this.branchesMap.get(id);
|
|
112
|
+
if (branch?.head === undefined || branch.head === null)
|
|
113
|
+
return [];
|
|
114
|
+
const out = [];
|
|
115
|
+
let cursor = branch.head;
|
|
116
|
+
while (cursor !== null) {
|
|
117
|
+
const snap = this.snapshots.get(cursor);
|
|
118
|
+
if (snap?.branchId !== id)
|
|
119
|
+
break;
|
|
120
|
+
out.push(snap);
|
|
121
|
+
cursor = snap.parentId;
|
|
122
|
+
}
|
|
123
|
+
return out.reverse();
|
|
124
|
+
}
|
|
125
|
+
/** All branches, in insertion order. */
|
|
126
|
+
branches() {
|
|
127
|
+
return [...this.branchesMap.values()];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Replace store state from a serialised dump. Wipes any existing
|
|
131
|
+
* snapshots / branches. Used by hosts implementing persistence.
|
|
132
|
+
*/
|
|
133
|
+
import(dump) {
|
|
134
|
+
this.snapshots.clear();
|
|
135
|
+
this.branchesMap.clear();
|
|
136
|
+
for (const b of dump.branches)
|
|
137
|
+
this.branchesMap.set(b.id, b);
|
|
138
|
+
if (!this.branchesMap.has(DEFAULT_BRANCH_ID)) {
|
|
139
|
+
this.branchesMap.set(DEFAULT_BRANCH_ID, {
|
|
140
|
+
id: DEFAULT_BRANCH_ID,
|
|
141
|
+
name: "main",
|
|
142
|
+
parentBranchId: null,
|
|
143
|
+
parentVersionId: null,
|
|
144
|
+
head: null,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
for (const s of dump.snapshots)
|
|
148
|
+
this.snapshots.set(s.id, s);
|
|
149
|
+
this._currentBranchId = DEFAULT_BRANCH_ID;
|
|
150
|
+
this.notify();
|
|
151
|
+
}
|
|
152
|
+
/** Snapshot the store's state for persistence. */
|
|
153
|
+
export() {
|
|
154
|
+
return { snapshots: this.list(), branches: this.branches() };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Subscribe to capture / branch / setCurrentBranch / import events.
|
|
158
|
+
* Returns an unsubscribe fn.
|
|
159
|
+
*/
|
|
160
|
+
subscribe(fn) {
|
|
161
|
+
this.listeners.add(fn);
|
|
162
|
+
return () => this.listeners.delete(fn);
|
|
163
|
+
}
|
|
164
|
+
notify() {
|
|
165
|
+
for (const fn of this.listeners)
|
|
166
|
+
fn();
|
|
167
|
+
}
|
|
168
|
+
uniqueId(prefix) {
|
|
169
|
+
return `${prefix}-${++this.idCounter}-${Date.now().toString(36)}`;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,SAAS,IAAI,aAAa,EAC1B,iBAAiB,GAKlB,MAAM,YAAY,CAAC;AAqBpB;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IACP,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC3C,WAAW,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC1C,SAAS,G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 -0,0 +1,63 @@
|
|
|
1
|
+
import type { Scene } from "@oh-just-another/scene";
|
|
2
|
+
/**
|
|
3
|
+
* Opaque identifier for a single snapshot. Caller owns uniqueness;
|
|
4
|
+
* `SnapshotStore.capture` generates one if not provided.
|
|
5
|
+
*/
|
|
6
|
+
declare const versionIdBrand: unique symbol;
|
|
7
|
+
export type VersionId = string & {
|
|
8
|
+
readonly [versionIdBrand]: true;
|
|
9
|
+
};
|
|
10
|
+
export declare const versionId: (raw: string) => VersionId;
|
|
11
|
+
/**
|
|
12
|
+
* Opaque identifier for a branch. Branches are first-class — every
|
|
13
|
+
* snapshot carries a `branchId`, and history forms a tree rooted at
|
|
14
|
+
* `DEFAULT_BRANCH_ID`. New branches are created by `branch(from)`.
|
|
15
|
+
*/
|
|
16
|
+
declare const branchIdBrand: unique symbol;
|
|
17
|
+
export type BranchId = string & {
|
|
18
|
+
readonly [branchIdBrand]: true;
|
|
19
|
+
};
|
|
20
|
+
export declare const branchId: (raw: string) => BranchId;
|
|
21
|
+
/** Default branch name — analogue of git's `main`. */
|
|
22
|
+
export declare const DEFAULT_BRANCH_ID: BranchId;
|
|
23
|
+
/**
|
|
24
|
+
* A snapshot is an immutable point-in-time copy of a `Scene` plus
|
|
25
|
+
* metadata (author, timestamp, message, parent link). Stored by
|
|
26
|
+
* `SnapshotStore`; restored by `Editor.restoreSnapshot` which calls
|
|
27
|
+
* `loadScene(snapshot.scene)`.
|
|
28
|
+
*/
|
|
29
|
+
export interface Snapshot {
|
|
30
|
+
readonly id: VersionId;
|
|
31
|
+
/** Branch this snapshot belongs to. */
|
|
32
|
+
readonly branchId: BranchId;
|
|
33
|
+
/**
|
|
34
|
+
* Previous snapshot id in this branch's history. `null` for the
|
|
35
|
+
* very first snapshot of a branch (which, when not the default
|
|
36
|
+
* branch, points at the snapshot it was branched from via
|
|
37
|
+
* `Branch.parentVersionId`).
|
|
38
|
+
*/
|
|
39
|
+
readonly parentId: VersionId | null;
|
|
40
|
+
readonly scene: Scene;
|
|
41
|
+
readonly author: {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
};
|
|
45
|
+
/** ISO-8601 timestamp. */
|
|
46
|
+
readonly timestamp: string;
|
|
47
|
+
/** Human-readable label. */
|
|
48
|
+
readonly message: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Branch descriptor. `head` is the latest snapshot in the branch;
|
|
52
|
+
* `parentBranchId` + `parentVersionId` form the cross-branch link
|
|
53
|
+
* (the point from which this branch diverged).
|
|
54
|
+
*/
|
|
55
|
+
export interface Branch {
|
|
56
|
+
readonly id: BranchId;
|
|
57
|
+
readonly name: string;
|
|
58
|
+
readonly parentBranchId: BranchId | null;
|
|
59
|
+
readonly parentVersionId: VersionId | null;
|
|
60
|
+
readonly head: VersionId | null;
|
|
61
|
+
}
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;GAGG;AACH,OAAO,CAAC,MAAM,cAAc,EAAE,OAAO,MAAM,CAAC;AAC5C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AACrE,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,KAAG,SAA6B,CAAC;AAEtE;;;;GAIG;AACH,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAC3C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AACnE,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,QAA2B,CAAC;AAEnE,sDAAsD;AACtD,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
|
1
|
+
{
|
|
2
|
+
"name": "@oh-just-another/versioning",
|
|
3
|
+
"version": "0.57.0",
|
|
4
|
+
"description": "Snapshot history + branch tree + diff utilities for diagram scenes.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Rustam Garifulin <rustam@n69.in>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/oh-just-another/diagram.git",
|
|
10
|
+
"directory": "packages/versioning"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/oh-just-another/diagram#readme",
|
|
13
|
+
"bugs": "https://github.com/oh-just-another/diagram/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"diagram",
|
|
16
|
+
"canvas",
|
|
17
|
+
"svg",
|
|
18
|
+
"editor",
|
|
19
|
+
"graph",
|
|
20
|
+
"drawing"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"module": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md",
|
|
35
|
+
"CHANGELOG.md"
|
|
36
|
+
],
|
|
37
|
+
"sideEffects": false,
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@oh-just-another/types": "0.57.0",
|
|
43
|
+
"@oh-just-another/scene": "0.57.0",
|
|
44
|
+
"@oh-just-another/serialization": "0.57.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc -b tsconfig.build.json",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"test:watch": "vitest",
|
|
51
|
+
"lint": "eslint src tests",
|
|
52
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
53
|
+
}
|
|
54
|
+
}
|