@speclynx/apidom-overlay 5.1.0 → 5.2.1
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 +25 -0
- package/README.md +4 -3
- package/dist/apidom-overlay.browser.js +2038 -346
- package/dist/apidom-overlay.browser.min.js +1 -1
- package/package.json +8 -8
- package/src/apply/realms/apidom.cjs +144 -30
- package/src/apply/realms/apidom.mjs +145 -31
- package/src/apply/realms/pojo.cjs +14 -2
- package/src/apply/realms/pojo.mjs +14 -2
- package/src/apply/realms/uri.cjs +5 -2
- package/src/apply/realms/uri.mjs +5 -2
- package/src/diff/realms/apidom.cjs +7 -3
- package/src/diff/realms/apidom.mjs +8 -4
- package/types/apidom-overlay.d.ts +29 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.2.1](https://github.com/speclynx/apidom/compare/v5.2.0...v5.2.1) (2026-08-29)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @speclynx/apidom-overlay
|
|
9
|
+
|
|
10
|
+
# [5.2.0](https://github.com/speclynx/apidom/compare/v5.1.1...v5.2.0) (2026-08-29)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @speclynx/apidom-overlay
|
|
13
|
+
|
|
14
|
+
## [5.1.1](https://github.com/speclynx/apidom/compare/v5.1.0...v5.1.1) (2026-08-19)
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
- **overlay:** apply root-target updates in place ([da41593](https://github.com/speclynx/apidom/commit/da4159322ba53af8595628ae74e11285c8272915)), closes [#471](https://github.com/speclynx/apidom/issues/471)
|
|
19
|
+
- **overlay:** clone the parse result under immutable apply ([203d2b5](https://github.com/speclynx/apidom/commit/203d2b53323d9b6d9a77e6b180de005600b067e6)), closes [#475](https://github.com/speclynx/apidom/issues/475)
|
|
20
|
+
- **overlay:** clone update value per matched target ([cb98f2b](https://github.com/speclynx/apidom/commit/cb98f2b68a6b1a0831b608f7734895a164b97f0b)), closes [#460](https://github.com/speclynx/apidom/issues/460)
|
|
21
|
+
- **overlay:** clone update values emitted by diff ([31b8db9](https://github.com/speclynx/apidom/commit/31b8db9205636a2c79c27a64e57c5da4ba9a14fb)), closes [#469](https://github.com/speclynx/apidom/issues/469)
|
|
22
|
+
- **overlay:** honour the immutable default for partial options ([5730aed](https://github.com/speclynx/apidom/commit/5730aedd7c21b256dc41e8f408a36fbf4f09d01a))
|
|
23
|
+
- **overlay:** restore the result marker after a root replacement ([#482](https://github.com/speclynx/apidom/issues/482)) ([9227cfc](https://github.com/speclynx/apidom/commit/9227cfc5a287b1d63afb704df4906d41c4984d99)), closes [#481](https://github.com/speclynx/apidom/issues/481)
|
|
24
|
+
- **overlay:** return an independent tree from no-op apply ([eb545b8](https://github.com/speclynx/apidom/commit/eb545b8eb53214102d2cbe3975efead1974e6bd5)), closes [#470](https://github.com/speclynx/apidom/issues/470)
|
|
25
|
+
- **overlay:** snapshot copy source before updating targets ([bb6ee06](https://github.com/speclynx/apidom/commit/bb6ee06937a6fa296eb6e29dcab1cf6e5c1f9106)), closes [#470](https://github.com/speclynx/apidom/issues/470)
|
|
26
|
+
|
|
27
|
+
### Performance Improvements
|
|
28
|
+
|
|
29
|
+
- **overlay:** skip the throwaway clone in the POJO realm ([07c5a81](https://github.com/speclynx/apidom/commit/07c5a818d874f4d492fe8a958bf495351c54b625))
|
|
30
|
+
|
|
6
31
|
# [5.1.0](https://github.com/speclynx/apidom/compare/v5.0.2...v5.1.0) (2026-08-09)
|
|
7
32
|
|
|
8
33
|
**Note:** Version bump only for package @speclynx/apidom-overlay
|
package/README.md
CHANGED
|
@@ -38,7 +38,9 @@ const yaml = toYAML(result.api, { preserveStyle: true });
|
|
|
38
38
|
### Applying to ApiDOM elements
|
|
39
39
|
|
|
40
40
|
`applyOverlayApiDOM` applies an entire overlay document to a target element. Accepts `Overlay1Element`
|
|
41
|
-
or `ParseResultElement`. Immutable by default
|
|
41
|
+
or `ParseResultElement`. Immutable by default. Returns a new element, even when no action
|
|
42
|
+
changes anything. When the target is a `ParseResultElement`, a new parse result is returned
|
|
43
|
+
and the one passed in is left untouched.
|
|
42
44
|
|
|
43
45
|
```js
|
|
44
46
|
import { refract } from '@speclynx/apidom-datamodel';
|
|
@@ -200,7 +202,6 @@ The diff walks both element trees recursively and generates [JSONPath (RFC 9535)
|
|
|
200
202
|
| Root structural type change | Throws `OverlayError`. Overlay has no mechanism to replace the root node. |
|
|
201
203
|
| Array insert-at-position | Overlay 1.x has no insert primitive. Positional diffing cascades replacements + appends, which is always correct but may be verbose for large array reorderings. |
|
|
202
204
|
| Array item structural type change | Handled via tail-reconstruct: items from the first type-mismatched index onward are removed and re-appended. Always correct, but produces more actions than a minimal diff. |
|
|
203
|
-
| Shared element references | Action `update` values reference elements from the right document directly. Mutating the right document after calling `diff` will affect the returned overlay. |
|
|
204
205
|
| Reverse diff | The overlay carries no "before" value. It cannot be reversed without the original document. |
|
|
205
206
|
|
|
206
207
|
## Overlay spec semantics
|
|
@@ -283,7 +284,7 @@ Passed to `applyActionApiDOM`, `applyOverlayApiDOM`, and `applyOverlay`:
|
|
|
283
284
|
|---|---|---|---|
|
|
284
285
|
| `deepmerge` | `DeepMergeUserOptions` | `{}` | Custom [deepmerge options](https://github.com/speclynx/apidom/blob/main/packages/apidom-core/src/merge/deepmerge.ts) from `@speclynx/apidom-core`. Default `customMerge` enforces Overlay spec type compatibility. |
|
|
285
286
|
| `strict` | `boolean` | `false` | When `true`, throws `OverlayError` if any action's target JSONPath matches zero nodes. |
|
|
286
|
-
| `immutable` | `boolean` | `true` | When `true
|
|
287
|
+
| `immutable` | `boolean` | `true`<br>(`false` in `applyOverlay`) | When `true`, the target is cloned once up front and actions are applied to the clone, so the returned element is always independent of the input, including when no action changes anything. For a `ParseResultElement` target the new parse result shares the children no action can reach, such as annotations. Set to `false` for in-place mutation. The one case that cannot be applied in place is a `target: $` action replacing a primitive root with a differently typed value — there the return value is the only carrier, so always use it. |
|
|
287
288
|
| `trace` | `OverlayTrace` | — | When provided, populated in place with action-by-action trace data. See [Tracing](#tracing). |
|
|
288
289
|
|
|
289
290
|
### ApplyOverlayOptions
|