@speclynx/apidom-overlay 4.5.0 → 4.7.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 +12 -0
- package/README.md +56 -0
- package/dist/apidom-overlay.browser.js +159 -35
- package/dist/apidom-overlay.browser.min.js +1 -1
- package/package.json +9 -8
- package/src/apply/{apidom.cjs → realms/apidom.cjs} +75 -11
- package/src/apply/{apidom.mjs → realms/apidom.mjs} +74 -11
- package/src/apply/{pojo.cjs → realms/pojo.cjs} +2 -2
- package/src/apply/{pojo.mjs → realms/pojo.mjs} +2 -2
- package/src/apply/{uri.cjs → realms/uri.cjs} +17 -12
- package/src/apply/{uri.mjs → realms/uri.mjs} +16 -11
- package/src/apply/trace/TraceBuilder.cjs +45 -0
- package/src/apply/trace/TraceBuilder.mjs +41 -0
- package/src/apply/trace/index.cjs +7 -0
- package/src/apply/trace/index.mjs +1 -0
- package/src/apply/trace/types.cjs +3 -0
- package/src/apply/trace/types.mjs +1 -0
- package/src/index.cjs +6 -4
- package/src/index.mjs +3 -3
- package/types/apidom-overlay.d.ts +44 -4
|
@@ -6,6 +6,26 @@ import { Element as Element_2 } from '@speclynx/apidom-datamodel';
|
|
|
6
6
|
import { MemberElement } from '@speclynx/apidom-datamodel';
|
|
7
7
|
import { Overlay1Element } from '@speclynx/apidom-ns-overlay-1';
|
|
8
8
|
import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
9
|
+
import type { PartialDeep } from 'type-fest';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Trace entry for a single overlay action application.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export declare interface ActionTrace {
|
|
17
|
+
readonly target: string;
|
|
18
|
+
readonly type: ActionTraceType;
|
|
19
|
+
readonly matchCount: number;
|
|
20
|
+
readonly normalizedPaths: string[];
|
|
21
|
+
readonly success: boolean;
|
|
22
|
+
readonly error?: OverlayError;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare type ActionTraceType = 'update' | 'copy' | 'remove' | 'noop';
|
|
9
29
|
|
|
10
30
|
/**
|
|
11
31
|
* Applies a single overlay action to a target element.
|
|
@@ -20,7 +40,7 @@ export declare const applyActionApiDOM: (actionElement: ActionElement, targetEle
|
|
|
20
40
|
*
|
|
21
41
|
* @public
|
|
22
42
|
*/
|
|
23
|
-
export declare const applyActionPOJO: (action: Record<string, unknown>, target: Record<string, unknown
|
|
43
|
+
export declare const applyActionPOJO: (action: Record<string, unknown>, target: Record<string, unknown>, options?: ApplyOptions) => unknown;
|
|
24
44
|
|
|
25
45
|
/**
|
|
26
46
|
* @public
|
|
@@ -29,6 +49,7 @@ export declare interface ApplyOptions {
|
|
|
29
49
|
readonly deepmerge?: DeepMergeUserOptions;
|
|
30
50
|
readonly strict?: boolean;
|
|
31
51
|
readonly immutable?: boolean;
|
|
52
|
+
readonly trace?: OverlayTrace;
|
|
32
53
|
}
|
|
33
54
|
|
|
34
55
|
/**
|
|
@@ -40,7 +61,7 @@ export declare interface ApplyOptions {
|
|
|
40
61
|
*
|
|
41
62
|
* @param overlayURI - URI to the overlay document (file path or URL)
|
|
42
63
|
* @param targetURI - URI to the target document; if omitted, uses the overlay's `extends` field
|
|
43
|
-
* @param options -
|
|
64
|
+
* @param options - overlay apply options; reference options live under `options.reference`
|
|
44
65
|
* @returns ParseResultElement with the modified target document
|
|
45
66
|
*
|
|
46
67
|
* @public
|
|
@@ -58,7 +79,8 @@ export declare const applyOverlayApiDOM: <T extends Element_2 | ParseResultEleme
|
|
|
58
79
|
/**
|
|
59
80
|
* @public
|
|
60
81
|
*/
|
|
61
|
-
export declare interface ApplyOverlayOptions extends
|
|
82
|
+
export declare interface ApplyOverlayOptions extends ApplyOptions {
|
|
83
|
+
readonly reference?: PartialDeep<ApiDOMReferenceOptions>;
|
|
62
84
|
}
|
|
63
85
|
|
|
64
86
|
/**
|
|
@@ -66,7 +88,12 @@ export declare interface ApplyOverlayOptions extends Partial<ApiDOMReferenceOpti
|
|
|
66
88
|
*
|
|
67
89
|
* @public
|
|
68
90
|
*/
|
|
69
|
-
export declare const applyOverlayPOJO: (overlay: Record<string, unknown>, target: Record<string, unknown
|
|
91
|
+
export declare const applyOverlayPOJO: (overlay: Record<string, unknown>, target: Record<string, unknown>, options?: ApplyOptions) => unknown;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
export declare const defaultApplyOverlayOptions: ApplyOverlayOptions;
|
|
70
97
|
|
|
71
98
|
/**
|
|
72
99
|
* @public
|
|
@@ -87,6 +114,19 @@ export declare interface OverlayErrorOptions {
|
|
|
87
114
|
readonly [key: string]: unknown;
|
|
88
115
|
}
|
|
89
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Top-level trace container populated during overlay application.
|
|
119
|
+
* Pass as `trace` option — it will be mutated in place.
|
|
120
|
+
*
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
export declare interface OverlayTrace {
|
|
124
|
+
actions: ActionTrace[];
|
|
125
|
+
failed: boolean;
|
|
126
|
+
failedAt: number;
|
|
127
|
+
message: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
90
130
|
/**
|
|
91
131
|
* Validates that an ActionElement has the correct shape per the Overlay spec.
|
|
92
132
|
*
|