@xano/developer-mcp 1.0.51 → 1.0.52
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.
|
@@ -10,6 +10,36 @@ Essential patterns for XanoScript development. Use this as a quick reference for
|
|
|
10
10
|
|
|
11
11
|
## Quick Reference
|
|
12
12
|
|
|
13
|
+
### Variable Access Rules
|
|
14
|
+
|
|
15
|
+
**Inputs must use `$input.fieldname` — no shorthand exists.**
|
|
16
|
+
|
|
17
|
+
Input fields declared in the `input {}` block are only accessible via the `$input` prefix. You cannot reference them as bare variables.
|
|
18
|
+
|
|
19
|
+
```xs
|
|
20
|
+
input {
|
|
21
|
+
text name
|
|
22
|
+
int age
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ❌ Wrong — $name is not defined; inputs live on $input
|
|
26
|
+
var $greeting { value = "Hello, " ~ $name }
|
|
27
|
+
|
|
28
|
+
// ✅ Correct
|
|
29
|
+
var $greeting { value = "Hello, " ~ $input.name }
|
|
30
|
+
var $is_adult { value = $input.age >= 18 }
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Stack variables have an optional `$var.` prefix — both forms are identical.**
|
|
34
|
+
|
|
35
|
+
```xs
|
|
36
|
+
var $total { value = 100 }
|
|
37
|
+
|
|
38
|
+
// ✅ Both are the same thing
|
|
39
|
+
$var.total // explicit prefix form
|
|
40
|
+
$total // shorthand form (no prefix)
|
|
41
|
+
```
|
|
42
|
+
|
|
13
43
|
### Reserved Variable Names
|
|
14
44
|
|
|
15
45
|
These variable names are reserved and cannot be used:
|
|
@@ -85,6 +85,29 @@ Working with...
|
|
|
85
85
|
|
|
86
86
|
## Quick Reference
|
|
87
87
|
|
|
88
|
+
### Variable Access Prefixes
|
|
89
|
+
|
|
90
|
+
| Prefix | Applies to | Shorthand? |
|
|
91
|
+
|--------|-----------|------------|
|
|
92
|
+
| `$input.field` | Input parameters | No — prefix always required |
|
|
93
|
+
| `$var.field` | Stack variables | Yes — `$field` is identical |
|
|
94
|
+
| `$auth.field` | Auth context | No |
|
|
95
|
+
| `$env.NAME` | Environment variables | No |
|
|
96
|
+
| `$db.table.field` | DB field refs (queries) | No |
|
|
97
|
+
|
|
98
|
+
```xs
|
|
99
|
+
// ❌ Wrong — input fields are NOT accessible as bare variables
|
|
100
|
+
var $name { value = $name } // undefined; inputs live on $input
|
|
101
|
+
|
|
102
|
+
// ✅ Correct — always use $input for input fields
|
|
103
|
+
var $name { value = $input.name }
|
|
104
|
+
|
|
105
|
+
// ✅ Both are valid for stack variables
|
|
106
|
+
var $total { value = 0 }
|
|
107
|
+
$var.total // explicit
|
|
108
|
+
$total // shorthand — same thing
|
|
109
|
+
```
|
|
110
|
+
|
|
88
111
|
### Operators
|
|
89
112
|
| Category | Operators |
|
|
90
113
|
|----------|-----------|
|
package/package.json
CHANGED