@swagger-api/apidom-json-pointer-relative 1.0.0-beta.9 → 1.0.0-rc.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 +178 -0
- package/dist/apidom-json-pointer-relative.browser.js +14428 -12358
- package/dist/apidom-json-pointer-relative.browser.min.js +1 -1
- package/package.json +8 -8
- package/src/compile.cjs +2 -2
- package/src/compile.mjs +1 -1
- package/src/evaluate.cjs +3 -3
- package/src/evaluate.mjs +2 -2
- package/src/parse.cjs +2 -2
- package/src/parse.mjs +2 -2
- package/types/apidom-json-pointer-relative.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swagger-api/apidom-json-pointer-relative",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc.0",
|
|
4
4
|
"description": "Evaluate Relative JSON Pointer expressions against ApiDOM.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
|
|
24
24
|
"lint": "eslint ./",
|
|
25
25
|
"lint:fix": "eslint ./ --fix",
|
|
26
|
-
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs'
|
|
26
|
+
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types",
|
|
27
27
|
"typescript:check-types": "tsc --noEmit",
|
|
28
28
|
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
|
|
29
|
-
"test": "
|
|
29
|
+
"test": "NODE_ENV=test ts-mocha --exit",
|
|
30
30
|
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
|
|
31
31
|
"postpack": "rimraf NOTICE LICENSES"
|
|
32
32
|
},
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"author": "Vladimír Gorej",
|
|
38
38
|
"license": "Apache-2.0",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@babel/runtime-corejs3": "^7.
|
|
41
|
-
"@swagger-api/apidom-core": "^1.0.0-
|
|
42
|
-
"@swagger-api/apidom-error": "^1.0.0-
|
|
43
|
-
"@swagger-api/apidom-json-pointer": "^1.0.0-
|
|
40
|
+
"@babel/runtime-corejs3": "^7.26.10",
|
|
41
|
+
"@swagger-api/apidom-core": "^1.0.0-rc.0",
|
|
42
|
+
"@swagger-api/apidom-error": "^1.0.0-rc.0",
|
|
43
|
+
"@swagger-api/apidom-json-pointer": "^1.0.0-rc.0",
|
|
44
44
|
"@types/ramda": "~0.30.0",
|
|
45
45
|
"ramda": "~0.30.0",
|
|
46
46
|
"ramda-adjunct": "^5.0.0"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"README.md",
|
|
56
56
|
"CHANGELOG.md"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "af4b6e0fcae489477729581c52036725ac57a412"
|
|
59
59
|
}
|
package/src/compile.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var
|
|
6
|
+
var _modern = require("@swagger-api/apidom-json-pointer/modern");
|
|
7
7
|
var _CompilationRelativeJsonPointerError = _interopRequireDefault(require("./errors/CompilationRelativeJsonPointerError.cjs"));
|
|
8
8
|
/**
|
|
9
9
|
* @public
|
|
@@ -21,7 +21,7 @@ const compile = relativeJsonPointer => {
|
|
|
21
21
|
}
|
|
22
22
|
if (Array.isArray(relativeJsonPointer.jsonPointerTokens)) {
|
|
23
23
|
// <json-pointer>
|
|
24
|
-
relativePointer += (0,
|
|
24
|
+
relativePointer += (0, _modern.compile)(relativeJsonPointer.jsonPointerTokens);
|
|
25
25
|
} else if (relativeJsonPointer.hashCharacter) {
|
|
26
26
|
// "#"
|
|
27
27
|
relativePointer += '#';
|
package/src/compile.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compile as compileJsonPointer } from '@swagger-api/apidom-json-pointer';
|
|
1
|
+
import { compile as compileJsonPointer } from '@swagger-api/apidom-json-pointer/modern';
|
|
2
2
|
import CompilationRelativeJsonPointerError from "./errors/CompilationRelativeJsonPointerError.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* @public
|
package/src/evaluate.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
6
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
7
|
-
var
|
|
7
|
+
var _modern = require("@swagger-api/apidom-json-pointer/modern");
|
|
8
8
|
var _ramda = require("ramda");
|
|
9
9
|
var _EvaluationRelativeJsonPointerError = _interopRequireDefault(require("./errors/EvaluationRelativeJsonPointerError.cjs"));
|
|
10
10
|
var _parse = _interopRequireDefault(require("./parse.cjs"));
|
|
@@ -100,8 +100,8 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
100
100
|
}
|
|
101
101
|
if (Array.isArray(relativeJsonPointer.jsonPointerTokens)) {
|
|
102
102
|
// <json-pointer>
|
|
103
|
-
const jsonPointer = (0,
|
|
104
|
-
cursor = (0,
|
|
103
|
+
const jsonPointer = (0, _modern.compile)(relativeJsonPointer.jsonPointerTokens);
|
|
104
|
+
cursor = (0, _modern.evaluate)(cursor, jsonPointer);
|
|
105
105
|
} else if (relativeJsonPointer.hashCharacter) {
|
|
106
106
|
// "#"
|
|
107
107
|
if (cursor === rootElement) {
|
package/src/evaluate.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { visit, cloneDeep, BREAK, isElement, isMemberElement, isArrayElement, NumberElement } from '@swagger-api/apidom-core';
|
|
2
|
-
import { compile as compileJsonPointer, evaluate as evaluateJsonPointer } from '@swagger-api/apidom-json-pointer';
|
|
2
|
+
import { compile as compileJsonPointer, evaluate as evaluateJsonPointer } from '@swagger-api/apidom-json-pointer/modern';
|
|
3
3
|
import { last } from 'ramda';
|
|
4
4
|
import EvaluationRelativeJsonPointerError from "./errors/EvaluationRelativeJsonPointerError.mjs";
|
|
5
5
|
import parse from "./parse.mjs";
|
|
@@ -96,7 +96,7 @@ const evaluate = (relativePointer, currentElement, rootElement) => {
|
|
|
96
96
|
if (Array.isArray(relativeJsonPointer.jsonPointerTokens)) {
|
|
97
97
|
// <json-pointer>
|
|
98
98
|
const jsonPointer = compileJsonPointer(relativeJsonPointer.jsonPointerTokens);
|
|
99
|
-
cursor = evaluateJsonPointer(
|
|
99
|
+
cursor = evaluateJsonPointer(cursor, jsonPointer);
|
|
100
100
|
} else if (relativeJsonPointer.hashCharacter) {
|
|
101
101
|
// "#"
|
|
102
102
|
if (cursor === rootElement) {
|
package/src/parse.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.isRelativeJsonPointer = exports.default = void 0;
|
|
6
|
-
var
|
|
6
|
+
var _modern = require("@swagger-api/apidom-json-pointer/modern");
|
|
7
7
|
var _InvalidRelativeJsonPointerError = _interopRequireDefault(require("./errors/InvalidRelativeJsonPointerError.cjs"));
|
|
8
8
|
const nonNegativeIntegerPrefixRegExp = '(?<nonNegativeIntegerPrefix>[1-9]\\d*|0)';
|
|
9
9
|
const indexManipulationRegExp = '(?<indexManipulation>[+-][1-9]\\d*|0)';
|
|
@@ -35,7 +35,7 @@ const parse = relativePointer => {
|
|
|
35
35
|
// index-manipulation
|
|
36
36
|
const indexManipulation = typeof match.groups.indexManipulation === 'string' ? parseInt(match.groups.indexManipulation, 10) : undefined;
|
|
37
37
|
// <json-pointer>
|
|
38
|
-
const jsonPointerTokens = typeof match.groups.jsonPointer === 'string' ? (0,
|
|
38
|
+
const jsonPointerTokens = typeof match.groups.jsonPointer === 'string' ? (0, _modern.parse)(match.groups.jsonPointer).tree : undefined;
|
|
39
39
|
// "#"
|
|
40
40
|
const hashCharacter = typeof match.groups.hashCharacter === 'string';
|
|
41
41
|
return {
|
package/src/parse.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parse as parseJsonPointer } from '@swagger-api/apidom-json-pointer';
|
|
1
|
+
import { parse as parseJsonPointer } from '@swagger-api/apidom-json-pointer/modern';
|
|
2
2
|
import InvalidRelativeJsonPointerError from "./errors/InvalidRelativeJsonPointerError.mjs";
|
|
3
3
|
const nonNegativeIntegerPrefixRegExp = '(?<nonNegativeIntegerPrefix>[1-9]\\d*|0)';
|
|
4
4
|
const indexManipulationRegExp = '(?<indexManipulation>[+-][1-9]\\d*|0)';
|
|
@@ -29,7 +29,7 @@ const parse = relativePointer => {
|
|
|
29
29
|
// index-manipulation
|
|
30
30
|
const indexManipulation = typeof match.groups.indexManipulation === 'string' ? parseInt(match.groups.indexManipulation, 10) : undefined;
|
|
31
31
|
// <json-pointer>
|
|
32
|
-
const jsonPointerTokens = typeof match.groups.jsonPointer === 'string' ? parseJsonPointer(match.groups.jsonPointer) : undefined;
|
|
32
|
+
const jsonPointerTokens = typeof match.groups.jsonPointer === 'string' ? parseJsonPointer(match.groups.jsonPointer).tree : undefined;
|
|
33
33
|
// "#"
|
|
34
34
|
const hashCharacter = typeof match.groups.hashCharacter === 'string';
|
|
35
35
|
return {
|
|
@@ -29,7 +29,7 @@ export declare const compile: (relativeJsonPointer: RelativeJsonPointer) => stri
|
|
|
29
29
|
* Evaluates Relative JSON Pointer against ApiDOM fragment.
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
|
-
export declare const evaluate: <T extends Element_2, U extends Element_2>(relativePointer: string, currentElement: T, rootElement: U) => Element_2;
|
|
32
|
+
export declare const evaluate: <T extends Element_2, U extends Element_2>(relativePointer: string, currentElement: T, rootElement: U) => Element_2 | undefined;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* @public
|