@swaggerexpert/jsonpath 3.0.1 → 3.2.2

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.
@@ -1,118 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _apgLite = require("../../apg-lite.cjs");
6
- var _cst = _interopRequireDefault(require("../callbacks/cst.cjs"));
7
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
- class CSTTranslator extends _apgLite.Ast {
9
- constructor() {
10
- super();
11
-
12
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.1.1
13
- this.callbacks['jsonpath-query'] = (0, _cst.default)('jsonpath-query');
14
- this.callbacks['segments'] = (0, _cst.default)('segments');
15
- this.callbacks['B'] = (0, _cst.default)('text');
16
- this.callbacks['S'] = (0, _cst.default)('text');
17
-
18
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.2.1
19
- this.callbacks['root-identifier'] = (0, _cst.default)('root-identifier');
20
-
21
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.3
22
- this.callbacks['selector'] = (0, _cst.default)('selector');
23
-
24
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.3.1.1
25
- this.callbacks['name-selector'] = (0, _cst.default)('name-selector');
26
- this.callbacks['string-literal'] = (0, _cst.default)('string-literal');
27
- this.callbacks['double-quoted'] = (0, _cst.default)('double-quoted');
28
- this.callbacks['single-quoted'] = (0, _cst.default)('single-quoted');
29
-
30
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.3.2.1
31
- this.callbacks['wildcard-selector'] = (0, _cst.default)('wildcard-selector');
32
-
33
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.3.3.1
34
- this.callbacks['index-selector'] = (0, _cst.default)('index-selector');
35
-
36
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.3.4.1
37
- this.callbacks['slice-selector'] = (0, _cst.default)('slice-selector');
38
- this.callbacks['start'] = (0, _cst.default)('start');
39
- this.callbacks['end'] = (0, _cst.default)('end');
40
- this.callbacks['step'] = (0, _cst.default)('step');
41
-
42
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.3.5.1
43
- this.callbacks['filter-selector'] = (0, _cst.default)('filter-selector');
44
- this.callbacks['logical-expr'] = (0, _cst.default)('logical-expr');
45
- this.callbacks['logical-or-expr'] = (0, _cst.default)('logical-or-expr');
46
- this.callbacks['logical-and-expr'] = (0, _cst.default)('logical-and-expr');
47
- this.callbacks['basic-expr'] = (0, _cst.default)('basic-expr');
48
- this.callbacks['paren-expr'] = (0, _cst.default)('paren-expr');
49
- this.callbacks['logical-not-op'] = (0, _cst.default)('logical-not-op');
50
- this.callbacks['test-expr'] = (0, _cst.default)('test-expr');
51
- this.callbacks['filter-query'] = (0, _cst.default)('filter-query');
52
- this.callbacks['rel-query'] = (0, _cst.default)('rel-query');
53
- this.callbacks['current-node-identifier'] = (0, _cst.default)('current-node-identifier');
54
- this.callbacks['comparison-expr'] = (0, _cst.default)('comparison-expr');
55
- this.callbacks['literal'] = (0, _cst.default)('literal');
56
- this.callbacks['comparable'] = (0, _cst.default)('comparable');
57
- this.callbacks['comparison-op'] = (0, _cst.default)('comparison-op');
58
- this.callbacks['singular-query'] = (0, _cst.default)('singular-query');
59
- this.callbacks['rel-singular-query'] = (0, _cst.default)('rel-singular-query');
60
- this.callbacks['abs-singular-query'] = (0, _cst.default)('abs-singular-query');
61
- this.callbacks['singular-query-segments'] = (0, _cst.default)('singular-query-segments');
62
- this.callbacks['name-segment'] = (0, _cst.default)('name-segment');
63
- this.callbacks['index-segment'] = (0, _cst.default)('index-segment');
64
- this.callbacks['number'] = (0, _cst.default)('number');
65
- this.callbacks['true'] = (0, _cst.default)('true');
66
- this.callbacks['false'] = (0, _cst.default)('false');
67
- this.callbacks['null'] = (0, _cst.default)('null');
68
-
69
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.4
70
- this.callbacks['function-name'] = (0, _cst.default)('function-name');
71
- this.callbacks['function-expr'] = (0, _cst.default)('function-expr');
72
- this.callbacks['function-argument'] = (0, _cst.default)('function-argument');
73
-
74
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.5
75
- this.callbacks['segment'] = (0, _cst.default)('segment');
76
-
77
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.5.1.1
78
- this.callbacks['child-segment'] = (0, _cst.default)('child-segment');
79
- this.callbacks['bracketed-selection'] = (0, _cst.default)('bracketed-selection');
80
- this.callbacks['member-name-shorthand'] = (0, _cst.default)('member-name-shorthand');
81
-
82
- // https://www.rfc-editor.org/rfc/rfc9535#section-2.5.2.1
83
- this.callbacks['descendant-segment'] = (0, _cst.default)('descendant-segment');
84
-
85
- // https://www.rfc-editor.org/rfc/rfc9535#name-normalized-paths
86
- this.callbacks['normalized-path'] = (0, _cst.default)('normalized-path');
87
- this.callbacks['normal-index-segment'] = (0, _cst.default)('normal-index-segment');
88
- this.callbacks['normal-selector'] = (0, _cst.default)('normal-selector');
89
- this.callbacks['normal-name-selector'] = (0, _cst.default)('normal-name-selector');
90
- this.callbacks['normal-index-selector'] = (0, _cst.default)('normal-index-selector');
91
- this.callbacks['normal-single-quoted'] = (0, _cst.default)('normal-single-quoted');
92
-
93
- // Surrogate named rules
94
- this.callbacks['dot-prefix'] = (0, _cst.default)('text');
95
- this.callbacks['double-dot-prefix'] = (0, _cst.default)('text');
96
- this.callbacks['left-bracket'] = (0, _cst.default)('text');
97
- this.callbacks['right-bracket'] = (0, _cst.default)('text');
98
- this.callbacks['comma'] = (0, _cst.default)('text');
99
- this.callbacks['colon'] = (0, _cst.default)('text');
100
- this.callbacks['dquote'] = (0, _cst.default)('text');
101
- this.callbacks['squote'] = (0, _cst.default)('text');
102
- this.callbacks['questionmark'] = (0, _cst.default)('text');
103
- this.callbacks['disjunction'] = (0, _cst.default)('text');
104
- this.callbacks['conjunction'] = (0, _cst.default)('text');
105
- this.callbacks['left-paren'] = (0, _cst.default)('text');
106
- this.callbacks['right-paren'] = (0, _cst.default)('text');
107
- }
108
- getTree() {
109
- const data = {
110
- stack: [],
111
- root: null
112
- };
113
- this.translate(data);
114
- delete data.stack;
115
- return data;
116
- }
117
- }
118
- var _default = exports.default = CSTTranslator;
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _CSTTranslator = _interopRequireDefault(require("./CSTTranslator.cjs"));
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
- class XMLTranslator extends _CSTTranslator.default {
8
- getTree() {
9
- return this.toXml();
10
- }
11
- }
12
- var _default = exports.default = XMLTranslator;
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.default = void 0;
5
- var _index = _interopRequireDefault(require("../parse/index.cjs"));
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
- const test = (jsonPath, {
8
- normalized = false
9
- } = {}) => {
10
- if (typeof jsonPath !== 'string') return false;
11
- try {
12
- const {
13
- result
14
- } = (0, _index.default)(jsonPath, {
15
- normalized,
16
- stats: false,
17
- trace: false,
18
- translator: null
19
- });
20
- return result.success;
21
- } catch {
22
- return false;
23
- }
24
- };
25
- var _default = exports.default = test;
@@ -1,40 +0,0 @@
1
- class JSONPathError extends Error {
2
- constructor(message, options = undefined) {
3
- super(message, options);
4
- this.name = this.constructor.name;
5
- if (typeof message === 'string') {
6
- this.message = message;
7
- }
8
- if (typeof Error.captureStackTrace === 'function') {
9
- Error.captureStackTrace(this, this.constructor);
10
- } else {
11
- this.stack = new Error(message).stack;
12
- }
13
-
14
- /**
15
- * This needs to stay here until our minimum supported version of Node.js is >= 16.9.0.
16
- * Node.js is >= 16.9.0 supports error causes natively.
17
- */
18
- if (options != null && typeof options === 'object' && Object.prototype.hasOwnProperty.call(options, 'cause') && !('cause' in this)) {
19
- const {
20
- cause
21
- } = options;
22
- this.cause = cause;
23
- if (cause instanceof Error && 'stack' in cause) {
24
- this.stack = `${this.stack}\nCAUSE: ${cause.stack}`;
25
- }
26
- }
27
-
28
- /**
29
- * Allows to assign arbitrary properties to the error object.
30
- */
31
- if (options != null && typeof options === 'object') {
32
- const {
33
- cause,
34
- ...causelessOptions
35
- } = options;
36
- Object.assign(this, causelessOptions);
37
- }
38
- }
39
- }
40
- export default JSONPathError;
@@ -1,3 +0,0 @@
1
- import JSONPathError from "./JSONPathError.mjs";
2
- class JSONPathParseError extends JSONPathError {}
3
- export default JSONPathParseError;