@swagger-api/apidom-json-pointer 1.0.0-alpha.9 → 1.0.0-beta.1

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.
@@ -0,0 +1,97 @@
1
+ import { ApiDOMErrorOptions } from '@swagger-api/apidom-error';
2
+ import { ApiDOMStructuredError } from '@swagger-api/apidom-error';
3
+ import { Element as Element_2 } from '@swagger-api/apidom-core';
4
+
5
+ /**
6
+ * @public
7
+ */
8
+ export declare class CompilationJsonPointerError extends JsonPointerError {
9
+ readonly tokens: string[];
10
+ constructor(message?: string, structuredOptions?: CompilationJsonPointerErrorOptions);
11
+ }
12
+
13
+ /**
14
+ * @public
15
+ */
16
+ export declare interface CompilationJsonPointerErrorOptions extends ApiDOMErrorOptions {
17
+ readonly tokens: string[];
18
+ }
19
+
20
+ /**
21
+ * @public
22
+ */
23
+ export declare const compile: (tokens: string[]) => string;
24
+
25
+ /**
26
+ * @public
27
+ */
28
+ declare const escape_2: (str: string) => string;
29
+ export { escape_2 as escape }
30
+
31
+ /**
32
+ * Evaluates JSON Pointer against ApiDOM fragment.
33
+ * @public
34
+ */
35
+ export declare const evaluate: <T extends Element_2>(pointer: string, element: T) => Element_2;
36
+
37
+ /**
38
+ * @public
39
+ */
40
+ export declare class EvaluationJsonPointerError<T extends Element_2> extends JsonPointerError {
41
+ readonly pointer: string;
42
+ readonly tokens?: string[];
43
+ readonly failedToken?: string;
44
+ readonly failedTokenPosition?: number;
45
+ readonly element: T;
46
+ constructor(message?: string, structuredOptions?: EvaluationJsonPointerErrorOptions<T>);
47
+ }
48
+
49
+ /**
50
+ * @public
51
+ */
52
+ export declare interface EvaluationJsonPointerErrorOptions<T extends Element_2> extends ApiDOMErrorOptions {
53
+ readonly pointer: string;
54
+ readonly tokens?: string[];
55
+ readonly failedToken?: string;
56
+ readonly failedTokenPosition?: number;
57
+ readonly element: T;
58
+ }
59
+
60
+ /**
61
+ * @public
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;
90
+ export { unescape_2 as unescape }
91
+
92
+ /**
93
+ * @public
94
+ */
95
+ export declare const uriToPointer: (uri: string) => string;
96
+
97
+ export { }
package/cjs/compile.cjs DELETED
@@ -1,22 +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
- // compile :: String[] -> String
9
- const compile = tokens => {
10
- try {
11
- if (tokens.length === 0) {
12
- return '';
13
- }
14
- return `/${tokens.map(_escape.default).join('/')}`;
15
- } catch (error) {
16
- throw new _CompilationJsonPointerError.default('JSON Pointer compilation of tokens encountered an error.', {
17
- tokens,
18
- cause: error
19
- });
20
- }
21
- };
22
- var _default = exports.default = compile;
@@ -1,16 +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 _JsonPointerError = _interopRequireDefault(require("./JsonPointerError.cjs"));
7
- class CompilationJsonPointerError extends _JsonPointerError.default {
8
- tokens;
9
- constructor(message, structuredOptions) {
10
- super(message, structuredOptions);
11
- if (typeof structuredOptions !== 'undefined') {
12
- this.tokens = [...structuredOptions.tokens];
13
- }
14
- }
15
- }
16
- var _default = exports.default = CompilationJsonPointerError;
@@ -1,26 +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 _JsonPointerError = _interopRequireDefault(require("./JsonPointerError.cjs"));
7
- class EvaluationJsonPointerError extends _JsonPointerError.default {
8
- pointer;
9
- tokens;
10
- failedToken;
11
- failedTokenPosition;
12
- element;
13
- constructor(message, structuredOptions) {
14
- super(message, structuredOptions);
15
- if (typeof structuredOptions !== 'undefined') {
16
- this.pointer = structuredOptions.pointer;
17
- if (Array.isArray(structuredOptions.tokens)) {
18
- this.tokens = [...structuredOptions.tokens];
19
- }
20
- this.failedToken = structuredOptions.failedToken;
21
- this.failedTokenPosition = structuredOptions.failedTokenPosition;
22
- this.element = structuredOptions.element;
23
- }
24
- }
25
- }
26
- var _default = exports.default = EvaluationJsonPointerError;
@@ -1,16 +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 _JsonPointerError = _interopRequireDefault(require("./JsonPointerError.cjs"));
7
- class InvalidJsonPointerError extends _JsonPointerError.default {
8
- pointer;
9
- constructor(message, structuredOptions) {
10
- super(message, structuredOptions);
11
- if (typeof structuredOptions !== 'undefined') {
12
- this.pointer = structuredOptions.pointer;
13
- }
14
- }
15
- }
16
- var _default = exports.default = InvalidJsonPointerError;
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _apidomError = require("@swagger-api/apidom-error");
6
- class JsonPointerError extends _apidomError.ApiDOMStructuredError {}
7
- var _default = exports.default = JsonPointerError;
package/cjs/escape.cjs DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _ramda = require("ramda");
6
- // escape :: String -> String
7
- const escape = (0, _ramda.pipe)((0, _ramda.replace)(/~/g, '~0'), (0, _ramda.replace)(/\//g, '~1'), encodeURIComponent);
8
- var _default = exports.default = escape;
package/cjs/evaluate.cjs DELETED
@@ -1,59 +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 _ramdaAdjunct = require("ramda-adjunct");
7
- var _apidomCore = require("@swagger-api/apidom-core");
8
- var _parse = _interopRequireDefault(require("./parse.cjs"));
9
- var _EvaluationJsonPointerError = _interopRequireDefault(require("./errors/EvaluationJsonPointerError.cjs"));
10
- // evaluates JSON Pointer against ApiDOM fragment
11
- const evaluate = (pointer, element) => {
12
- let tokens;
13
- try {
14
- tokens = (0, _parse.default)(pointer);
15
- } catch (error) {
16
- throw new _EvaluationJsonPointerError.default(`JSON Pointer evaluation failed while parsing the pointer "${pointer}".`, {
17
- pointer,
18
- element: (0, _apidomCore.cloneDeep)(element),
19
- cause: error
20
- });
21
- }
22
- return tokens.reduce((acc, token, tokenPosition) => {
23
- if ((0, _apidomCore.isObjectElement)(acc)) {
24
- // @ts-ignore
25
- if (!acc.hasKey(token)) {
26
- throw new _EvaluationJsonPointerError.default(`JSON Pointer evaluation failed while evaluating token "${token}" against an ObjectElement`, {
27
- pointer,
28
- tokens,
29
- failedToken: token,
30
- failedTokenPosition: tokenPosition,
31
- element: (0, _apidomCore.cloneDeep)(acc)
32
- });
33
- }
34
- // @ts-ignore
35
- return acc.get(token);
36
- }
37
- if ((0, _apidomCore.isArrayElement)(acc)) {
38
- if (!(token in acc.content) || !(0, _ramdaAdjunct.isInteger)(Number(token))) {
39
- throw new _EvaluationJsonPointerError.default(`JSON Pointer evaluation failed while evaluating token "${token}" against an ArrayElement`, {
40
- pointer,
41
- tokens,
42
- failedToken: token,
43
- failedTokenPosition: tokenPosition,
44
- element: (0, _apidomCore.cloneDeep)(acc)
45
- });
46
- }
47
- // @ts-ignore
48
- return acc.get(Number(token));
49
- }
50
- throw new _EvaluationJsonPointerError.default(`JSON Pointer evaluation failed while evaluating token "${token}" against an unexpected Element`, {
51
- pointer,
52
- tokens,
53
- failedToken: token,
54
- failedTokenPosition: tokenPosition,
55
- element: (0, _apidomCore.cloneDeep)(acc)
56
- });
57
- }, element);
58
- };
59
- var _default = exports.default = evaluate;
package/cjs/index.cjs DELETED
@@ -1,25 +0,0 @@
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 _escape = _interopRequireDefault(require("./escape.cjs"));
16
- exports.escape = _escape.default;
17
- var _unescape = _interopRequireDefault(require("./unescape.cjs"));
18
- exports.unescape = _unescape.default;
19
- var _parse = _interopRequireWildcard(require("./parse.cjs"));
20
- exports.parse = _parse.default;
21
- exports.uriToPointer = _parse.uriToPointer;
22
- var _compile = _interopRequireDefault(require("./compile.cjs"));
23
- exports.compile = _compile.default;
24
- var _evaluate = _interopRequireDefault(require("./evaluate.cjs"));
25
- exports.evaluate = _evaluate.default;
package/cjs/parse.cjs DELETED
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
- exports.__esModule = true;
5
- exports.uriToPointer = exports.default = void 0;
6
- var _ramda = require("ramda");
7
- var _ramdaAdjunct = require("ramda-adjunct");
8
- var _unescape = _interopRequireDefault(require("./unescape.cjs"));
9
- var _InvalidJsonPointerError = _interopRequireDefault(require("./errors/InvalidJsonPointerError.cjs"));
10
- // parse :: String -> String[]
11
- const parse = pointer => {
12
- if ((0, _ramdaAdjunct.isEmptyString)(pointer)) {
13
- return [];
14
- }
15
- if (!(0, _ramda.startsWith)('/', pointer)) {
16
- throw new _InvalidJsonPointerError.default(`Invalid JSON Pointer "${pointer}". JSON Pointers must begin with "/"`, {
17
- pointer
18
- });
19
- }
20
- try {
21
- const tokens = (0, _ramda.pipe)((0, _ramda.split)('/'), (0, _ramda.map)(_unescape.default))(pointer);
22
- return (0, _ramda.tail)(tokens);
23
- } catch (error) {
24
- throw new _InvalidJsonPointerError.default(`JSON Pointer parsing of "${pointer}" encountered an error.`, {
25
- pointer,
26
- cause: error
27
- });
28
- }
29
- };
30
-
31
- /**
32
- * Returns the hash (URL fragment), of the given path.
33
- * If there is no hash, then the root hash ("#") is returned.
34
- */
35
- const getHash = uri => {
36
- const hashIndex = uri.indexOf('#');
37
- if (hashIndex !== -1) {
38
- return uri.substring(hashIndex);
39
- }
40
- return '#';
41
- };
42
-
43
- // uriToPointer :: String -> String
44
- const uriToPointer = uri => {
45
- const hash = getHash(uri);
46
- return (0, _ramdaAdjunct.trimCharsStart)('#', hash);
47
- };
48
- exports.uriToPointer = uriToPointer;
49
- var _default = exports.default = parse;
package/cjs/unescape.cjs DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _ramda = require("ramda");
6
- /**
7
- * decodeURIComponent can throw URIError in certain cases like 'c%d'.
8
- * safeDecodeURIComponent is a safe variant of decodeURIComponent that never trows.
9
- *
10
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Malformed_URI|More info about URIError}
11
- */
12
- const safeDecodeURIComponent = encodedURIComponent => {
13
- try {
14
- return decodeURIComponent(encodedURIComponent);
15
- } catch {
16
- return encodedURIComponent;
17
- }
18
- };
19
-
20
- // unescape :: String -> String
21
- const unescape = (0, _ramda.pipe)((0, _ramda.replace)(/~1/g, '/'), (0, _ramda.replace)(/~0/g, '~'), safeDecodeURIComponent);
22
- var _default = exports.default = unescape;
package/es/compile.mjs DELETED
@@ -1,16 +0,0 @@
1
- import escape from "./escape.mjs";
2
- import CompilationJsonPointerError from "./errors/CompilationJsonPointerError.mjs"; // compile :: String[] -> String
3
- const compile = tokens => {
4
- try {
5
- if (tokens.length === 0) {
6
- return '';
7
- }
8
- return `/${tokens.map(escape).join('/')}`;
9
- } catch (error) {
10
- throw new CompilationJsonPointerError('JSON Pointer compilation of tokens encountered an error.', {
11
- tokens,
12
- cause: error
13
- });
14
- }
15
- };
16
- export default compile;
@@ -1,11 +0,0 @@
1
- import JsonPointerError from "./JsonPointerError.mjs";
2
- class CompilationJsonPointerError extends JsonPointerError {
3
- tokens;
4
- constructor(message, structuredOptions) {
5
- super(message, structuredOptions);
6
- if (typeof structuredOptions !== 'undefined') {
7
- this.tokens = [...structuredOptions.tokens];
8
- }
9
- }
10
- }
11
- export default CompilationJsonPointerError;
@@ -1,21 +0,0 @@
1
- import JsonPointerError from "./JsonPointerError.mjs";
2
- class EvaluationJsonPointerError extends JsonPointerError {
3
- pointer;
4
- tokens;
5
- failedToken;
6
- failedTokenPosition;
7
- element;
8
- constructor(message, structuredOptions) {
9
- super(message, structuredOptions);
10
- if (typeof structuredOptions !== 'undefined') {
11
- this.pointer = structuredOptions.pointer;
12
- if (Array.isArray(structuredOptions.tokens)) {
13
- this.tokens = [...structuredOptions.tokens];
14
- }
15
- this.failedToken = structuredOptions.failedToken;
16
- this.failedTokenPosition = structuredOptions.failedTokenPosition;
17
- this.element = structuredOptions.element;
18
- }
19
- }
20
- }
21
- export default EvaluationJsonPointerError;
@@ -1,11 +0,0 @@
1
- import JsonPointerError from "./JsonPointerError.mjs";
2
- class InvalidJsonPointerError extends JsonPointerError {
3
- pointer;
4
- constructor(message, structuredOptions) {
5
- super(message, structuredOptions);
6
- if (typeof structuredOptions !== 'undefined') {
7
- this.pointer = structuredOptions.pointer;
8
- }
9
- }
10
- }
11
- export default InvalidJsonPointerError;
@@ -1,3 +0,0 @@
1
- import { ApiDOMStructuredError } from '@swagger-api/apidom-error';
2
- class JsonPointerError extends ApiDOMStructuredError {}
3
- export default JsonPointerError;
package/es/escape.mjs DELETED
@@ -1,5 +0,0 @@
1
- import { pipe, replace } from 'ramda';
2
-
3
- // escape :: String -> String
4
- const escape = pipe(replace(/~/g, '~0'), replace(/\//g, '~1'), encodeURIComponent);
5
- export default escape;
package/es/evaluate.mjs DELETED
@@ -1,53 +0,0 @@
1
- import { isInteger } from 'ramda-adjunct';
2
- import { isObjectElement, isArrayElement, cloneDeep } from '@swagger-api/apidom-core';
3
- import parse from "./parse.mjs";
4
- import EvaluationJsonPointerError from "./errors/EvaluationJsonPointerError.mjs"; // evaluates JSON Pointer against ApiDOM fragment
5
- const evaluate = (pointer, element) => {
6
- let tokens;
7
- try {
8
- tokens = parse(pointer);
9
- } catch (error) {
10
- throw new EvaluationJsonPointerError(`JSON Pointer evaluation failed while parsing the pointer "${pointer}".`, {
11
- pointer,
12
- element: cloneDeep(element),
13
- cause: error
14
- });
15
- }
16
- return tokens.reduce((acc, token, tokenPosition) => {
17
- if (isObjectElement(acc)) {
18
- // @ts-ignore
19
- if (!acc.hasKey(token)) {
20
- throw new EvaluationJsonPointerError(`JSON Pointer evaluation failed while evaluating token "${token}" against an ObjectElement`, {
21
- pointer,
22
- tokens,
23
- failedToken: token,
24
- failedTokenPosition: tokenPosition,
25
- element: cloneDeep(acc)
26
- });
27
- }
28
- // @ts-ignore
29
- return acc.get(token);
30
- }
31
- if (isArrayElement(acc)) {
32
- if (!(token in acc.content) || !isInteger(Number(token))) {
33
- throw new EvaluationJsonPointerError(`JSON Pointer evaluation failed while evaluating token "${token}" against an ArrayElement`, {
34
- pointer,
35
- tokens,
36
- failedToken: token,
37
- failedTokenPosition: tokenPosition,
38
- element: cloneDeep(acc)
39
- });
40
- }
41
- // @ts-ignore
42
- return acc.get(Number(token));
43
- }
44
- throw new EvaluationJsonPointerError(`JSON Pointer evaluation failed while evaluating token "${token}" against an unexpected Element`, {
45
- pointer,
46
- tokens,
47
- failedToken: token,
48
- failedTokenPosition: tokenPosition,
49
- element: cloneDeep(acc)
50
- });
51
- }, element);
52
- };
53
- export default evaluate;
package/es/index.mjs DELETED
@@ -1,9 +0,0 @@
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 escape } from "./escape.mjs";
6
- export { default as unescape } from "./unescape.mjs";
7
- export { default as parse, uriToPointer } from "./parse.mjs";
8
- export { default as compile } from "./compile.mjs";
9
- export { default as evaluate } from "./evaluate.mjs";
package/es/parse.mjs DELETED
@@ -1,42 +0,0 @@
1
- import { map, pipe, split, startsWith, tail } from 'ramda';
2
- import { isEmptyString, trimCharsStart } from 'ramda-adjunct';
3
- import unescape from "./unescape.mjs";
4
- import InvalidJsonPointerError from "./errors/InvalidJsonPointerError.mjs"; // parse :: String -> String[]
5
- const parse = pointer => {
6
- if (isEmptyString(pointer)) {
7
- return [];
8
- }
9
- if (!startsWith('/', pointer)) {
10
- throw new InvalidJsonPointerError(`Invalid JSON Pointer "${pointer}". JSON Pointers must begin with "/"`, {
11
- pointer
12
- });
13
- }
14
- try {
15
- const tokens = pipe(split('/'), map(unescape))(pointer);
16
- return tail(tokens);
17
- } catch (error) {
18
- throw new InvalidJsonPointerError(`JSON Pointer parsing of "${pointer}" encountered an error.`, {
19
- pointer,
20
- cause: error
21
- });
22
- }
23
- };
24
-
25
- /**
26
- * Returns the hash (URL fragment), of the given path.
27
- * If there is no hash, then the root hash ("#") is returned.
28
- */
29
- const getHash = uri => {
30
- const hashIndex = uri.indexOf('#');
31
- if (hashIndex !== -1) {
32
- return uri.substring(hashIndex);
33
- }
34
- return '#';
35
- };
36
-
37
- // uriToPointer :: String -> String
38
- export const uriToPointer = uri => {
39
- const hash = getHash(uri);
40
- return trimCharsStart('#', hash);
41
- };
42
- export default parse;
package/es/unescape.mjs DELETED
@@ -1,19 +0,0 @@
1
- import { pipe, replace } from 'ramda';
2
-
3
- /**
4
- * decodeURIComponent can throw URIError in certain cases like 'c%d'.
5
- * safeDecodeURIComponent is a safe variant of decodeURIComponent that never trows.
6
- *
7
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Malformed_URI|More info about URIError}
8
- */
9
- const safeDecodeURIComponent = encodedURIComponent => {
10
- try {
11
- return decodeURIComponent(encodedURIComponent);
12
- } catch {
13
- return encodedURIComponent;
14
- }
15
- };
16
-
17
- // unescape :: String -> String
18
- const unescape = pipe(replace(/~1/g, '/'), replace(/~0/g, '~'), safeDecodeURIComponent);
19
- export default unescape;
package/types/dist.d.ts DELETED
@@ -1,50 +0,0 @@
1
- import { ApiDOMStructuredError, ApiDOMErrorOptions } from '@swagger-api/apidom-error';
2
- import { Element } from '@swagger-api/apidom-core';
3
-
4
- declare class JsonPointerError extends ApiDOMStructuredError {
5
- }
6
-
7
- interface InvalidJsonPointerErrorOptions extends ApiDOMErrorOptions {
8
- readonly pointer: string;
9
- }
10
- declare class InvalidJsonPointerError extends JsonPointerError {
11
- readonly pointer: string;
12
- constructor(message?: string, structuredOptions?: InvalidJsonPointerErrorOptions);
13
- }
14
-
15
- interface CompilationJsonPointerErrorOptions extends ApiDOMErrorOptions {
16
- readonly tokens: string[];
17
- }
18
- declare class CompilationJsonPointerError extends JsonPointerError {
19
- readonly tokens: string[];
20
- constructor(message?: string, structuredOptions?: CompilationJsonPointerErrorOptions);
21
- }
22
-
23
- interface EvaluationJsonPointerErrorOptions<T extends Element> extends ApiDOMErrorOptions {
24
- readonly pointer: string;
25
- readonly tokens?: string[];
26
- readonly failedToken?: string;
27
- readonly failedTokenPosition?: number;
28
- readonly element: T;
29
- }
30
- declare class EvaluationJsonPointerError<T extends Element> extends JsonPointerError {
31
- readonly pointer: string;
32
- readonly tokens?: string[];
33
- readonly failedToken?: string;
34
- readonly failedTokenPosition?: number;
35
- readonly element: T;
36
- constructor(message?: string, structuredOptions?: EvaluationJsonPointerErrorOptions<T>);
37
- }
38
-
39
- declare const escape: (str: string) => string;
40
-
41
- declare const unescape: (str: string) => string;
42
-
43
- declare const parse: (pointer: string) => string[];
44
- declare const uriToPointer: (uri: string) => string;
45
-
46
- declare const compile: (tokens: string[]) => string;
47
-
48
- declare const evaluate: <T extends Element>(pointer: string, element: T) => Element;
49
-
50
- export { CompilationJsonPointerError, type CompilationJsonPointerErrorOptions, EvaluationJsonPointerError, type EvaluationJsonPointerErrorOptions, InvalidJsonPointerError, type InvalidJsonPointerErrorOptions, JsonPointerError, compile, escape, evaluate, parse, unescape, uriToPointer };