@swagger-api/apidom-json-pointer-relative 0.78.0 → 0.80.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 +8 -0
- package/cjs/errors/EvaluationRelativeJsonPointerError.cjs +3 -15
- package/cjs/evaluate.cjs +18 -18
- package/dist/apidom-json-pointer-relative.browser.js +134 -328
- package/dist/apidom-json-pointer-relative.browser.min.js +1 -1
- package/es/errors/EvaluationRelativeJsonPointerError.mjs +3 -15
- package/es/evaluate.mjs +19 -19
- package/package.json +5 -5
- package/types/dist.d.ts +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
# [0.80.0](https://github.com/swagger-api/apidom/compare/v0.79.0...v0.80.0) (2023-10-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @swagger-api/apidom-json-pointer-relative
|
|
9
|
+
|
|
10
|
+
# [0.79.0](https://github.com/swagger-api/apidom/compare/v0.78.0...v0.79.0) (2023-10-24)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @swagger-api/apidom-json-pointer-relative
|
|
13
|
+
|
|
6
14
|
# [0.78.0](https://github.com/swagger-api/apidom/compare/v0.77.0...v0.78.0) (2023-10-17)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
|
@@ -3,27 +3,15 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _apidomCore = require("@swagger-api/apidom-core");
|
|
7
6
|
var _RelativeJsonPointerError = _interopRequireDefault(require("./RelativeJsonPointerError.cjs"));
|
|
8
7
|
class EvaluationRelativeJsonPointerError extends _RelativeJsonPointerError.default {
|
|
9
8
|
constructor(message, structuredOptions) {
|
|
10
9
|
super(message, structuredOptions);
|
|
11
10
|
if (typeof structuredOptions !== 'undefined') {
|
|
12
11
|
this.relativePointer = structuredOptions.relativePointer;
|
|
13
|
-
this.currentElement = structuredOptions.currentElement
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
this.rootElement = structuredOptions.rootElement.element;
|
|
18
|
-
if ((0, _apidomCore.hasElementSourceMap)(structuredOptions.rootElement)) {
|
|
19
|
-
this.rootElementSourceMap = (0, _apidomCore.toValue)(structuredOptions.rootElement.getMetaProperty('sourceMap'));
|
|
20
|
-
}
|
|
21
|
-
if (typeof structuredOptions.cursorElement !== 'undefined') {
|
|
22
|
-
this.cursorElement = structuredOptions.cursorElement.element;
|
|
23
|
-
if ((0, _apidomCore.hasElementSourceMap)(structuredOptions.cursorElement)) {
|
|
24
|
-
this.cursorElementSourceMap = (0, _apidomCore.toValue)(structuredOptions.cursorElement.getMetaProperty('sourceMap'));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
12
|
+
this.currentElement = structuredOptions.currentElement;
|
|
13
|
+
this.rootElement = structuredOptions.rootElement;
|
|
14
|
+
this.cursorElement = structuredOptions.cursorElement;
|
|
27
15
|
}
|
|
28
16
|
}
|
|
29
17
|
}
|
package/cjs/evaluate.cjs
CHANGED
|
@@ -24,9 +24,9 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
24
24
|
if (ancestorLineage.length === 0) {
|
|
25
25
|
throw new _EvaluationRelativeJsonPointerError.default('Relative JSON Pointer evaluation failed. Current element not found inside the root element', {
|
|
26
26
|
relativePointer,
|
|
27
|
-
currentElement,
|
|
28
|
-
rootElement,
|
|
29
|
-
cursorElement: cursor
|
|
27
|
+
currentElement: (0, _apidomCore.cloneDeep)(currentElement),
|
|
28
|
+
rootElement: (0, _apidomCore.cloneDeep)(rootElement),
|
|
29
|
+
cursorElement: _apidomCore.cloneDeep.safe(cursor)
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
if ((0, _ramda.last)(ancestorLineage) === rootElement) {
|
|
@@ -43,9 +43,9 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
43
43
|
} catch (error) {
|
|
44
44
|
throw new _EvaluationRelativeJsonPointerError.default('Relative JSON Pointer evaluation failed while parsing the pointer.', {
|
|
45
45
|
relativePointer,
|
|
46
|
-
currentElement,
|
|
47
|
-
rootElement,
|
|
48
|
-
cursorElement: cursor,
|
|
46
|
+
currentElement: (0, _apidomCore.cloneDeep)(currentElement),
|
|
47
|
+
rootElement: (0, _apidomCore.cloneDeep)(currentElement),
|
|
48
|
+
cursorElement: _apidomCore.cloneDeep.safe(cursor),
|
|
49
49
|
cause: error
|
|
50
50
|
});
|
|
51
51
|
}
|
|
@@ -64,9 +64,9 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
64
64
|
if (typeof cursor === 'undefined') {
|
|
65
65
|
throw new _EvaluationRelativeJsonPointerError.default(`Relative JSON Pointer evaluation failed on non-negative-integer prefix of "${relativeJsonPointer.nonNegativeIntegerPrefix}"`, {
|
|
66
66
|
relativePointer,
|
|
67
|
-
currentElement,
|
|
68
|
-
rootElement,
|
|
69
|
-
cursorElement: cursor
|
|
67
|
+
currentElement: (0, _apidomCore.cloneDeep)(currentElement),
|
|
68
|
+
rootElement: (0, _apidomCore.cloneDeep)(rootElement),
|
|
69
|
+
cursorElement: _apidomCore.cloneDeep.safe(cursor)
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
ancestorLineage = ancestorLineageCopy;
|
|
@@ -78,9 +78,9 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
78
78
|
if (typeof containedArray === 'undefined' || !(0, _apidomCore.isArrayElement)(containedArray)) {
|
|
79
79
|
throw new _EvaluationRelativeJsonPointerError.default(`Relative JSON Pointer evaluation failed failed on index-manipulation "${relativeJsonPointer.indexManipulation}"`, {
|
|
80
80
|
relativePointer,
|
|
81
|
-
currentElement,
|
|
82
|
-
rootElement,
|
|
83
|
-
cursorElement: cursor
|
|
81
|
+
currentElement: (0, _apidomCore.cloneDeep)(currentElement),
|
|
82
|
+
rootElement: (0, _apidomCore.cloneDeep)(rootElement),
|
|
83
|
+
cursorElement: _apidomCore.cloneDeep.safe(cursor)
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
const currentCursorIndex = containedArray.content.indexOf(cursor);
|
|
@@ -89,9 +89,9 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
89
89
|
if (typeof cursor === 'undefined') {
|
|
90
90
|
throw new _EvaluationRelativeJsonPointerError.default(`Relative JSON Pointer evaluation failed on index-manipulation "${relativeJsonPointer.indexManipulation}"`, {
|
|
91
91
|
relativePointer,
|
|
92
|
-
currentElement,
|
|
93
|
-
rootElement,
|
|
94
|
-
cursorElement: cursor
|
|
92
|
+
currentElement: (0, _apidomCore.cloneDeep)(currentElement),
|
|
93
|
+
rootElement: (0, _apidomCore.cloneDeep)(rootElement),
|
|
94
|
+
cursorElement: _apidomCore.cloneDeep.safe(cursor)
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -104,9 +104,9 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
104
104
|
if (cursor === rootElement) {
|
|
105
105
|
throw new _EvaluationRelativeJsonPointerError.default('Relative JSON Pointer evaluation failed. Current element cannot be the root element to apply "#"', {
|
|
106
106
|
relativePointer,
|
|
107
|
-
currentElement,
|
|
108
|
-
rootElement,
|
|
109
|
-
cursorElement: cursor
|
|
107
|
+
currentElement: (0, _apidomCore.cloneDeep)(currentElement),
|
|
108
|
+
rootElement: (0, _apidomCore.cloneDeep)(rootElement),
|
|
109
|
+
cursorElement: _apidomCore.cloneDeep.safe(cursor)
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
const parentElement = (0, _ramda.last)(ancestorLineage);
|