@xano/developer-mcp 1.0.34 → 1.0.36
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/README.md +17 -2
- 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 +31 -1
- package/dist/xanoscript.test.js +6 -0
- package/dist/xanoscript_docs/README.md +56 -43
- package/dist/xanoscript_docs/addons.md +10 -0
- package/dist/xanoscript_docs/agents.md +15 -0
- package/dist/xanoscript_docs/apis.md +45 -24
- package/dist/xanoscript_docs/cheatsheet.md +252 -0
- package/dist/xanoscript_docs/database.md +37 -0
- package/dist/xanoscript_docs/docs_index.json +236 -0
- package/dist/xanoscript_docs/frontend.md +10 -0
- package/dist/xanoscript_docs/functions.md +18 -0
- package/dist/xanoscript_docs/integrations/cloud-storage.md +142 -0
- package/dist/xanoscript_docs/integrations/external-apis.md +201 -0
- package/dist/xanoscript_docs/integrations/redis.md +194 -0
- package/dist/xanoscript_docs/integrations/search.md +242 -0
- package/dist/xanoscript_docs/integrations/utilities.md +331 -0
- package/dist/xanoscript_docs/integrations.md +55 -901
- package/dist/xanoscript_docs/mcp-servers.md +10 -0
- package/dist/xanoscript_docs/performance.md +15 -0
- package/dist/xanoscript_docs/quickstart.md +288 -41
- package/dist/xanoscript_docs/run.md +10 -0
- package/dist/xanoscript_docs/security.md +26 -0
- package/dist/xanoscript_docs/streaming.md +10 -0
- package/dist/xanoscript_docs/syntax.md +78 -0
- package/dist/xanoscript_docs/tables.md +15 -0
- package/dist/xanoscript_docs/tasks.md +11 -0
- package/dist/xanoscript_docs/tools.md +15 -0
- package/dist/xanoscript_docs/triggers.md +57 -192
- package/dist/xanoscript_docs/types.md +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "function/**/*.xs, api/**/*.xs, task/**/*.xs"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Utility Integrations
|
|
6
|
+
|
|
7
|
+
> **TL;DR:** Local storage (`storage.*`), security (`security.*`), email (`util.send_email`), archives (`zip.*`), Lambda (`api.lambda`), and utilities (template engine, geo, etc.).
|
|
8
|
+
|
|
9
|
+
## Quick Reference
|
|
10
|
+
|
|
11
|
+
| Category | Prefix | Purpose |
|
|
12
|
+
|----------|--------|---------|
|
|
13
|
+
| Local Storage | `storage.*` | File resources, images, attachments |
|
|
14
|
+
| Security | `security.*` | Passwords, encryption, JWT, random |
|
|
15
|
+
| Email | `util.send_email` | Send emails via providers |
|
|
16
|
+
| Archives | `zip.*` | Create, modify, extract ZIP files |
|
|
17
|
+
| Lambda | `api.lambda` | Execute inline code |
|
|
18
|
+
| Utilities | `util.*` | Templates, IP lookup, geo distance |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Local Storage
|
|
23
|
+
|
|
24
|
+
### File Operations
|
|
25
|
+
|
|
26
|
+
```xs
|
|
27
|
+
# Create file resource
|
|
28
|
+
storage.create_file_resource {
|
|
29
|
+
filename = "report.csv"
|
|
30
|
+
filedata = $csv_content
|
|
31
|
+
} as $file
|
|
32
|
+
|
|
33
|
+
# Read file resource
|
|
34
|
+
storage.read_file_resource {
|
|
35
|
+
value = $input.file
|
|
36
|
+
} as $content
|
|
37
|
+
|
|
38
|
+
# Delete file
|
|
39
|
+
storage.delete_file { pathname = "temp/old-file.txt" }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Image/Attachment Handling
|
|
43
|
+
|
|
44
|
+
```xs
|
|
45
|
+
# Create image metadata
|
|
46
|
+
storage.create_image {
|
|
47
|
+
value = $input.image
|
|
48
|
+
access = "public"
|
|
49
|
+
filename = "profile.jpg"
|
|
50
|
+
} as $image_meta
|
|
51
|
+
|
|
52
|
+
# Create attachment metadata
|
|
53
|
+
storage.create_attachment {
|
|
54
|
+
value = $input.file
|
|
55
|
+
access = "private"
|
|
56
|
+
filename = "document.pdf"
|
|
57
|
+
} as $attachment_meta
|
|
58
|
+
|
|
59
|
+
# Sign private URL
|
|
60
|
+
storage.sign_private_url {
|
|
61
|
+
pathname = "private/document.pdf"
|
|
62
|
+
ttl = 300
|
|
63
|
+
} as $signed_url
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Security
|
|
69
|
+
|
|
70
|
+
### Password Hashing
|
|
71
|
+
|
|
72
|
+
```xs
|
|
73
|
+
# Password is auto-hashed on insert
|
|
74
|
+
db.add "user" {
|
|
75
|
+
data = { email: $input.email, password: $input.password }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
# Verify password
|
|
79
|
+
security.check_password {
|
|
80
|
+
text_password = $input.password
|
|
81
|
+
hash_password = $user.password
|
|
82
|
+
} as $is_valid
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Encryption
|
|
86
|
+
|
|
87
|
+
```xs
|
|
88
|
+
# Encrypt
|
|
89
|
+
security.encrypt {
|
|
90
|
+
data = $sensitive_data
|
|
91
|
+
algorithm = "aes-256-cbc"
|
|
92
|
+
key = $env.ENCRYPTION_KEY
|
|
93
|
+
iv = $env.ENCRYPTION_IV
|
|
94
|
+
} as $encrypted
|
|
95
|
+
|
|
96
|
+
# Decrypt
|
|
97
|
+
security.decrypt {
|
|
98
|
+
data = $encrypted
|
|
99
|
+
algorithm = "aes-256-cbc"
|
|
100
|
+
key = $env.ENCRYPTION_KEY
|
|
101
|
+
iv = $env.ENCRYPTION_IV
|
|
102
|
+
} as $decrypted
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### JWT (JWS/JWE)
|
|
106
|
+
|
|
107
|
+
```xs
|
|
108
|
+
# Sign JWT
|
|
109
|
+
security.jws_encode {
|
|
110
|
+
claims = { user_id: $user.id, role: $user.role }
|
|
111
|
+
key = $env.JWT_SECRET
|
|
112
|
+
signature_algorithm = "HS256"
|
|
113
|
+
ttl = 3600
|
|
114
|
+
} as $token
|
|
115
|
+
|
|
116
|
+
# Verify JWT
|
|
117
|
+
security.jws_decode {
|
|
118
|
+
token = $input.token
|
|
119
|
+
key = $env.JWT_SECRET
|
|
120
|
+
signature_algorithm = "HS256"
|
|
121
|
+
} as $claims
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Random Generation
|
|
125
|
+
|
|
126
|
+
```xs
|
|
127
|
+
security.create_uuid as $uuid
|
|
128
|
+
security.random_number { min = 1, max = 100 } as $random
|
|
129
|
+
security.random_bytes { length = 32 } as $bytes
|
|
130
|
+
security.create_password {
|
|
131
|
+
character_count = 16
|
|
132
|
+
require_lowercase = true
|
|
133
|
+
require_uppercase = true
|
|
134
|
+
require_digit = true
|
|
135
|
+
require_symbol = true
|
|
136
|
+
} as $password
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Email
|
|
142
|
+
|
|
143
|
+
```xs
|
|
144
|
+
util.send_email {
|
|
145
|
+
service_provider = "resend"
|
|
146
|
+
api_key = $env.RESEND_API_KEY
|
|
147
|
+
to = $user.email
|
|
148
|
+
from = "noreply@example.com"
|
|
149
|
+
subject = "Welcome!"
|
|
150
|
+
message = "Thanks for signing up."
|
|
151
|
+
reply_to = "support@example.com"
|
|
152
|
+
} as $result
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Zip/Archive Operations
|
|
158
|
+
|
|
159
|
+
### Create Archive
|
|
160
|
+
|
|
161
|
+
```xs
|
|
162
|
+
zip.create_archive {
|
|
163
|
+
filename = "export.zip"
|
|
164
|
+
} as $archive
|
|
165
|
+
|
|
166
|
+
// Add files
|
|
167
|
+
zip.add_to_archive {
|
|
168
|
+
archive = $archive
|
|
169
|
+
files = [
|
|
170
|
+
{ path: "data/users.json", content: $users|json_encode },
|
|
171
|
+
{ path: "data/orders.json", content: $orders|json_encode },
|
|
172
|
+
{ path: "readme.txt", content: "Export generated on " ~ now|format_timestamp:"Y-m-d" }
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
storage.create_file_resource {
|
|
177
|
+
filename = "export.zip"
|
|
178
|
+
filedata = $archive
|
|
179
|
+
} as $file
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Add to Existing Archive
|
|
183
|
+
|
|
184
|
+
```xs
|
|
185
|
+
zip.add_to_archive {
|
|
186
|
+
archive = $input.zip_file
|
|
187
|
+
files = [
|
|
188
|
+
{ path: "additional/data.json", content: $data|json_encode }
|
|
189
|
+
]
|
|
190
|
+
} as $updated_archive
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Delete from Archive
|
|
194
|
+
|
|
195
|
+
```xs
|
|
196
|
+
zip.delete_from_archive {
|
|
197
|
+
archive = $input.zip_file
|
|
198
|
+
paths = ["old_file.txt", "deprecated/"]
|
|
199
|
+
} as $cleaned_archive
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Extract Archive
|
|
203
|
+
|
|
204
|
+
```xs
|
|
205
|
+
zip.extract {
|
|
206
|
+
archive = $input.zip_file
|
|
207
|
+
target_path = "extracted/"
|
|
208
|
+
} as $extracted_files
|
|
209
|
+
|
|
210
|
+
// $extracted_files = [
|
|
211
|
+
// { path: "data/users.json", content: "..." },
|
|
212
|
+
// { path: "readme.txt", content: "..." }
|
|
213
|
+
// ]
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### View Contents
|
|
217
|
+
|
|
218
|
+
```xs
|
|
219
|
+
zip.view_contents {
|
|
220
|
+
archive = $input.zip_file
|
|
221
|
+
} as $contents
|
|
222
|
+
|
|
223
|
+
// $contents = [
|
|
224
|
+
// { path: "data/users.json", size: 1234, compressed_size: 456 },
|
|
225
|
+
// { path: "readme.txt", size: 100, compressed_size: 80 }
|
|
226
|
+
// ]
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Full Example: Export & Download
|
|
230
|
+
|
|
231
|
+
```xs
|
|
232
|
+
query "export_data" {
|
|
233
|
+
input {
|
|
234
|
+
int[] user_ids
|
|
235
|
+
}
|
|
236
|
+
stack {
|
|
237
|
+
// Fetch data
|
|
238
|
+
db.query "user" {
|
|
239
|
+
where = $db.user.id in $input.user_ids
|
|
240
|
+
} as $users
|
|
241
|
+
|
|
242
|
+
db.query "order" {
|
|
243
|
+
where = $db.order.user_id in $input.user_ids
|
|
244
|
+
} as $orders
|
|
245
|
+
|
|
246
|
+
// Create archive
|
|
247
|
+
zip.create_archive {
|
|
248
|
+
filename = "user_export_" ~ now|format_timestamp:"Y-m-d" ~ ".zip"
|
|
249
|
+
} as $archive
|
|
250
|
+
|
|
251
|
+
zip.add_to_archive {
|
|
252
|
+
archive = $archive
|
|
253
|
+
files = [
|
|
254
|
+
{ path: "users.json", content: $users|json_encode },
|
|
255
|
+
{ path: "orders.json", content: $orders|json_encode },
|
|
256
|
+
{ path: "manifest.json", content: {
|
|
257
|
+
exported_at: now,
|
|
258
|
+
user_count: $users|count,
|
|
259
|
+
order_count: $orders|count
|
|
260
|
+
}|json_encode }
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
storage.create_file_resource {
|
|
265
|
+
filename = "export.zip"
|
|
266
|
+
filedata = $archive
|
|
267
|
+
} as $download
|
|
268
|
+
}
|
|
269
|
+
response = { download_url: $download.url }
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Lambda Integration
|
|
276
|
+
|
|
277
|
+
### api.lambda
|
|
278
|
+
|
|
279
|
+
Execute inline code with optional timeout.
|
|
280
|
+
|
|
281
|
+
```xs
|
|
282
|
+
api.lambda {
|
|
283
|
+
code = 'return "hello";'
|
|
284
|
+
timeout = 10
|
|
285
|
+
} as $result
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
| Parameter | Type | Description |
|
|
289
|
+
|-----------|------|-------------|
|
|
290
|
+
| `code` | string | Code to execute (required) |
|
|
291
|
+
| `timeout` | integer | Execution timeout in seconds (optional) |
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Utilities
|
|
296
|
+
|
|
297
|
+
```xs
|
|
298
|
+
// Template engine (Twig)
|
|
299
|
+
util.template_engine {
|
|
300
|
+
value = """
|
|
301
|
+
Hello {{ $var.name }}!
|
|
302
|
+
{% for item in $var.items %}
|
|
303
|
+
- {{ item.name }}
|
|
304
|
+
{% endfor %}
|
|
305
|
+
"""
|
|
306
|
+
} as $rendered
|
|
307
|
+
|
|
308
|
+
// IP lookup
|
|
309
|
+
util.ip_lookup { value = $env.$remote_ip } as $location
|
|
310
|
+
|
|
311
|
+
// Geo distance
|
|
312
|
+
util.geo_distance {
|
|
313
|
+
latitude_1 = 40.71
|
|
314
|
+
longitude_1 = -74.00
|
|
315
|
+
latitude_2 = 34.05
|
|
316
|
+
longitude_2 = -118.24
|
|
317
|
+
} as $distance_km
|
|
318
|
+
|
|
319
|
+
// Sleep
|
|
320
|
+
util.sleep { value = 5 }
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Related Topics
|
|
326
|
+
|
|
327
|
+
| Topic | Description |
|
|
328
|
+
|-------|-------------|
|
|
329
|
+
| `security` | Security best practices |
|
|
330
|
+
| `integrations/cloud-storage` | Cloud storage alternatives |
|
|
331
|
+
| `integrations` | All integrations index |
|