@swagger-api/apidom-json-pointer 1.0.0-beta.8 → 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 +186 -0
- package/README.md +37 -6
- package/dist/apidom-json-pointer.browser.js +7982 -11742
- package/dist/apidom-json-pointer.browser.min.js +1 -1
- package/package.json +25 -15
- package/src/index.cjs +26 -22
- package/src/index.mjs +36 -9
- package/src/legacy/compile.cjs +25 -0
- package/src/legacy/compile.mjs +20 -0
- package/src/{errors → legacy/errors}/CompilationJsonPointerError.cjs +2 -0
- package/src/{errors → legacy/errors}/CompilationJsonPointerError.mjs +2 -0
- package/src/{errors → legacy/errors}/EvaluationJsonPointerError.cjs +2 -0
- package/src/{errors → legacy/errors}/EvaluationJsonPointerError.mjs +2 -0
- package/src/{errors → legacy/errors}/InvalidJsonPointerError.cjs +2 -0
- package/src/{errors → legacy/errors}/InvalidJsonPointerError.mjs +2 -0
- package/src/{errors → legacy/errors}/JsonPointerError.cjs +1 -0
- package/src/{errors → legacy/errors}/JsonPointerError.mjs +1 -0
- package/src/legacy/escape.cjs +13 -0
- package/src/legacy/escape.mjs +10 -0
- package/src/legacy/evaluate.cjs +36 -0
- package/src/legacy/evaluate.mjs +31 -0
- package/src/legacy/index.cjs +25 -0
- package/src/legacy/index.mjs +9 -0
- package/src/legacy/parse.cjs +38 -0
- package/src/legacy/parse.mjs +34 -0
- package/src/legacy/unescape.cjs +13 -0
- package/src/legacy/unescape.mjs +10 -0
- package/types/apidom-json-pointer.d.ts +68 -91
- package/src/compile.cjs +0 -24
- package/src/compile.mjs +0 -19
- package/src/escape.cjs +0 -10
- package/src/escape.mjs +0 -7
- package/src/evaluate.cjs +0 -62
- package/src/evaluate.mjs +0 -57
- package/src/parse.cjs +0 -53
- package/src/parse.mjs +0 -47
- package/src/unescape.cjs +0 -24
- package/src/unescape.mjs +0 -21
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _jsonPointer = require("@swaggerexpert/json-pointer");
|
|
7
|
+
var _CompilationJsonPointerError = _interopRequireDefault(require("./errors/CompilationJsonPointerError.cjs"));
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
* @deprecated
|
|
11
|
+
*/
|
|
12
|
+
const compile = tokens => {
|
|
13
|
+
try {
|
|
14
|
+
return _jsonPointer.URIFragmentIdentifier.to((0, _jsonPointer.compile)(tokens)).slice(1);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error instanceof _jsonPointer.JSONPointerCompileError) {
|
|
17
|
+
throw new _CompilationJsonPointerError.default(error.message, {
|
|
18
|
+
tokens,
|
|
19
|
+
cause: error
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var _default = exports.default = compile;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { compile as baseCompile, URIFragmentIdentifier, JSONPointerCompileError } from '@swaggerexpert/json-pointer';
|
|
2
|
+
import CompilationJsonPointerError from "./errors/CompilationJsonPointerError.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
const compile = tokens => {
|
|
8
|
+
try {
|
|
9
|
+
return URIFragmentIdentifier.to(baseCompile(tokens)).slice(1);
|
|
10
|
+
} catch (error) {
|
|
11
|
+
if (error instanceof JSONPointerCompileError) {
|
|
12
|
+
throw new CompilationJsonPointerError(error.message, {
|
|
13
|
+
tokens,
|
|
14
|
+
cause: error
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export default compile;
|
|
@@ -6,10 +6,12 @@ exports.default = void 0;
|
|
|
6
6
|
var _JsonPointerError = _interopRequireDefault(require("./JsonPointerError.cjs"));
|
|
7
7
|
/**
|
|
8
8
|
* @public
|
|
9
|
+
* @deprecated
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @public
|
|
14
|
+
* @deprecated
|
|
13
15
|
*/
|
|
14
16
|
class CompilationJsonPointerError extends _JsonPointerError.default {
|
|
15
17
|
tokens;
|
|
@@ -6,10 +6,12 @@ exports.default = void 0;
|
|
|
6
6
|
var _JsonPointerError = _interopRequireDefault(require("./JsonPointerError.cjs"));
|
|
7
7
|
/**
|
|
8
8
|
* @public
|
|
9
|
+
* @deprecated
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @public
|
|
14
|
+
* @deprecated
|
|
13
15
|
*/
|
|
14
16
|
class EvaluationJsonPointerError extends _JsonPointerError.default {
|
|
15
17
|
pointer;
|
|
@@ -6,10 +6,12 @@ exports.default = void 0;
|
|
|
6
6
|
var _JsonPointerError = _interopRequireDefault(require("./JsonPointerError.cjs"));
|
|
7
7
|
/**
|
|
8
8
|
* @public
|
|
9
|
+
* @deprecated
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* @public
|
|
14
|
+
* @deprecated
|
|
13
15
|
*/
|
|
14
16
|
class InvalidJsonPointerError extends _JsonPointerError.default {
|
|
15
17
|
pointer;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _jsonPointer = require("@swaggerexpert/json-pointer");
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
const escape = referenceToken => {
|
|
11
|
+
return _jsonPointer.URIFragmentIdentifier.to((0, _jsonPointer.escape)(referenceToken)).slice(1);
|
|
12
|
+
};
|
|
13
|
+
var _default = exports.default = escape;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { escape as baseEscape, URIFragmentIdentifier } from '@swaggerexpert/json-pointer';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
const escape = referenceToken => {
|
|
8
|
+
return URIFragmentIdentifier.to(baseEscape(referenceToken)).slice(1);
|
|
9
|
+
};
|
|
10
|
+
export default escape;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _jsonPointer = require("@swaggerexpert/json-pointer");
|
|
7
|
+
var _apidom = require("@swaggerexpert/json-pointer/evaluate/realms/apidom");
|
|
8
|
+
var _apidomCore = require("@swagger-api/apidom-core");
|
|
9
|
+
var _EvaluationJsonPointerError = _interopRequireDefault(require("./errors/EvaluationJsonPointerError.cjs"));
|
|
10
|
+
/**
|
|
11
|
+
* Evaluates JSON Pointer against ApiDOM fragment.
|
|
12
|
+
* @public
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
15
|
+
const evaluate = (pointer, element) => {
|
|
16
|
+
try {
|
|
17
|
+
return (0, _apidom.evaluate)(element, _jsonPointer.URIFragmentIdentifier.from(pointer));
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error instanceof _jsonPointer.JSONPointerEvaluateError) {
|
|
20
|
+
throw new _EvaluationJsonPointerError.default(error.message, {
|
|
21
|
+
pointer,
|
|
22
|
+
tokens: error.referenceTokens,
|
|
23
|
+
failedToken: error.referenceToken,
|
|
24
|
+
failedTokenPosition: error.referenceTokenPosition,
|
|
25
|
+
element: (0, _apidomCore.cloneDeep)(element),
|
|
26
|
+
cause: error
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
throw new _EvaluationJsonPointerError.default(error.message, {
|
|
30
|
+
pointer,
|
|
31
|
+
element: (0, _apidomCore.cloneDeep)(element),
|
|
32
|
+
cause: error
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var _default = exports.default = evaluate;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { JSONPointerEvaluateError, URIFragmentIdentifier } from '@swaggerexpert/json-pointer';
|
|
2
|
+
import { evaluate as baseEvaluate } from '@swaggerexpert/json-pointer/evaluate/realms/apidom';
|
|
3
|
+
import { cloneDeep } from '@swagger-api/apidom-core';
|
|
4
|
+
import EvaluationJsonPointerError from "./errors/EvaluationJsonPointerError.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Evaluates JSON Pointer against ApiDOM fragment.
|
|
7
|
+
* @public
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
const evaluate = (pointer, element) => {
|
|
11
|
+
try {
|
|
12
|
+
return baseEvaluate(element, URIFragmentIdentifier.from(pointer));
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (error instanceof JSONPointerEvaluateError) {
|
|
15
|
+
throw new EvaluationJsonPointerError(error.message, {
|
|
16
|
+
pointer,
|
|
17
|
+
tokens: error.referenceTokens,
|
|
18
|
+
failedToken: error.referenceToken,
|
|
19
|
+
failedTokenPosition: error.referenceTokenPosition,
|
|
20
|
+
element: cloneDeep(element),
|
|
21
|
+
cause: error
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
throw new EvaluationJsonPointerError(error.message, {
|
|
25
|
+
pointer,
|
|
26
|
+
element: cloneDeep(element),
|
|
27
|
+
cause: error
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export default evaluate;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.uriToPointer = exports.unescape = exports.parse = exports.evaluate = exports.escape = exports.compile = exports.JsonPointerError = exports.InvalidJsonPointerError = exports.EvaluationJsonPointerError = exports.CompilationJsonPointerError = void 0;
|
|
7
|
+
var _JsonPointerError = _interopRequireDefault(require("./errors/JsonPointerError.cjs"));
|
|
8
|
+
exports.JsonPointerError = _JsonPointerError.default;
|
|
9
|
+
var _InvalidJsonPointerError = _interopRequireDefault(require("./errors/InvalidJsonPointerError.cjs"));
|
|
10
|
+
exports.InvalidJsonPointerError = _InvalidJsonPointerError.default;
|
|
11
|
+
var _CompilationJsonPointerError = _interopRequireDefault(require("./errors/CompilationJsonPointerError.cjs"));
|
|
12
|
+
exports.CompilationJsonPointerError = _CompilationJsonPointerError.default;
|
|
13
|
+
var _EvaluationJsonPointerError = _interopRequireDefault(require("./errors/EvaluationJsonPointerError.cjs"));
|
|
14
|
+
exports.EvaluationJsonPointerError = _EvaluationJsonPointerError.default;
|
|
15
|
+
var _parse = _interopRequireWildcard(require("./parse.cjs"));
|
|
16
|
+
exports.parse = _parse.default;
|
|
17
|
+
exports.uriToPointer = _parse.uriToPointer;
|
|
18
|
+
var _evaluate = _interopRequireDefault(require("./evaluate.cjs"));
|
|
19
|
+
exports.evaluate = _evaluate.default;
|
|
20
|
+
var _escape = _interopRequireDefault(require("./escape.cjs"));
|
|
21
|
+
exports.escape = _escape.default;
|
|
22
|
+
var _unescape = _interopRequireDefault(require("./unescape.cjs"));
|
|
23
|
+
exports.unescape = _unescape.default;
|
|
24
|
+
var _compile = _interopRequireDefault(require("./compile.cjs"));
|
|
25
|
+
exports.compile = _compile.default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as JsonPointerError } from "./errors/JsonPointerError.mjs";
|
|
2
|
+
export { default as InvalidJsonPointerError } from "./errors/InvalidJsonPointerError.mjs";
|
|
3
|
+
export { default as CompilationJsonPointerError } from "./errors/CompilationJsonPointerError.mjs";
|
|
4
|
+
export { default as EvaluationJsonPointerError } from "./errors/EvaluationJsonPointerError.mjs";
|
|
5
|
+
export { default as parse, uriToPointer } from "./parse.mjs";
|
|
6
|
+
export { default as evaluate } from "./evaluate.mjs";
|
|
7
|
+
export { default as escape } from "./escape.mjs";
|
|
8
|
+
export { default as unescape } from "./unescape.mjs";
|
|
9
|
+
export { default as compile } from "./compile.mjs";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.uriToPointer = exports.default = void 0;
|
|
5
|
+
var _jsonPointer = require("@swaggerexpert/json-pointer");
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
const parse = (pointer, options) => {
|
|
11
|
+
const {
|
|
12
|
+
tree
|
|
13
|
+
} = (0, _jsonPointer.parse)(_jsonPointer.URIFragmentIdentifier.from(pointer), options);
|
|
14
|
+
return tree;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Returns the hash (URL fragment), of the given path.
|
|
19
|
+
* If there is no hash, then the root hash ("#") is returned.
|
|
20
|
+
*/
|
|
21
|
+
const getHash = uri => {
|
|
22
|
+
const hashIndex = uri.indexOf('#');
|
|
23
|
+
if (hashIndex !== -1) {
|
|
24
|
+
return uri.substring(hashIndex);
|
|
25
|
+
}
|
|
26
|
+
return '#';
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
* @deprecated
|
|
32
|
+
*/
|
|
33
|
+
const uriToPointer = uri => {
|
|
34
|
+
const hash = getHash(uri);
|
|
35
|
+
return _jsonPointer.URIFragmentIdentifier.from(hash);
|
|
36
|
+
};
|
|
37
|
+
exports.uriToPointer = uriToPointer;
|
|
38
|
+
var _default = exports.default = parse;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { parse as jsonPointerParse, URIFragmentIdentifier } from '@swaggerexpert/json-pointer';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
const parse = (pointer, options) => {
|
|
8
|
+
const {
|
|
9
|
+
tree
|
|
10
|
+
} = jsonPointerParse(URIFragmentIdentifier.from(pointer), options);
|
|
11
|
+
return tree;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns the hash (URL fragment), of the given path.
|
|
16
|
+
* If there is no hash, then the root hash ("#") is returned.
|
|
17
|
+
*/
|
|
18
|
+
const getHash = uri => {
|
|
19
|
+
const hashIndex = uri.indexOf('#');
|
|
20
|
+
if (hashIndex !== -1) {
|
|
21
|
+
return uri.substring(hashIndex);
|
|
22
|
+
}
|
|
23
|
+
return '#';
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
* @deprecated
|
|
29
|
+
*/
|
|
30
|
+
export const uriToPointer = uri => {
|
|
31
|
+
const hash = getHash(uri);
|
|
32
|
+
return URIFragmentIdentifier.from(hash);
|
|
33
|
+
};
|
|
34
|
+
export default parse;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _jsonPointer = require("@swaggerexpert/json-pointer");
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
const unescape = referenceToken => {
|
|
11
|
+
return _jsonPointer.URIFragmentIdentifier.from((0, _jsonPointer.unescape)(referenceToken));
|
|
12
|
+
};
|
|
13
|
+
var _default = exports.default = unescape;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { unescape as baseUnescape, URIFragmentIdentifier } from '@swaggerexpert/json-pointer';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
7
|
+
const unescape = referenceToken => {
|
|
8
|
+
return URIFragmentIdentifier.from(baseUnescape(referenceToken));
|
|
9
|
+
};
|
|
10
|
+
export default unescape;
|
|
@@ -1,97 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { ASTTranslator } from '@swaggerexpert/json-pointer';
|
|
2
|
+
import { compile } from '@swaggerexpert/json-pointer';
|
|
3
|
+
import { CSTTranslator } from '@swaggerexpert/json-pointer';
|
|
4
|
+
import { escape as escape_2 } from '@swaggerexpert/json-pointer';
|
|
5
|
+
import { evaluate } from '@swaggerexpert/json-pointer/evaluate/realms/apidom';
|
|
6
|
+
import { Grammar } from '@swaggerexpert/json-pointer';
|
|
7
|
+
import { JSONPointerCompileError } from '@swaggerexpert/json-pointer';
|
|
8
|
+
import { JSONPointerError } from '@swaggerexpert/json-pointer';
|
|
9
|
+
import { JSONPointerEvaluateError } from '@swaggerexpert/json-pointer';
|
|
10
|
+
import { JSONPointerIndexError } from '@swaggerexpert/json-pointer';
|
|
11
|
+
import { JSONPointerKeyError } from '@swaggerexpert/json-pointer';
|
|
12
|
+
import { JSONPointerParseError } from '@swaggerexpert/json-pointer';
|
|
13
|
+
import { JSONPointerTypeError } from '@swaggerexpert/json-pointer';
|
|
14
|
+
import { JSONString } from '@swaggerexpert/json-pointer';
|
|
15
|
+
import { parse } from '@swaggerexpert/json-pointer';
|
|
16
|
+
import { testArrayDash } from '@swaggerexpert/json-pointer';
|
|
17
|
+
import { testArrayIndex } from '@swaggerexpert/json-pointer';
|
|
18
|
+
import { testArrayLocation } from '@swaggerexpert/json-pointer';
|
|
19
|
+
import { testJSONPointer } from '@swaggerexpert/json-pointer';
|
|
20
|
+
import { testReferenceToken } from '@swaggerexpert/json-pointer';
|
|
21
|
+
import { unescape as unescape_2 } from '@swaggerexpert/json-pointer';
|
|
22
|
+
import { URIFragmentIdentifier } from '@swaggerexpert/json-pointer';
|
|
23
|
+
import { XMLTranslator } from '@swaggerexpert/json-pointer';
|
|
24
|
+
|
|
25
|
+
export { ASTTranslator }
|
|
26
|
+
|
|
27
|
+
export { compile }
|
|
28
|
+
|
|
29
|
+
export { CSTTranslator }
|
|
30
|
+
|
|
29
31
|
export { escape_2 as escape }
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export declare class InvalidJsonPointerError extends JsonPointerError {
|
|
64
|
-
readonly pointer: string;
|
|
65
|
-
constructor(message?: string, structuredOptions?: InvalidJsonPointerErrorOptions);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @public
|
|
70
|
-
*/
|
|
71
|
-
export declare interface InvalidJsonPointerErrorOptions extends ApiDOMErrorOptions {
|
|
72
|
-
readonly pointer: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
export declare class JsonPointerError extends ApiDOMStructuredError {
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
export declare const parse: (pointer: string) => string[];
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
89
|
-
declare const unescape_2: (str: string) => string;
|
|
33
|
+
export { evaluate }
|
|
34
|
+
|
|
35
|
+
export { Grammar }
|
|
36
|
+
|
|
37
|
+
export { JSONPointerCompileError }
|
|
38
|
+
|
|
39
|
+
export { JSONPointerError }
|
|
40
|
+
|
|
41
|
+
export { JSONPointerEvaluateError }
|
|
42
|
+
|
|
43
|
+
export { JSONPointerIndexError }
|
|
44
|
+
|
|
45
|
+
export { JSONPointerKeyError }
|
|
46
|
+
|
|
47
|
+
export { JSONPointerParseError }
|
|
48
|
+
|
|
49
|
+
export { JSONPointerTypeError }
|
|
50
|
+
|
|
51
|
+
export { JSONString }
|
|
52
|
+
|
|
53
|
+
export { parse }
|
|
54
|
+
|
|
55
|
+
export { testArrayDash }
|
|
56
|
+
|
|
57
|
+
export { testArrayIndex }
|
|
58
|
+
|
|
59
|
+
export { testArrayLocation }
|
|
60
|
+
|
|
61
|
+
export { testJSONPointer }
|
|
62
|
+
|
|
63
|
+
export { testReferenceToken }
|
|
64
|
+
|
|
90
65
|
export { unescape_2 as unescape }
|
|
91
66
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
67
|
+
export { URIFragmentIdentifier }
|
|
68
|
+
|
|
69
|
+
export { XMLTranslator }
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
export * from "@swaggerexpert/json-pointer";
|
|
96
73
|
|
|
97
74
|
export { }
|
package/src/compile.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.default = void 0;
|
|
6
|
-
var _escape = _interopRequireDefault(require("./escape.cjs"));
|
|
7
|
-
var _CompilationJsonPointerError = _interopRequireDefault(require("./errors/CompilationJsonPointerError.cjs"));
|
|
8
|
-
/**
|
|
9
|
-
* @public
|
|
10
|
-
*/
|
|
11
|
-
const compile = tokens => {
|
|
12
|
-
try {
|
|
13
|
-
if (tokens.length === 0) {
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
return `/${tokens.map(_escape.default).join('/')}`;
|
|
17
|
-
} catch (error) {
|
|
18
|
-
throw new _CompilationJsonPointerError.default('JSON Pointer compilation of tokens encountered an error.', {
|
|
19
|
-
tokens,
|
|
20
|
-
cause: error
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
var _default = exports.default = compile;
|
package/src/compile.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import escape from "./escape.mjs";
|
|
2
|
-
import CompilationJsonPointerError from "./errors/CompilationJsonPointerError.mjs";
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
const compile = tokens => {
|
|
7
|
-
try {
|
|
8
|
-
if (tokens.length === 0) {
|
|
9
|
-
return '';
|
|
10
|
-
}
|
|
11
|
-
return `/${tokens.map(escape).join('/')}`;
|
|
12
|
-
} catch (error) {
|
|
13
|
-
throw new CompilationJsonPointerError('JSON Pointer compilation of tokens encountered an error.', {
|
|
14
|
-
tokens,
|
|
15
|
-
cause: error
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
export default compile;
|
package/src/escape.cjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = void 0;
|
|
5
|
-
var _ramda = require("ramda");
|
|
6
|
-
/**
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
const escape = (0, _ramda.pipe)((0, _ramda.replace)(/~/g, '~0'), (0, _ramda.replace)(/\//g, '~1'), encodeURIComponent);
|
|
10
|
-
var _default = exports.default = escape;
|