@xano/developer-mcp 1.0.33 → 1.0.35
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/tools/index.d.ts +2 -15
- package/dist/tools/index.js +2 -2
- package/dist/tools/validate_xanoscript.d.ts +84 -9
- package/dist/tools/validate_xanoscript.js +345 -31
- package/dist/xanoscript.js +5 -0
- package/dist/xanoscript.test.js +4 -2
- package/dist/xanoscript_docs/README.md +81 -7
- package/dist/xanoscript_docs/database.md +14 -0
- package/dist/xanoscript_docs/functions.md +14 -0
- package/dist/xanoscript_docs/integrations.md +75 -5
- package/dist/xanoscript_docs/quickstart.md +653 -0
- package/dist/xanoscript_docs/syntax.md +104 -1
- package/dist/xanoscript_docs/types.md +14 -0
- package/package.json +1 -1
|
@@ -21,12 +21,67 @@ Complete reference for XanoScript expressions, operators, and filters.
|
|
|
21
21
|
| Filter | Purpose | Example |
|
|
22
22
|
|--------|---------|---------|
|
|
23
23
|
| `trim` | Remove whitespace | `$s\|trim` |
|
|
24
|
-
| `
|
|
24
|
+
| `to_lower` / `to_upper` | Case conversion | `$s\|to_lower` |
|
|
25
25
|
| `first` / `last` | Array endpoints | `$arr\|first` |
|
|
26
26
|
| `count` | Array/object length | `$arr\|count` |
|
|
27
27
|
| `get` | Object property | `$obj\|get:"key"` |
|
|
28
28
|
| `set` | Set property | `$obj\|set:"key":"val"` |
|
|
29
29
|
| `json_encode` / `json_decode` | JSON conversion | `$obj\|json_encode` |
|
|
30
|
+
| `to_text` / `to_int` | Type conversion | `$num\|to_text` |
|
|
31
|
+
|
|
32
|
+
> **Note:** There is no `default` filter. Use conditional blocks or `first_notnull`/`first_notempty` instead.
|
|
33
|
+
|
|
34
|
+
### String Concatenation with Filters
|
|
35
|
+
|
|
36
|
+
When concatenating strings that use filters, wrap each filtered expression in parentheses:
|
|
37
|
+
|
|
38
|
+
```xs
|
|
39
|
+
// ✅ Correct - parentheses around filtered expressions
|
|
40
|
+
var $message {
|
|
41
|
+
value = ($status|to_text) ~ ": " ~ ($data|json_encode)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ❌ Incorrect - missing parentheses causes parse error
|
|
45
|
+
var $message {
|
|
46
|
+
value = $status|to_text ~ ": " ~ $data|json_encode
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Conditional Blocks
|
|
53
|
+
|
|
54
|
+
Use `conditional` blocks for if/elseif/else logic:
|
|
55
|
+
|
|
56
|
+
```xs
|
|
57
|
+
conditional {
|
|
58
|
+
if (`$status == "success"`) {
|
|
59
|
+
var $message { value = "All good!" }
|
|
60
|
+
}
|
|
61
|
+
elseif (`$status == "pending"`) {
|
|
62
|
+
var $message { value = "Please wait..." }
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
var $message { value = "Unknown status" }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
> **Important:** Use `elseif` (one word), not `else if` or `else { if (...) }`. Nested `if` inside `else` blocks is not supported.
|
|
71
|
+
|
|
72
|
+
### Conditional as Expression
|
|
73
|
+
|
|
74
|
+
Use conditional blocks inline to return values:
|
|
75
|
+
|
|
76
|
+
```xs
|
|
77
|
+
var $tier_limit {
|
|
78
|
+
value = conditional {
|
|
79
|
+
if ($auth.tier == "premium") { 1000 }
|
|
80
|
+
elseif ($auth.tier == "pro") { 500 }
|
|
81
|
+
else { 100 }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
30
85
|
|
|
31
86
|
---
|
|
32
87
|
|
|
@@ -225,6 +280,8 @@ Generate numeric ranges with the `..` operator:
|
|
|
225
280
|
|
|
226
281
|
## Type Filters
|
|
227
282
|
|
|
283
|
+
> **Full reference:** For input types and validation, see `xanoscript_docs({ topic: "types" })`.
|
|
284
|
+
|
|
228
285
|
| Filter | Example | Result |
|
|
229
286
|
|--------|---------|--------|
|
|
230
287
|
| `to_int` | `"123"\|to_int` | `123` |
|
|
@@ -288,6 +345,8 @@ $ts|timestamp_day_of_week // Day (0=Sunday)
|
|
|
288
345
|
|
|
289
346
|
## Security Filters
|
|
290
347
|
|
|
348
|
+
> **Full reference:** For security best practices, see `xanoscript_docs({ topic: "security" })`.
|
|
349
|
+
|
|
291
350
|
| Filter | Example |
|
|
292
351
|
|--------|---------|
|
|
293
352
|
| `md5` | `"text"\|md5` |
|
|
@@ -304,6 +363,8 @@ $ts|timestamp_day_of_week // Day (0=Sunday)
|
|
|
304
363
|
|
|
305
364
|
## DB Query Filters
|
|
306
365
|
|
|
366
|
+
> **Full reference:** For complete database operations, see `xanoscript_docs({ topic: "database" })`.
|
|
367
|
+
|
|
307
368
|
Used in `db.query` where clauses:
|
|
308
369
|
|
|
309
370
|
| Filter | Example | Description |
|
|
@@ -431,6 +492,32 @@ var $client_ip { value = $env.$remote_ip }
|
|
|
431
492
|
var $method { value = $env.$request_method }
|
|
432
493
|
var $headers { value = $env.$http_headers }
|
|
433
494
|
var $current_branch { value = $env.$branch }
|
|
495
|
+
|
|
496
|
+
// Custom environment variables (set in Xano dashboard)
|
|
497
|
+
var $api_key { value = $env.MY_API_KEY }
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### $env Limitations
|
|
501
|
+
|
|
502
|
+
> **Important:** `$env` variables cannot be used in `run.job` or `run.service` input blocks. Input values must be constants.
|
|
503
|
+
|
|
504
|
+
```xs
|
|
505
|
+
// ❌ Invalid - $env not allowed in run.job input
|
|
506
|
+
run.job "my_job" {
|
|
507
|
+
input {
|
|
508
|
+
text api_key = $env.API_KEY // Error!
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// ✅ Valid - access $env inside the stack instead
|
|
513
|
+
run.job "my_job" {
|
|
514
|
+
input {
|
|
515
|
+
text api_key // No default value
|
|
516
|
+
}
|
|
517
|
+
stack {
|
|
518
|
+
var $key { value = $env.API_KEY }
|
|
519
|
+
}
|
|
520
|
+
}
|
|
434
521
|
```
|
|
435
522
|
|
|
436
523
|
---
|
|
@@ -650,6 +737,8 @@ $db.created_at|timestamp_epoch_ms // Milliseconds since epoch
|
|
|
650
737
|
|
|
651
738
|
### Vector Operations (AI/ML)
|
|
652
739
|
|
|
740
|
+
> **Full reference:** For AI agents and embeddings, see `xanoscript_docs({ topic: "agents" })`.
|
|
741
|
+
|
|
653
742
|
Additional vector similarity functions:
|
|
654
743
|
|
|
655
744
|
```xs
|
|
@@ -660,3 +749,17 @@ $db.embedding|inner_product:$input.vector // Inner product
|
|
|
660
749
|
// Geo covers (for polygon containment)
|
|
661
750
|
$db.boundary|covers:$input.point // Polygon covers point
|
|
662
751
|
```
|
|
752
|
+
|
|
753
|
+
---
|
|
754
|
+
|
|
755
|
+
## Related Topics
|
|
756
|
+
|
|
757
|
+
Explore more with `xanoscript_docs({ topic: "<topic>" })`:
|
|
758
|
+
|
|
759
|
+
| Topic | Description |
|
|
760
|
+
|-------|-------------|
|
|
761
|
+
| `quickstart` | Common patterns, examples, mistakes to avoid |
|
|
762
|
+
| `types` | Data types, input validation, schema definitions |
|
|
763
|
+
| `database` | All db.* operations with query examples |
|
|
764
|
+
| `functions` | Reusable function stacks, async patterns |
|
|
765
|
+
| `security` | Security best practices and authentication |
|
|
@@ -362,3 +362,17 @@ precondition ($input.start_date < $input.end_date) {
|
|
|
362
362
|
2. **Use filters first** - Prefer declarative filters over stack validation
|
|
363
363
|
3. **Mark sensitive data** - Use `sensitive = true` for PII/credentials
|
|
364
364
|
4. **Validate at boundaries** - Validate user input, trust internal calls
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Related Topics
|
|
369
|
+
|
|
370
|
+
Explore more with `xanoscript_docs({ topic: "<topic>" })`:
|
|
371
|
+
|
|
372
|
+
| Topic | Description |
|
|
373
|
+
|-------|-------------|
|
|
374
|
+
| `schema` | Runtime schema parsing and validation |
|
|
375
|
+
| `syntax` | All filters, operators, and error handling |
|
|
376
|
+
| `quickstart` | Common patterns and mistakes to avoid |
|
|
377
|
+
| `functions` | Using input blocks in functions |
|
|
378
|
+
| `apis` | Using input blocks in API endpoints |
|
package/package.json
CHANGED