@xano/developer-mcp 1.0.26 → 1.0.27
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/dist/xanoscript_docs/README.md +78 -64
- package/dist/xanoscript_docs/apis.md +81 -27
- package/dist/xanoscript_docs/branch.md +13 -13
- package/dist/xanoscript_docs/database.md +57 -17
- package/dist/xanoscript_docs/functions.md +43 -71
- package/dist/xanoscript_docs/performance.md +14 -23
- package/dist/xanoscript_docs/tables.md +47 -1
- package/dist/xanoscript_docs/tools.md +9 -7
- package/dist/xanoscript_docs/types.md +12 -10
- package/package.json +1 -1
- package/dist/api_docs/format.d.ts +0 -5
- package/dist/api_docs/format.js +0 -171
- package/dist/api_docs/index.d.ts +0 -52
- package/dist/api_docs/index.js +0 -111
- package/dist/api_docs/topics/agent.d.ts +0 -2
- package/dist/api_docs/topics/agent.js +0 -142
- package/dist/api_docs/topics/api.d.ts +0 -2
- package/dist/api_docs/topics/api.js +0 -176
- package/dist/api_docs/topics/apigroup.d.ts +0 -2
- package/dist/api_docs/topics/apigroup.js +0 -124
- package/dist/api_docs/topics/authentication.d.ts +0 -2
- package/dist/api_docs/topics/authentication.js +0 -61
- package/dist/api_docs/topics/branch.d.ts +0 -2
- package/dist/api_docs/topics/branch.js +0 -73
- package/dist/api_docs/topics/file.d.ts +0 -2
- package/dist/api_docs/topics/file.js +0 -70
- package/dist/api_docs/topics/function.d.ts +0 -2
- package/dist/api_docs/topics/function.js +0 -164
- package/dist/api_docs/topics/history.d.ts +0 -2
- package/dist/api_docs/topics/history.js +0 -149
- package/dist/api_docs/topics/mcp_server.d.ts +0 -2
- package/dist/api_docs/topics/mcp_server.js +0 -139
- package/dist/api_docs/topics/middleware.d.ts +0 -2
- package/dist/api_docs/topics/middleware.js +0 -156
- package/dist/api_docs/topics/realtime.d.ts +0 -2
- package/dist/api_docs/topics/realtime.js +0 -112
- package/dist/api_docs/topics/start.d.ts +0 -2
- package/dist/api_docs/topics/start.js +0 -107
- package/dist/api_docs/topics/table.d.ts +0 -2
- package/dist/api_docs/topics/table.js +0 -195
- package/dist/api_docs/topics/task.d.ts +0 -2
- package/dist/api_docs/topics/task.js +0 -165
- package/dist/api_docs/topics/tool.d.ts +0 -2
- package/dist/api_docs/topics/tool.js +0 -150
- package/dist/api_docs/topics/workflows.d.ts +0 -2
- package/dist/api_docs/topics/workflows.js +0 -131
- package/dist/api_docs/topics/workspace.d.ts +0 -2
- package/dist/api_docs/topics/workspace.js +0 -153
- package/dist/api_docs/types.d.ts +0 -79
- package/dist/api_docs/types.js +0 -4
- package/dist/templates/init-workspace.d.ts +0 -10
- package/dist/templates/init-workspace.js +0 -278
- package/dist/templates/xanoscript-index.d.ts +0 -11
- package/dist/templates/xanoscript-index.js +0 -72
- package/dist/xanoscript_docs/ephemeral.md +0 -330
- package/dist/xanoscript_docs_auto/README.md +0 -119
- package/dist/xanoscript_docs_auto/agents.md +0 -446
- package/dist/xanoscript_docs_auto/apis.md +0 -517
- package/dist/xanoscript_docs_auto/control-flow.md +0 -543
- package/dist/xanoscript_docs_auto/database.md +0 -551
- package/dist/xanoscript_docs_auto/debugging.md +0 -527
- package/dist/xanoscript_docs_auto/filters.md +0 -464
- package/dist/xanoscript_docs_auto/functions.md +0 -431
- package/dist/xanoscript_docs_auto/integrations.md +0 -657
- package/dist/xanoscript_docs_auto/mcp-servers.md +0 -408
- package/dist/xanoscript_docs_auto/operators.md +0 -368
- package/dist/xanoscript_docs_auto/syntax.md +0 -287
- package/dist/xanoscript_docs_auto/tables.md +0 -447
- package/dist/xanoscript_docs_auto/tasks.md +0 -479
- package/dist/xanoscript_docs_auto/testing.md +0 -574
- package/dist/xanoscript_docs_auto/tools.md +0 -485
- package/dist/xanoscript_docs_auto/triggers.md +0 -595
- package/dist/xanoscript_docs_auto/types.md +0 -323
- package/dist/xanoscript_docs_auto/variables.md +0 -462
- package/dist/xanoscript_docs_auto/version.json +0 -5
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
applyTo: "**/*.xs"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Operators
|
|
6
|
-
|
|
7
|
-
Complete reference for XanoScript operators.
|
|
8
|
-
|
|
9
|
-
## Quick Reference
|
|
10
|
-
|
|
11
|
-
| Category | Operators |
|
|
12
|
-
|----------|-----------|
|
|
13
|
-
| Arithmetic | `+`, `-`, `*`, `/`, `%` |
|
|
14
|
-
| Comparison | `==`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
15
|
-
| Strict | `===`, `!==` |
|
|
16
|
-
| Logical | `&&`, `\|\|`, `!` |
|
|
17
|
-
| String | `~` (concat) |
|
|
18
|
-
| Null-safe | `==?`, `!=?`, `>=?`, `<=?` |
|
|
19
|
-
| Nullish | `??` |
|
|
20
|
-
| Pipe | `\|` (filters) |
|
|
21
|
-
| Database | `=`, `in`, `like`, `ilike`, `between`, `contains`, `@>`, `~` |
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Arithmetic Operators
|
|
26
|
-
|
|
27
|
-
```xs
|
|
28
|
-
$a + $b // Addition
|
|
29
|
-
$a - $b // Subtraction
|
|
30
|
-
$a * $b // Multiplication
|
|
31
|
-
$a / $b // Division
|
|
32
|
-
$a % $b // Modulus (remainder)
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### Examples
|
|
36
|
-
|
|
37
|
-
```xs
|
|
38
|
-
var $total {
|
|
39
|
-
value = $input.quantity * $input.price
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var $remainder {
|
|
43
|
-
value = $input.value % 10
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var $average {
|
|
47
|
-
value = $sum / $count
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Comparison Operators
|
|
54
|
-
|
|
55
|
-
```xs
|
|
56
|
-
$a == $b // Equal
|
|
57
|
-
$a != $b // Not equal
|
|
58
|
-
$a > $b // Greater than
|
|
59
|
-
$a >= $b // Greater or equal
|
|
60
|
-
$a < $b // Less than
|
|
61
|
-
$a <= $b // Less or equal
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Strict Equality
|
|
65
|
-
|
|
66
|
-
```xs
|
|
67
|
-
$a === $b // Strict equal (type + value)
|
|
68
|
-
$a !== $b // Strict not equal
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Examples
|
|
72
|
-
|
|
73
|
-
```xs
|
|
74
|
-
conditional {
|
|
75
|
-
if ($input.age >= 18) {
|
|
76
|
-
var $status { value = "adult" }
|
|
77
|
-
}
|
|
78
|
-
elseif ($input.age >= 13) {
|
|
79
|
-
var $status { value = "teen" }
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
var $status { value = "child" }
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Logical Operators
|
|
90
|
-
|
|
91
|
-
```xs
|
|
92
|
-
$a && $b // AND - both must be true
|
|
93
|
-
$a || $b // OR - at least one true
|
|
94
|
-
!$a // NOT - invert boolean
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Examples
|
|
98
|
-
|
|
99
|
-
```xs
|
|
100
|
-
conditional {
|
|
101
|
-
if ($user != null && $user.active) {
|
|
102
|
-
// User exists and is active
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
conditional {
|
|
107
|
-
if ($input.role == "admin" || $input.role == "moderator") {
|
|
108
|
-
// Has elevated permissions
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
conditional {
|
|
113
|
-
if (!$input.disabled) {
|
|
114
|
-
// Not disabled
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
## String Concatenation
|
|
122
|
-
|
|
123
|
-
Use `~` for string concatenation:
|
|
124
|
-
|
|
125
|
-
```xs
|
|
126
|
-
var $greeting {
|
|
127
|
-
value = "Hello, " ~ $input.name ~ "!"
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
var $full_name {
|
|
131
|
-
value = $input.first_name ~ " " ~ $input.last_name
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## Null-Safe Operators
|
|
138
|
-
|
|
139
|
-
In database queries, ignore condition if value is null:
|
|
140
|
-
|
|
141
|
-
```xs
|
|
142
|
-
db.query "product" {
|
|
143
|
-
where = $db.product.category ==? $input.category
|
|
144
|
-
&& $db.product.price >=? $input.min_price
|
|
145
|
-
&& $db.product.price <=? $input.max_price
|
|
146
|
-
} as $products
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
| Operator | Description |
|
|
150
|
-
|----------|-------------|
|
|
151
|
-
| `==?` | Equal if not null |
|
|
152
|
-
| `!=?` | Not equal if not null |
|
|
153
|
-
| `>=?` | Greater or equal if not null |
|
|
154
|
-
| `<=?` | Less or equal if not null |
|
|
155
|
-
| `>?` | Greater than if not null |
|
|
156
|
-
| `<?` | Less than if not null |
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Nullish Coalescing
|
|
161
|
-
|
|
162
|
-
Return right operand when left is null (not just falsy):
|
|
163
|
-
|
|
164
|
-
```xs
|
|
165
|
-
$value ?? "default" // Returns "default" only if $value is null
|
|
166
|
-
$value || "default" // Returns "default" if $value is null, 0, "", or false
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Difference
|
|
170
|
-
|
|
171
|
-
```xs
|
|
172
|
-
var $count { value = 0 }
|
|
173
|
-
$count ?? 10 // Returns 0 (not null)
|
|
174
|
-
$count || 10 // Returns 10 (0 is falsy)
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## Pipe Operator
|
|
180
|
-
|
|
181
|
-
Chain filters with `|`:
|
|
182
|
-
|
|
183
|
-
```xs
|
|
184
|
-
$input.email|trim|lower
|
|
185
|
-
$input.name|strlen
|
|
186
|
-
$array|first
|
|
187
|
-
($a + $b)|round:2
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### Filter Chaining
|
|
191
|
-
|
|
192
|
-
```xs
|
|
193
|
-
var $processed {
|
|
194
|
-
value = $input.text
|
|
195
|
-
|trim
|
|
196
|
-
|lower
|
|
197
|
-
|replace:" ":"-"
|
|
198
|
-
|substr:0:50
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## Database Query Operators
|
|
205
|
-
|
|
206
|
-
### Basic Operators
|
|
207
|
-
|
|
208
|
-
```xs
|
|
209
|
-
db.query "product" {
|
|
210
|
-
where = $db.product.status == "active"
|
|
211
|
-
&& $db.product.price > 10
|
|
212
|
-
&& $db.product.stock >= 1
|
|
213
|
-
} as $products
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### IN Operator
|
|
217
|
-
|
|
218
|
-
```xs
|
|
219
|
-
db.query "product" {
|
|
220
|
-
where = $db.product.category in ["electronics", "clothing", "books"]
|
|
221
|
-
} as $products
|
|
222
|
-
|
|
223
|
-
db.query "product" {
|
|
224
|
-
where = $db.product.status not in ["deleted", "archived"]
|
|
225
|
-
} as $products
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### LIKE / ILIKE (Pattern Matching)
|
|
229
|
-
|
|
230
|
-
```xs
|
|
231
|
-
// Case-sensitive pattern
|
|
232
|
-
db.query "product" {
|
|
233
|
-
where = $db.product.name like "%Widget%"
|
|
234
|
-
} as $products
|
|
235
|
-
|
|
236
|
-
// Case-insensitive pattern
|
|
237
|
-
db.query "product" {
|
|
238
|
-
where = $db.product.name ilike "%widget%"
|
|
239
|
-
} as $products
|
|
240
|
-
|
|
241
|
-
// Negated
|
|
242
|
-
db.query "product" {
|
|
243
|
-
where = $db.product.name not ilike "%test%"
|
|
244
|
-
} as $products
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### BETWEEN
|
|
248
|
-
|
|
249
|
-
```xs
|
|
250
|
-
db.query "product" {
|
|
251
|
-
where = $db.product.price between 10:100
|
|
252
|
-
} as $products
|
|
253
|
-
|
|
254
|
-
db.query "order" {
|
|
255
|
-
where = $db.order.created_at between $start_date:$end_date
|
|
256
|
-
} as $orders
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Array Contains
|
|
260
|
-
|
|
261
|
-
```xs
|
|
262
|
-
// Array contains value
|
|
263
|
-
db.query "product" {
|
|
264
|
-
where = $db.product.tags|contains:"featured"
|
|
265
|
-
} as $products
|
|
266
|
-
|
|
267
|
-
// String includes substring
|
|
268
|
-
db.query "product" {
|
|
269
|
-
where = $db.product.description|includes:"sale"
|
|
270
|
-
} as $products
|
|
271
|
-
|
|
272
|
-
// Arrays share elements
|
|
273
|
-
db.query "product" {
|
|
274
|
-
where = $db.product.categories|overlaps:["tech", "gadgets"]
|
|
275
|
-
} as $products
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### JSON Contains
|
|
279
|
-
|
|
280
|
-
```xs
|
|
281
|
-
db.query "product" {
|
|
282
|
-
where = $db.product.metadata @> {"featured": true}
|
|
283
|
-
} as $products
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Regex Match
|
|
287
|
-
|
|
288
|
-
```xs
|
|
289
|
-
db.query "product" {
|
|
290
|
-
where = $db.product.sku ~ "^SKU-[0-9]+"
|
|
291
|
-
} as $products
|
|
292
|
-
|
|
293
|
-
// Negated regex
|
|
294
|
-
db.query "product" {
|
|
295
|
-
where = $db.product.name !~ "^test"
|
|
296
|
-
} as $products
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
### Full-Text Search
|
|
300
|
-
|
|
301
|
-
```xs
|
|
302
|
-
db.query "product" {
|
|
303
|
-
where = $db.product.description search $input.query
|
|
304
|
-
} as $products
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## Bitwise Operators
|
|
310
|
-
|
|
311
|
-
### As Filters
|
|
312
|
-
|
|
313
|
-
```xs
|
|
314
|
-
5|bitwise_and:3 // 1
|
|
315
|
-
5|bitwise_or:3 // 7
|
|
316
|
-
5|bitwise_xor:3 // 6
|
|
317
|
-
5|bitwise_not // -6
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
### As Functions
|
|
321
|
-
|
|
322
|
-
```xs
|
|
323
|
-
math.bitwise.and {
|
|
324
|
-
a = 5
|
|
325
|
-
b = 3
|
|
326
|
-
} as $result // 1
|
|
327
|
-
|
|
328
|
-
math.bitwise.or {
|
|
329
|
-
a = 5
|
|
330
|
-
b = 3
|
|
331
|
-
} as $result // 7
|
|
332
|
-
|
|
333
|
-
math.bitwise.xor {
|
|
334
|
-
a = 5
|
|
335
|
-
b = 3
|
|
336
|
-
} as $result // 6
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## Operator Precedence
|
|
342
|
-
|
|
343
|
-
From highest to lowest:
|
|
344
|
-
|
|
345
|
-
1. `()` - Parentheses
|
|
346
|
-
2. `|` - Pipe/filters
|
|
347
|
-
3. `!` - Logical NOT
|
|
348
|
-
4. `*`, `/`, `%` - Multiplication, division, modulus
|
|
349
|
-
5. `+`, `-` - Addition, subtraction
|
|
350
|
-
6. `~` - String concatenation
|
|
351
|
-
7. `<`, `<=`, `>`, `>=` - Comparison
|
|
352
|
-
8. `==`, `!=`, `===`, `!==` - Equality
|
|
353
|
-
9. `&&` - Logical AND
|
|
354
|
-
10. `||` - Logical OR
|
|
355
|
-
11. `??` - Nullish coalescing
|
|
356
|
-
|
|
357
|
-
### Examples
|
|
358
|
-
|
|
359
|
-
```xs
|
|
360
|
-
// Parentheses override precedence
|
|
361
|
-
var $result { value = (2 + 3) * 4 } // 20, not 14
|
|
362
|
-
|
|
363
|
-
// Filters bind tightly
|
|
364
|
-
var $len { value = $text|trim|strlen }
|
|
365
|
-
|
|
366
|
-
// Logical operators
|
|
367
|
-
var $ok { value = $a > 0 && $b < 100 || $override }
|
|
368
|
-
```
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
applyTo: "**/*.xs"
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Syntax Reference
|
|
6
|
-
|
|
7
|
-
Complete reference for XanoScript expressions, operators, and filters.
|
|
8
|
-
|
|
9
|
-
## Quick Reference
|
|
10
|
-
|
|
11
|
-
### Operators
|
|
12
|
-
| Category | Operators |
|
|
13
|
-
|----------|-----------|
|
|
14
|
-
| Comparison | `==`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
15
|
-
| Logical | `&&`, `\|\|`, `!` |
|
|
16
|
-
| Math | `+`, `-`, `*`, `/`, `%` |
|
|
17
|
-
| String | `~` (concat) |
|
|
18
|
-
| Null-safe | `==?`, `!=?`, `>=?`, `<=?` (ignore if null) |
|
|
19
|
-
|
|
20
|
-
### Common Filters
|
|
21
|
-
| Filter | Purpose | Example |
|
|
22
|
-
|--------|---------|---------|
|
|
23
|
-
| `trim` | Remove whitespace | `$s\|trim` |
|
|
24
|
-
| `lower` / `upper` | Case conversion | `$s\|to_lower` |
|
|
25
|
-
| `first` / `last` | Array endpoints | `$arr\|first` |
|
|
26
|
-
| `count` | Array/object length | `$arr\|count` |
|
|
27
|
-
| `get` | Object property | `$obj\|get:"key"` |
|
|
28
|
-
| `set` | Set property | `$obj\|set:"key":"val"` |
|
|
29
|
-
| `json_encode` / `json_decode` | JSON conversion | `$obj\|json_encode` |
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Expressions
|
|
34
|
-
|
|
35
|
-
Expressions evaluate values using operators and filters:
|
|
36
|
-
|
|
37
|
-
```xs
|
|
38
|
-
var $total { value = $input.qty * $input.price }
|
|
39
|
-
var $name { value = $input.first ~ " " ~ $input.last }
|
|
40
|
-
|
|
41
|
-
conditional {
|
|
42
|
-
if ($input.age >= 18) { ... }
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Math Filters
|
|
49
|
-
|
|
50
|
-
| Filter | Example | Result |
|
|
51
|
-
|--------|---------|--------|
|
|
52
|
-
| `add` | `10\|add:5` | `15` |
|
|
53
|
-
| `subtract` | `10\|subtract:3` | `7` |
|
|
54
|
-
| `multiply` | `10\|multiply:2` | `20` |
|
|
55
|
-
| `divide` | `10\|divide:2` | `5` |
|
|
56
|
-
| `modulus` | `10\|modulus:3` | `1` |
|
|
57
|
-
| `floor` | `2.7\|floor` | `2` |
|
|
58
|
-
| `ceil` | `2.3\|ceil` | `3` |
|
|
59
|
-
| `round` | `2.567\|round:2` | `2.57` |
|
|
60
|
-
| `abs` | `-5\|abs` | `5` |
|
|
61
|
-
| `sqrt` | `9\|sqrt` | `3` |
|
|
62
|
-
| `pow` | `2\|pow:3` | `8` |
|
|
63
|
-
| `min` | `5\|min:3` | `3` |
|
|
64
|
-
| `max` | `5\|max:10` | `10` |
|
|
65
|
-
|
|
66
|
-
### Array Math
|
|
67
|
-
```xs
|
|
68
|
-
[1,2,3,4]|sum // 10
|
|
69
|
-
[1,2,3,4]|avg // 2.5
|
|
70
|
-
[1,2,3,4]|product // 24
|
|
71
|
-
[5,2,8,1]|array_min // 1
|
|
72
|
-
[5,2,8,1]|array_max // 8
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Trigonometry
|
|
76
|
-
`sin`, `cos`, `tan`, `asin`, `acos`, `atan`, `deg2rad`, `rad2deg`
|
|
77
|
-
|
|
78
|
-
---
|
|
79
|
-
|
|
80
|
-
## String Filters
|
|
81
|
-
|
|
82
|
-
| Filter | Example | Result |
|
|
83
|
-
|--------|---------|--------|
|
|
84
|
-
| `trim` | `" hi "\|trim` | `"hi"` |
|
|
85
|
-
| `ltrim` / `rtrim` | `" hi"\|ltrim` | `"hi"` |
|
|
86
|
-
| `to_lower` | `"Hi"\|to_lower` | `"hi"` |
|
|
87
|
-
| `to_upper` | `"Hi"\|to_upper` | `"HI"` |
|
|
88
|
-
| `capitalize` | `"hi there"\|capitalize` | `"Hi There"` |
|
|
89
|
-
| `strlen` | `"hello"\|strlen` | `5` |
|
|
90
|
-
| `substr` | `"hello"\|substr:1:3` | `"ell"` |
|
|
91
|
-
| `split` | `"a,b,c"\|split:","` | `["a","b","c"]` |
|
|
92
|
-
| `replace` | `"hello"\|replace:"l":"x"` | `"hexxo"` |
|
|
93
|
-
| `contains` | `"hello"\|contains:"ell"` | `true` |
|
|
94
|
-
| `starts_with` | `"hello"\|starts_with:"he"` | `true` |
|
|
95
|
-
| `ends_with` | `"hello"\|ends_with:"lo"` | `true` |
|
|
96
|
-
| `concat` | `"a"\|concat:"b":"-"` | `"a-b"` |
|
|
97
|
-
|
|
98
|
-
### Case-Insensitive Variants
|
|
99
|
-
`icontains`, `istarts_with`, `iends_with`, `iindex`
|
|
100
|
-
|
|
101
|
-
### Regex
|
|
102
|
-
```xs
|
|
103
|
-
"/pattern/"|regex_matches:"subject" // Boolean match
|
|
104
|
-
"/(\w+)/"|regex_get_first_match:"test" // First match
|
|
105
|
-
"/\w+/"|regex_get_all_matches:"a b c" // All matches
|
|
106
|
-
"/\s+/"|regex_replace:"-":"a b" // Replace: "a-b"
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Array Filters
|
|
112
|
-
|
|
113
|
-
| Filter | Example | Result |
|
|
114
|
-
|--------|---------|--------|
|
|
115
|
-
| `first` | `[1,2,3]\|first` | `1` |
|
|
116
|
-
| `last` | `[1,2,3]\|last` | `3` |
|
|
117
|
-
| `count` | `[1,2,3]\|count` | `3` |
|
|
118
|
-
| `reverse` | `[1,2,3]\|reverse` | `[3,2,1]` |
|
|
119
|
-
| `unique` | `[1,1,2]\|unique` | `[1,2]` |
|
|
120
|
-
| `flatten` | `[[1,2],[3]]\|flatten` | `[1,2,3]` |
|
|
121
|
-
| `shuffle` | `[1,2,3]\|shuffle` | Random order |
|
|
122
|
-
| `slice` | `[1,2,3,4]\|slice:1:2` | `[2,3]` |
|
|
123
|
-
| `push` | `[1,2]\|push:3` | `[1,2,3]` |
|
|
124
|
-
| `pop` | `[1,2,3]\|pop` | `3` |
|
|
125
|
-
| `shift` | `[1,2,3]\|shift` | `1` |
|
|
126
|
-
| `unshift` | `[1,2]\|unshift:0` | `[0,1,2]` |
|
|
127
|
-
| `merge` | `[1,2]\|merge:[3,4]` | `[1,2,3,4]` |
|
|
128
|
-
| `diff` | `[1,2,3]\|diff:[2]` | `[1,3]` |
|
|
129
|
-
| `intersect` | `[1,2,3]\|intersect:[2,3,4]` | `[2,3]` |
|
|
130
|
-
| `join` | `["a","b"]\|join:","` | `"a,b"` |
|
|
131
|
-
| `range` | `\|range:1:5` | `[1,2,3,4,5]` |
|
|
132
|
-
|
|
133
|
-
### Functional Operations
|
|
134
|
-
```xs
|
|
135
|
-
// Map - transform each element
|
|
136
|
-
[{v:1},{v:2}]|map:$$.v*2 // [2,4]
|
|
137
|
-
|
|
138
|
-
// Filter - keep matching elements
|
|
139
|
-
[1,2,3,4]|filter:$$%2==0 // [2,4]
|
|
140
|
-
|
|
141
|
-
// Find - first matching element
|
|
142
|
-
[{id:1},{id:2}]|find:$$.id==2 // {id:2}
|
|
143
|
-
|
|
144
|
-
// FindIndex - index of first match
|
|
145
|
-
[{id:1},{id:2}]|findIndex:$$.id==2 // 1
|
|
146
|
-
|
|
147
|
-
// Some - any element matches?
|
|
148
|
-
[1,2,3]|some:$$>2 // true
|
|
149
|
-
|
|
150
|
-
// Every - all elements match?
|
|
151
|
-
[2,4,6]|every:$$%2==0 // true
|
|
152
|
-
|
|
153
|
-
// Reduce - accumulate to single value
|
|
154
|
-
[1,2,3,4]|reduce:$$+$result:0 // 10
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Grouping & Indexing
|
|
158
|
-
```xs
|
|
159
|
-
// Group by property
|
|
160
|
-
[{g:"a",v:1},{g:"b",v:2},{g:"a",v:3}]|index_by:g
|
|
161
|
-
|
|
162
|
-
// Sort
|
|
163
|
-
[{n:"z"},{n:"a"}]|sort:n:text:false // Ascending by n
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Object Filters
|
|
169
|
-
|
|
170
|
-
| Filter | Example | Result |
|
|
171
|
-
|--------|---------|--------|
|
|
172
|
-
| `get` | `{a:1}\|get:"a"` | `1` |
|
|
173
|
-
| `set` | `{a:1}\|set:"b":2` | `{a:1,b:2}` |
|
|
174
|
-
| `unset` | `{a:1,b:2}\|unset:"b"` | `{a:1}` |
|
|
175
|
-
| `has` | `{a:1}\|has:"a"` | `true` |
|
|
176
|
-
| `keys` | `{a:1,b:2}\|keys` | `["a","b"]` |
|
|
177
|
-
| `values` | `{a:1,b:2}\|values` | `[1,2]` |
|
|
178
|
-
| `entries` | `{a:1}\|entries` | `[{key:"a",value:1}]` |
|
|
179
|
-
| `pick` | `{a:1,b:2,c:3}\|pick:[a,c]` | `{a:1,c:3}` |
|
|
180
|
-
| `unpick` | `{a:1,b:2,c:3}\|unpick:[b]` | `{a:1,c:3}` |
|
|
181
|
-
|
|
182
|
-
### Conditional Set
|
|
183
|
-
```xs
|
|
184
|
-
{a:1}|set_conditional:"b":2:true // {a:1,b:2} if condition true
|
|
185
|
-
{a:1}|set_ifnotempty:"b":"val" // Set only if val not empty
|
|
186
|
-
{a:1}|set_ifnotnull:"b":$var // Set only if $var not null
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Type Filters
|
|
192
|
-
|
|
193
|
-
| Filter | Example | Result |
|
|
194
|
-
|--------|---------|--------|
|
|
195
|
-
| `to_int` | `"123"\|to_int` | `123` |
|
|
196
|
-
| `to_decimal` | `"1.5"\|to_decimal` | `1.5` |
|
|
197
|
-
| `to_text` | `123\|to_text` | `"123"` |
|
|
198
|
-
| `to_bool` | `"true"\|to_bool` | `true` |
|
|
199
|
-
| `is_null` | `null\|is_null` | `true` |
|
|
200
|
-
| `is_empty` | `[]\|is_empty` | `true` |
|
|
201
|
-
| `is_array` | `[1]\|is_array` | `true` |
|
|
202
|
-
| `is_object` | `{}\|is_object` | `true` |
|
|
203
|
-
|
|
204
|
-
### Null Handling
|
|
205
|
-
```xs
|
|
206
|
-
null|first_notnull:0 // 0
|
|
207
|
-
""|first_notempty:"default" // "default"
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
---
|
|
211
|
-
|
|
212
|
-
## Date/Time Filters
|
|
213
|
-
|
|
214
|
-
| Filter | Example | Description |
|
|
215
|
-
|--------|---------|-------------|
|
|
216
|
-
| `to_timestamp` | `"now"\|to_timestamp` | Parse to timestamp |
|
|
217
|
-
| `to_ms` | `"now"\|to_ms` | Milliseconds since epoch |
|
|
218
|
-
| `to_seconds` | `"now"\|to_seconds` | Seconds since epoch |
|
|
219
|
-
| `format_timestamp` | `$ts\|format_timestamp:"Y-m-d":"UTC"` | Format timestamp |
|
|
220
|
-
| `transform_timestamp` | `$ts\|transform_timestamp:"-7 days"` | Relative time |
|
|
221
|
-
| `add_secs_to_timestamp` | `$ts\|add_secs_to_timestamp:60` | Add seconds |
|
|
222
|
-
|
|
223
|
-
### Timestamp Parts
|
|
224
|
-
```xs
|
|
225
|
-
$ts|timestamp_year // Year
|
|
226
|
-
$ts|timestamp_month // Month (1-12)
|
|
227
|
-
$ts|timestamp_day_of_month // Day (1-31)
|
|
228
|
-
$ts|timestamp_hour // Hour (0-23)
|
|
229
|
-
$ts|timestamp_minute // Minute (0-59)
|
|
230
|
-
$ts|timestamp_day_of_week // Day (0=Sunday)
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
---
|
|
234
|
-
|
|
235
|
-
## Encoding Filters
|
|
236
|
-
|
|
237
|
-
| Filter | Example |
|
|
238
|
-
|--------|---------|
|
|
239
|
-
| `json_encode` | `{a:1}\|json_encode` |
|
|
240
|
-
| `json_decode` | `'{"a":1}'\|json_decode` |
|
|
241
|
-
| `base64_encode` | `"hello"\|base64_encode` |
|
|
242
|
-
| `base64_decode` | `"aGVsbG8="\|base64_decode` |
|
|
243
|
-
| `url_encode` | `"a b"\|url_encode` |
|
|
244
|
-
| `url_decode` | `"a%20b"\|url_decode` |
|
|
245
|
-
| `xml_decode` | `"<a>1</a>"\|xml_decode` |
|
|
246
|
-
| `yaml_encode` / `yaml_decode` | YAML conversion |
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## Security Filters
|
|
251
|
-
|
|
252
|
-
| Filter | Example |
|
|
253
|
-
|--------|---------|
|
|
254
|
-
| `md5` | `"text"\|md5` |
|
|
255
|
-
| `sha1` / `sha256` / `sha512` | Hash functions |
|
|
256
|
-
| `hmac_sha256` | `"msg"\|hmac_sha256:"key"` |
|
|
257
|
-
| `encrypt` | `"data"\|encrypt:"aes-256-cbc":"key":"iv"` |
|
|
258
|
-
| `decrypt` | `$enc\|decrypt:"aes-256-cbc":"key":"iv"` |
|
|
259
|
-
| `uuid` | `\|uuid` |
|
|
260
|
-
|
|
261
|
-
---
|
|
262
|
-
|
|
263
|
-
## System Variables
|
|
264
|
-
|
|
265
|
-
### Request Context
|
|
266
|
-
| Variable | Description |
|
|
267
|
-
|----------|-------------|
|
|
268
|
-
| `$remote_ip` | Client IP address |
|
|
269
|
-
| `$request_method` | HTTP method |
|
|
270
|
-
| `$request_uri` | Full request URI |
|
|
271
|
-
| `$http_headers` | Request headers object |
|
|
272
|
-
| `$request_auth_token` | Authorization token |
|
|
273
|
-
|
|
274
|
-
### System Context
|
|
275
|
-
| Variable | Description |
|
|
276
|
-
|----------|-------------|
|
|
277
|
-
| `$datasource` | Current data source name |
|
|
278
|
-
| `$branch` | Current branch name |
|
|
279
|
-
| `$tenant` | Tenant ID |
|
|
280
|
-
| `$api_baseurl` | API base URL |
|
|
281
|
-
|
|
282
|
-
### Access via $env
|
|
283
|
-
```xs
|
|
284
|
-
var $client_ip { value = $env.$remote_ip }
|
|
285
|
-
var $method { value = $env.$request_method }
|
|
286
|
-
var $headers { value = $env.$http_headers }
|
|
287
|
-
```
|