@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,389 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "basic now",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
6
|
+
"definition": "$$date:$"
|
|
7
|
+
},
|
|
8
|
+
"expect": {
|
|
9
|
+
"equal": "2020-12-31T12:34:56.780Z"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "parse date only",
|
|
14
|
+
"given": {
|
|
15
|
+
"input": "2020-12-31",
|
|
16
|
+
"definition": "$$date:$"
|
|
17
|
+
},
|
|
18
|
+
"expect": {
|
|
19
|
+
"equal": "2020-12-31T00:00:00Z"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "basic now with empty argument",
|
|
24
|
+
"given": {
|
|
25
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
26
|
+
"definition": "$$date():$"
|
|
27
|
+
},
|
|
28
|
+
"expect": {
|
|
29
|
+
"equal": "2020-12-31T12:34:56.780Z"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "basic now with iso",
|
|
34
|
+
"given": {
|
|
35
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
36
|
+
"definition": "$$date(iso):$"
|
|
37
|
+
},
|
|
38
|
+
"expect": {
|
|
39
|
+
"equal": "2020-12-31T12:34:56.780Z"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "basic now with ISO and 0",
|
|
44
|
+
"given": {
|
|
45
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
46
|
+
"definition": "$$date(ISO,0):$"
|
|
47
|
+
},
|
|
48
|
+
"expect": {
|
|
49
|
+
"equal": "2020-12-31T12:34:56Z"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "basic now with iso and 3",
|
|
54
|
+
"given": {
|
|
55
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
56
|
+
"definition": "$$date(iso,3):$"
|
|
57
|
+
},
|
|
58
|
+
"expect": {
|
|
59
|
+
"equal": "2020-12-31T12:34:56.780Z"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "basic now with iso and 6",
|
|
64
|
+
"given": {
|
|
65
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
66
|
+
"definition": "$$date(iso,6):$"
|
|
67
|
+
},
|
|
68
|
+
"expect": {
|
|
69
|
+
"equal": "2020-12-31T12:34:56.780000Z"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "basic now with ZONE and America/New_York",
|
|
74
|
+
"given": {
|
|
75
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
76
|
+
"definition": "$$date(ZONE,America/New_York):$"
|
|
77
|
+
},
|
|
78
|
+
"expect": {
|
|
79
|
+
"equal": "2020-12-31T07:34:56.78-05:00"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "basic 2023 with ZONE and EST",
|
|
84
|
+
"given": {
|
|
85
|
+
"input": "2023-01-01T00:00:00Z",
|
|
86
|
+
"definition": "$$date(ZONE,EST):$"
|
|
87
|
+
},
|
|
88
|
+
"expect": {
|
|
89
|
+
"equal": "2022-12-31T19:00:00-05:00"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "basic now with GMT",
|
|
94
|
+
"given": {
|
|
95
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
96
|
+
"definition": "$$date(GMT):$"
|
|
97
|
+
},
|
|
98
|
+
"expect": {
|
|
99
|
+
"equal": "Thu, 31 Dec 2020 12:34:56 GMT"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "basic now with date",
|
|
104
|
+
"given": {
|
|
105
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
106
|
+
"definition": "$$date(date):$"
|
|
107
|
+
},
|
|
108
|
+
"expect": {
|
|
109
|
+
"equal": "2020-12-31"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "basic now with 'date'",
|
|
114
|
+
"given": {
|
|
115
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
116
|
+
"definition": "$$date('date'):$"
|
|
117
|
+
},
|
|
118
|
+
"expect": {
|
|
119
|
+
"equal": "2020-12-31"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "format now",
|
|
124
|
+
"given": {
|
|
125
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
126
|
+
"definition": "$$date(format,'dd.MM.yyyy'):$"
|
|
127
|
+
},
|
|
128
|
+
"expect": {
|
|
129
|
+
"equal": "31.12.2020"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "format 2023",
|
|
134
|
+
"given": {
|
|
135
|
+
"input": "2023-01-01T00:00:00Z",
|
|
136
|
+
"definition": "$$date(format,'yyyy-MM-dd HH:mm'):$"
|
|
137
|
+
},
|
|
138
|
+
"expect": {
|
|
139
|
+
"equal": "2023-01-01 00:00"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "format 2023 with UTC",
|
|
144
|
+
"given": {
|
|
145
|
+
"input": "2023-01-01T00:00:00Z",
|
|
146
|
+
"definition": "$$date(format,'yyyy-MM-dd HH:mm',UTC):$"
|
|
147
|
+
},
|
|
148
|
+
"expect": {
|
|
149
|
+
"equal": "2023-01-01 00:00"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "format 2023 with America/New_York",
|
|
154
|
+
"given": {
|
|
155
|
+
"input": "2023-01-01T00:00:00Z",
|
|
156
|
+
"definition": "$$date(format,'yyyy-MM-dd HH:mm','America/New_York'):$"
|
|
157
|
+
},
|
|
158
|
+
"expect": {
|
|
159
|
+
"equal": "2022-12-31 19:00"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "epoch now",
|
|
164
|
+
"given": {
|
|
165
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
166
|
+
"definition": "$$date(epoch):$"
|
|
167
|
+
},
|
|
168
|
+
"expect": {
|
|
169
|
+
"equal": 1609418096
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "epoch now with MS",
|
|
174
|
+
"given": {
|
|
175
|
+
"input": "2020-12-31T12:34:56.78Z",
|
|
176
|
+
"definition": "$$date(epoch,MS):$"
|
|
177
|
+
},
|
|
178
|
+
"expect": {
|
|
179
|
+
"equal": 1609418096780
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "timezoneError with spaces",
|
|
184
|
+
"given": {
|
|
185
|
+
"input": " +01:00 ",
|
|
186
|
+
"definition": "$$date(ZONE,$):2023-01-01T00:00:00Z"
|
|
187
|
+
},
|
|
188
|
+
"expect": {
|
|
189
|
+
"equal": "2023-01-01T01:00:00+01:00"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "timezone - no error",
|
|
194
|
+
"given": {
|
|
195
|
+
"input": "+01:00",
|
|
196
|
+
"definition": "$$date(ZONE,$):2023-01-01T00:00:00Z"
|
|
197
|
+
},
|
|
198
|
+
"expect": {
|
|
199
|
+
"equal": "2023-01-01T01:00:00+01:00"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "addSub exactNow with only add",
|
|
204
|
+
"given": {
|
|
205
|
+
"input": "2020-12-31T00:00:00Z",
|
|
206
|
+
"definition": "$$date(add):$"
|
|
207
|
+
},
|
|
208
|
+
"expect": {
|
|
209
|
+
"isNull": true
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "addSub exactNow with ADD and MILLIS",
|
|
214
|
+
"given": {
|
|
215
|
+
"input": "2020-12-31T00:00:00Z",
|
|
216
|
+
"definition": "$$date(ADD,MILLIS,100):$"
|
|
217
|
+
},
|
|
218
|
+
"expect": {
|
|
219
|
+
"equal": "2020-12-31T00:00:00.100Z"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "addSub exactNow with add and SECONDS",
|
|
224
|
+
"given": {
|
|
225
|
+
"input": "2020-12-31T00:00:00Z",
|
|
226
|
+
"definition": "$$date(add,SECONDS,59):$"
|
|
227
|
+
},
|
|
228
|
+
"expect": {
|
|
229
|
+
"equal": "2020-12-31T00:00:59Z"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "addSub exactNow with add and MINUTES",
|
|
234
|
+
"given": {
|
|
235
|
+
"input": "2020-12-31T00:00:00Z",
|
|
236
|
+
"definition": "$$date(add,MINUTES,59):$"
|
|
237
|
+
},
|
|
238
|
+
"expect": {
|
|
239
|
+
"equal": "2020-12-31T00:59:00Z"
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "addSub exactNow with add and HOURS",
|
|
244
|
+
"given": {
|
|
245
|
+
"input": "2020-12-31T00:00:00Z",
|
|
246
|
+
"definition": "$$date(add,HOURS,24):$"
|
|
247
|
+
},
|
|
248
|
+
"expect": {
|
|
249
|
+
"equal": "2021-01-01T00:00:00Z"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "addSub exactNow with ADD and DAYS",
|
|
254
|
+
"given": {
|
|
255
|
+
"input": "2020-12-31T00:00:00Z",
|
|
256
|
+
"definition": "$$date(ADD, DAYS, 1):$"
|
|
257
|
+
},
|
|
258
|
+
"expect": {
|
|
259
|
+
"equal": "2021-01-01T00:00:00Z"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "addSub exactNow with add and days",
|
|
264
|
+
"given": {
|
|
265
|
+
"input": "2020-12-31T00:00:00Z",
|
|
266
|
+
"definition": "$$date(add,days , 1):$"
|
|
267
|
+
},
|
|
268
|
+
"expect": {
|
|
269
|
+
"equal": "2021-01-01T00:00:00Z"
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "addSub exactNow with add and MONTHS",
|
|
274
|
+
"given": {
|
|
275
|
+
"input": "2020-12-31T00:00:00Z",
|
|
276
|
+
"definition": "$$date(add,MONTHS,1):$"
|
|
277
|
+
},
|
|
278
|
+
"expect": {
|
|
279
|
+
"equal": "2021-01-31T00:00:00Z"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "addSub exactNow with add and YEARS",
|
|
284
|
+
"given": {
|
|
285
|
+
"input": "2020-12-31T00:00:00Z",
|
|
286
|
+
"definition": "$$date(add,YEARS,1):$"
|
|
287
|
+
},
|
|
288
|
+
"expect": {
|
|
289
|
+
"equal": "2021-12-31T00:00:00Z"
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "addSub exactNow with SUB and HOURS",
|
|
294
|
+
"given": {
|
|
295
|
+
"input": "2020-12-31T00:00:00Z",
|
|
296
|
+
"definition": "$$date(SUB,HOURS,23):$"
|
|
297
|
+
},
|
|
298
|
+
"expect": {
|
|
299
|
+
"equal": "2020-12-30T01:00:00Z"
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": "addSub exactNow with sub and DAYS",
|
|
304
|
+
"given": {
|
|
305
|
+
"input": "2020-12-31T00:00:00Z",
|
|
306
|
+
"definition": "$$date(sub,DAYS,1):$"
|
|
307
|
+
},
|
|
308
|
+
"expect": {
|
|
309
|
+
"equal": "2020-12-30T00:00:00Z"
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": "addSub exactNow with sub and MONTHS",
|
|
314
|
+
"given": {
|
|
315
|
+
"input": "2020-12-31T00:00:00Z",
|
|
316
|
+
"definition": "$$date(sub,MONTHS,1):$"
|
|
317
|
+
},
|
|
318
|
+
"expect": {
|
|
319
|
+
"equal": "2020-11-30T00:00:00Z"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"name": "addSub exactNow with sub and YEARS",
|
|
324
|
+
"given": {
|
|
325
|
+
"input": "2020-12-31T00:00:00Z",
|
|
326
|
+
"definition": "$$date(sub,YEARS,1):$"
|
|
327
|
+
},
|
|
328
|
+
"expect": {
|
|
329
|
+
"equal": "2019-12-31T00:00:00Z"
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"name": "addSub exactNow with add and DAYS negative",
|
|
334
|
+
"given": {
|
|
335
|
+
"input": "2020-12-31T00:00:00Z",
|
|
336
|
+
"definition": "$$date(add,DAYS,-1):$"
|
|
337
|
+
},
|
|
338
|
+
"expect": {
|
|
339
|
+
"equal": "2020-12-30T00:00:00Z"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"name": "addSub exactNow with add and YEARS negative",
|
|
344
|
+
"given": {
|
|
345
|
+
"input": "2020-12-31T00:00:00Z",
|
|
346
|
+
"definition": "$$date(add,YEARS,-1):$"
|
|
347
|
+
},
|
|
348
|
+
"expect": {
|
|
349
|
+
"equal": "2019-12-31T00:00:00Z"
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"name": "addSub with args from vars",
|
|
354
|
+
"given": {
|
|
355
|
+
"input": {
|
|
356
|
+
"date": "2020-12-31T00:00:00Z",
|
|
357
|
+
"amount": 2,
|
|
358
|
+
"unit": "HOURS"
|
|
359
|
+
},
|
|
360
|
+
"definition": "$$date(add,$.unit,'$.amount'):$.date"
|
|
361
|
+
},
|
|
362
|
+
"expect": {
|
|
363
|
+
"equal": "2020-12-31T02:00:00Z"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"name": "difference between date in specified object under field 'a' to the date under field 'b'",
|
|
368
|
+
"given": {
|
|
369
|
+
"input": {
|
|
370
|
+
"a": "2024-01-01",
|
|
371
|
+
"b": "2025-01-01"
|
|
372
|
+
},
|
|
373
|
+
"definition": "$$date(DIFF,DAYS,$.b):$.a"
|
|
374
|
+
},
|
|
375
|
+
"expect": {
|
|
376
|
+
"equal": 366
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"name": "seconds since 1970-01-01 to a specified date",
|
|
381
|
+
"given": {
|
|
382
|
+
"input": "2024-01-01",
|
|
383
|
+
"definition": "$$date(DIFF,SECONDS,$):1970-01-01"
|
|
384
|
+
},
|
|
385
|
+
"expect": {
|
|
386
|
+
"equal": 1704067200
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
]
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "convert string to decimal",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": "123456789.87654321",
|
|
6
|
+
"definition": "$$decimal:$"
|
|
7
|
+
},
|
|
8
|
+
"expect": {
|
|
9
|
+
"equal": 123456789.87654321
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "convert string to decimal with empty parentheses",
|
|
14
|
+
"given": {
|
|
15
|
+
"input": "123456789.87654321",
|
|
16
|
+
"definition": "$$decimal():$"
|
|
17
|
+
},
|
|
18
|
+
"expect": {
|
|
19
|
+
"equal": 123456789.87654321
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "convert number to decimal",
|
|
24
|
+
"given": {
|
|
25
|
+
"input": 123456789.87654321,
|
|
26
|
+
"definition": "$$decimal:$"
|
|
27
|
+
},
|
|
28
|
+
"expect": {
|
|
29
|
+
"equal": 123456789.87654321
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "convert null to decimal",
|
|
34
|
+
"given": {
|
|
35
|
+
"input": null,
|
|
36
|
+
"definition": "$$decimal:$"
|
|
37
|
+
},
|
|
38
|
+
"expect": {
|
|
39
|
+
"isNull": true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "scaling with rounding",
|
|
44
|
+
"given": {
|
|
45
|
+
"input": "123456789.87654321",
|
|
46
|
+
"definition": "$$decimal(2):$"
|
|
47
|
+
},
|
|
48
|
+
"expect": {
|
|
49
|
+
"equal": 123456789.88
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "scaling with floor rounding",
|
|
54
|
+
"given": {
|
|
55
|
+
"input": "123456789.87654321",
|
|
56
|
+
"definition": "$$decimal(2,FLOOR):$"
|
|
57
|
+
},
|
|
58
|
+
"expect": {
|
|
59
|
+
"equal": 123456789.87
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "scaling without rounding (over max)",
|
|
64
|
+
"given": {
|
|
65
|
+
"input": "1.01234567890123456789",
|
|
66
|
+
"definition": "$$decimal:$"
|
|
67
|
+
},
|
|
68
|
+
"expect": {
|
|
69
|
+
"equal": 1.012345678901235
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "object with rounding",
|
|
74
|
+
"given": {
|
|
75
|
+
"input": "123456789.87654321",
|
|
76
|
+
"definition": { "$$decimal": "$", "scale": 2 }
|
|
77
|
+
},
|
|
78
|
+
"expect": {
|
|
79
|
+
"equal": 123456789.88
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "object with floor rounding",
|
|
84
|
+
"given": {
|
|
85
|
+
"input": "123456789.87654321",
|
|
86
|
+
"definition": { "$$decimal": "$", "scale": 2, "rounding": "FLOOR" }
|
|
87
|
+
},
|
|
88
|
+
"expect": {
|
|
89
|
+
"equal": 123456789.87
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "object without rounding",
|
|
94
|
+
"given": {
|
|
95
|
+
"input": "1.01234567890123456789",
|
|
96
|
+
"definition": { "$$decimal": "$" }
|
|
97
|
+
},
|
|
98
|
+
"expect": {
|
|
99
|
+
"equal": 1.012345678901235
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Digest - Default SHA-1 Base64",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": "Hello World",
|
|
6
|
+
"definition": "$$digest:$"
|
|
7
|
+
},
|
|
8
|
+
"expect": {
|
|
9
|
+
"equal": "Ck1VqNd45QIvq3AZd8XYQLvEhtA="
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "Digest - SHA-1 Base64",
|
|
14
|
+
"given": {
|
|
15
|
+
"input": "Hello World",
|
|
16
|
+
"definition": "$$digest(SHA-1):$"
|
|
17
|
+
},
|
|
18
|
+
"expect": {
|
|
19
|
+
"equal": "Ck1VqNd45QIvq3AZd8XYQLvEhtA="
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Digest - SHA-1 HEX",
|
|
24
|
+
"given": {
|
|
25
|
+
"input": "Hello World",
|
|
26
|
+
"definition": "$$digest(SHA-1,HEX):$"
|
|
27
|
+
},
|
|
28
|
+
"expect": {
|
|
29
|
+
"equal": "0a4d55a8d778e5022fab701977c5d840bbc486d0"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "Digest - SHA-256 Base64",
|
|
34
|
+
"given": {
|
|
35
|
+
"input": "Hello World",
|
|
36
|
+
"definition": "$$digest(SHA-256):$"
|
|
37
|
+
},
|
|
38
|
+
"expect": {
|
|
39
|
+
"equal": "pZGm1Av0IEBKARczz7exkNYsZb8LzaMrV7J32a2fFG4="
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "Digest - SHA-256 HEX",
|
|
44
|
+
"given": {
|
|
45
|
+
"input": "Hello World",
|
|
46
|
+
"definition": "$$digest(SHA-256,HEX):$"
|
|
47
|
+
},
|
|
48
|
+
"expect": {
|
|
49
|
+
"equal": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "Digest - SHA-384 Base64",
|
|
54
|
+
"given": {
|
|
55
|
+
"input": "Hello World",
|
|
56
|
+
"definition": "$$digest(SHA-384):$"
|
|
57
|
+
},
|
|
58
|
+
"expect": {
|
|
59
|
+
"equal": "mVFDKRhrL2rkoTKefubGEKcpY2M1F0rGt0D5AoOW/MgD0Ok4Y6fD2Q+Gvu54L08/"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "Digest - SHA-384 Base64URL",
|
|
64
|
+
"given": {
|
|
65
|
+
"input": "Hello World",
|
|
66
|
+
"definition": "$$digest(SHA-384,BASE64URL):$"
|
|
67
|
+
},
|
|
68
|
+
"expect": {
|
|
69
|
+
"equal": "mVFDKRhrL2rkoTKefubGEKcpY2M1F0rGt0D5AoOW_MgD0Ok4Y6fD2Q-Gvu54L08_"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "Digest - SHA-512 Base64",
|
|
74
|
+
"given": {
|
|
75
|
+
"input": "Hello World",
|
|
76
|
+
"definition": "$$digest(SHA-512):$"
|
|
77
|
+
},
|
|
78
|
+
"expect": {
|
|
79
|
+
"equal": "LHT9F+2v2A6ER7DUZ0HuJDt+t03SFJoKsbkkb7MDgvJ+hT2FhXGeDmfL2g2qj1FnEGRhXWRa4nrLFb+xRH9Fmw=="
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "Digest - MD5 Base64",
|
|
84
|
+
"given": {
|
|
85
|
+
"input": "Hello World",
|
|
86
|
+
"definition": "$$digest(MD5):$"
|
|
87
|
+
},
|
|
88
|
+
"expect": {
|
|
89
|
+
"equal": "sQqNsWTgdUEFt6mb5y4/5Q=="
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "Digest - MD5 HEX",
|
|
94
|
+
"given": {
|
|
95
|
+
"input": "Hello World",
|
|
96
|
+
"definition": "$$digest(MD5,HEX):$"
|
|
97
|
+
},
|
|
98
|
+
"expect": {
|
|
99
|
+
"equal": "b10a8db164e0754105b7a99be72e3fe5"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "Inline Java - Default Digest",
|
|
104
|
+
"given": {
|
|
105
|
+
"input": "Hello World",
|
|
106
|
+
"definition": "$$digest(JAVA):$"
|
|
107
|
+
},
|
|
108
|
+
"expect": {
|
|
109
|
+
"equal": -862545276
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "Java - Default Digest",
|
|
114
|
+
"given": {
|
|
115
|
+
"input": "Hello World",
|
|
116
|
+
"definition": {
|
|
117
|
+
"$$digest": "$",
|
|
118
|
+
"algorithm": "JAVA"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"expect": {
|
|
122
|
+
"equal": -862545276
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
]
|