@speclynx/apidom-overlay 4.4.0 → 4.5.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 +6 -0
- package/README.md +39 -10
- package/dist/apidom-overlay.browser.js +142 -104
- package/dist/apidom-overlay.browser.min.js +1 -1
- package/package.json +8 -8
- package/src/{apply.cjs → apply/apidom.cjs} +5 -5
- package/src/{apply.mjs → apply/apidom.mjs} +3 -3
- package/src/apply/pojo.cjs +23 -0
- package/src/apply/pojo.mjs +17 -0
- package/src/{apply-uri.cjs → apply/uri.cjs} +3 -3
- package/src/{apply-uri.mjs → apply/uri.mjs} +2 -2
- package/src/index.cjs +10 -7
- package/src/index.mjs +4 -3
- package/types/apidom-overlay.d.ts +16 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-overlay",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "Apply Overlay 1.x.y documents to API definitions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apidom",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"license": "Apache-2.0",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@babel/runtime-corejs3": "^7.28.4",
|
|
56
|
-
"@speclynx/apidom-core": "4.
|
|
57
|
-
"@speclynx/apidom-datamodel": "4.
|
|
58
|
-
"@speclynx/apidom-error": "4.
|
|
59
|
-
"@speclynx/apidom-json-path": "4.
|
|
60
|
-
"@speclynx/apidom-ns-overlay-1": "4.
|
|
61
|
-
"@speclynx/apidom-reference": "4.
|
|
56
|
+
"@speclynx/apidom-core": "4.5.0",
|
|
57
|
+
"@speclynx/apidom-datamodel": "4.5.0",
|
|
58
|
+
"@speclynx/apidom-error": "4.5.0",
|
|
59
|
+
"@speclynx/apidom-json-path": "4.5.0",
|
|
60
|
+
"@speclynx/apidom-ns-overlay-1": "4.5.0",
|
|
61
|
+
"@speclynx/apidom-reference": "4.5.0"
|
|
62
62
|
},
|
|
63
63
|
"files": [
|
|
64
64
|
"src/**/*.mjs",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"README.md",
|
|
71
71
|
"CHANGELOG.md"
|
|
72
72
|
],
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "2df7f3dcd368bdbc0644117fb677610a8b4a03a5"
|
|
74
74
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.applyUpdateAction = exports.applyRemoveAction = exports.
|
|
5
|
+
exports.applyUpdateAction = exports.applyRemoveAction = exports.applyOverlay = exports.applyCopyAction = exports.applyAction = void 0;
|
|
6
6
|
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
7
7
|
var _apidomCore = require("@speclynx/apidom-core");
|
|
8
8
|
var _apidomJsonPath = require("@speclynx/apidom-json-path");
|
|
9
9
|
var _apidomNsOverlay = require("@speclynx/apidom-ns-overlay-1");
|
|
10
|
-
var _OverlayError = _interopRequireDefault(require("
|
|
11
|
-
var _validate = require("
|
|
10
|
+
var _OverlayError = _interopRequireDefault(require("../errors/OverlayError.cjs"));
|
|
11
|
+
var _validate = require("../validate.cjs");
|
|
12
12
|
/**
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
@@ -214,7 +214,7 @@ const applyAction = (actionElement, targetElement, options = defaultApplyOptions
|
|
|
214
214
|
* @public
|
|
215
215
|
*/
|
|
216
216
|
exports.applyAction = applyAction;
|
|
217
|
-
const
|
|
217
|
+
const applyOverlay = (overlayElement, targetElement, options = defaultApplyOptions) => {
|
|
218
218
|
const overlay = overlayElement instanceof _apidomDatamodel.ParseResultElement ? overlayElement.api : overlayElement;
|
|
219
219
|
if (!(0, _apidomNsOverlay.isOverlay1Element)(overlay)) {
|
|
220
220
|
throw new _OverlayError.default('First argument must be an Overlay 1.x document');
|
|
@@ -240,4 +240,4 @@ const applyOverlayApiDOM = (overlayElement, targetElement, options = defaultAppl
|
|
|
240
240
|
}
|
|
241
241
|
return target;
|
|
242
242
|
};
|
|
243
|
-
exports.
|
|
243
|
+
exports.applyOverlay = applyOverlay;
|
|
@@ -2,8 +2,8 @@ import { isObjectElement, isArrayElement, cloneDeep, ParseResultElement } from '
|
|
|
2
2
|
import { deepmerge, toValue } from '@speclynx/apidom-core';
|
|
3
3
|
import { evaluate, NormalizedPath } from '@speclynx/apidom-json-path';
|
|
4
4
|
import { isOverlay1Element } from '@speclynx/apidom-ns-overlay-1';
|
|
5
|
-
import OverlayError from "
|
|
6
|
-
import { validateAction, validateTargetNodes } from "
|
|
5
|
+
import OverlayError from "../errors/OverlayError.mjs";
|
|
6
|
+
import { validateAction, validateTargetNodes } from "../validate.mjs";
|
|
7
7
|
/**
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
@@ -204,7 +204,7 @@ export const applyAction = (actionElement, targetElement, options = defaultApply
|
|
|
204
204
|
*
|
|
205
205
|
* @public
|
|
206
206
|
*/
|
|
207
|
-
export const
|
|
207
|
+
export const applyOverlay = (overlayElement, targetElement, options = defaultApplyOptions) => {
|
|
208
208
|
const overlay = overlayElement instanceof ParseResultElement ? overlayElement.api : overlayElement;
|
|
209
209
|
if (!isOverlay1Element(overlay)) {
|
|
210
210
|
throw new OverlayError('First argument must be an Overlay 1.x document');
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.applyOverlay = exports.applyAction = void 0;
|
|
5
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
6
|
+
var _apidomCore = require("@speclynx/apidom-core");
|
|
7
|
+
var _apidomNsOverlay = require("@speclynx/apidom-ns-overlay-1");
|
|
8
|
+
var _apidom = require("./apidom.cjs");
|
|
9
|
+
/**
|
|
10
|
+
* Applies a single overlay action (POJO) to a target (POJO).
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
const applyAction = (action, target) => (0, _apidomCore.toValue)((0, _apidom.applyAction)((0, _apidomNsOverlay.refractAction)(action), (0, _apidomDatamodel.refract)(target)));
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Applies an entire overlay document (POJO) to a target (POJO).
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
exports.applyAction = applyAction;
|
|
22
|
+
const applyOverlay = (overlay, target) => (0, _apidomCore.toValue)((0, _apidom.applyOverlay)((0, _apidomNsOverlay.refractOverlay1)(overlay), (0, _apidomDatamodel.refract)(target)));
|
|
23
|
+
exports.applyOverlay = applyOverlay;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { refract } from '@speclynx/apidom-datamodel';
|
|
2
|
+
import { toValue } from '@speclynx/apidom-core';
|
|
3
|
+
import { refractAction, refractOverlay1 } from '@speclynx/apidom-ns-overlay-1';
|
|
4
|
+
import { applyAction as applyActionApiDOM, applyOverlay as applyOverlayApiDOM } from "./apidom.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Applies a single overlay action (POJO) to a target (POJO).
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export const applyAction = (action, target) => toValue(applyActionApiDOM(refractAction(action), refract(target)));
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Applies an entire overlay document (POJO) to a target (POJO).
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export const applyOverlay = (overlay, target) => toValue(applyOverlayApiDOM(refractOverlay1(overlay), refract(target)));
|
|
@@ -6,8 +6,8 @@ exports.default = void 0;
|
|
|
6
6
|
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
7
7
|
var _apidomNsOverlay = require("@speclynx/apidom-ns-overlay-1");
|
|
8
8
|
var _apidomReference = require("@speclynx/apidom-reference");
|
|
9
|
-
var
|
|
10
|
-
var _OverlayError = _interopRequireDefault(require("
|
|
9
|
+
var _apidom = require("./apidom.cjs");
|
|
10
|
+
var _OverlayError = _interopRequireDefault(require("../errors/OverlayError.cjs"));
|
|
11
11
|
/**
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
@@ -75,6 +75,6 @@ const applyOverlay = async (overlayURI, targetURI, options = {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// apply overlay actions to the target (returns targetParseResult with result replaced)
|
|
78
|
-
return (0,
|
|
78
|
+
return (0, _apidom.applyOverlay)(overlayParseResult, targetParseResult, options);
|
|
79
79
|
};
|
|
80
80
|
var _default = exports.default = applyOverlay;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isParseResultElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import { isOverlay1Element } from '@speclynx/apidom-ns-overlay-1';
|
|
3
3
|
import { parse, mergeOptions } from '@speclynx/apidom-reference';
|
|
4
|
-
import { applyOverlayApiDOM } from "./
|
|
5
|
-
import OverlayError from "
|
|
4
|
+
import { applyOverlay as applyOverlayApiDOM } from "./apidom.mjs";
|
|
5
|
+
import OverlayError from "../errors/OverlayError.mjs";
|
|
6
6
|
/**
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
package/src/index.cjs
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.validateAction = exports.
|
|
6
|
-
var
|
|
7
|
-
exports.
|
|
8
|
-
exports.applyOverlayApiDOM =
|
|
5
|
+
exports.validateAction = exports.applyOverlayPOJO = exports.applyOverlayApiDOM = exports.applyOverlay = exports.applyActionPOJO = exports.applyActionApiDOM = exports.OverlayError = void 0;
|
|
6
|
+
var _apidom = require("./apply/apidom.cjs");
|
|
7
|
+
exports.applyActionApiDOM = _apidom.applyAction;
|
|
8
|
+
exports.applyOverlayApiDOM = _apidom.applyOverlay;
|
|
9
|
+
var _uri = _interopRequireDefault(require("./apply/uri.cjs"));
|
|
10
|
+
exports.applyOverlay = _uri.default;
|
|
11
|
+
var _pojo = require("./apply/pojo.cjs");
|
|
12
|
+
exports.applyActionPOJO = _pojo.applyAction;
|
|
13
|
+
exports.applyOverlayPOJO = _pojo.applyOverlay;
|
|
9
14
|
var _validate = require("./validate.cjs");
|
|
10
15
|
exports.validateAction = _validate.validateAction;
|
|
11
16
|
var _OverlayError = _interopRequireDefault(require("./errors/OverlayError.cjs"));
|
|
12
|
-
exports.OverlayError = _OverlayError.default;
|
|
13
|
-
var _applyUri = _interopRequireDefault(require("./apply-uri.cjs"));
|
|
14
|
-
exports.default = _applyUri.default;
|
|
17
|
+
exports.OverlayError = _OverlayError.default;
|
package/src/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { applyAction, applyOverlayApiDOM } from "./apply.mjs";
|
|
1
|
+
export { applyAction as applyActionApiDOM, applyOverlay as applyOverlayApiDOM } from "./apply/apidom.mjs";
|
|
2
|
+
export { default as applyOverlay } from "./apply/uri.mjs";
|
|
3
|
+
export { applyAction as applyActionPOJO, applyOverlay as applyOverlayPOJO } from "./apply/pojo.mjs";
|
|
2
4
|
export { validateAction } from "./validate.mjs";
|
|
3
|
-
export { default as OverlayError } from "./errors/OverlayError.mjs";
|
|
4
|
-
export { default } from "./apply-uri.mjs";
|
|
5
|
+
export { default as OverlayError } from "./errors/OverlayError.mjs";
|
|
@@ -13,7 +13,14 @@ import { ParseResultElement } from '@speclynx/apidom-datamodel';
|
|
|
13
13
|
*
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const applyActionApiDOM: (actionElement: ActionElement, targetElement: Element_2, options?: ApplyOptions) => Element_2;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Applies a single overlay action (POJO) to a target (POJO).
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare const applyActionPOJO: (action: Record<string, unknown>, target: Record<string, unknown>) => unknown;
|
|
17
24
|
|
|
18
25
|
/**
|
|
19
26
|
* @public
|
|
@@ -38,8 +45,7 @@ export declare interface ApplyOptions {
|
|
|
38
45
|
*
|
|
39
46
|
* @public
|
|
40
47
|
*/
|
|
41
|
-
declare const applyOverlay: (overlayURI: string, targetURI?: string, options?: ApplyOverlayOptions) => Promise<ParseResultElement>;
|
|
42
|
-
export default applyOverlay;
|
|
48
|
+
export declare const applyOverlay: (overlayURI: string, targetURI?: string, options?: ApplyOverlayOptions) => Promise<ParseResultElement>;
|
|
43
49
|
|
|
44
50
|
/**
|
|
45
51
|
* Applies an entire overlay document to a target element.
|
|
@@ -55,6 +61,13 @@ export declare const applyOverlayApiDOM: <T extends Element_2 | ParseResultEleme
|
|
|
55
61
|
export declare interface ApplyOverlayOptions extends Partial<ApiDOMReferenceOptions>, ApplyOptions {
|
|
56
62
|
}
|
|
57
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Applies an entire overlay document (POJO) to a target (POJO).
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export declare const applyOverlayPOJO: (overlay: Record<string, unknown>, target: Record<string, unknown>) => unknown;
|
|
70
|
+
|
|
58
71
|
/**
|
|
59
72
|
* @public
|
|
60
73
|
*/
|