@swaggerexpert/jsonpath 3.1.0 → 3.2.3
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/package.json +1 -1
- package/cjs/apg-lite.cjs +0 -1221
- package/cjs/compile.cjs +0 -50
- package/cjs/errors/JSONPathCompileError.cjs +0 -8
- package/cjs/errors/JSONPathError.cjs +0 -44
- package/cjs/errors/JSONPathParseError.cjs +0 -8
- package/cjs/escape.cjs +0 -59
- package/cjs/grammar.cjs +0 -2839
- package/cjs/index.cjs +0 -31
- package/cjs/parse/callbacks/cst.cjs +0 -49
- package/cjs/parse/index.cjs +0 -41
- package/cjs/parse/trace/Expectations.cjs +0 -10
- package/cjs/parse/trace/Trace.cjs +0 -35
- package/cjs/parse/translators/ASTTranslator/decoders.cjs +0 -83
- package/cjs/parse/translators/ASTTranslator/index.cjs +0 -15
- package/cjs/parse/translators/ASTTranslator/transformers.cjs +0 -411
- package/cjs/parse/translators/CSTOptimizedTranslator.cjs +0 -39
- package/cjs/parse/translators/CSTTranslator.cjs +0 -118
- package/cjs/parse/translators/XMLTranslator.cjs +0 -12
- package/cjs/test/index.cjs +0 -25
- package/es/compile.mjs +0 -45
- package/es/errors/JSONPathCompileError.mjs +0 -3
- package/es/errors/JSONPathError.mjs +0 -40
- package/es/errors/JSONPathParseError.mjs +0 -3
- package/es/escape.mjs +0 -55
- package/es/grammar.mjs +0 -2835
- package/es/index.mjs +0 -13
- package/es/parse/callbacks/cst.mjs +0 -44
- package/es/parse/index.mjs +0 -36
- package/es/parse/trace/Expectations.mjs +0 -6
- package/es/parse/trace/Trace.mjs +0 -30
- package/es/parse/translators/ASTTranslator/decoders.mjs +0 -75
- package/es/parse/translators/ASTTranslator/index.mjs +0 -9
- package/es/parse/translators/ASTTranslator/transformers.mjs +0 -405
- package/es/parse/translators/CSTOptimizedTranslator.mjs +0 -34
- package/es/parse/translators/CSTTranslator.mjs +0 -113
- package/es/parse/translators/XMLTranslator.mjs +0 -7
- package/es/test/index.mjs +0 -20
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Ast as AST } from 'apg-lite';
|
|
2
|
-
import cstCallback from "../callbacks/cst.mjs";
|
|
3
|
-
class CSTTranslator extends AST {
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
|
-
|
|
7
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.1.1
|
|
8
|
-
this.callbacks['jsonpath-query'] = cstCallback('jsonpath-query');
|
|
9
|
-
this.callbacks['segments'] = cstCallback('segments');
|
|
10
|
-
this.callbacks['B'] = cstCallback('text');
|
|
11
|
-
this.callbacks['S'] = cstCallback('text');
|
|
12
|
-
|
|
13
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.2.1
|
|
14
|
-
this.callbacks['root-identifier'] = cstCallback('root-identifier');
|
|
15
|
-
|
|
16
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.3
|
|
17
|
-
this.callbacks['selector'] = cstCallback('selector');
|
|
18
|
-
|
|
19
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.3.1.1
|
|
20
|
-
this.callbacks['name-selector'] = cstCallback('name-selector');
|
|
21
|
-
this.callbacks['string-literal'] = cstCallback('string-literal');
|
|
22
|
-
this.callbacks['double-quoted'] = cstCallback('double-quoted');
|
|
23
|
-
this.callbacks['single-quoted'] = cstCallback('single-quoted');
|
|
24
|
-
|
|
25
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.3.2.1
|
|
26
|
-
this.callbacks['wildcard-selector'] = cstCallback('wildcard-selector');
|
|
27
|
-
|
|
28
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.3.3.1
|
|
29
|
-
this.callbacks['index-selector'] = cstCallback('index-selector');
|
|
30
|
-
|
|
31
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.3.4.1
|
|
32
|
-
this.callbacks['slice-selector'] = cstCallback('slice-selector');
|
|
33
|
-
this.callbacks['start'] = cstCallback('start');
|
|
34
|
-
this.callbacks['end'] = cstCallback('end');
|
|
35
|
-
this.callbacks['step'] = cstCallback('step');
|
|
36
|
-
|
|
37
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.3.5.1
|
|
38
|
-
this.callbacks['filter-selector'] = cstCallback('filter-selector');
|
|
39
|
-
this.callbacks['logical-expr'] = cstCallback('logical-expr');
|
|
40
|
-
this.callbacks['logical-or-expr'] = cstCallback('logical-or-expr');
|
|
41
|
-
this.callbacks['logical-and-expr'] = cstCallback('logical-and-expr');
|
|
42
|
-
this.callbacks['basic-expr'] = cstCallback('basic-expr');
|
|
43
|
-
this.callbacks['paren-expr'] = cstCallback('paren-expr');
|
|
44
|
-
this.callbacks['logical-not-op'] = cstCallback('logical-not-op');
|
|
45
|
-
this.callbacks['test-expr'] = cstCallback('test-expr');
|
|
46
|
-
this.callbacks['filter-query'] = cstCallback('filter-query');
|
|
47
|
-
this.callbacks['rel-query'] = cstCallback('rel-query');
|
|
48
|
-
this.callbacks['current-node-identifier'] = cstCallback('current-node-identifier');
|
|
49
|
-
this.callbacks['comparison-expr'] = cstCallback('comparison-expr');
|
|
50
|
-
this.callbacks['literal'] = cstCallback('literal');
|
|
51
|
-
this.callbacks['comparable'] = cstCallback('comparable');
|
|
52
|
-
this.callbacks['comparison-op'] = cstCallback('comparison-op');
|
|
53
|
-
this.callbacks['singular-query'] = cstCallback('singular-query');
|
|
54
|
-
this.callbacks['rel-singular-query'] = cstCallback('rel-singular-query');
|
|
55
|
-
this.callbacks['abs-singular-query'] = cstCallback('abs-singular-query');
|
|
56
|
-
this.callbacks['singular-query-segments'] = cstCallback('singular-query-segments');
|
|
57
|
-
this.callbacks['name-segment'] = cstCallback('name-segment');
|
|
58
|
-
this.callbacks['index-segment'] = cstCallback('index-segment');
|
|
59
|
-
this.callbacks['number'] = cstCallback('number');
|
|
60
|
-
this.callbacks['true'] = cstCallback('true');
|
|
61
|
-
this.callbacks['false'] = cstCallback('false');
|
|
62
|
-
this.callbacks['null'] = cstCallback('null');
|
|
63
|
-
|
|
64
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.4
|
|
65
|
-
this.callbacks['function-name'] = cstCallback('function-name');
|
|
66
|
-
this.callbacks['function-expr'] = cstCallback('function-expr');
|
|
67
|
-
this.callbacks['function-argument'] = cstCallback('function-argument');
|
|
68
|
-
|
|
69
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.5
|
|
70
|
-
this.callbacks['segment'] = cstCallback('segment');
|
|
71
|
-
|
|
72
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.5.1.1
|
|
73
|
-
this.callbacks['child-segment'] = cstCallback('child-segment');
|
|
74
|
-
this.callbacks['bracketed-selection'] = cstCallback('bracketed-selection');
|
|
75
|
-
this.callbacks['member-name-shorthand'] = cstCallback('member-name-shorthand');
|
|
76
|
-
|
|
77
|
-
// https://www.rfc-editor.org/rfc/rfc9535#section-2.5.2.1
|
|
78
|
-
this.callbacks['descendant-segment'] = cstCallback('descendant-segment');
|
|
79
|
-
|
|
80
|
-
// https://www.rfc-editor.org/rfc/rfc9535#name-normalized-paths
|
|
81
|
-
this.callbacks['normalized-path'] = cstCallback('normalized-path');
|
|
82
|
-
this.callbacks['normal-index-segment'] = cstCallback('normal-index-segment');
|
|
83
|
-
this.callbacks['normal-selector'] = cstCallback('normal-selector');
|
|
84
|
-
this.callbacks['normal-name-selector'] = cstCallback('normal-name-selector');
|
|
85
|
-
this.callbacks['normal-index-selector'] = cstCallback('normal-index-selector');
|
|
86
|
-
this.callbacks['normal-single-quoted'] = cstCallback('normal-single-quoted');
|
|
87
|
-
|
|
88
|
-
// Surrogate named rules
|
|
89
|
-
this.callbacks['dot-prefix'] = cstCallback('text');
|
|
90
|
-
this.callbacks['double-dot-prefix'] = cstCallback('text');
|
|
91
|
-
this.callbacks['left-bracket'] = cstCallback('text');
|
|
92
|
-
this.callbacks['right-bracket'] = cstCallback('text');
|
|
93
|
-
this.callbacks['comma'] = cstCallback('text');
|
|
94
|
-
this.callbacks['colon'] = cstCallback('text');
|
|
95
|
-
this.callbacks['dquote'] = cstCallback('text');
|
|
96
|
-
this.callbacks['squote'] = cstCallback('text');
|
|
97
|
-
this.callbacks['questionmark'] = cstCallback('text');
|
|
98
|
-
this.callbacks['disjunction'] = cstCallback('text');
|
|
99
|
-
this.callbacks['conjunction'] = cstCallback('text');
|
|
100
|
-
this.callbacks['left-paren'] = cstCallback('text');
|
|
101
|
-
this.callbacks['right-paren'] = cstCallback('text');
|
|
102
|
-
}
|
|
103
|
-
getTree() {
|
|
104
|
-
const data = {
|
|
105
|
-
stack: [],
|
|
106
|
-
root: null
|
|
107
|
-
};
|
|
108
|
-
this.translate(data);
|
|
109
|
-
delete data.stack;
|
|
110
|
-
return data;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export default CSTTranslator;
|
package/es/test/index.mjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import parse from "../parse/index.mjs";
|
|
2
|
-
const test = (jsonPath, {
|
|
3
|
-
normalized = false
|
|
4
|
-
} = {}) => {
|
|
5
|
-
if (typeof jsonPath !== 'string') return false;
|
|
6
|
-
try {
|
|
7
|
-
const {
|
|
8
|
-
result
|
|
9
|
-
} = parse(jsonPath, {
|
|
10
|
-
normalized,
|
|
11
|
-
stats: false,
|
|
12
|
-
trace: false,
|
|
13
|
-
translator: null
|
|
14
|
-
});
|
|
15
|
-
return result.success;
|
|
16
|
-
} catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
export default test;
|