@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,2090 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
and: {
|
|
5
|
+
description: "Evaluates to `true` if all values provided will evaluate to `true` (using the [Truthy logic](../truthy-logic))",
|
|
6
|
+
inputSchema: { type: "array", required: true, description: "Values to check" },
|
|
7
|
+
outputSchema: { type: "boolean" },
|
|
8
|
+
},
|
|
9
|
+
at: {
|
|
10
|
+
description: "Retrieves an element from a specific position inside an input array",
|
|
11
|
+
inputSchema: { type: "array", required: true, description: "Array to fetch from" },
|
|
12
|
+
outputSchemaTemplate: { type: "object", description: "Same as value at specified index" },
|
|
13
|
+
arguments: [
|
|
14
|
+
{
|
|
15
|
+
name: "index",
|
|
16
|
+
description: "The index of element to return, **negative** indices will return element from the end (`-n -> length - n`)",
|
|
17
|
+
type: "integer",
|
|
18
|
+
position: 0,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
avg: {
|
|
24
|
+
description: "Returns the average of all values in the array",
|
|
25
|
+
inputSchema: { type: "array", required: true, description: "Array to average" },
|
|
26
|
+
outputSchema: { type: "number", $comment: "BigDecimal" },
|
|
27
|
+
arguments: [
|
|
28
|
+
{
|
|
29
|
+
name: "default",
|
|
30
|
+
description: "The default value to use for empty values",
|
|
31
|
+
type: "BigDecimal",
|
|
32
|
+
position: 0,
|
|
33
|
+
default: 0.0,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "by",
|
|
37
|
+
description: "A transformer to extract a property to sum by (using `##current` to refer to the current item)",
|
|
38
|
+
type: "transformer",
|
|
39
|
+
position: 1,
|
|
40
|
+
default: "##current",
|
|
41
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
base64: {
|
|
46
|
+
description: "Encode to or decode from base64",
|
|
47
|
+
inputSchema: { type: "string", required: true, description: "Value to encode/decode" },
|
|
48
|
+
outputSchema: { type: "string" },
|
|
49
|
+
arguments: [
|
|
50
|
+
{
|
|
51
|
+
name: "action",
|
|
52
|
+
description: "Whether to encode or decode input",
|
|
53
|
+
type: "enum",
|
|
54
|
+
enum: ["ENCODE", "DECODE"],
|
|
55
|
+
position: 0,
|
|
56
|
+
default: "ENCODE",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "rfc",
|
|
60
|
+
description: 'Which alphabet to use (`BASIC` = "The Base64 Alphabet" from RFC-2045, `URL` = "URL and Filename safe Base64 Alphabet" from RFC-4648, `MIME` = Same as `BASIC` but in lines with no more than 76 characters each)',
|
|
61
|
+
type: "enum",
|
|
62
|
+
enum: ["BASIC", "URL", "MIME"],
|
|
63
|
+
position: 1,
|
|
64
|
+
default: "BASIC",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "without_padding",
|
|
68
|
+
description: "Don't add padding at the end of the output (The character `=`)",
|
|
69
|
+
type: "boolean",
|
|
70
|
+
position: 2,
|
|
71
|
+
default: false,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
boolean: {
|
|
76
|
+
description: "Evaluates input to boolean using the [Truthy logic](../truthy-logic)",
|
|
77
|
+
usageNotes: 'Strings evaluation depends on `style` argument:\n- By default, value must be `"true"` for `true`.\n- Unless `style` is set to `JS`, then any non-empty value is `true`. Arrays and objects of size 0 returns `false`.\n',
|
|
78
|
+
inputSchema: { type: "any" },
|
|
79
|
+
outputSchema: { type: "boolean" },
|
|
80
|
+
arguments: [
|
|
81
|
+
{
|
|
82
|
+
name: "style",
|
|
83
|
+
description: "Style of considering truthy values (`JS` only relates to string handling; not objects and arrays)",
|
|
84
|
+
type: "enum",
|
|
85
|
+
enum: ["JAVA", "JS"],
|
|
86
|
+
position: 0,
|
|
87
|
+
default: "JAVA",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
coalesce: {
|
|
92
|
+
aliases: ["first"],
|
|
93
|
+
description: "Returns the first non-null value",
|
|
94
|
+
notes: ":::tip\nCoalesce can also be referred to as `$$first` instead of `$$coealesce`\n:::\n",
|
|
95
|
+
inputSchema: { type: "array", required: true, description: "Array of elements (may include nulls)" },
|
|
96
|
+
outputSchemaTemplate: { type: "object", description: "Same as first non-null value" },
|
|
97
|
+
},
|
|
98
|
+
concat: {
|
|
99
|
+
description: "Concatenates primary value array with elements or other arrays of elements",
|
|
100
|
+
notes: ":::note\nElements which are `null` on the primary value will be ignored.\n:::",
|
|
101
|
+
inputSchema: {
|
|
102
|
+
type: "array",
|
|
103
|
+
required: true,
|
|
104
|
+
description: "Array of arrays / elements (null elements are ignored)",
|
|
105
|
+
},
|
|
106
|
+
outputSchemaTemplate: { type: "array" },
|
|
107
|
+
},
|
|
108
|
+
contains: {
|
|
109
|
+
description: "Checks whether an array contains a certain value",
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: "array",
|
|
112
|
+
required: true,
|
|
113
|
+
description: "Array of arrays / elements (null elements are ignored)",
|
|
114
|
+
},
|
|
115
|
+
outputSchema: { type: "boolean" },
|
|
116
|
+
arguments: [{ name: "that", required: true, description: "The value to look for", type: "any", position: 0 }],
|
|
117
|
+
},
|
|
118
|
+
csv: {
|
|
119
|
+
description: "Converts an array of objects/arrays to a CSV string",
|
|
120
|
+
inputSchema: { type: "array", required: true, description: "Array of objects/arrays" },
|
|
121
|
+
outputSchemaTemplate: { type: "string", description: "CSV" },
|
|
122
|
+
outputSchema: { type: "string" },
|
|
123
|
+
arguments: [
|
|
124
|
+
{
|
|
125
|
+
name: "no_headers",
|
|
126
|
+
description: "Whether to include object keys as headers (taken from first object if no `names`)",
|
|
127
|
+
type: "boolean",
|
|
128
|
+
position: 0,
|
|
129
|
+
default: false,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "force_quote",
|
|
133
|
+
description: "Whether to quote all the values",
|
|
134
|
+
type: "boolean",
|
|
135
|
+
position: 1,
|
|
136
|
+
default: false,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "separator",
|
|
140
|
+
description: "Use an alternative field separator",
|
|
141
|
+
type: "string",
|
|
142
|
+
position: 2,
|
|
143
|
+
default: ",",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "names",
|
|
147
|
+
description: "Names of fields to extract into csv if objects (will be used as the header row, unless `no_headers`)",
|
|
148
|
+
type: "string[]",
|
|
149
|
+
position: 3,
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
csvparse: {
|
|
154
|
+
description: "Converts a CSV string into an array of objects/arrays",
|
|
155
|
+
inputSchema: { type: "string", required: true, description: "csv contents" },
|
|
156
|
+
outputSchema: { type: "array", items: { type: "object" } },
|
|
157
|
+
subfunctions: [
|
|
158
|
+
{
|
|
159
|
+
if: [{ argument: "no_headers", equals: "TRUE" }],
|
|
160
|
+
then: {
|
|
161
|
+
outputSchema: { type: "array", items: { type: "array" } },
|
|
162
|
+
description: "Converts a CSV string into an array of arrays",
|
|
163
|
+
arguments: [
|
|
164
|
+
{
|
|
165
|
+
name: "no_headers",
|
|
166
|
+
description: "Whether to treat the first row as object keys",
|
|
167
|
+
type: "const",
|
|
168
|
+
position: 0,
|
|
169
|
+
const: true,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "separator",
|
|
173
|
+
description: "Use an alternative field separator",
|
|
174
|
+
type: "string",
|
|
175
|
+
position: 1,
|
|
176
|
+
default: ",",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "names",
|
|
180
|
+
description: "Names of fields of input arrays (by indices) or objects (can sift if provided less names than there are in the objects provided)",
|
|
181
|
+
type: "array",
|
|
182
|
+
position: 2,
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
arguments: [
|
|
189
|
+
{
|
|
190
|
+
name: "no_headers",
|
|
191
|
+
description: "Whether to treat the first row as object keys",
|
|
192
|
+
type: "boolean",
|
|
193
|
+
position: 0,
|
|
194
|
+
default: false,
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "separator",
|
|
198
|
+
description: "Use an alternative field separator",
|
|
199
|
+
type: "string",
|
|
200
|
+
position: 1,
|
|
201
|
+
default: ",",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "names",
|
|
205
|
+
description: "Names of fields of input arrays (by indices) or objects (can sift if provided less names than there are in the objects provided)",
|
|
206
|
+
type: "array",
|
|
207
|
+
position: 2,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
},
|
|
211
|
+
date: {
|
|
212
|
+
description: "Date manipulation and formatting utility",
|
|
213
|
+
notes: ":::note\ninput must be a Date in ISO-8601 format or Date or Instant\n:::\n\n:::tip\nUseful to be used in conjunction with `#now` as input\n:::\n",
|
|
214
|
+
inputSchema: { type: "string", required: true, description: "Date or Date-Time in ISO-8601 format" },
|
|
215
|
+
outputSchema: { type: "string", format: "date-time" },
|
|
216
|
+
subfunctions: [
|
|
217
|
+
{
|
|
218
|
+
if: [{ argument: "format", equals: "ISO" }],
|
|
219
|
+
then: {
|
|
220
|
+
outputSchema: { type: "string", format: "date-time" },
|
|
221
|
+
description: "Returns the ISO-8601 representation of the input date (to the specified precision set by `digits`)",
|
|
222
|
+
arguments: [
|
|
223
|
+
{
|
|
224
|
+
name: "format",
|
|
225
|
+
type: "const",
|
|
226
|
+
position: 0,
|
|
227
|
+
required: true,
|
|
228
|
+
const: "ISO",
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "digits",
|
|
232
|
+
description: "precision for time part (scale) 0|3|6|9|-1 (-1 means maximum)",
|
|
233
|
+
type: "integer",
|
|
234
|
+
position: 1,
|
|
235
|
+
default: -1,
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
if: [{ argument: "format", equals: "GMT" }],
|
|
242
|
+
then: {
|
|
243
|
+
outputSchema: { type: "string" },
|
|
244
|
+
description: "RFC-1123 format",
|
|
245
|
+
arguments: [
|
|
246
|
+
{
|
|
247
|
+
name: "format",
|
|
248
|
+
type: "const",
|
|
249
|
+
position: 0,
|
|
250
|
+
required: true,
|
|
251
|
+
const: "GMT",
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
if: [{ argument: "format", equals: "DATE" }],
|
|
258
|
+
then: {
|
|
259
|
+
outputSchema: { type: "string", format: "date" },
|
|
260
|
+
description: "Date part of ISO 8601",
|
|
261
|
+
arguments: [
|
|
262
|
+
{
|
|
263
|
+
name: "format",
|
|
264
|
+
type: "const",
|
|
265
|
+
position: 0,
|
|
266
|
+
required: true,
|
|
267
|
+
const: "DATE",
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
if: [{ argument: "format", equals: "ADD" }],
|
|
274
|
+
then: {
|
|
275
|
+
outputSchema: { type: "string", format: "date-time" },
|
|
276
|
+
description: "Adds an amount chronological units (`ChronoUnit`, see Java docs) to input date",
|
|
277
|
+
arguments: [
|
|
278
|
+
{
|
|
279
|
+
name: "format",
|
|
280
|
+
type: "const",
|
|
281
|
+
position: 0,
|
|
282
|
+
required: true,
|
|
283
|
+
const: "ADD",
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: "units",
|
|
287
|
+
description: "Units to use (ChronoUnit)",
|
|
288
|
+
type: "enum",
|
|
289
|
+
enum: [
|
|
290
|
+
"NANOS",
|
|
291
|
+
"MICROS",
|
|
292
|
+
"MILLIS",
|
|
293
|
+
"SECONDS",
|
|
294
|
+
"MINUTES",
|
|
295
|
+
"HOURS",
|
|
296
|
+
"HALF_DAYS",
|
|
297
|
+
"DAYS",
|
|
298
|
+
"MONTHS",
|
|
299
|
+
"YEARS",
|
|
300
|
+
],
|
|
301
|
+
position: 1,
|
|
302
|
+
required: true,
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "amount",
|
|
306
|
+
description: "Amount of units to add (can be negative)",
|
|
307
|
+
type: "long",
|
|
308
|
+
position: 2,
|
|
309
|
+
default: 0,
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
if: [{ argument: "format", equals: "SUB" }],
|
|
316
|
+
then: {
|
|
317
|
+
outputSchema: { type: "string", format: "date-time" },
|
|
318
|
+
description: "Subtracts an amount chronological units (`ChronoUnit`, see Java docs) from input date",
|
|
319
|
+
arguments: [
|
|
320
|
+
{
|
|
321
|
+
name: "format",
|
|
322
|
+
type: "const",
|
|
323
|
+
position: 0,
|
|
324
|
+
required: true,
|
|
325
|
+
const: "SUB",
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: "units",
|
|
329
|
+
description: "Units to use (ChronoUnit)",
|
|
330
|
+
type: "enum",
|
|
331
|
+
enum: [
|
|
332
|
+
"NANOS",
|
|
333
|
+
"MICROS",
|
|
334
|
+
"MILLIS",
|
|
335
|
+
"SECONDS",
|
|
336
|
+
"MINUTES",
|
|
337
|
+
"HOURS",
|
|
338
|
+
"HALF_DAYS",
|
|
339
|
+
"DAYS",
|
|
340
|
+
"MONTHS",
|
|
341
|
+
"YEARS",
|
|
342
|
+
],
|
|
343
|
+
position: 1,
|
|
344
|
+
required: true,
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: "amount",
|
|
348
|
+
description: "Amount of units to subtract (can be negative)",
|
|
349
|
+
type: "long",
|
|
350
|
+
position: 2,
|
|
351
|
+
default: 0,
|
|
352
|
+
},
|
|
353
|
+
],
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
if: [{ argument: "format", equals: "DIFF" }],
|
|
358
|
+
then: {
|
|
359
|
+
outputSchema: { type: "integer" },
|
|
360
|
+
description: "Calculate the difference between two dates in specified units.",
|
|
361
|
+
arguments: [
|
|
362
|
+
{
|
|
363
|
+
name: "format",
|
|
364
|
+
type: "const",
|
|
365
|
+
position: 0,
|
|
366
|
+
required: true,
|
|
367
|
+
const: "DIFF",
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: "units",
|
|
371
|
+
description: "Units to use (ChronoUnit)",
|
|
372
|
+
type: "enum",
|
|
373
|
+
enum: ["NANOS", "MICROS", "MILLIS", "SECONDS", "MINUTES", "HOURS", "HALF_DAYS", "DAYS"],
|
|
374
|
+
position: 1,
|
|
375
|
+
required: true,
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
name: "end",
|
|
379
|
+
description: "End date",
|
|
380
|
+
type: "string",
|
|
381
|
+
position: 2,
|
|
382
|
+
required: true,
|
|
383
|
+
},
|
|
384
|
+
],
|
|
385
|
+
},
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
if: [{ argument: "format", equals: "EPOCH" }],
|
|
389
|
+
then: {
|
|
390
|
+
outputSchema: { type: "integer" },
|
|
391
|
+
description: "Seconds passed since 1970-01-01; unless `resolution`=`MS` then milliseconds,",
|
|
392
|
+
arguments: [
|
|
393
|
+
{
|
|
394
|
+
name: "format",
|
|
395
|
+
type: "const",
|
|
396
|
+
position: 0,
|
|
397
|
+
required: true,
|
|
398
|
+
const: "EPOCH",
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
name: "resolution",
|
|
402
|
+
description: "Resolution of epoch (Seconds or Milliseconds)",
|
|
403
|
+
type: "enum",
|
|
404
|
+
enum: ["UNIX", "MS"],
|
|
405
|
+
position: 1,
|
|
406
|
+
default: "UNIX",
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
if: [{ argument: "format", equals: "FORMAT" }],
|
|
413
|
+
then: {
|
|
414
|
+
outputSchema: { type: "string" },
|
|
415
|
+
description: "Format using a date format pattern (Java style)",
|
|
416
|
+
arguments: [
|
|
417
|
+
{
|
|
418
|
+
name: "format",
|
|
419
|
+
type: "const",
|
|
420
|
+
position: 0,
|
|
421
|
+
required: true,
|
|
422
|
+
const: "FORMAT",
|
|
423
|
+
},
|
|
424
|
+
{ name: "pattern", description: "Pattern to use", type: "string", position: 1, required: true },
|
|
425
|
+
{ name: "timezone", description: "Time zone to use", type: "string", position: 2, default: "UTC" },
|
|
426
|
+
],
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
if: [{ argument: "format", equals: "ZONE" }],
|
|
431
|
+
then: {
|
|
432
|
+
outputSchema: { type: "string", format: "date-time" },
|
|
433
|
+
description: "Returns the ISO-8601 with offset by specifying a timezone",
|
|
434
|
+
arguments: [
|
|
435
|
+
{
|
|
436
|
+
name: "format",
|
|
437
|
+
type: "const",
|
|
438
|
+
position: 0,
|
|
439
|
+
required: true,
|
|
440
|
+
const: "ZONE",
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
name: "zone",
|
|
444
|
+
description: "Time zone to use\n- Java's `ZoneId` (with `SHORT_IDS`)",
|
|
445
|
+
type: "enum",
|
|
446
|
+
enum: [],
|
|
447
|
+
position: 1,
|
|
448
|
+
default: "UTC",
|
|
449
|
+
},
|
|
450
|
+
],
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
],
|
|
454
|
+
arguments: [
|
|
455
|
+
{
|
|
456
|
+
name: "format",
|
|
457
|
+
description: "Formatter to use",
|
|
458
|
+
type: "enum",
|
|
459
|
+
enum: ["ISO", "GMT", "DATE", "ADD", "SUB", "DIFF", "EPOCH", "FORMAT", "ZONE"],
|
|
460
|
+
position: 0,
|
|
461
|
+
default: "ISO",
|
|
462
|
+
},
|
|
463
|
+
],
|
|
464
|
+
},
|
|
465
|
+
decimal: {
|
|
466
|
+
description: "Converts number to BigDecimal type",
|
|
467
|
+
inputSchema: { type: "any", required: true, description: "Value to convert" },
|
|
468
|
+
outputSchema: { type: "number", $comment: "BigDecimal" },
|
|
469
|
+
arguments: [
|
|
470
|
+
{
|
|
471
|
+
name: "scale",
|
|
472
|
+
description: "Scale of BigDecimal to set (default is 10 max)",
|
|
473
|
+
type: "integer",
|
|
474
|
+
position: 0,
|
|
475
|
+
default: -1,
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
name: "rounding",
|
|
479
|
+
description: "Java\u0027s `RoundingMode`",
|
|
480
|
+
type: "enum",
|
|
481
|
+
enum: ["UP", "DOWN", "CEILING", "FLOOR", "HALF_UP", "HALF_DOWN", "HALF_EVEN"],
|
|
482
|
+
position: 1,
|
|
483
|
+
default: "HALF_UP",
|
|
484
|
+
},
|
|
485
|
+
],
|
|
486
|
+
},
|
|
487
|
+
digest: {
|
|
488
|
+
description: "Creates a message digest based on a supported algorithm",
|
|
489
|
+
inputSchema: { type: "string" },
|
|
490
|
+
outputSchema: { type: "string" },
|
|
491
|
+
subfunctions: [
|
|
492
|
+
{
|
|
493
|
+
if: [{ argument: "algorithm", equals: "JAVA" }],
|
|
494
|
+
then: {
|
|
495
|
+
outputSchema: { type: "integer" },
|
|
496
|
+
description: "Creates a message digest based on Java's hashCode()",
|
|
497
|
+
arguments: [
|
|
498
|
+
{
|
|
499
|
+
name: "algorithm",
|
|
500
|
+
type: "const",
|
|
501
|
+
position: 0,
|
|
502
|
+
const: "JAVA",
|
|
503
|
+
},
|
|
504
|
+
],
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
],
|
|
508
|
+
arguments: [
|
|
509
|
+
{
|
|
510
|
+
name: "algorithm",
|
|
511
|
+
description: "Hashing algorithm",
|
|
512
|
+
type: "enum",
|
|
513
|
+
enum: ["SHA-1", "SHA-256", "SHA-384", "SHA-512", "MD5", "JAVA"],
|
|
514
|
+
position: 0,
|
|
515
|
+
default: "SHA-1",
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
name: "format",
|
|
519
|
+
description: 'Format of output (`BASE64` = "The Base64 Alphabet" from RFC-2045, `BAS64URL` = "URL and Filename safe Base64 Alphabet" from RFC-4648, `HEX` = Hexadecimal string)',
|
|
520
|
+
type: "enum",
|
|
521
|
+
enum: ["BASE64", "BASE64URL", "HEX"],
|
|
522
|
+
position: 1,
|
|
523
|
+
default: "BASE64",
|
|
524
|
+
},
|
|
525
|
+
],
|
|
526
|
+
},
|
|
527
|
+
distinct: {
|
|
528
|
+
description: "Returns a distinct array (repeating elements removed, only primitive values are supported if no `by` was specified)",
|
|
529
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
530
|
+
outputSchemaTemplate: { type: "array", description: "Same items type as input" },
|
|
531
|
+
pipedType: true,
|
|
532
|
+
arguments: [
|
|
533
|
+
{
|
|
534
|
+
name: "by",
|
|
535
|
+
description: "A mapping for each element to distinct by (instead of the whole element, using `##current` to refer to the current item)",
|
|
536
|
+
type: "transformer",
|
|
537
|
+
position: 0,
|
|
538
|
+
default: "##current",
|
|
539
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
540
|
+
},
|
|
541
|
+
],
|
|
542
|
+
},
|
|
543
|
+
entries: {
|
|
544
|
+
description: "Gets the entries* of an object or an array",
|
|
545
|
+
notes: ":::note\n*Entry is in the form of `[ key / index, value ]`\n:::",
|
|
546
|
+
inputSchema: {
|
|
547
|
+
type: "any",
|
|
548
|
+
required: true,
|
|
549
|
+
description: "An `object` or an `array` to get entries from",
|
|
550
|
+
},
|
|
551
|
+
outputSchema: {
|
|
552
|
+
type: "array",
|
|
553
|
+
items: { type: "array", items: [{ type: "string" }, { type: undefined }] },
|
|
554
|
+
},
|
|
555
|
+
},
|
|
556
|
+
eval: {
|
|
557
|
+
description: "Evaluates the input and then transforms the context with the expression",
|
|
558
|
+
inputSchema: { type: "any", required: true, description: "Transformer definition" },
|
|
559
|
+
},
|
|
560
|
+
every: {
|
|
561
|
+
aliases: ["all"],
|
|
562
|
+
description: "Checks if all elements in an array satisfy a predicate",
|
|
563
|
+
usageNotes: ":::info\npredicate `by` should resolve to a `boolean` value, it uses the [truthy logic](../truthy-logic)\n:::",
|
|
564
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
565
|
+
outputSchema: { type: "boolean" },
|
|
566
|
+
arguments: [
|
|
567
|
+
{
|
|
568
|
+
name: "by",
|
|
569
|
+
description: "A predicate transformer for an element",
|
|
570
|
+
type: "transformer",
|
|
571
|
+
position: 0,
|
|
572
|
+
required: true,
|
|
573
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
574
|
+
},
|
|
575
|
+
],
|
|
576
|
+
},
|
|
577
|
+
filter: {
|
|
578
|
+
description: "Filter input array to all the elements that satisfy the predicate transformer",
|
|
579
|
+
usageNotes: ":::info\npredicate `by` should resolve to a `boolean` value, it uses the [truthy logic](../truthy-logic)\n:::",
|
|
580
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
581
|
+
outputSchemaTemplate: { type: "array", description: "Same items type as input" },
|
|
582
|
+
pipedType: true,
|
|
583
|
+
arguments: [
|
|
584
|
+
{
|
|
585
|
+
name: "by",
|
|
586
|
+
description: "A predicate transformer for an element",
|
|
587
|
+
type: "transformer",
|
|
588
|
+
position: 0,
|
|
589
|
+
required: true,
|
|
590
|
+
transformerArguments: [
|
|
591
|
+
{ name: "##current", type: "any", position: 0, description: "Current element" },
|
|
592
|
+
{ name: "##index", type: "integer", position: 1, description: "Current index" },
|
|
593
|
+
],
|
|
594
|
+
},
|
|
595
|
+
],
|
|
596
|
+
},
|
|
597
|
+
find: {
|
|
598
|
+
description: "Find the first element in a specified array that satisfy the predicate transformer",
|
|
599
|
+
usageNotes: ":::info\npredicate `by` should resolve to a `boolean` value, it uses the [truthy logic](../truthy-logic)\n:::",
|
|
600
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
601
|
+
outputSchemaTemplate: { type: "object", description: "Same as found element" },
|
|
602
|
+
arguments: [
|
|
603
|
+
{
|
|
604
|
+
name: "by",
|
|
605
|
+
description: "A predicate transformer for an element",
|
|
606
|
+
type: "transformer",
|
|
607
|
+
position: 0,
|
|
608
|
+
default: "##current",
|
|
609
|
+
transformerArguments: [
|
|
610
|
+
{ name: "##current", type: "any", position: 0, description: "Current element" },
|
|
611
|
+
{ name: "##index", type: "integer", position: 1, description: "Current index" },
|
|
612
|
+
],
|
|
613
|
+
},
|
|
614
|
+
],
|
|
615
|
+
},
|
|
616
|
+
findindex: {
|
|
617
|
+
description: "Find the index of the first element in a specified array that satisfy the predicate transformer.\n\nIf none of the elements satisfy the predicate the result will be `-1`.",
|
|
618
|
+
usageNotes: ":::info\npredicate `by` should resolve to a `boolean` value, it uses the [truthy logic](../truthy-logic)\n:::",
|
|
619
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
620
|
+
outputSchema: { type: "number" },
|
|
621
|
+
arguments: [
|
|
622
|
+
{
|
|
623
|
+
name: "by",
|
|
624
|
+
description: "A predicate transformer for an element",
|
|
625
|
+
type: "transformer",
|
|
626
|
+
position: 0,
|
|
627
|
+
default: "##current",
|
|
628
|
+
transformerArguments: [
|
|
629
|
+
{ name: "##current", type: "any", position: 0, description: "Current element" },
|
|
630
|
+
{ name: "##index", type: "integer", position: 1, description: "Current index" },
|
|
631
|
+
],
|
|
632
|
+
},
|
|
633
|
+
],
|
|
634
|
+
},
|
|
635
|
+
flat: {
|
|
636
|
+
description: "Flatten an array of arrays (non array elements will remain)",
|
|
637
|
+
notes: ":::note\nAll `null` elements are removed from result\n:::",
|
|
638
|
+
inputSchema: { type: "array", required: true, description: "Array of arrays / elements" },
|
|
639
|
+
outputSchemaTemplate: { type: "array" },
|
|
640
|
+
},
|
|
641
|
+
flatten: {
|
|
642
|
+
description: "Flattens an object into a flat dot seperated list of entries",
|
|
643
|
+
inputSchema: { type: "object", required: true, description: "any object" },
|
|
644
|
+
outputSchema: { type: "object" },
|
|
645
|
+
arguments: [
|
|
646
|
+
{ name: "target", description: "A target to merge into", type: "object", position: 0, default: null },
|
|
647
|
+
{ name: "prefix", description: "A prefix to add to the base", type: "string", position: 1, default: "" },
|
|
648
|
+
{
|
|
649
|
+
name: "array_prefix",
|
|
650
|
+
description: 'Sets how array elements indices should be prefixed (If not set, elements will be prefixed like ` ${index}`).\n - Set to `"#null"` to not flatten arrays.',
|
|
651
|
+
type: "string",
|
|
652
|
+
position: 2,
|
|
653
|
+
default: "$",
|
|
654
|
+
},
|
|
655
|
+
],
|
|
656
|
+
},
|
|
657
|
+
form: {
|
|
658
|
+
description: "Converts an object to Form URL-Encoded string (a.k.a Query String)",
|
|
659
|
+
notes: "- Array values will be treated as multiple values for the same key (so the key will be duplicated in the result for each of the values)",
|
|
660
|
+
inputSchema: { type: "object", required: true },
|
|
661
|
+
outputSchemaTemplate: { type: "string", description: "form url-encoded string" },
|
|
662
|
+
outputSchema: { type: "string" },
|
|
663
|
+
},
|
|
664
|
+
formparse: {
|
|
665
|
+
description: "Parses a Form URL-Encoded string to `object`",
|
|
666
|
+
notes: "- Every element will have 2 forms in the result object:\n - Singular with its original query name (e.g. `q`)\n - Plural with its name suffixed with `$$` (e.g. `q$$`)",
|
|
667
|
+
inputSchema: { type: "string", required: true, description: "form url-encoded string" },
|
|
668
|
+
outputSchema: { type: "object" },
|
|
669
|
+
},
|
|
670
|
+
group: {
|
|
671
|
+
description: "Groups an array of entries into a map of `key -> array` by a specified transformer (with optional nested grouping)",
|
|
672
|
+
notes: "Sorts elements of an array",
|
|
673
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
674
|
+
outputSchemaTemplate: { type: "object", description: "Map of `key -> array`" },
|
|
675
|
+
outputSchema: { type: "object", additionalProperties: { type: "array" } },
|
|
676
|
+
arguments: [
|
|
677
|
+
{
|
|
678
|
+
name: "by",
|
|
679
|
+
description: "A transformer to extract a property to group by",
|
|
680
|
+
type: "transformer",
|
|
681
|
+
position: 0,
|
|
682
|
+
required: true,
|
|
683
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
name: "order",
|
|
687
|
+
description: "Direction of ordering (ascending / descending)",
|
|
688
|
+
type: "enum",
|
|
689
|
+
enum: ["ASC", "DESC"],
|
|
690
|
+
position: 1,
|
|
691
|
+
default: "ASC",
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
name: "type",
|
|
695
|
+
description: "Type of values to expect when ordering the input array",
|
|
696
|
+
type: "enum",
|
|
697
|
+
enum: ["AUTO", "STRING", "NUMBER", "BOOLEAN"],
|
|
698
|
+
position: 2,
|
|
699
|
+
default: "AUTO",
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
name: "then",
|
|
703
|
+
description: 'An array of subsequent grouping. When previous sort had no difference (only when `by` specified)\n`{ "by": ..., "order": ..., "type": ...}` // same 3 fields as above (`by` is required)',
|
|
704
|
+
type: "array",
|
|
705
|
+
position: 3,
|
|
706
|
+
},
|
|
707
|
+
],
|
|
708
|
+
},
|
|
709
|
+
if: {
|
|
710
|
+
description: "Conditionally returns a value, if the evaluation of the condition argument is truthy (using the [Truthy logic](../truthy-logic)).\nA fallback value (if condition evaluates to false) is optional",
|
|
711
|
+
usageNotes: ":::note\nAlternative form is available using \n```transformers \n{\n" +
|
|
712
|
+
' "$$if": [ /* condition */, /* then */, /* else ? */]\n' +
|
|
713
|
+
"}\n```\nIf `then` is used, the primary argument is treated as a condition\n:::",
|
|
714
|
+
inputSchema: {
|
|
715
|
+
type: "any",
|
|
716
|
+
required: true,
|
|
717
|
+
description: "Condition",
|
|
718
|
+
},
|
|
719
|
+
arguments: [
|
|
720
|
+
{ name: "then", required: true, description: "Value to return if condition is true", type: "any", position: 0 },
|
|
721
|
+
{ name: "else", description: "Value to return if condition is false", type: "any", position: 1, default: null },
|
|
722
|
+
],
|
|
723
|
+
},
|
|
724
|
+
indexof: {
|
|
725
|
+
description: "Find the index of the first element that matches the specified value.",
|
|
726
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
727
|
+
outputSchema: { type: "number" },
|
|
728
|
+
arguments: [
|
|
729
|
+
{
|
|
730
|
+
name: "of",
|
|
731
|
+
description: "The value to look for",
|
|
732
|
+
type: "any",
|
|
733
|
+
position: 0,
|
|
734
|
+
required: true,
|
|
735
|
+
},
|
|
736
|
+
],
|
|
737
|
+
},
|
|
738
|
+
is: {
|
|
739
|
+
description: "Checks value for one or more predicates (all predicates must be satisfied)",
|
|
740
|
+
usageNotes: ":::note\n**Inline form** supports only `that` and `op` arguments.\n:::\n\n:::tip\n`gt`/`gte`/`lt`/`lte` - Uses the [Comparison logic](../comparison-logic)\n:::",
|
|
741
|
+
inputSchema: { type: "object", required: true, description: "Value to check against" },
|
|
742
|
+
outputSchema: { type: "boolean" },
|
|
743
|
+
arguments: [
|
|
744
|
+
{
|
|
745
|
+
name: "op",
|
|
746
|
+
description: "A type of check to do exclusively (goes together with `that`)",
|
|
747
|
+
type: "enum",
|
|
748
|
+
enum: ["IN", "NIN", "EQ", "=", "==", "NEQ", "!=", "<>", "GT", ">", "GTE", ">=", "LT", "<", "LTE", "<="],
|
|
749
|
+
position: 0,
|
|
750
|
+
},
|
|
751
|
+
{ name: "that", description: "", type: "any", position: 1 },
|
|
752
|
+
{ name: "in", description: "Array of values the input should be part of", type: "array" },
|
|
753
|
+
{ name: "nin", description: "Array of values the input should **NOT** be part of", type: "array" },
|
|
754
|
+
{ name: "eq", description: "A value the input should be equal to", type: "any" },
|
|
755
|
+
{ name: "neq", description: "A value the input should **NOT** be equal to", type: "any" },
|
|
756
|
+
{ name: "gt", description: "A value the input should be greater than (input > value)", type: "any" },
|
|
757
|
+
{
|
|
758
|
+
name: "gte",
|
|
759
|
+
description: "A value the input should be greater than or equal (input >= value)",
|
|
760
|
+
type: "any",
|
|
761
|
+
},
|
|
762
|
+
{ name: "lt", description: "A value the input should be lower than (input < value)", type: "any" },
|
|
763
|
+
{
|
|
764
|
+
name: "lte",
|
|
765
|
+
description: "A value the input should be lower than or equal (input <= value)",
|
|
766
|
+
type: "any",
|
|
767
|
+
},
|
|
768
|
+
],
|
|
769
|
+
},
|
|
770
|
+
isnull: {
|
|
771
|
+
description: "Returns true if value does not exist or equal to null",
|
|
772
|
+
inputSchema: { type: "object", required: true, description: "value to check against" },
|
|
773
|
+
outputSchema: { type: "boolean" },
|
|
774
|
+
},
|
|
775
|
+
join: {
|
|
776
|
+
description: 'Joins an array of input as strings with an optional delimiter (default is `""`), prefix and suffix. `null` values are omitted',
|
|
777
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
778
|
+
outputSchema: { type: "string" },
|
|
779
|
+
arguments: [
|
|
780
|
+
{
|
|
781
|
+
name: "delimiter",
|
|
782
|
+
description: "Delimiter to join any 2 adjacent elements",
|
|
783
|
+
type: "string",
|
|
784
|
+
position: 0,
|
|
785
|
+
default: "",
|
|
786
|
+
},
|
|
787
|
+
{ name: "prefix", description: "A string to prefix the result", type: "string", position: 1, default: "" },
|
|
788
|
+
{
|
|
789
|
+
name: "keep_nulls",
|
|
790
|
+
description: "Whether to keep null values when joining",
|
|
791
|
+
type: "boolean",
|
|
792
|
+
position: 3,
|
|
793
|
+
default: false,
|
|
794
|
+
},
|
|
795
|
+
{ name: "suffix", description: "A string to suffix the result", type: "string", position: 2, default: "" },
|
|
796
|
+
],
|
|
797
|
+
},
|
|
798
|
+
jsonparse: {
|
|
799
|
+
description: "Parses input as JSON string",
|
|
800
|
+
inputSchema: { type: "string", required: true, description: "JSON serialized string" },
|
|
801
|
+
outputSchemaTemplate: { type: "object", description: "Parsed value" },
|
|
802
|
+
outputSchema: { type: "object" },
|
|
803
|
+
},
|
|
804
|
+
jsonpatch: {
|
|
805
|
+
description: "Apply patches defined by JSON Patch RFC-6902",
|
|
806
|
+
argumentsNotes: '#### JSON Patch Operations\n\n| Operation | Example |\n|-----------|---------------------------------------------------------------------------------------------------|\n| Add | `{ "op":"add", "path":"/...", "value":"..." }` |\n| Remove | `{ "op":"remove", "path":"/..." }` |\n| Replace | `{ "op":"replace", "path":"/...", "value":"..." }` |\n| Move | `{ "op":"move", "path":"/...", "from":"/..." }` |\n| Copy | `{ "op":"copy", "path":"/...", "from":"/..." }` |\n| Test | `{ "op":"test", "path":"/...", "value":"..." }` (if test fails, the function result will be null) |',
|
|
807
|
+
inputSchema: { type: "any", required: true, description: "Object to patch" },
|
|
808
|
+
outputSchemaTemplate: { type: "object", description: "Operations output" },
|
|
809
|
+
arguments: [
|
|
810
|
+
{
|
|
811
|
+
name: "ops",
|
|
812
|
+
description: "A list of operations",
|
|
813
|
+
type: "array",
|
|
814
|
+
position: 0,
|
|
815
|
+
required: true,
|
|
816
|
+
},
|
|
817
|
+
],
|
|
818
|
+
},
|
|
819
|
+
jsonpath: {
|
|
820
|
+
description: "Query a JSON document using JSONPath",
|
|
821
|
+
inputSchema: { type: "object", required: true, description: "Object to query" },
|
|
822
|
+
outputSchema: { type: "object" },
|
|
823
|
+
arguments: [
|
|
824
|
+
{
|
|
825
|
+
name: "path",
|
|
826
|
+
description: "JSONPath expression",
|
|
827
|
+
type: "string",
|
|
828
|
+
position: 0,
|
|
829
|
+
required: true,
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
name: "options",
|
|
833
|
+
description: "Configurations for the resolver, A list of options [by jayway](https://github.com/json-path/JsonPath?tab=readme-ov-file#tweaking-configuration)",
|
|
834
|
+
type: "string[]",
|
|
835
|
+
position: 1,
|
|
836
|
+
default: ["SUPPRESS_EXCEPTIONS"],
|
|
837
|
+
},
|
|
838
|
+
],
|
|
839
|
+
},
|
|
840
|
+
jsonpointer: {
|
|
841
|
+
description: "Apply mutations or queries over an object using JSON Pointer (defined by RFC-6901)",
|
|
842
|
+
inputSchema: { type: "object", required: true, description: "Object to query" },
|
|
843
|
+
outputSchemaTemplate: { type: "object", description: "Query result" },
|
|
844
|
+
outputSchema: { type: "object" },
|
|
845
|
+
arguments: [
|
|
846
|
+
{
|
|
847
|
+
name: "op",
|
|
848
|
+
description: "Operation",
|
|
849
|
+
type: "enum",
|
|
850
|
+
enum: ["GET", "SET", "REMOVE"],
|
|
851
|
+
position: 0,
|
|
852
|
+
required: true,
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
name: "pointer",
|
|
856
|
+
description: "JSON Pointer to apply operation on (as defined by RFC-6901)",
|
|
857
|
+
type: "string",
|
|
858
|
+
position: 1,
|
|
859
|
+
required: true,
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
name: "value",
|
|
863
|
+
description: "Value to use (when operation is `SET`)",
|
|
864
|
+
type: "any",
|
|
865
|
+
position: 2,
|
|
866
|
+
},
|
|
867
|
+
],
|
|
868
|
+
},
|
|
869
|
+
jwtparse: {
|
|
870
|
+
description: "Parses JWT tokens and returns their payload",
|
|
871
|
+
notes: ":::caution\nThis function does not **validate** the JWT. Only returns its payload (claims).\n:::",
|
|
872
|
+
inputSchema: { type: "string", required: true, description: "JWT string" },
|
|
873
|
+
outputSchemaTemplate: { type: "object", description: "Token's payload" },
|
|
874
|
+
outputSchema: { type: "object" },
|
|
875
|
+
},
|
|
876
|
+
length: {
|
|
877
|
+
description: "Returns the length of a value",
|
|
878
|
+
inputSchema: { type: "any", required: true, description: "Value to check length of (`string`/`object`/`array`)" },
|
|
879
|
+
outputSchema: { type: "integer" },
|
|
880
|
+
arguments: [
|
|
881
|
+
{
|
|
882
|
+
name: "type",
|
|
883
|
+
description: "Restrict the type of value to check length of (if specified type no detected the result will be `null`)",
|
|
884
|
+
type: "enum",
|
|
885
|
+
enum: ["AUTO", "STRING", "ARRAY", "OBJECT"],
|
|
886
|
+
position: 0,
|
|
887
|
+
default: "AUTO",
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
name: "default_zero",
|
|
891
|
+
description: "Whether to return 0 instead of `null` (on any kind of issue)",
|
|
892
|
+
type: "boolean",
|
|
893
|
+
position: 1,
|
|
894
|
+
default: false,
|
|
895
|
+
},
|
|
896
|
+
],
|
|
897
|
+
},
|
|
898
|
+
long: {
|
|
899
|
+
description: "Converts to integer, all decimal digits are truncated",
|
|
900
|
+
inputSchema: { type: "any", description: "Value to convert" },
|
|
901
|
+
outputSchema: { type: "integer", $comment: "Long" },
|
|
902
|
+
},
|
|
903
|
+
lookup: {
|
|
904
|
+
description: "Joins multiple arrays of objects by a dynamic condition (transformer) on each pair of matches",
|
|
905
|
+
usageNotes: '```transformers\n{\n "$$lookup": [ /* values */ ],\n "using": [\n { "with": [ /* values 2 */], "as": /* name 2 */, "on": /* Transformer */ },\n { "with": [ /* values 3 */], "as": /* name 3 */, "on": /* Transformer */ },\n ...\n ],\n "to": /* Transformer */\n}\n```',
|
|
906
|
+
inputSchema: { type: "array", required: true, description: "Main array of elements" },
|
|
907
|
+
outputSchemaTemplate: {
|
|
908
|
+
type: "array",
|
|
909
|
+
description: "of type of `to`'s result or the merge of both primary array's item and `with`'s item",
|
|
910
|
+
},
|
|
911
|
+
arguments: [
|
|
912
|
+
{
|
|
913
|
+
name: "using",
|
|
914
|
+
description: "Array of definitions of how to match other arrays to the main one",
|
|
915
|
+
type: "array",
|
|
916
|
+
position: 0,
|
|
917
|
+
required: true,
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
name: "to",
|
|
921
|
+
description: "Transformer to map each pair of elements to its value in the result array\n\nDefault behavior is to merge `##current` with `##{as}` (append & overwrite)",
|
|
922
|
+
type: "transformer",
|
|
923
|
+
position: 1,
|
|
924
|
+
transformerArguments: [
|
|
925
|
+
{ name: "##current", type: "any", position: 0, description: "Current element" },
|
|
926
|
+
{ name: "##{as}", type: "any", position: 1, description: "Matched element from `with`" },
|
|
927
|
+
{ name: "...", type: "any", position: 2 },
|
|
928
|
+
],
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
name: "using[].with",
|
|
932
|
+
type: "array",
|
|
933
|
+
required: true,
|
|
934
|
+
description: "Array of elements to match with",
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
name: "using[].as",
|
|
938
|
+
type: "string",
|
|
939
|
+
required: true,
|
|
940
|
+
description: "The name the elements from this entry will be referred as (`#{as}`)",
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
name: "using[].on",
|
|
944
|
+
type: "transformer",
|
|
945
|
+
required: true,
|
|
946
|
+
description: "Evaluated condition on when to match an element from the main array and with array (uses the [Truthy logic](../truthy-logic))",
|
|
947
|
+
transformerArguments: [
|
|
948
|
+
{ name: "##current", type: "any", position: 0, description: "Current element" },
|
|
949
|
+
{ name: "##index", type: "any", position: 1, description: "Current index" },
|
|
950
|
+
{
|
|
951
|
+
name: "##{as}",
|
|
952
|
+
type: "any",
|
|
953
|
+
position: 2,
|
|
954
|
+
description: "the matched element from the array (replace `{as}` with the name provided in `as` argument)",
|
|
955
|
+
},
|
|
956
|
+
],
|
|
957
|
+
},
|
|
958
|
+
],
|
|
959
|
+
},
|
|
960
|
+
lower: {
|
|
961
|
+
description: "Converts a string to all lowercase letters",
|
|
962
|
+
inputSchema: { type: "string", required: true, description: "Input string" },
|
|
963
|
+
outputSchema: { type: "string" },
|
|
964
|
+
},
|
|
965
|
+
map: {
|
|
966
|
+
description: "Returns a mapped array applying the transformer on each of the elements",
|
|
967
|
+
usageNotes: ":::note\nAlternative form is available using \n```transformers \n{\n" +
|
|
968
|
+
' "$$map": [ /* values */, /* to */ ]\n' +
|
|
969
|
+
"}\n```\nIf `to` is used, the primary argument is treated only as values\n:::",
|
|
970
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
971
|
+
outputSchemaTemplate: { type: "array", description: "of type of `to`'s result" },
|
|
972
|
+
arguments: [
|
|
973
|
+
{
|
|
974
|
+
name: "to",
|
|
975
|
+
description: "Transformer to map each element to its value in the result array",
|
|
976
|
+
type: "transformer",
|
|
977
|
+
position: 0,
|
|
978
|
+
required: true,
|
|
979
|
+
transformerArguments: [
|
|
980
|
+
{ name: "##current", type: "any", position: 0, description: "Current element" },
|
|
981
|
+
{ name: "##index", type: "integer", position: 1, description: "Current index" },
|
|
982
|
+
],
|
|
983
|
+
},
|
|
984
|
+
],
|
|
985
|
+
},
|
|
986
|
+
match: {
|
|
987
|
+
description: "Returns a matched substring from input by a pattern (and optionally group id)",
|
|
988
|
+
inputSchema: { type: "string", required: true, description: "Input string" },
|
|
989
|
+
outputSchema: { type: "string" },
|
|
990
|
+
arguments: [
|
|
991
|
+
{
|
|
992
|
+
name: "pattern",
|
|
993
|
+
description: "Regular expression to match and extract from input string",
|
|
994
|
+
type: "string",
|
|
995
|
+
position: 0,
|
|
996
|
+
required: true,
|
|
997
|
+
},
|
|
998
|
+
{ name: "group", description: "The group id to get", type: "integer", position: 1, default: 0 },
|
|
999
|
+
],
|
|
1000
|
+
},
|
|
1001
|
+
matchall: {
|
|
1002
|
+
description: "Returns all matches substring from input by a pattern (and optionally group id)",
|
|
1003
|
+
inputSchema: { type: "string", required: true, description: "Input string" },
|
|
1004
|
+
outputSchema: { type: "array", items: { type: "string" } },
|
|
1005
|
+
arguments: [
|
|
1006
|
+
{
|
|
1007
|
+
name: "pattern",
|
|
1008
|
+
description: "Regular expression to match and extract from input string",
|
|
1009
|
+
type: "string",
|
|
1010
|
+
position: 0,
|
|
1011
|
+
required: true,
|
|
1012
|
+
},
|
|
1013
|
+
{ name: "group", description: "The group id to get", type: "integer", position: 1, default: 0 },
|
|
1014
|
+
],
|
|
1015
|
+
},
|
|
1016
|
+
math: {
|
|
1017
|
+
description: "Evaluate a mathematical expression",
|
|
1018
|
+
inputSchema: {
|
|
1019
|
+
type: "BigDecimal",
|
|
1020
|
+
required: true,
|
|
1021
|
+
description: "`op1` / `op` / `array` (`[op1, op, op2]` / `[op, op1, op2]`)",
|
|
1022
|
+
},
|
|
1023
|
+
usageNotes: '**OR**\n```transformers\n{\n "$$math": [/* operator */, /* operand 1 */, /* operand 2 ? */]\n}\n```\n**OR**\n```transformers\n{\n "$$math": [/* operand 1 */, /* operator */, /* operand 2 ? */]\n}\n```\n**OR**\n```transformers\n"$$math(<operand1>,<operator>,[operand2])"\n\n"$$math(<operator>,<operand1>,[operand2])"\n\n"$$math(<operator>,[operand2]):{operand1}"\n```',
|
|
1024
|
+
argumentsNotes: '#### Operators\n\n| `operator` | Action | Example |\n|---------------------------|------------------------|-----------------------------|\n| `+`, `ADD` | Addition | `"$$math(2,+,3)"` = `5` |\n| `-`, `SUB`, `SUBTRACT` | Subtraction | `"$$math(5,-,3)"` = `2` |\n| `*`, `MUL`, `MULTIPLY` | Multiplication | `"$$math(2,*,3)"` = `6` |\n| `/`, `DIV`, `DIVIDE` | Division | `"$$math(6,/,3)"` = `2` |\n| `//`, `INTDIV` | Integer division | `"$$math(7,//,3)"` = `2` |\n| `%`, `MOD`, `REMAINDER` | Modulu | `"$$math(7,%,3)"` = `1` |\n| `^`, `**`, `POW`, `POWER` | Power | `"$$math(2,^,3)"` = `8` |\n| `&`, `AND` | Bit-wise AND | `"$$math(6,&,3)"` = `2` |\n| `\\|`, `OR` | Bit-wise OR | `"$$math(6,OR,3)"` = `7` |\n| `~`, `XOR` | Bit-wise XOR | `"$$math(6,~,3)"` = `5` |\n| `<<`, `SHL` | Shift left (bit-wise) | `"$$math(6,>>,1)"` = `3` |\n| `>>`, `SHR` | Shift right (bit-wise) | `"$$math(6,<<,3)"` = `48` |\n| `MIN` | Minimum | `"$$math(MIN,4,2)"` = `2` |\n| `MAX` | Maximum | `"$$math(MAX,4,2)"` = `4` |\n| `SQRT` | Square root | `"$$math(SQRT,81)"` = `9` |\n| `ROUND` | Round | `"$$math(ROUND,4.6)"` = `5` |\n| `FLOOR` | Floor | `"$$math(FLOOR,4.6)"` = `4` |\n| `CEIL` | Ceil | `"$$math(CEIL,4.2)"` = `5` |\n| `ABS` | Absolute | `"$$math(ABS,-10)"` = `10` |\n| `NEG`, `NEGATE` | Negation | `"$$math(NEG,4)"` = `-4` |\n| `SIG`, `SIGNUM` | Sign Number | `"$$math(SIG,-42)"` = `-1` |\n',
|
|
1025
|
+
outputSchema: { type: "number", $comment: "BigDecimal" },
|
|
1026
|
+
argumentsAsInputSchema: true,
|
|
1027
|
+
arguments: [
|
|
1028
|
+
{ name: "op1", description: "First operand", type: "BigDecimal", position: 0, required: true },
|
|
1029
|
+
{
|
|
1030
|
+
name: "op",
|
|
1031
|
+
description: "Math operation (operator)",
|
|
1032
|
+
type: "enum",
|
|
1033
|
+
enum: [
|
|
1034
|
+
"+",
|
|
1035
|
+
"-",
|
|
1036
|
+
"*",
|
|
1037
|
+
"/",
|
|
1038
|
+
"//",
|
|
1039
|
+
"%",
|
|
1040
|
+
"^",
|
|
1041
|
+
"&",
|
|
1042
|
+
"|",
|
|
1043
|
+
"~",
|
|
1044
|
+
"<<",
|
|
1045
|
+
">>",
|
|
1046
|
+
"MIN",
|
|
1047
|
+
"MAX",
|
|
1048
|
+
"SQRT",
|
|
1049
|
+
"ROUND",
|
|
1050
|
+
"FLOOR",
|
|
1051
|
+
"CEIL",
|
|
1052
|
+
"ABS",
|
|
1053
|
+
"NEG",
|
|
1054
|
+
"SIG",
|
|
1055
|
+
],
|
|
1056
|
+
position: 1,
|
|
1057
|
+
required: true,
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
name: "op2",
|
|
1061
|
+
description: "Second operand or scale for `ROUND`/`FLOOR`/`CEIL`",
|
|
1062
|
+
type: "BigDecimal",
|
|
1063
|
+
position: 2,
|
|
1064
|
+
default: 0.0,
|
|
1065
|
+
},
|
|
1066
|
+
],
|
|
1067
|
+
},
|
|
1068
|
+
max: {
|
|
1069
|
+
description: "Returns the max of all values in the array",
|
|
1070
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
1071
|
+
outputSchemaTemplate: { type: "object", $comment: "Same as picked element" },
|
|
1072
|
+
arguments: [
|
|
1073
|
+
{ name: "default", type: "any", description: "The default value to use for empty values", position: 0 },
|
|
1074
|
+
{
|
|
1075
|
+
name: "type",
|
|
1076
|
+
description: "Type of values to expect when ordering the input array",
|
|
1077
|
+
type: "enum",
|
|
1078
|
+
enum: ["AUTO", "STRING", "NUMBER", "BOOLEAN"],
|
|
1079
|
+
position: 1,
|
|
1080
|
+
default: "AUTO",
|
|
1081
|
+
},
|
|
1082
|
+
{
|
|
1083
|
+
name: "by",
|
|
1084
|
+
description: "A transformer to extract a property to compare by",
|
|
1085
|
+
type: "transformer",
|
|
1086
|
+
position: 2,
|
|
1087
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
1088
|
+
},
|
|
1089
|
+
],
|
|
1090
|
+
},
|
|
1091
|
+
merge: {
|
|
1092
|
+
description: "Merge multiple objects into one. Allows deep merging and array concatenation.",
|
|
1093
|
+
inputSchema: { type: "array", required: true, description: "Array of objects to merge" },
|
|
1094
|
+
outputSchemaTemplate: { type: "object", description: "The merged schema of all specified objects" },
|
|
1095
|
+
outputSchema: { type: "object" },
|
|
1096
|
+
arguments: [
|
|
1097
|
+
{
|
|
1098
|
+
name: "deep",
|
|
1099
|
+
description: "Whether to merge objects deeply",
|
|
1100
|
+
type: "boolean",
|
|
1101
|
+
position: 0,
|
|
1102
|
+
default: false,
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
name: "arrays",
|
|
1106
|
+
description: "Whether to concatenate arrays",
|
|
1107
|
+
type: "boolean",
|
|
1108
|
+
position: 1,
|
|
1109
|
+
default: false,
|
|
1110
|
+
},
|
|
1111
|
+
],
|
|
1112
|
+
},
|
|
1113
|
+
min: {
|
|
1114
|
+
description: "Returns the min of all values in the array",
|
|
1115
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
1116
|
+
outputSchemaTemplate: { type: "object", $comment: "Same as picked element" },
|
|
1117
|
+
arguments: [
|
|
1118
|
+
{ name: "default", type: "any", description: "The default value to use for empty values", position: 0 },
|
|
1119
|
+
{
|
|
1120
|
+
name: "type",
|
|
1121
|
+
description: "Type of values to expect when ordering the input array",
|
|
1122
|
+
type: "enum",
|
|
1123
|
+
enum: ["AUTO", "STRING", "NUMBER", "BOOLEAN"],
|
|
1124
|
+
position: 1,
|
|
1125
|
+
default: "AUTO",
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
name: "by",
|
|
1129
|
+
description: "A transformer to extract a property to compare by",
|
|
1130
|
+
type: "transformer",
|
|
1131
|
+
position: 2,
|
|
1132
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
1133
|
+
},
|
|
1134
|
+
],
|
|
1135
|
+
},
|
|
1136
|
+
normalize: {
|
|
1137
|
+
description: "Replace special characters forms with their simple form equivalent (removing marks by default)",
|
|
1138
|
+
notes: '- Allows post-processing over Java\'s normalizer algorithm result\n#### Post Operations\n- `ROBUST` - Try to return the most of similar letters to latin, replaced to their latin equivalent, including:\n - Removing combining diacritical marks (works with NFD/NFKD which leaves the characters decomposed)\n - Stroked (and others which are not composed) (i.e. "ĐŁłŒ" -> "DLlOE")\n - Replacing (with space) and trimming white-spaces\n',
|
|
1139
|
+
inputSchema: { type: "string", required: true, description: "String to normalize" },
|
|
1140
|
+
outputSchema: { type: "string" },
|
|
1141
|
+
arguments: [
|
|
1142
|
+
{
|
|
1143
|
+
name: "form",
|
|
1144
|
+
description: "Normalizer Form (as described in Java's documentation. Default is NFKD; Decompose for compatibility)",
|
|
1145
|
+
type: "enum",
|
|
1146
|
+
enum: ["NFKD", "NFKC", "NFD", "NFC"],
|
|
1147
|
+
position: 0,
|
|
1148
|
+
default: "NFKD",
|
|
1149
|
+
},
|
|
1150
|
+
{
|
|
1151
|
+
name: "post_operation",
|
|
1152
|
+
description: "Post operation to run on result to remove/replace more letters",
|
|
1153
|
+
type: "enum",
|
|
1154
|
+
enum: ["ROBUST", "NONE"],
|
|
1155
|
+
position: 1,
|
|
1156
|
+
default: "ROBUST",
|
|
1157
|
+
},
|
|
1158
|
+
],
|
|
1159
|
+
},
|
|
1160
|
+
not: {
|
|
1161
|
+
description: "Returns the opposite of the input's boolean evaluated value (this returns the opposite of [$$boolean](boolean))",
|
|
1162
|
+
inputSchema: { type: "any" },
|
|
1163
|
+
outputSchema: { type: "boolean" },
|
|
1164
|
+
arguments: [
|
|
1165
|
+
{
|
|
1166
|
+
name: "style",
|
|
1167
|
+
description: "Style of considering truthy values (JS only relates to string handling; not objects and arrays)",
|
|
1168
|
+
type: "enum",
|
|
1169
|
+
enum: ["JAVA", "JS"],
|
|
1170
|
+
position: 0,
|
|
1171
|
+
default: "JAVA",
|
|
1172
|
+
},
|
|
1173
|
+
],
|
|
1174
|
+
},
|
|
1175
|
+
numberformat: {
|
|
1176
|
+
description: "Formats a number",
|
|
1177
|
+
inputSchema: { type: "BigDecimal", required: true, description: "Number to format" },
|
|
1178
|
+
outputSchema: { type: "string" },
|
|
1179
|
+
subfunctions: [
|
|
1180
|
+
{
|
|
1181
|
+
if: [{ argument: "type", equals: "NUMBER" }],
|
|
1182
|
+
then: {
|
|
1183
|
+
description: 'Formats a number using the default pattern `"#,##0.000"`',
|
|
1184
|
+
arguments: [
|
|
1185
|
+
{
|
|
1186
|
+
name: "type",
|
|
1187
|
+
description: "Type of output format",
|
|
1188
|
+
type: "const",
|
|
1189
|
+
position: 0,
|
|
1190
|
+
const: "NUMBER",
|
|
1191
|
+
},
|
|
1192
|
+
],
|
|
1193
|
+
},
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
if: [{ argument: "type", equals: "DECIMAL" }],
|
|
1197
|
+
then: {
|
|
1198
|
+
description: "Formats a number to a decimal representation",
|
|
1199
|
+
arguments: [
|
|
1200
|
+
{
|
|
1201
|
+
name: "type",
|
|
1202
|
+
description: "Type of output format",
|
|
1203
|
+
type: "const",
|
|
1204
|
+
position: 0,
|
|
1205
|
+
const: "DECIMAL",
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
name: "locale",
|
|
1209
|
+
description: "Locale to use (language and country specific formatting)",
|
|
1210
|
+
type: "string",
|
|
1211
|
+
position: 1,
|
|
1212
|
+
default: "en-US",
|
|
1213
|
+
},
|
|
1214
|
+
{
|
|
1215
|
+
name: "pattern",
|
|
1216
|
+
description: "See [tutorial](https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html)",
|
|
1217
|
+
type: "string",
|
|
1218
|
+
position: 2,
|
|
1219
|
+
default: "#0.00",
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
name: "grouping",
|
|
1223
|
+
description: "A custom character to be used for grouping",
|
|
1224
|
+
type: "string",
|
|
1225
|
+
position: 3,
|
|
1226
|
+
default: ",",
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
name: "decimal",
|
|
1230
|
+
description: "A custom character to be used for decimal point",
|
|
1231
|
+
type: "string",
|
|
1232
|
+
position: 4,
|
|
1233
|
+
default: ".",
|
|
1234
|
+
},
|
|
1235
|
+
],
|
|
1236
|
+
},
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
if: [{ argument: "type", equals: "CURRENCY" }],
|
|
1240
|
+
then: {
|
|
1241
|
+
description: "Formats a number as currency",
|
|
1242
|
+
arguments: [
|
|
1243
|
+
{
|
|
1244
|
+
name: "type",
|
|
1245
|
+
description: "Type of output format",
|
|
1246
|
+
type: "const",
|
|
1247
|
+
position: 0,
|
|
1248
|
+
const: "CURRENCY",
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
name: "locale",
|
|
1252
|
+
description: "Locale to use (language and country specific formatting)",
|
|
1253
|
+
type: "string",
|
|
1254
|
+
position: 1,
|
|
1255
|
+
default: "en-US",
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
name: "currency",
|
|
1259
|
+
description: "Currency to use in format ([ISO-4217 currency code](https://www.iso.org/iso-4217-currency-codes.html)) (default would be based on locale)",
|
|
1260
|
+
type: "string",
|
|
1261
|
+
position: 2,
|
|
1262
|
+
},
|
|
1263
|
+
],
|
|
1264
|
+
},
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
if: [{ argument: "type", equals: "PERCENT" }],
|
|
1268
|
+
then: {
|
|
1269
|
+
description: "Formats a number as percent",
|
|
1270
|
+
arguments: [
|
|
1271
|
+
{
|
|
1272
|
+
name: "type",
|
|
1273
|
+
description: "Type of output format",
|
|
1274
|
+
type: "const",
|
|
1275
|
+
position: 0,
|
|
1276
|
+
const: "PERCENT",
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
name: "locale",
|
|
1280
|
+
description: "Locale to use (language and country specific formatting)",
|
|
1281
|
+
type: "string",
|
|
1282
|
+
position: 1,
|
|
1283
|
+
default: "en-US",
|
|
1284
|
+
},
|
|
1285
|
+
],
|
|
1286
|
+
},
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
if: [{ argument: "type", equals: "INTEGER" }],
|
|
1290
|
+
then: {
|
|
1291
|
+
description: "Formats a number as an integer",
|
|
1292
|
+
arguments: [
|
|
1293
|
+
{
|
|
1294
|
+
name: "type",
|
|
1295
|
+
description: "Type of output format",
|
|
1296
|
+
type: "const",
|
|
1297
|
+
position: 0,
|
|
1298
|
+
const: "INTEGER",
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
name: "locale",
|
|
1302
|
+
description: "Locale to use (language and country specific formatting)",
|
|
1303
|
+
type: "string",
|
|
1304
|
+
position: 1,
|
|
1305
|
+
default: "en-US",
|
|
1306
|
+
},
|
|
1307
|
+
],
|
|
1308
|
+
},
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
if: [{ argument: "type", equals: "COMPACT" }],
|
|
1312
|
+
then: {
|
|
1313
|
+
description: "Formats a number in compact style",
|
|
1314
|
+
arguments: [
|
|
1315
|
+
{
|
|
1316
|
+
name: "type",
|
|
1317
|
+
description: "Type of output format",
|
|
1318
|
+
type: "const",
|
|
1319
|
+
position: 0,
|
|
1320
|
+
const: "COMPACT",
|
|
1321
|
+
},
|
|
1322
|
+
{
|
|
1323
|
+
name: "locale",
|
|
1324
|
+
description: "Locale to use (language and country specific formatting)",
|
|
1325
|
+
type: "string",
|
|
1326
|
+
position: 1,
|
|
1327
|
+
default: "en-US",
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
name: "compact_style",
|
|
1331
|
+
description: "Type of compacting format",
|
|
1332
|
+
type: "enum",
|
|
1333
|
+
enum: ["SHORT", "LONG"],
|
|
1334
|
+
position: 2,
|
|
1335
|
+
default: "SHORT",
|
|
1336
|
+
},
|
|
1337
|
+
],
|
|
1338
|
+
},
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
if: [{ argument: "type", equals: "BASE" }],
|
|
1342
|
+
then: {
|
|
1343
|
+
description: "Formats a number in a specific radix",
|
|
1344
|
+
arguments: [
|
|
1345
|
+
{
|
|
1346
|
+
name: "type",
|
|
1347
|
+
description: "Type of output format",
|
|
1348
|
+
type: "const",
|
|
1349
|
+
position: 0,
|
|
1350
|
+
const: "BASE",
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
name: "radix",
|
|
1354
|
+
description: "Radix to be used for formatting input",
|
|
1355
|
+
type: "integer",
|
|
1356
|
+
position: 1,
|
|
1357
|
+
default: 10,
|
|
1358
|
+
},
|
|
1359
|
+
],
|
|
1360
|
+
},
|
|
1361
|
+
},
|
|
1362
|
+
],
|
|
1363
|
+
arguments: [
|
|
1364
|
+
{
|
|
1365
|
+
name: "type",
|
|
1366
|
+
description: "Type of output format",
|
|
1367
|
+
type: "enum",
|
|
1368
|
+
enum: ["NUMBER", "DECIMAL", "CURRENCY", "PERCENT", "INTEGER", "COMPACT", "BASE"],
|
|
1369
|
+
position: 0,
|
|
1370
|
+
default: "NUMBER",
|
|
1371
|
+
},
|
|
1372
|
+
],
|
|
1373
|
+
},
|
|
1374
|
+
numberparse: {
|
|
1375
|
+
description: "Parses a number from string",
|
|
1376
|
+
inputSchema: { type: "string", description: "String containing a number" },
|
|
1377
|
+
outputSchema: { type: "number", $comment: "BigDecimal" },
|
|
1378
|
+
subfunctions: [
|
|
1379
|
+
{
|
|
1380
|
+
if: [{ argument: "pattern", equals: "BASE" }],
|
|
1381
|
+
then: {
|
|
1382
|
+
description: "Parses a number from string in a specific radix",
|
|
1383
|
+
arguments: [
|
|
1384
|
+
{
|
|
1385
|
+
name: "pattern",
|
|
1386
|
+
description: "Specify parse in a specific base",
|
|
1387
|
+
type: "const",
|
|
1388
|
+
position: 0,
|
|
1389
|
+
const: "BASE",
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
name: "radix",
|
|
1393
|
+
description: "Radix to be used for parsing input",
|
|
1394
|
+
type: "integer",
|
|
1395
|
+
position: 1,
|
|
1396
|
+
default: 10,
|
|
1397
|
+
},
|
|
1398
|
+
],
|
|
1399
|
+
},
|
|
1400
|
+
},
|
|
1401
|
+
],
|
|
1402
|
+
arguments: [
|
|
1403
|
+
{
|
|
1404
|
+
name: "pattern",
|
|
1405
|
+
description: "See [tutorial](https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html).\n`DecimalFormat` pattern / `BASE`.",
|
|
1406
|
+
type: "string",
|
|
1407
|
+
position: 0,
|
|
1408
|
+
default: "#0.00",
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
name: "locale",
|
|
1412
|
+
description: "Locale to use (language and country specific formatting)",
|
|
1413
|
+
type: "string",
|
|
1414
|
+
position: 1,
|
|
1415
|
+
default: "en-US",
|
|
1416
|
+
},
|
|
1417
|
+
{
|
|
1418
|
+
name: "grouping",
|
|
1419
|
+
description: "A custom character to be used for grouping",
|
|
1420
|
+
type: "string",
|
|
1421
|
+
position: 2,
|
|
1422
|
+
default: ",",
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
name: "decimal",
|
|
1426
|
+
description: "A custom character to be used for decimal point",
|
|
1427
|
+
type: "string",
|
|
1428
|
+
position: 3,
|
|
1429
|
+
default: ".",
|
|
1430
|
+
},
|
|
1431
|
+
],
|
|
1432
|
+
},
|
|
1433
|
+
object: {
|
|
1434
|
+
description: "Reduces an array of entries into an object",
|
|
1435
|
+
notes: ":::note\n*Entry is in the form of `[ key, value ]`\n:::",
|
|
1436
|
+
inputSchema: { type: "array", required: true, description: "Array of entries" },
|
|
1437
|
+
outputSchema: { type: "object" },
|
|
1438
|
+
},
|
|
1439
|
+
or: {
|
|
1440
|
+
description: "Evaluates to `true` if any of the values provided will evaluate to `true` (using the [Truthy logic](../truthy-logic))",
|
|
1441
|
+
inputSchema: { type: "array", required: true, description: "Values to check" },
|
|
1442
|
+
outputSchema: { type: "boolean" },
|
|
1443
|
+
},
|
|
1444
|
+
pad: {
|
|
1445
|
+
description: "Pad a provided string with certain character(s) repeated until a certain width of output string",
|
|
1446
|
+
notes: "(Strings longer than `width` will be returned as-is)",
|
|
1447
|
+
inputSchema: { type: "any", description: "Value to pad" },
|
|
1448
|
+
outputSchema: { type: "string" },
|
|
1449
|
+
arguments: [
|
|
1450
|
+
{
|
|
1451
|
+
name: "direction",
|
|
1452
|
+
description: "On which side of the input to pad",
|
|
1453
|
+
type: "enum",
|
|
1454
|
+
enum: ["LEFT", "START", "RIGHT", "END"],
|
|
1455
|
+
position: 0,
|
|
1456
|
+
required: true,
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
name: "width",
|
|
1460
|
+
description: "What is the maximum length of the output string",
|
|
1461
|
+
type: "integer",
|
|
1462
|
+
position: 1,
|
|
1463
|
+
required: true,
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
name: "pad_string",
|
|
1467
|
+
description: "The character(s) to pad with",
|
|
1468
|
+
type: "string",
|
|
1469
|
+
position: 2,
|
|
1470
|
+
default: "0",
|
|
1471
|
+
},
|
|
1472
|
+
],
|
|
1473
|
+
},
|
|
1474
|
+
partition: {
|
|
1475
|
+
description: "Partition an array to multiple constant size arrays",
|
|
1476
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
1477
|
+
outputSchemaTemplate: { type: "array", items: { type: "array" }, description: "of same items type as input" },
|
|
1478
|
+
arguments: [
|
|
1479
|
+
{ name: "size", description: "The size of each partition", type: "integer", position: 0, default: 100 },
|
|
1480
|
+
],
|
|
1481
|
+
},
|
|
1482
|
+
range: {
|
|
1483
|
+
description: "Creates an array with a sequence of numbers starting with `start` up-to `end` in steps of `step`",
|
|
1484
|
+
usageNotes: ":::note\nAlternative form is available using \n```transformers \n{\n" +
|
|
1485
|
+
' "$$range": [ /* start */, /* end */, /* step ? */]\n' +
|
|
1486
|
+
"}\n```\nIf `start` is used, the primary argument is ignored and can be of any value\n:::",
|
|
1487
|
+
argumentsAsInputSchema: true,
|
|
1488
|
+
outputSchema: { type: "array", items: { type: "number", $comment: "BigDecimal" } },
|
|
1489
|
+
arguments: [
|
|
1490
|
+
{ name: "start", description: "First value", type: "BigDecimal", position: 0, required: true },
|
|
1491
|
+
{
|
|
1492
|
+
name: "end",
|
|
1493
|
+
description: "Max value to appear in sequence",
|
|
1494
|
+
type: "BigDecimal",
|
|
1495
|
+
position: 1,
|
|
1496
|
+
required: true,
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
name: "step",
|
|
1500
|
+
description: "Step to add on each iteration to the previous value in the sequence",
|
|
1501
|
+
type: "BigDecimal",
|
|
1502
|
+
position: 2,
|
|
1503
|
+
default: 1.0,
|
|
1504
|
+
},
|
|
1505
|
+
],
|
|
1506
|
+
},
|
|
1507
|
+
raw: {
|
|
1508
|
+
description: "Returns the input as-is without interpreting transformers",
|
|
1509
|
+
inputSchema: { type: "any", required: true, description: "Value to return as-is" },
|
|
1510
|
+
outputSchemaTemplate: { type: "object", description: "Same type as input" },
|
|
1511
|
+
},
|
|
1512
|
+
reduce: {
|
|
1513
|
+
description: "Reduce an array with an initial value (`identity`) and a context transformer to a single value",
|
|
1514
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
1515
|
+
outputSchemaTemplate: { type: "object", description: "The reduced value (type of `to` or `identity`)" },
|
|
1516
|
+
arguments: [
|
|
1517
|
+
{
|
|
1518
|
+
name: "to",
|
|
1519
|
+
description: "Transformer to apply on each element (with last accumulation) to get the next accumulation",
|
|
1520
|
+
type: "transformer",
|
|
1521
|
+
position: 0,
|
|
1522
|
+
required: true,
|
|
1523
|
+
transformerArguments: [
|
|
1524
|
+
{ name: "##accumulator", type: "any", position: 0, description: "Previously accumulated value" },
|
|
1525
|
+
{ name: "##current", type: "any", position: 1, description: "Current element" },
|
|
1526
|
+
{ name: "##index", type: "integer", position: 2, description: "Current index" },
|
|
1527
|
+
],
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
name: "identity",
|
|
1531
|
+
description: "Initial value to start the accumulation with",
|
|
1532
|
+
type: "any",
|
|
1533
|
+
position: 1,
|
|
1534
|
+
required: true,
|
|
1535
|
+
},
|
|
1536
|
+
],
|
|
1537
|
+
},
|
|
1538
|
+
repeat: {
|
|
1539
|
+
description: "Creates an array with the specified value repeated `count` times",
|
|
1540
|
+
inputSchema: { type: "any", required: true, description: "Value to repeat" },
|
|
1541
|
+
outputSchemaTemplate: { type: "array", description: "of same type as input" },
|
|
1542
|
+
arguments: [
|
|
1543
|
+
{
|
|
1544
|
+
name: "count",
|
|
1545
|
+
description: "The amount of times to repeat the value",
|
|
1546
|
+
type: "integer",
|
|
1547
|
+
position: 0,
|
|
1548
|
+
required: true,
|
|
1549
|
+
},
|
|
1550
|
+
],
|
|
1551
|
+
},
|
|
1552
|
+
replace: {
|
|
1553
|
+
description: "Search and replaces a substring in the given input",
|
|
1554
|
+
inputSchema: { type: "string", required: true },
|
|
1555
|
+
outputSchema: { type: "string" },
|
|
1556
|
+
arguments: [
|
|
1557
|
+
{
|
|
1558
|
+
name: "find",
|
|
1559
|
+
description: "Value to search in input string (depends on `type`, if set to `REGEX`, should be a regular expression)",
|
|
1560
|
+
type: "string",
|
|
1561
|
+
position: 0,
|
|
1562
|
+
required: true,
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
name: "replacement",
|
|
1566
|
+
description: "Value to replace each match (or only first if type is `REGEX-FIRST`), when using regular expression can use group matches (e.g. `$1`) (Note: to escape `$` if starting with it)",
|
|
1567
|
+
type: "string",
|
|
1568
|
+
position: 1,
|
|
1569
|
+
default: "",
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
name: "type",
|
|
1573
|
+
description: "Matching type",
|
|
1574
|
+
type: "enum",
|
|
1575
|
+
enum: ["STRING", "FIRST", "REGEX", "REGEX-FIRST"],
|
|
1576
|
+
position: 2,
|
|
1577
|
+
default: "STRING",
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
name: "from",
|
|
1581
|
+
description: "At what index in the string the search should start from",
|
|
1582
|
+
type: "integer",
|
|
1583
|
+
position: 3,
|
|
1584
|
+
default: 0,
|
|
1585
|
+
},
|
|
1586
|
+
],
|
|
1587
|
+
},
|
|
1588
|
+
reverse: {
|
|
1589
|
+
description: "Reverses the order of elements in an array",
|
|
1590
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
1591
|
+
outputSchemaTemplate: { type: "array", description: "Same type as input array" },
|
|
1592
|
+
pipedType: true,
|
|
1593
|
+
},
|
|
1594
|
+
slice: {
|
|
1595
|
+
description: "Gets a slice of an array by indices (negative begin index will slice from the end)",
|
|
1596
|
+
inputSchema: { type: "array", required: true, description: "Array to fetch from" },
|
|
1597
|
+
outputSchemaTemplate: {
|
|
1598
|
+
type: "object",
|
|
1599
|
+
description: "Same type as input array",
|
|
1600
|
+
},
|
|
1601
|
+
pipedType: true,
|
|
1602
|
+
arguments: [
|
|
1603
|
+
{
|
|
1604
|
+
name: "begin",
|
|
1605
|
+
description: "Index of first element to slice from (if negative, counts from the end of the array)",
|
|
1606
|
+
type: "integer",
|
|
1607
|
+
position: 0,
|
|
1608
|
+
required: true,
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
name: "end",
|
|
1612
|
+
description: "Index of last element to slice to (if negative, counts from the end of the array)",
|
|
1613
|
+
type: "integer",
|
|
1614
|
+
position: 1,
|
|
1615
|
+
default: Infinity,
|
|
1616
|
+
},
|
|
1617
|
+
],
|
|
1618
|
+
},
|
|
1619
|
+
some: {
|
|
1620
|
+
aliases: ["any"],
|
|
1621
|
+
description: "Checks if any elements in an array satisfy a predicate",
|
|
1622
|
+
usageNotes: ":::info\npredicate `by` should resolve to a `boolean` value, it uses the [truthy logic](../truthy-logic)\n:::",
|
|
1623
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
1624
|
+
outputSchema: { type: "boolean" },
|
|
1625
|
+
arguments: [
|
|
1626
|
+
{
|
|
1627
|
+
name: "by",
|
|
1628
|
+
description: "A predicate transformer for an element",
|
|
1629
|
+
type: "transformer",
|
|
1630
|
+
position: 0,
|
|
1631
|
+
required: true,
|
|
1632
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
1633
|
+
},
|
|
1634
|
+
],
|
|
1635
|
+
},
|
|
1636
|
+
sort: {
|
|
1637
|
+
description: "Sorts elements of an array",
|
|
1638
|
+
inputSchema: { type: "array", required: true, description: "Array of elements" },
|
|
1639
|
+
outputSchemaTemplate: { type: "array", description: "Same type as input array" },
|
|
1640
|
+
pipedType: true,
|
|
1641
|
+
arguments: [
|
|
1642
|
+
{
|
|
1643
|
+
name: "by",
|
|
1644
|
+
description: "A transformer to extract a property to sort by",
|
|
1645
|
+
type: "transformer",
|
|
1646
|
+
position: 0,
|
|
1647
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
1648
|
+
default: "##current",
|
|
1649
|
+
},
|
|
1650
|
+
{
|
|
1651
|
+
name: "order",
|
|
1652
|
+
description: "Direction of ordering (ascending / descending)",
|
|
1653
|
+
type: "enum",
|
|
1654
|
+
enum: ["ASC", "DESC"],
|
|
1655
|
+
position: 1,
|
|
1656
|
+
default: "ASC",
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
name: "type",
|
|
1660
|
+
description: "Type of values to expect when ordering the input array",
|
|
1661
|
+
type: "enum",
|
|
1662
|
+
enum: ["AUTO", "STRING", "NUMBER", "BOOLEAN"],
|
|
1663
|
+
position: 2,
|
|
1664
|
+
default: "AUTO",
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
name: "then",
|
|
1668
|
+
description: "An array of secondary sorting in case previous sorting returned equal, first being the root fields",
|
|
1669
|
+
type: "array",
|
|
1670
|
+
position: 3,
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
name: "then[].by",
|
|
1674
|
+
description: "A transformer to extract a property to sort by",
|
|
1675
|
+
type: "array",
|
|
1676
|
+
required: true,
|
|
1677
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
1678
|
+
},
|
|
1679
|
+
{
|
|
1680
|
+
name: "then[].order",
|
|
1681
|
+
description: "Direction of ordering (ascending / descending)",
|
|
1682
|
+
type: "enum",
|
|
1683
|
+
enum: ["ASC", "DESC"],
|
|
1684
|
+
default: "ASC",
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
name: "then[].type",
|
|
1688
|
+
description: "Type of values to expect when ordering the input array",
|
|
1689
|
+
type: "enum",
|
|
1690
|
+
enum: ["AUTO", "STRING", "NUMBER", "BOOLEAN"],
|
|
1691
|
+
default: "AUTO",
|
|
1692
|
+
},
|
|
1693
|
+
],
|
|
1694
|
+
},
|
|
1695
|
+
split: {
|
|
1696
|
+
description: "Splits a string using a given delimiter/regex",
|
|
1697
|
+
inputSchema: { type: "string", required: true, description: "String to split" },
|
|
1698
|
+
outputSchema: { type: "array", items: { type: "string" } },
|
|
1699
|
+
arguments: [
|
|
1700
|
+
{
|
|
1701
|
+
name: "delimiter",
|
|
1702
|
+
description: "Delimiter to split by (can be a regular expression)",
|
|
1703
|
+
type: "string",
|
|
1704
|
+
position: 0,
|
|
1705
|
+
default: "",
|
|
1706
|
+
},
|
|
1707
|
+
{
|
|
1708
|
+
name: "limit",
|
|
1709
|
+
description: "Limit the amount of elements returned (and by that, the amount the pattern get matched).\n - `0` - Means no limit.",
|
|
1710
|
+
type: "integer",
|
|
1711
|
+
position: 1,
|
|
1712
|
+
default: 0,
|
|
1713
|
+
},
|
|
1714
|
+
],
|
|
1715
|
+
},
|
|
1716
|
+
string: {
|
|
1717
|
+
description: "Converts to string (if `json` set to `true`, will convert `null` and strings also as JSON strings)",
|
|
1718
|
+
inputSchema: { type: "object", required: true, description: "Value to convert to string" },
|
|
1719
|
+
outputSchema: { type: "string" },
|
|
1720
|
+
arguments: [
|
|
1721
|
+
{
|
|
1722
|
+
name: "json",
|
|
1723
|
+
description: "Whether to convert `null` and strings to json (otherwise, `null` stays `null` and strings are returned as-is)",
|
|
1724
|
+
type: "boolean",
|
|
1725
|
+
position: 0,
|
|
1726
|
+
default: false,
|
|
1727
|
+
},
|
|
1728
|
+
],
|
|
1729
|
+
},
|
|
1730
|
+
substring: {
|
|
1731
|
+
description: "Gets a slice of a string by indices (negative begin index will slice from the end)",
|
|
1732
|
+
inputSchema: { type: "string", required: true, description: "String to slice" },
|
|
1733
|
+
outputSchema: { type: "string" },
|
|
1734
|
+
arguments: [
|
|
1735
|
+
{
|
|
1736
|
+
name: "begin",
|
|
1737
|
+
description: "Index of first character to slice from (if negative, counts from the end of the string)",
|
|
1738
|
+
type: "integer",
|
|
1739
|
+
position: 0,
|
|
1740
|
+
required: true,
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
name: "end",
|
|
1744
|
+
description: "Index of last character to slice to (if negative, counts from the end of the string)",
|
|
1745
|
+
type: "integer",
|
|
1746
|
+
position: 1,
|
|
1747
|
+
},
|
|
1748
|
+
],
|
|
1749
|
+
},
|
|
1750
|
+
sum: {
|
|
1751
|
+
description: "Returns the sum of all values in an array",
|
|
1752
|
+
inputSchema: { type: "array", required: true, description: "Array to sum" },
|
|
1753
|
+
outputSchema: { type: "number", $comment: "BigDecimal" },
|
|
1754
|
+
arguments: [
|
|
1755
|
+
{
|
|
1756
|
+
name: "default",
|
|
1757
|
+
description: "The default value to use for empty values",
|
|
1758
|
+
type: "BigDecimal",
|
|
1759
|
+
position: 0,
|
|
1760
|
+
default: 0.0,
|
|
1761
|
+
},
|
|
1762
|
+
{
|
|
1763
|
+
name: "by",
|
|
1764
|
+
description: "A transformer to extract a property to sum by",
|
|
1765
|
+
type: "transformer",
|
|
1766
|
+
position: 1,
|
|
1767
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
1768
|
+
},
|
|
1769
|
+
],
|
|
1770
|
+
},
|
|
1771
|
+
switch: {
|
|
1772
|
+
description: "Switch-case expression. Value is compared to each of the keys in `cases` and a matching **key** will result with its **value**, otherwise `default` value or `null` will be returned.",
|
|
1773
|
+
inputSchema: { type: "any", required: true, description: "Value to test" },
|
|
1774
|
+
outputSchemaTemplate: { type: "object", description: "Same as `default` value or one of the `cases` values" },
|
|
1775
|
+
arguments: [
|
|
1776
|
+
{
|
|
1777
|
+
name: "cases",
|
|
1778
|
+
description: "A map of cases (string to value)",
|
|
1779
|
+
type: "object",
|
|
1780
|
+
position: 0,
|
|
1781
|
+
required: true,
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
name: "default",
|
|
1785
|
+
description: "Fallback value in case no match to any key in cases",
|
|
1786
|
+
type: "any",
|
|
1787
|
+
position: 1,
|
|
1788
|
+
default: null,
|
|
1789
|
+
},
|
|
1790
|
+
],
|
|
1791
|
+
},
|
|
1792
|
+
template: {
|
|
1793
|
+
description: "Renders a specified text template with the given input referencing a specified payload.",
|
|
1794
|
+
argumentsNotes: "#### * Different Types of default parameter resolving options\n| Type | Description |\n|--------------------|------------------------------------------------------------------|\n| `UNIQUE` (default) | Each instance of a parameter is resolved to its explicit default |\n| `FIRST_VALUE` | The first default found for the parameter is used by all |\n| `LAST_VALUE` | The last default found is used by all |\n",
|
|
1795
|
+
inputSchema: { type: "string", required: true, description: "The text template to render" },
|
|
1796
|
+
outputSchema: { type: "string" },
|
|
1797
|
+
arguments: [
|
|
1798
|
+
{
|
|
1799
|
+
name: "payload",
|
|
1800
|
+
description: "Additional context, referred to as `##current` from the template",
|
|
1801
|
+
type: "any",
|
|
1802
|
+
position: 0,
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
name: "default_resolve",
|
|
1806
|
+
description: "Resolve default value based on previous default values or not",
|
|
1807
|
+
type: "enum",
|
|
1808
|
+
position: 1,
|
|
1809
|
+
enum: ["UNIQUE", "FIRST_VALUE", "LAST_VALUE"],
|
|
1810
|
+
default: "UNIQUE",
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
name: "url_encode",
|
|
1814
|
+
description: "URL encode parameters",
|
|
1815
|
+
type: "boolean",
|
|
1816
|
+
position: 2,
|
|
1817
|
+
default: false,
|
|
1818
|
+
},
|
|
1819
|
+
],
|
|
1820
|
+
},
|
|
1821
|
+
test: {
|
|
1822
|
+
description: "Checks if a string matches a certain pattern",
|
|
1823
|
+
inputSchema: { type: "string", required: true, description: "String to test" },
|
|
1824
|
+
outputSchema: { type: "boolean" },
|
|
1825
|
+
arguments: [
|
|
1826
|
+
{
|
|
1827
|
+
name: "pattern",
|
|
1828
|
+
description: "Regular expression to match against input string",
|
|
1829
|
+
type: "string",
|
|
1830
|
+
position: 0,
|
|
1831
|
+
required: true,
|
|
1832
|
+
},
|
|
1833
|
+
],
|
|
1834
|
+
},
|
|
1835
|
+
transform: {
|
|
1836
|
+
description: "Applies a transformation inside a transformer (Useful for piping functions results)",
|
|
1837
|
+
inputSchema: { type: "object", required: true, description: "Input value" },
|
|
1838
|
+
outputSchemaTemplate: { type: "object", description: "Transformed value" },
|
|
1839
|
+
arguments: [
|
|
1840
|
+
{
|
|
1841
|
+
name: "to",
|
|
1842
|
+
description: "Transformer to apply on input",
|
|
1843
|
+
type: "transformer",
|
|
1844
|
+
position: 0,
|
|
1845
|
+
required: true,
|
|
1846
|
+
transformerArguments: [{ name: "##current", type: "any", position: 0, description: "Current element" }],
|
|
1847
|
+
},
|
|
1848
|
+
],
|
|
1849
|
+
},
|
|
1850
|
+
trim: {
|
|
1851
|
+
description: "Removes whitespaces from sides of string",
|
|
1852
|
+
argumentsNotes: "#### * Different Types of trimming\n| Type | Java equivalent function |\n|------------------|---------------------------|\n| `BOTH` (default) | `String::strip()` |\n| `START` | `String::stripLeading()` |\n| `END` | `String::stripTrailing()` |\n| `INDENT` | `String::stripIndent()` |\n| `JAVA` | `String::trim()` |",
|
|
1853
|
+
inputSchema: { type: "string", required: true, description: "String to trim" },
|
|
1854
|
+
outputSchema: { type: "string" },
|
|
1855
|
+
arguments: [
|
|
1856
|
+
{
|
|
1857
|
+
name: "type",
|
|
1858
|
+
description: "Type of trimming",
|
|
1859
|
+
type: "enum",
|
|
1860
|
+
enum: ["BOTH", "START", "END", "INDENT", "JAVA"],
|
|
1861
|
+
position: 0,
|
|
1862
|
+
default: "BOTH",
|
|
1863
|
+
},
|
|
1864
|
+
],
|
|
1865
|
+
},
|
|
1866
|
+
unflatten: {
|
|
1867
|
+
description: "Accepts an object with dot separated field names and merges them into an hierarchical object",
|
|
1868
|
+
inputSchema: { type: "object", required: true, description: "Object with dot separated field names" },
|
|
1869
|
+
outputSchema: { type: "object" },
|
|
1870
|
+
arguments: [
|
|
1871
|
+
{ name: "target", description: "A target to merge into", type: "object", position: 0, default: null },
|
|
1872
|
+
{
|
|
1873
|
+
name: "path",
|
|
1874
|
+
description: "The root path in the target to merge into",
|
|
1875
|
+
type: "string",
|
|
1876
|
+
position: 1,
|
|
1877
|
+
default: null,
|
|
1878
|
+
},
|
|
1879
|
+
],
|
|
1880
|
+
},
|
|
1881
|
+
upper: {
|
|
1882
|
+
description: "Converts a string to all uppercase letters",
|
|
1883
|
+
inputSchema: { type: "string", required: true, description: "Input string" },
|
|
1884
|
+
outputSchema: { type: "string" },
|
|
1885
|
+
},
|
|
1886
|
+
uriparse: {
|
|
1887
|
+
description: "Parses a URI to its components",
|
|
1888
|
+
inputSchema: {
|
|
1889
|
+
type: "string",
|
|
1890
|
+
required: true,
|
|
1891
|
+
description: "A URI formatted string",
|
|
1892
|
+
},
|
|
1893
|
+
outputSchema: {
|
|
1894
|
+
type: "object",
|
|
1895
|
+
properties: {
|
|
1896
|
+
scheme: {
|
|
1897
|
+
type: "string",
|
|
1898
|
+
},
|
|
1899
|
+
user_info: {
|
|
1900
|
+
type: "string",
|
|
1901
|
+
},
|
|
1902
|
+
authority: {
|
|
1903
|
+
type: "string",
|
|
1904
|
+
},
|
|
1905
|
+
host: {
|
|
1906
|
+
type: "string",
|
|
1907
|
+
},
|
|
1908
|
+
hostname: {
|
|
1909
|
+
type: "string",
|
|
1910
|
+
},
|
|
1911
|
+
port: {
|
|
1912
|
+
type: "integer",
|
|
1913
|
+
},
|
|
1914
|
+
path: {
|
|
1915
|
+
type: "string",
|
|
1916
|
+
},
|
|
1917
|
+
query: {
|
|
1918
|
+
type: "object",
|
|
1919
|
+
},
|
|
1920
|
+
query_raw: {
|
|
1921
|
+
type: "string",
|
|
1922
|
+
},
|
|
1923
|
+
fragment: {
|
|
1924
|
+
type: "string",
|
|
1925
|
+
},
|
|
1926
|
+
},
|
|
1927
|
+
},
|
|
1928
|
+
},
|
|
1929
|
+
urldecode: {
|
|
1930
|
+
description: "URL decodes as string",
|
|
1931
|
+
inputSchema: { type: "string", required: true, description: "URL encoded string" },
|
|
1932
|
+
outputSchema: { type: "string" },
|
|
1933
|
+
arguments: [
|
|
1934
|
+
{
|
|
1935
|
+
name: "charset",
|
|
1936
|
+
description: "Character encoding to use",
|
|
1937
|
+
type: "enum",
|
|
1938
|
+
enum: ["UTF-8", "UTF-16"],
|
|
1939
|
+
position: 0,
|
|
1940
|
+
default: "UTF-8",
|
|
1941
|
+
},
|
|
1942
|
+
],
|
|
1943
|
+
},
|
|
1944
|
+
urlencode: {
|
|
1945
|
+
description: "URL encodes as string",
|
|
1946
|
+
inputSchema: { type: "string", required: true, description: "String to encode" },
|
|
1947
|
+
outputSchema: { type: "string" },
|
|
1948
|
+
arguments: [
|
|
1949
|
+
{
|
|
1950
|
+
name: "charset",
|
|
1951
|
+
description: "Character encoding to use",
|
|
1952
|
+
type: "enum",
|
|
1953
|
+
enum: ["UTF-8", "UTF-16"],
|
|
1954
|
+
position: 0,
|
|
1955
|
+
default: "UTF-8",
|
|
1956
|
+
},
|
|
1957
|
+
],
|
|
1958
|
+
},
|
|
1959
|
+
uuid: {
|
|
1960
|
+
description: "Format and transform UUID",
|
|
1961
|
+
notes: ":::info\nInput must be a UUID in standard string format (RFC 4122; with hyphens), can be used in conjunction with `#uuid`\n:::",
|
|
1962
|
+
argumentsNotes: '- `NO_HYPHENS` (can also be specified as `N`) - Same as `CANONICAL` with hyphens removed\n- `BASE36` (can also be specified as `B36`) - alphanumeric alphabet\n- `BASE62` (can also be specified as `B62`) - alphanumeric alphabet, case sensitive\n- `BASE64` (can also be specified as `B64`) - "URL and Filename safe Base64 Alphabet"\n- `V3` - Consider input as name and generate a UUIDv3 (name-based, RFC 4122) (namespace optionally used)\n- `V5` - Consider input as name and generate a UUIDv5 (name-based, RFC 4122) (namespace optionally used)\n',
|
|
1963
|
+
inputSchema: {
|
|
1964
|
+
type: "string",
|
|
1965
|
+
description: "UUID",
|
|
1966
|
+
},
|
|
1967
|
+
outputSchema: { type: "string" },
|
|
1968
|
+
arguments: [
|
|
1969
|
+
{
|
|
1970
|
+
name: "format",
|
|
1971
|
+
description: "Formatting (or generation in case of v3/v5)",
|
|
1972
|
+
type: "enum",
|
|
1973
|
+
enum: ["CANONICAL", "NO_HYPHENS", "BASE62", "BASE64", "BASE36", "V3", "V5"],
|
|
1974
|
+
position: 0,
|
|
1975
|
+
default: "CANONICAL",
|
|
1976
|
+
},
|
|
1977
|
+
{ name: "namespace", description: "UUID to be used as salt (for V3/V5)", type: "string", position: 1 },
|
|
1978
|
+
],
|
|
1979
|
+
},
|
|
1980
|
+
value: {
|
|
1981
|
+
description: "Returns the value if it passes the [truthy logic](../truthy-logic), or `null` otherwise",
|
|
1982
|
+
inputSchema: { type: "any", description: "Any value" },
|
|
1983
|
+
outputSchemaTemplate: { type: "object", description: "Same type as input or `null`" },
|
|
1984
|
+
},
|
|
1985
|
+
wrap: {
|
|
1986
|
+
description: "Wrap an input string with `prefix` and `suffix`",
|
|
1987
|
+
inputSchema: { type: "string", required: true, description: "String to wrap" },
|
|
1988
|
+
outputSchema: { type: "string" },
|
|
1989
|
+
arguments: [
|
|
1990
|
+
{
|
|
1991
|
+
name: "prefix",
|
|
1992
|
+
description: "String that will prefix the input in the output",
|
|
1993
|
+
type: "string",
|
|
1994
|
+
position: 0,
|
|
1995
|
+
default: "",
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
name: "suffix",
|
|
1999
|
+
description: "String that will suffix the input in the output",
|
|
2000
|
+
type: "string",
|
|
2001
|
+
position: 1,
|
|
2002
|
+
default: "",
|
|
2003
|
+
},
|
|
2004
|
+
],
|
|
2005
|
+
},
|
|
2006
|
+
xml: {
|
|
2007
|
+
description: "Converts an object to XML string (a wrapper element can be added by specifying the field `root` with the element name)",
|
|
2008
|
+
notes: "Optionally runs an XSLT over the result before returning it",
|
|
2009
|
+
inputSchema: { type: "object", required: true, description: '"XML structured" JSON object' },
|
|
2010
|
+
outputSchemaTemplate: { type: "string", description: "XML String" },
|
|
2011
|
+
outputSchema: { type: "string" },
|
|
2012
|
+
arguments: [
|
|
2013
|
+
{
|
|
2014
|
+
name: "root",
|
|
2015
|
+
description: "Name for a wrapper element (e.g. an array was passed and a container is needed)",
|
|
2016
|
+
type: "string",
|
|
2017
|
+
position: 0,
|
|
2018
|
+
default: null,
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
name: "xslt",
|
|
2022
|
+
description: "XSLT document to transform xml created from input",
|
|
2023
|
+
type: "string",
|
|
2024
|
+
position: 1,
|
|
2025
|
+
default: null,
|
|
2026
|
+
},
|
|
2027
|
+
{
|
|
2028
|
+
name: "indent",
|
|
2029
|
+
description: "Whether to pretty print the XML",
|
|
2030
|
+
type: "boolean",
|
|
2031
|
+
position: 2,
|
|
2032
|
+
default: false,
|
|
2033
|
+
},
|
|
2034
|
+
],
|
|
2035
|
+
},
|
|
2036
|
+
xmlparse: {
|
|
2037
|
+
description: "Parses an XML and converts it to an object",
|
|
2038
|
+
notes: "- Elements with text and attributes will be converted to objects with a `$content` field for the text",
|
|
2039
|
+
inputSchema: { type: "string", required: true, description: "XML string" },
|
|
2040
|
+
outputSchema: { type: "object" },
|
|
2041
|
+
arguments: [
|
|
2042
|
+
{
|
|
2043
|
+
name: "keep_strings",
|
|
2044
|
+
description: "Do not try to detect primitive types (e.g. numbers, boolean, etc)",
|
|
2045
|
+
type: "boolean",
|
|
2046
|
+
position: 0,
|
|
2047
|
+
default: false,
|
|
2048
|
+
},
|
|
2049
|
+
{
|
|
2050
|
+
name: "cdata_tag_name",
|
|
2051
|
+
description: "A key for the CDATA section",
|
|
2052
|
+
type: "string",
|
|
2053
|
+
position: 1,
|
|
2054
|
+
default: "$content",
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
name: "convert_nil_to_null",
|
|
2058
|
+
description: 'If values with attribute `xsi:nil="true"` will be converted to `null`',
|
|
2059
|
+
type: "boolean",
|
|
2060
|
+
position: 2,
|
|
2061
|
+
default: false,
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
name: "force_list",
|
|
2065
|
+
description: "Tag names that will always be parsed as arrays",
|
|
2066
|
+
type: "string[]",
|
|
2067
|
+
position: 3,
|
|
2068
|
+
default: [],
|
|
2069
|
+
},
|
|
2070
|
+
],
|
|
2071
|
+
},
|
|
2072
|
+
xor: {
|
|
2073
|
+
description: "Evaluates to `true` if only one of the values provided will evaluate to `true` (using the [Truthy logic](../truthy-logic))",
|
|
2074
|
+
inputSchema: { type: "array", required: true, description: "Values to check" },
|
|
2075
|
+
outputSchema: { type: "boolean" },
|
|
2076
|
+
},
|
|
2077
|
+
yaml: {
|
|
2078
|
+
description: "Converts an object to YAML format",
|
|
2079
|
+
notes: ":::info\nStructure of output may very depending on platform.\n:::",
|
|
2080
|
+
inputSchema: { type: "object", required: true },
|
|
2081
|
+
outputSchemaTemplate: { type: "string", description: "YAML string" },
|
|
2082
|
+
outputSchema: { type: "string" },
|
|
2083
|
+
},
|
|
2084
|
+
yamlparse: {
|
|
2085
|
+
description: "Parses a YAML format to `object`",
|
|
2086
|
+
inputSchema: { type: "string", required: true, description: "YAML string" },
|
|
2087
|
+
outputSchema: { type: "object" },
|
|
2088
|
+
},
|
|
2089
|
+
};
|
|
2090
|
+
//# sourceMappingURL=definitions.js.map
|