@bizone-ai/json-transform-utils 1.10.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/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/ParseContext.d.ts +23 -0
- package/dist/ParseContext.d.ts.map +1 -0
- package/dist/ParseContext.js +69 -0
- package/dist/ParseContext.js.map +1 -0
- package/dist/__tests__/functions/functionsParser.test.d.ts +2 -0
- package/dist/__tests__/functions/functionsParser.test.d.ts.map +1 -0
- package/dist/__tests__/functions/functionsParser.test.js +787 -0
- package/dist/__tests__/functions/functionsParser.test.js.map +1 -0
- package/dist/__tests__/jsonpath/jsonpathJoin.test.d.ts +2 -0
- package/dist/__tests__/jsonpath/jsonpathJoin.test.d.ts.map +1 -0
- package/dist/__tests__/jsonpath/jsonpathJoin.test.js +27 -0
- package/dist/__tests__/jsonpath/jsonpathJoin.test.js.map +1 -0
- package/dist/__tests__/parse.test.d.ts +2 -0
- package/dist/__tests__/parse.test.d.ts.map +1 -0
- package/dist/__tests__/parse.test.js +22 -0
- package/dist/__tests__/parse.test.js.map +1 -0
- package/dist/__tests__/utils/convert.test.d.ts +2 -0
- package/dist/__tests__/utils/convert.test.d.ts.map +1 -0
- package/dist/__tests__/utils/convert.test.js +181 -0
- package/dist/__tests__/utils/convert.test.js.map +1 -0
- package/dist/functions/ContextVariablesSchemas.d.ts +3 -0
- package/dist/functions/ContextVariablesSchemas.d.ts.map +1 -0
- package/dist/functions/ContextVariablesSchemas.js +9 -0
- package/dist/functions/ContextVariablesSchemas.js.map +1 -0
- package/dist/functions/definitions.d.ts +4 -0
- package/dist/functions/definitions.d.ts.map +1 -0
- package/dist/functions/definitions.js +2090 -0
- package/dist/functions/definitions.js.map +1 -0
- package/dist/functions/examples/and.json +44 -0
- package/dist/functions/examples/at.json +156 -0
- package/dist/functions/examples/avg.json +78 -0
- package/dist/functions/examples/base64.json +368 -0
- package/dist/functions/examples/boolean.json +236 -0
- package/dist/functions/examples/coalesce.json +58 -0
- package/dist/functions/examples/concat.json +70 -0
- package/dist/functions/examples/contains.json +61 -0
- package/dist/functions/examples/csv.json +116 -0
- package/dist/functions/examples/csvparse.json +97 -0
- package/dist/functions/examples/date.json +389 -0
- package/dist/functions/examples/decimal.json +102 -0
- package/dist/functions/examples/digest.json +125 -0
- package/dist/functions/examples/distinct.json +142 -0
- package/dist/functions/examples/entries.json +88 -0
- package/dist/functions/examples/eval.json +72 -0
- package/dist/functions/examples/every.json +96 -0
- package/dist/functions/examples/filter.json +51 -0
- package/dist/functions/examples/find.json +51 -0
- package/dist/functions/examples/findindex.json +61 -0
- package/dist/functions/examples/flat.json +74 -0
- package/dist/functions/examples/flatten.json +76 -0
- package/dist/functions/examples/form.json +60 -0
- package/dist/functions/examples/formparse.json +62 -0
- package/dist/functions/examples/group.json +208 -0
- package/dist/functions/examples/if.json +294 -0
- package/dist/functions/examples/indexof.json +48 -0
- package/dist/functions/examples/is.json +512 -0
- package/dist/functions/examples/isnull.json +51 -0
- package/dist/functions/examples/join.json +221 -0
- package/dist/functions/examples/jsonparse.json +101 -0
- package/dist/functions/examples/jsonpatch.json +30 -0
- package/dist/functions/examples/jsonpath.json +62 -0
- package/dist/functions/examples/jsonpointer.json +77 -0
- package/dist/functions/examples/jwtparse.json +54 -0
- package/dist/functions/examples/length.json +202 -0
- package/dist/functions/examples/long.json +53 -0
- package/dist/functions/examples/lookup.json +223 -0
- package/dist/functions/examples/lower.json +24 -0
- package/dist/functions/examples/map.json +188 -0
- package/dist/functions/examples/match.json +62 -0
- package/dist/functions/examples/matchall.json +62 -0
- package/dist/functions/examples/math.json +1073 -0
- package/dist/functions/examples/max.json +104 -0
- package/dist/functions/examples/merge.json +173 -0
- package/dist/functions/examples/min.json +104 -0
- package/dist/functions/examples/normalize.json +142 -0
- package/dist/functions/examples/not.json +99 -0
- package/dist/functions/examples/numberformat.json +162 -0
- package/dist/functions/examples/numberparse.json +72 -0
- package/dist/functions/examples/object.json +148 -0
- package/dist/functions/examples/or.json +102 -0
- package/dist/functions/examples/pad.json +102 -0
- package/dist/functions/examples/partition.json +32 -0
- package/dist/functions/examples/range.json +188 -0
- package/dist/functions/examples/raw.json +58 -0
- package/dist/functions/examples/reduce.json +79 -0
- package/dist/functions/examples/repeat.json +59 -0
- package/dist/functions/examples/replace.json +92 -0
- package/dist/functions/examples/reverse.json +94 -0
- package/dist/functions/examples/slice.json +360 -0
- package/dist/functions/examples/some.json +96 -0
- package/dist/functions/examples/sort.json +353 -0
- package/dist/functions/examples/split.json +52 -0
- package/dist/functions/examples/string.json +95 -0
- package/dist/functions/examples/substring.json +82 -0
- package/dist/functions/examples/sum.json +108 -0
- package/dist/functions/examples/switch.json +78 -0
- package/dist/functions/examples/template.json +125 -0
- package/dist/functions/examples/test.json +82 -0
- package/dist/functions/examples/transform.json +58 -0
- package/dist/functions/examples/trim.json +44 -0
- package/dist/functions/examples/unflatten.json +97 -0
- package/dist/functions/examples/upper.json +24 -0
- package/dist/functions/examples/uriparse.json +52 -0
- package/dist/functions/examples/urldecode.json +42 -0
- package/dist/functions/examples/urlencode.json +43 -0
- package/dist/functions/examples/uuid.json +142 -0
- package/dist/functions/examples/value.json +87 -0
- package/dist/functions/examples/wrap.json +122 -0
- package/dist/functions/examples/xml.json +142 -0
- package/dist/functions/examples/xmlparse.json +161 -0
- package/dist/functions/examples/xor.json +166 -0
- package/dist/functions/examples/yaml.json +196 -0
- package/dist/functions/examples/yamlparse.json +150 -0
- package/dist/functions/examples.d.ts +4 -0
- package/dist/functions/examples.d.ts.map +1 -0
- package/dist/functions/examples.js +178 -0
- package/dist/functions/examples.js.map +1 -0
- package/dist/functions/functions.d.ts +3 -0
- package/dist/functions/functions.d.ts.map +1 -0
- package/dist/functions/functions.js +9 -0
- package/dist/functions/functions.js.map +1 -0
- package/dist/functions/functionsParser.d.ts +45 -0
- package/dist/functions/functionsParser.d.ts.map +1 -0
- package/dist/functions/functionsParser.js +207 -0
- package/dist/functions/functionsParser.js.map +1 -0
- package/dist/functions/parseDefinitions.d.ts +4 -0
- package/dist/functions/parseDefinitions.d.ts.map +1 -0
- package/dist/functions/parseDefinitions.js +56 -0
- package/dist/functions/parseDefinitions.js.map +1 -0
- package/dist/functions/types.d.ts +163 -0
- package/dist/functions/types.d.ts.map +1 -0
- package/dist/functions/types.js +93 -0
- package/dist/functions/types.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonpath/jsonpathFunctions.d.ts +4 -0
- package/dist/jsonpath/jsonpathFunctions.d.ts.map +1 -0
- package/dist/jsonpath/jsonpathFunctions.js +26 -0
- package/dist/jsonpath/jsonpathFunctions.js.map +1 -0
- package/dist/jsonpath/jsonpathJoin.d.ts +3 -0
- package/dist/jsonpath/jsonpathJoin.d.ts.map +1 -0
- package/dist/jsonpath/jsonpathJoin.js +15 -0
- package/dist/jsonpath/jsonpathJoin.js.map +1 -0
- package/dist/parse.d.ts +12 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +522 -0
- package/dist/parse.js.map +1 -0
- package/dist/transformUtils.d.ts +40 -0
- package/dist/transformUtils.d.ts.map +1 -0
- package/dist/transformUtils.js +89 -0
- package/dist/transformUtils.js.map +1 -0
- package/dist/utils/convert.d.ts +3 -0
- package/dist/utils/convert.d.ts.map +1 -0
- package/dist/utils/convert.js +163 -0
- package/dist/utils/convert.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Object array input",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": ["a", "b", "c"],
|
|
6
|
+
"definition": {
|
|
7
|
+
"$$join": "$"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"expect": {
|
|
11
|
+
"equal": "abc"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "Object array with first element and B",
|
|
16
|
+
"given": {
|
|
17
|
+
"input": ["a", "b", "c"],
|
|
18
|
+
"definition": {
|
|
19
|
+
"$$join": ["$[0]", "B"]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"expect": {
|
|
23
|
+
"equal": "aB"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "Object array with first element, nulls and B",
|
|
28
|
+
"given": {
|
|
29
|
+
"input": ["a", "b", "c"],
|
|
30
|
+
"definition": {
|
|
31
|
+
"$$join": ["$[0]", null, null, "B"],
|
|
32
|
+
"delimiter": ","
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"expect": {
|
|
36
|
+
"equal": "a,B"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "Object array with delimiter",
|
|
41
|
+
"given": {
|
|
42
|
+
"input": ["a", "b", "c"],
|
|
43
|
+
"definition": {
|
|
44
|
+
"$$join": "$",
|
|
45
|
+
"$$delimiter": ","
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"expect": {
|
|
49
|
+
"equal": "a,b,c"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "Object array with prefix",
|
|
54
|
+
"given": {
|
|
55
|
+
"input": ["hello", "world"],
|
|
56
|
+
"definition": {
|
|
57
|
+
"$$join": "$",
|
|
58
|
+
"delimiter": " ",
|
|
59
|
+
"prefix": "<"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"expect": {
|
|
63
|
+
"equal": "<hello world"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "Object array with prefix and suffix",
|
|
68
|
+
"given": {
|
|
69
|
+
"input": ["hello", "world"],
|
|
70
|
+
"definition": {
|
|
71
|
+
"$$join": "$",
|
|
72
|
+
"delimiter": " ",
|
|
73
|
+
"prefix": "<",
|
|
74
|
+
"suffix": ">"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"expect": {
|
|
78
|
+
"equal": "<hello world>"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "Inline array input",
|
|
83
|
+
"given": {
|
|
84
|
+
"input": ["hello", " ", "world"],
|
|
85
|
+
"definition": "$$join:$"
|
|
86
|
+
},
|
|
87
|
+
"expect": {
|
|
88
|
+
"equal": "hello world"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "Inline array input with empty parenthesis",
|
|
93
|
+
"given": {
|
|
94
|
+
"input": ["hello", " ", "world"],
|
|
95
|
+
"definition": "$$join():$"
|
|
96
|
+
},
|
|
97
|
+
"expect": {
|
|
98
|
+
"equal": "hello world"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "Inline array with different types",
|
|
103
|
+
"given": {
|
|
104
|
+
"input": ["hello", 5, true],
|
|
105
|
+
"definition": "$$join:$"
|
|
106
|
+
},
|
|
107
|
+
"expect": {
|
|
108
|
+
"equal": "hello5true"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "Inline array input 2",
|
|
113
|
+
"given": {
|
|
114
|
+
"input": ["hello", " ", "world"],
|
|
115
|
+
"definition": "$$join:$"
|
|
116
|
+
},
|
|
117
|
+
"expect": {
|
|
118
|
+
"equal": "hello world"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "Inline array input sliced",
|
|
123
|
+
"given": {
|
|
124
|
+
"input": ["hello", " ", "world"],
|
|
125
|
+
"definition": "$$join:$"
|
|
126
|
+
},
|
|
127
|
+
"expect": {
|
|
128
|
+
"equal": "hello world"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "Inline array with nulls",
|
|
133
|
+
"given": {
|
|
134
|
+
"input": ["hello", null, "world"],
|
|
135
|
+
"definition": "$$join(' '):$"
|
|
136
|
+
},
|
|
137
|
+
"expect": {
|
|
138
|
+
"equal": "hello world"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "Inline array with nulls and true parameter",
|
|
143
|
+
"given": {
|
|
144
|
+
"input": ["hello", null, "world"],
|
|
145
|
+
"definition": "$$join(' ',,,true):$"
|
|
146
|
+
},
|
|
147
|
+
"expect": {
|
|
148
|
+
"equal": "hello null world"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "Inline array with comma delimiter",
|
|
153
|
+
"given": {
|
|
154
|
+
"input": ["hello", " ", "world"],
|
|
155
|
+
"definition": "$$join(,):$"
|
|
156
|
+
},
|
|
157
|
+
"expect": {
|
|
158
|
+
"equal": "hello world"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "Inline array with colon delimiter",
|
|
163
|
+
"given": {
|
|
164
|
+
"input": ["hello", " ", "world"],
|
|
165
|
+
"definition": "$$join(:):$"
|
|
166
|
+
},
|
|
167
|
+
"expect": {
|
|
168
|
+
"equal": "hello: :world"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "Inline array with comma string delimiter",
|
|
173
|
+
"given": {
|
|
174
|
+
"input": ["hello", " ", "world"],
|
|
175
|
+
"definition": "$$join(','):$"
|
|
176
|
+
},
|
|
177
|
+
"expect": {
|
|
178
|
+
"equal": "hello, ,world"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "Inline array with single quote delimiter",
|
|
183
|
+
"given": {
|
|
184
|
+
"input": ["hello", " ", "world"],
|
|
185
|
+
"definition": "$$join('\\''):$"
|
|
186
|
+
},
|
|
187
|
+
"expect": {
|
|
188
|
+
"equal": "hello' 'world"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "Inline array with second element as delimiter",
|
|
193
|
+
"given": {
|
|
194
|
+
"input": ["hello", " ", "world"],
|
|
195
|
+
"definition": "$$join('$[1]'):$"
|
|
196
|
+
},
|
|
197
|
+
"expect": {
|
|
198
|
+
"equal": "hello world"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "Inline array with prefix",
|
|
203
|
+
"given": {
|
|
204
|
+
"input": ["hello", "world"],
|
|
205
|
+
"definition": "$$join( ,<):$"
|
|
206
|
+
},
|
|
207
|
+
"expect": {
|
|
208
|
+
"equal": "<hello world"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "Inline array with prefix and suffix",
|
|
213
|
+
"given": {
|
|
214
|
+
"input": ["hello", "world"],
|
|
215
|
+
"definition": "$$join( ,<,>):$"
|
|
216
|
+
},
|
|
217
|
+
"expect": {
|
|
218
|
+
"equal": "<hello world>"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
]
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "From String",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": "\"text\"",
|
|
6
|
+
"definition": "$$jsonparse:$"
|
|
7
|
+
},
|
|
8
|
+
"expect": {
|
|
9
|
+
"equal": "text"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "From String with Empty Arguments",
|
|
14
|
+
"given": {
|
|
15
|
+
"input": "\"text\"",
|
|
16
|
+
"definition": "$$jsonparse():$"
|
|
17
|
+
},
|
|
18
|
+
"expect": {
|
|
19
|
+
"equal": "text"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "From Boolean",
|
|
24
|
+
"given": {
|
|
25
|
+
"input": "true",
|
|
26
|
+
"definition": "$$jsonparse:$"
|
|
27
|
+
},
|
|
28
|
+
"expect": {
|
|
29
|
+
"equal": true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "From Number",
|
|
34
|
+
"given": {
|
|
35
|
+
"input": "123",
|
|
36
|
+
"definition": "$$jsonparse:$"
|
|
37
|
+
},
|
|
38
|
+
"expect": {
|
|
39
|
+
"equal": 123
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "From Big Decimal",
|
|
44
|
+
"given": {
|
|
45
|
+
"input": "\"1234567890.098765432123456789\"",
|
|
46
|
+
"definition": "$$jsonparse:$"
|
|
47
|
+
},
|
|
48
|
+
"expect": {
|
|
49
|
+
"equal": "1234567890.098765432123456789"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "From Big Decimal - Large Value",
|
|
54
|
+
"given": {
|
|
55
|
+
"input": "\"123456789123456789123456789123456789\"",
|
|
56
|
+
"definition": "$$jsonparse:$"
|
|
57
|
+
},
|
|
58
|
+
"expect": {
|
|
59
|
+
"equal": "123456789123456789123456789123456789"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "From Object",
|
|
64
|
+
"given": {
|
|
65
|
+
"input": "{\"a\":\"b\"}",
|
|
66
|
+
"definition": "$$jsonparse:$"
|
|
67
|
+
},
|
|
68
|
+
"expect": {
|
|
69
|
+
"equal": {
|
|
70
|
+
"a": "b"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "From Array",
|
|
76
|
+
"given": {
|
|
77
|
+
"input": "[\"a\",\"b\"]",
|
|
78
|
+
"definition": "$$jsonparse:$"
|
|
79
|
+
},
|
|
80
|
+
"expect": {
|
|
81
|
+
"equal": [
|
|
82
|
+
"a",
|
|
83
|
+
"b"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "Object From Object",
|
|
89
|
+
"given": {
|
|
90
|
+
"input": "{\"a\":\"b\"}",
|
|
91
|
+
"definition": {
|
|
92
|
+
"$$jsonparse": "$"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"expect": {
|
|
96
|
+
"equal": {
|
|
97
|
+
"a": "b"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Add",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": {
|
|
6
|
+
"a": {
|
|
7
|
+
"b": "c"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"definition": {
|
|
11
|
+
"$$jsonpatch": "$",
|
|
12
|
+
"ops": [
|
|
13
|
+
{
|
|
14
|
+
"op": "add",
|
|
15
|
+
"path": "/a/d",
|
|
16
|
+
"value": "e"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"expect": {
|
|
22
|
+
"equal": {
|
|
23
|
+
"a": {
|
|
24
|
+
"b": "c",
|
|
25
|
+
"d": "e"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Yo Dawg",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": {
|
|
6
|
+
"path": "$.path"
|
|
7
|
+
},
|
|
8
|
+
"definition": "$$jsonpath($.path):$"
|
|
9
|
+
},
|
|
10
|
+
"expect": {
|
|
11
|
+
"equal": "$.path"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "In Array",
|
|
16
|
+
"given": {
|
|
17
|
+
"input": {
|
|
18
|
+
"arr": [null, "boo"]
|
|
19
|
+
},
|
|
20
|
+
"definition": "$$jsonpath('\\\\$.arr[1]'):$"
|
|
21
|
+
},
|
|
22
|
+
"expect": {
|
|
23
|
+
"equal": "boo"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "Multiple Results",
|
|
28
|
+
"given": {
|
|
29
|
+
"input": [
|
|
30
|
+
{
|
|
31
|
+
"id": 1,
|
|
32
|
+
"active": true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": 3,
|
|
36
|
+
"active": false
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": 4,
|
|
40
|
+
"active": true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"id": 5,
|
|
44
|
+
"active": false
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"definition": "$$jsonpath('\\\\$[?(@.active == true)]'):$"
|
|
48
|
+
},
|
|
49
|
+
"expect": {
|
|
50
|
+
"equal": [
|
|
51
|
+
{
|
|
52
|
+
"id": 1,
|
|
53
|
+
"active": true
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": 4,
|
|
57
|
+
"active": true
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Get",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": {
|
|
6
|
+
"b": [
|
|
7
|
+
"c",
|
|
8
|
+
"d",
|
|
9
|
+
{
|
|
10
|
+
"e": "Hello"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"definition": "$$jsonpointer(GET,/b/2/e):$"
|
|
15
|
+
},
|
|
16
|
+
"expect": {
|
|
17
|
+
"equal": "Hello"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "Get Yo Dawg",
|
|
22
|
+
"given": {
|
|
23
|
+
"input": {
|
|
24
|
+
"pointer": "/pointer"
|
|
25
|
+
},
|
|
26
|
+
"definition": "$$jsonpointer(get,$.pointer):$"
|
|
27
|
+
},
|
|
28
|
+
"expect": {
|
|
29
|
+
"equal": "/pointer"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "Set",
|
|
34
|
+
"given": {
|
|
35
|
+
"input": {
|
|
36
|
+
"b": [
|
|
37
|
+
"c",
|
|
38
|
+
"d",
|
|
39
|
+
{
|
|
40
|
+
"e": "Hello"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"definition": "$$jsonpointer(SET,/b,'$.b[2]'):$"
|
|
45
|
+
},
|
|
46
|
+
"expect": {
|
|
47
|
+
"equal": {
|
|
48
|
+
"b": {
|
|
49
|
+
"e": "Hello"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "Remove",
|
|
56
|
+
"given": {
|
|
57
|
+
"input": {
|
|
58
|
+
"b": [
|
|
59
|
+
"c",
|
|
60
|
+
"d",
|
|
61
|
+
{
|
|
62
|
+
"e": "Hello"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"definition": "$$jsonpointer(REMOVE,/b/2):$"
|
|
67
|
+
},
|
|
68
|
+
"expect": {
|
|
69
|
+
"equal": {
|
|
70
|
+
"b": [
|
|
71
|
+
"c",
|
|
72
|
+
"d"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
]
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Inline",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
|
|
6
|
+
"definition": "$$jwtparse:$"
|
|
7
|
+
},
|
|
8
|
+
"expect": {
|
|
9
|
+
"equal": {
|
|
10
|
+
"sub": "1234567890",
|
|
11
|
+
"name": "John Doe",
|
|
12
|
+
"iat": 1516239022
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "Inline Invalid",
|
|
18
|
+
"given": {
|
|
19
|
+
"input": true,
|
|
20
|
+
"definition": "$$jwtparse:$"
|
|
21
|
+
},
|
|
22
|
+
"expect": {
|
|
23
|
+
"isNull": true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "Object",
|
|
28
|
+
"given": {
|
|
29
|
+
"input": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
|
|
30
|
+
"definition": {
|
|
31
|
+
"$$jwtparse": "$"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"expect": {
|
|
35
|
+
"equal": {
|
|
36
|
+
"sub": "1234567890",
|
|
37
|
+
"name": "John Doe",
|
|
38
|
+
"iat": 1516239022
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "Object Invalid",
|
|
44
|
+
"given": {
|
|
45
|
+
"input": true,
|
|
46
|
+
"definition": {
|
|
47
|
+
"$$jwtparse": "$"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"expect": {
|
|
51
|
+
"isNull": true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
]
|