@xano/developer-mcp 1.0.27 → 1.0.29
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 +1 -1
- package/dist/api_docs/format.d.ts +5 -0
- package/dist/api_docs/format.js +171 -0
- package/dist/api_docs/index.d.ts +52 -0
- package/dist/api_docs/index.js +111 -0
- package/dist/api_docs/topics/agent.d.ts +2 -0
- package/dist/api_docs/topics/agent.js +142 -0
- package/dist/api_docs/topics/api.d.ts +2 -0
- package/dist/api_docs/topics/api.js +176 -0
- package/dist/api_docs/topics/apigroup.d.ts +2 -0
- package/dist/api_docs/topics/apigroup.js +124 -0
- package/dist/api_docs/topics/authentication.d.ts +2 -0
- package/dist/api_docs/topics/authentication.js +61 -0
- package/dist/api_docs/topics/branch.d.ts +2 -0
- package/dist/api_docs/topics/branch.js +73 -0
- package/dist/api_docs/topics/file.d.ts +2 -0
- package/dist/api_docs/topics/file.js +70 -0
- package/dist/api_docs/topics/function.d.ts +2 -0
- package/dist/api_docs/topics/function.js +164 -0
- package/dist/api_docs/topics/history.d.ts +2 -0
- package/dist/api_docs/topics/history.js +149 -0
- package/dist/api_docs/topics/mcp_server.d.ts +2 -0
- package/dist/api_docs/topics/mcp_server.js +139 -0
- package/dist/api_docs/topics/middleware.d.ts +2 -0
- package/dist/api_docs/topics/middleware.js +156 -0
- package/dist/api_docs/topics/realtime.d.ts +2 -0
- package/dist/api_docs/topics/realtime.js +112 -0
- package/dist/api_docs/topics/start.d.ts +2 -0
- package/dist/api_docs/topics/start.js +107 -0
- package/dist/api_docs/topics/table.d.ts +2 -0
- package/dist/api_docs/topics/table.js +195 -0
- package/dist/api_docs/topics/task.d.ts +2 -0
- package/dist/api_docs/topics/task.js +165 -0
- package/dist/api_docs/topics/tool.d.ts +2 -0
- package/dist/api_docs/topics/tool.js +150 -0
- package/dist/api_docs/topics/workflows.d.ts +2 -0
- package/dist/api_docs/topics/workflows.js +131 -0
- package/dist/api_docs/topics/workspace.d.ts +2 -0
- package/dist/api_docs/topics/workspace.js +153 -0
- package/dist/api_docs/types.d.ts +79 -0
- package/dist/api_docs/types.js +4 -0
- package/dist/meta_api_docs/topics/branch.js +154 -18
- package/dist/meta_api_docs/topics/workspace.js +45 -2
- package/dist/templates/init-workspace.d.ts +10 -0
- package/dist/templates/init-workspace.js +278 -0
- package/dist/templates/xanoscript-index.d.ts +11 -0
- package/dist/templates/xanoscript-index.js +72 -0
- package/dist/xanoscript_docs/README.md +3 -13
- package/dist/xanoscript_docs/ephemeral.md +330 -0
- package/dist/xanoscript_docs/functions.md +0 -21
- package/dist/xanoscript_docs/integrations.md +0 -10
- package/dist/xanoscript_docs/performance.md +1 -10
- package/dist/xanoscript_docs/realtime.md +1 -48
- package/dist/xanoscript_docs/security.md +2 -0
- package/dist/xanoscript_docs/tools.md +2 -21
- package/dist/xanoscript_docs/triggers.md +2 -27
- package/dist/xanoscript_docs_auto/README.md +119 -0
- package/dist/xanoscript_docs_auto/agents.md +446 -0
- package/dist/xanoscript_docs_auto/apis.md +517 -0
- package/dist/xanoscript_docs_auto/control-flow.md +543 -0
- package/dist/xanoscript_docs_auto/database.md +551 -0
- package/dist/xanoscript_docs_auto/debugging.md +527 -0
- package/dist/xanoscript_docs_auto/filters.md +464 -0
- package/dist/xanoscript_docs_auto/functions.md +431 -0
- package/dist/xanoscript_docs_auto/integrations.md +657 -0
- package/dist/xanoscript_docs_auto/mcp-servers.md +408 -0
- package/dist/xanoscript_docs_auto/operators.md +368 -0
- package/dist/xanoscript_docs_auto/syntax.md +287 -0
- package/dist/xanoscript_docs_auto/tables.md +447 -0
- package/dist/xanoscript_docs_auto/tasks.md +479 -0
- package/dist/xanoscript_docs_auto/testing.md +574 -0
- package/dist/xanoscript_docs_auto/tools.md +485 -0
- package/dist/xanoscript_docs_auto/triggers.md +595 -0
- package/dist/xanoscript_docs_auto/types.md +323 -0
- package/dist/xanoscript_docs_auto/variables.md +462 -0
- package/dist/xanoscript_docs_auto/version.json +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,657 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "functions/**/*.xs,apis/**/*.xs,tasks/*.xs"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Integrations
|
|
6
|
+
|
|
7
|
+
Cloud storage, Redis, external APIs, and security functions.
|
|
8
|
+
|
|
9
|
+
## Quick Reference
|
|
10
|
+
|
|
11
|
+
| Domain | Functions |
|
|
12
|
+
|--------|-----------|
|
|
13
|
+
| API | `api.request`, `api.call`, `api.stream` |
|
|
14
|
+
| Redis | `redis.get`, `redis.set`, `redis.del`, `redis.ratelimit` |
|
|
15
|
+
| AWS S3 | `cloud.aws.s3.*` |
|
|
16
|
+
| Google Cloud | `cloud.google.storage.*` |
|
|
17
|
+
| Azure | `cloud.azure.storage.*` |
|
|
18
|
+
| Security | `security.encrypt`, `security.decrypt`, `security.create_auth_token` |
|
|
19
|
+
| Email | `util.send_email` |
|
|
20
|
+
| Storage | `storage.create_file_resource`, `storage.read_file` |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## External API Requests
|
|
25
|
+
|
|
26
|
+
### Basic Request
|
|
27
|
+
|
|
28
|
+
```xs
|
|
29
|
+
api.request {
|
|
30
|
+
url = "https://api.example.com/data"
|
|
31
|
+
method = "GET"
|
|
32
|
+
} as $response
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### With Headers and Body
|
|
36
|
+
|
|
37
|
+
```xs
|
|
38
|
+
api.request {
|
|
39
|
+
url = "https://api.example.com/users"
|
|
40
|
+
method = "POST"
|
|
41
|
+
headers = {
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
"Authorization": "Bearer " ~ $env.API_KEY
|
|
44
|
+
}
|
|
45
|
+
body = {
|
|
46
|
+
name: $input.name,
|
|
47
|
+
email: $input.email
|
|
48
|
+
}
|
|
49
|
+
} as $response
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Query Parameters
|
|
53
|
+
|
|
54
|
+
```xs
|
|
55
|
+
api.request {
|
|
56
|
+
url = "https://api.example.com/search"
|
|
57
|
+
method = "GET"
|
|
58
|
+
params = {
|
|
59
|
+
q: $input.query,
|
|
60
|
+
limit: 10,
|
|
61
|
+
page: $input.page
|
|
62
|
+
}
|
|
63
|
+
} as $response
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Form Data
|
|
67
|
+
|
|
68
|
+
```xs
|
|
69
|
+
api.request {
|
|
70
|
+
url = "https://api.example.com/upload"
|
|
71
|
+
method = "POST"
|
|
72
|
+
headers = {
|
|
73
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
74
|
+
}
|
|
75
|
+
form = {
|
|
76
|
+
field1: "value1",
|
|
77
|
+
field2: "value2"
|
|
78
|
+
}
|
|
79
|
+
} as $response
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Error Handling
|
|
83
|
+
|
|
84
|
+
```xs
|
|
85
|
+
try_catch {
|
|
86
|
+
try {
|
|
87
|
+
api.request {
|
|
88
|
+
url = $external_api_url
|
|
89
|
+
method = "GET"
|
|
90
|
+
timeout = 5000
|
|
91
|
+
} as $response
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
debug.log { value = "API request failed: " ~ $error.message }
|
|
95
|
+
var $response { value = null }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Internal API Calls
|
|
103
|
+
|
|
104
|
+
Call other Xano API endpoints:
|
|
105
|
+
|
|
106
|
+
```xs
|
|
107
|
+
api.call {
|
|
108
|
+
path = "/api/users/validate"
|
|
109
|
+
method = "POST"
|
|
110
|
+
body = {
|
|
111
|
+
email: $input.email
|
|
112
|
+
}
|
|
113
|
+
} as $validation_result
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Redis
|
|
119
|
+
|
|
120
|
+
### Get/Set Values
|
|
121
|
+
|
|
122
|
+
```xs
|
|
123
|
+
// Set value with TTL (seconds)
|
|
124
|
+
redis.set {
|
|
125
|
+
key = "user:" ~ $user.id
|
|
126
|
+
value = $user|json_encode
|
|
127
|
+
ttl = 3600 // 1 hour
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Get value
|
|
131
|
+
redis.get {
|
|
132
|
+
key = "user:" ~ $input.user_id
|
|
133
|
+
} as $cached_user
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Delete Key
|
|
137
|
+
|
|
138
|
+
```xs
|
|
139
|
+
redis.del {
|
|
140
|
+
key = "user:" ~ $input.user_id
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Check Existence
|
|
145
|
+
|
|
146
|
+
```xs
|
|
147
|
+
redis.has {
|
|
148
|
+
key = "session:" ~ $input.token
|
|
149
|
+
} as $exists
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Increment/Decrement
|
|
153
|
+
|
|
154
|
+
```xs
|
|
155
|
+
redis.incr {
|
|
156
|
+
key = "counter:" ~ $input.id
|
|
157
|
+
} as $new_count
|
|
158
|
+
|
|
159
|
+
redis.decr {
|
|
160
|
+
key = "stock:" ~ $product.id
|
|
161
|
+
} as $remaining
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### List Operations
|
|
165
|
+
|
|
166
|
+
```xs
|
|
167
|
+
// Add to list
|
|
168
|
+
redis.push {
|
|
169
|
+
key = "queue:jobs"
|
|
170
|
+
value = $job|json_encode
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Get from list
|
|
174
|
+
redis.pop {
|
|
175
|
+
key = "queue:jobs"
|
|
176
|
+
} as $next_job
|
|
177
|
+
|
|
178
|
+
// Get range
|
|
179
|
+
redis.range {
|
|
180
|
+
key = "recent:items"
|
|
181
|
+
start = 0
|
|
182
|
+
stop = 9
|
|
183
|
+
} as $recent_items
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Rate Limiting
|
|
187
|
+
|
|
188
|
+
```xs
|
|
189
|
+
redis.ratelimit {
|
|
190
|
+
key = "rate:" ~ $env.$remote_ip
|
|
191
|
+
limit = 100
|
|
192
|
+
window = 60 // 100 requests per minute
|
|
193
|
+
} as $rate_check
|
|
194
|
+
|
|
195
|
+
conditional {
|
|
196
|
+
if (!$rate_check.allowed) {
|
|
197
|
+
throw {
|
|
198
|
+
name = "RateLimitExceeded"
|
|
199
|
+
value = "Too many requests"
|
|
200
|
+
code = 429
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Find Keys
|
|
207
|
+
|
|
208
|
+
```xs
|
|
209
|
+
redis.keys {
|
|
210
|
+
pattern = "user:*"
|
|
211
|
+
} as $user_keys
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## AWS S3
|
|
217
|
+
|
|
218
|
+
### Upload File
|
|
219
|
+
|
|
220
|
+
```xs
|
|
221
|
+
cloud.aws.s3.upload_file {
|
|
222
|
+
bucket = $env.S3_BUCKET
|
|
223
|
+
key = "uploads/" ~ $input.filename
|
|
224
|
+
content = $input.file
|
|
225
|
+
acl = "private"
|
|
226
|
+
} as $upload_result
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Read File
|
|
230
|
+
|
|
231
|
+
```xs
|
|
232
|
+
cloud.aws.s3.read_file {
|
|
233
|
+
bucket = $env.S3_BUCKET
|
|
234
|
+
key = $input.file_path
|
|
235
|
+
} as $file_content
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Delete File
|
|
239
|
+
|
|
240
|
+
```xs
|
|
241
|
+
cloud.aws.s3.delete_file {
|
|
242
|
+
bucket = $env.S3_BUCKET
|
|
243
|
+
key = $input.file_path
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### List Files
|
|
248
|
+
|
|
249
|
+
```xs
|
|
250
|
+
cloud.aws.s3.list_directory {
|
|
251
|
+
bucket = $env.S3_BUCKET
|
|
252
|
+
prefix = "uploads/"
|
|
253
|
+
} as $files
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Generate Signed URL
|
|
257
|
+
|
|
258
|
+
```xs
|
|
259
|
+
cloud.aws.s3.sign_url {
|
|
260
|
+
bucket = $env.S3_BUCKET
|
|
261
|
+
key = $input.file_path
|
|
262
|
+
expires = 3600 // 1 hour
|
|
263
|
+
} as $signed_url
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Google Cloud Storage
|
|
269
|
+
|
|
270
|
+
### Upload File
|
|
271
|
+
|
|
272
|
+
```xs
|
|
273
|
+
cloud.google.storage.upload_file {
|
|
274
|
+
bucket = $env.GCS_BUCKET
|
|
275
|
+
path = "uploads/" ~ $input.filename
|
|
276
|
+
content = $input.file
|
|
277
|
+
} as $upload_result
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Read File
|
|
281
|
+
|
|
282
|
+
```xs
|
|
283
|
+
cloud.google.storage.read_file {
|
|
284
|
+
bucket = $env.GCS_BUCKET
|
|
285
|
+
path = $input.file_path
|
|
286
|
+
} as $content
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Delete File
|
|
290
|
+
|
|
291
|
+
```xs
|
|
292
|
+
cloud.google.storage.delete_file {
|
|
293
|
+
bucket = $env.GCS_BUCKET
|
|
294
|
+
path = $input.file_path
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### List Directory
|
|
299
|
+
|
|
300
|
+
```xs
|
|
301
|
+
cloud.google.storage.list_directory {
|
|
302
|
+
bucket = $env.GCS_BUCKET
|
|
303
|
+
prefix = "uploads/"
|
|
304
|
+
} as $files
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Azure Blob Storage
|
|
310
|
+
|
|
311
|
+
### Upload File
|
|
312
|
+
|
|
313
|
+
```xs
|
|
314
|
+
cloud.azure.storage.upload_file {
|
|
315
|
+
container = $env.AZURE_CONTAINER
|
|
316
|
+
path = "uploads/" ~ $input.filename
|
|
317
|
+
content = $input.file
|
|
318
|
+
} as $result
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Read File
|
|
322
|
+
|
|
323
|
+
```xs
|
|
324
|
+
cloud.azure.storage.read_file {
|
|
325
|
+
container = $env.AZURE_CONTAINER
|
|
326
|
+
path = $input.file_path
|
|
327
|
+
} as $content
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Security Functions
|
|
333
|
+
|
|
334
|
+
### Encryption
|
|
335
|
+
|
|
336
|
+
```xs
|
|
337
|
+
// Encrypt data
|
|
338
|
+
security.encrypt {
|
|
339
|
+
algorithm = "aes-256-cbc"
|
|
340
|
+
data = $sensitive_data
|
|
341
|
+
key = $env.ENCRYPTION_KEY
|
|
342
|
+
} as $encrypted
|
|
343
|
+
|
|
344
|
+
// Decrypt data
|
|
345
|
+
security.decrypt {
|
|
346
|
+
algorithm = "aes-256-cbc"
|
|
347
|
+
data = $encrypted
|
|
348
|
+
key = $env.ENCRYPTION_KEY
|
|
349
|
+
} as $decrypted
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Password Hashing
|
|
353
|
+
|
|
354
|
+
```xs
|
|
355
|
+
// Hash password
|
|
356
|
+
security.create_password {
|
|
357
|
+
password = $input.password
|
|
358
|
+
} as $hashed
|
|
359
|
+
|
|
360
|
+
// Verify password
|
|
361
|
+
security.check_password {
|
|
362
|
+
password = $input.password
|
|
363
|
+
hash = $user.password_hash
|
|
364
|
+
} as $valid
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Auth Tokens
|
|
368
|
+
|
|
369
|
+
```xs
|
|
370
|
+
// Create JWT token
|
|
371
|
+
security.create_auth_token {
|
|
372
|
+
payload = {
|
|
373
|
+
user_id: $user.id,
|
|
374
|
+
role: $user.role
|
|
375
|
+
}
|
|
376
|
+
expires = 86400 // 24 hours
|
|
377
|
+
} as $token
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### UUID Generation
|
|
381
|
+
|
|
382
|
+
```xs
|
|
383
|
+
security.create_uuid {} as $uuid
|
|
384
|
+
security.generate_uuid {} as $uuid
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Random Values
|
|
388
|
+
|
|
389
|
+
```xs
|
|
390
|
+
security.random_bytes {
|
|
391
|
+
length = 32
|
|
392
|
+
} as $random_bytes
|
|
393
|
+
|
|
394
|
+
security.random_number {
|
|
395
|
+
min = 1
|
|
396
|
+
max = 100
|
|
397
|
+
} as $random_num
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Key Generation
|
|
401
|
+
|
|
402
|
+
```xs
|
|
403
|
+
// RSA key pair
|
|
404
|
+
security.create_rsa_key {
|
|
405
|
+
bits = 2048
|
|
406
|
+
} as $rsa_key
|
|
407
|
+
|
|
408
|
+
// Elliptic curve key
|
|
409
|
+
security.create_curve_key {
|
|
410
|
+
curve = "secp256k1"
|
|
411
|
+
} as $ec_key
|
|
412
|
+
|
|
413
|
+
// Secret key
|
|
414
|
+
security.create_secret_key {
|
|
415
|
+
length = 32
|
|
416
|
+
} as $secret
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### JWS/JWE
|
|
420
|
+
|
|
421
|
+
```xs
|
|
422
|
+
// Sign with JWS
|
|
423
|
+
security.jws_encode {
|
|
424
|
+
payload = $data
|
|
425
|
+
algorithm = "HS256"
|
|
426
|
+
secret = $env.JWT_SECRET
|
|
427
|
+
} as $signed
|
|
428
|
+
|
|
429
|
+
// Verify JWS
|
|
430
|
+
security.jws_decode {
|
|
431
|
+
token = $input.token
|
|
432
|
+
secret = $env.JWT_SECRET
|
|
433
|
+
} as $payload
|
|
434
|
+
|
|
435
|
+
// Encrypt with JWE
|
|
436
|
+
security.jwe_encode {
|
|
437
|
+
payload = $data
|
|
438
|
+
algorithm = "A256GCM"
|
|
439
|
+
key = $env.ENCRYPTION_KEY
|
|
440
|
+
} as $encrypted
|
|
441
|
+
|
|
442
|
+
// Decrypt JWE
|
|
443
|
+
security.jwe_decode {
|
|
444
|
+
token = $encrypted
|
|
445
|
+
key = $env.ENCRYPTION_KEY
|
|
446
|
+
} as $decrypted
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Email
|
|
452
|
+
|
|
453
|
+
### Send Email
|
|
454
|
+
|
|
455
|
+
```xs
|
|
456
|
+
util.send_email {
|
|
457
|
+
to = $user.email
|
|
458
|
+
subject = "Welcome!"
|
|
459
|
+
body = "Thank you for signing up."
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### With HTML
|
|
464
|
+
|
|
465
|
+
```xs
|
|
466
|
+
util.send_email {
|
|
467
|
+
to = $user.email
|
|
468
|
+
subject = "Your Order Confirmation"
|
|
469
|
+
html = "<h1>Order Confirmed</h1><p>Order #" ~ $order.id ~ "</p>"
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### With Attachments
|
|
474
|
+
|
|
475
|
+
```xs
|
|
476
|
+
util.send_email {
|
|
477
|
+
to = $user.email
|
|
478
|
+
subject = "Your Invoice"
|
|
479
|
+
body = "Please find your invoice attached."
|
|
480
|
+
attachments = [
|
|
481
|
+
{
|
|
482
|
+
filename: "invoice.pdf",
|
|
483
|
+
content: $pdf_content
|
|
484
|
+
}
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## File Storage
|
|
492
|
+
|
|
493
|
+
### Create File
|
|
494
|
+
|
|
495
|
+
```xs
|
|
496
|
+
storage.create_file_resource {
|
|
497
|
+
name = "document.pdf"
|
|
498
|
+
content = $file_content
|
|
499
|
+
} as $file
|
|
500
|
+
|
|
501
|
+
storage.create_image {
|
|
502
|
+
name = "photo.jpg"
|
|
503
|
+
content = $image_data
|
|
504
|
+
} as $image
|
|
505
|
+
|
|
506
|
+
storage.create_attachment {
|
|
507
|
+
name = "report.xlsx"
|
|
508
|
+
content = $excel_data
|
|
509
|
+
} as $attachment
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### Read File
|
|
513
|
+
|
|
514
|
+
```xs
|
|
515
|
+
storage.read_file_resource {
|
|
516
|
+
path = $input.file_path
|
|
517
|
+
} as $content
|
|
518
|
+
|
|
519
|
+
storage.read_file {
|
|
520
|
+
path = $input.file_path
|
|
521
|
+
} as $content
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### Delete File
|
|
525
|
+
|
|
526
|
+
```xs
|
|
527
|
+
storage.delete_file {
|
|
528
|
+
path = $file.path
|
|
529
|
+
}
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Signed URLs
|
|
533
|
+
|
|
534
|
+
```xs
|
|
535
|
+
storage.sign_private_url {
|
|
536
|
+
path = $file.path
|
|
537
|
+
expires = 3600
|
|
538
|
+
} as $signed_url
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
## Zip Operations
|
|
544
|
+
|
|
545
|
+
### Create Archive
|
|
546
|
+
|
|
547
|
+
```xs
|
|
548
|
+
zip.create_archive {
|
|
549
|
+
files = [
|
|
550
|
+
{name: "doc1.txt", content: $content1},
|
|
551
|
+
{name: "doc2.txt", content: $content2}
|
|
552
|
+
]
|
|
553
|
+
} as $zip_file
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### Extract Archive
|
|
557
|
+
|
|
558
|
+
```xs
|
|
559
|
+
zip.extract {
|
|
560
|
+
archive = $input.zip_file
|
|
561
|
+
} as $files
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
### View Contents
|
|
565
|
+
|
|
566
|
+
```xs
|
|
567
|
+
zip.view_contents {
|
|
568
|
+
archive = $input.zip_file
|
|
569
|
+
} as $file_list
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
---
|
|
573
|
+
|
|
574
|
+
## Streaming
|
|
575
|
+
|
|
576
|
+
### Stream from CSV
|
|
577
|
+
|
|
578
|
+
```xs
|
|
579
|
+
stream.from_csv {
|
|
580
|
+
file = $input.csv_file
|
|
581
|
+
run {
|
|
582
|
+
foreach ($this.rows) {
|
|
583
|
+
each as $row {
|
|
584
|
+
db.add import_data { data = $row }
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### Stream from Request
|
|
592
|
+
|
|
593
|
+
```xs
|
|
594
|
+
stream.from_request {
|
|
595
|
+
url = "https://api.example.com/large-data"
|
|
596
|
+
run {
|
|
597
|
+
foreach ($this.chunks) {
|
|
598
|
+
each as $chunk {
|
|
599
|
+
// Process chunk
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
## Utilities
|
|
609
|
+
|
|
610
|
+
### Sleep
|
|
611
|
+
|
|
612
|
+
```xs
|
|
613
|
+
util.sleep {
|
|
614
|
+
duration = 1000 // Milliseconds
|
|
615
|
+
}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### IP Lookup
|
|
619
|
+
|
|
620
|
+
```xs
|
|
621
|
+
util.ip_lookup {
|
|
622
|
+
ip = $env.$remote_ip
|
|
623
|
+
} as $location
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
### Geo Distance
|
|
627
|
+
|
|
628
|
+
```xs
|
|
629
|
+
util.geo_distance {
|
|
630
|
+
from = {lat: 40.7128, lng: -74.0060}
|
|
631
|
+
to = {lat: 34.0522, lng: -118.2437}
|
|
632
|
+
} as $distance_km
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
### Template Engine
|
|
636
|
+
|
|
637
|
+
```xs
|
|
638
|
+
util.template_engine {
|
|
639
|
+
template = "Hello {{name}}, you have {{count}} messages."
|
|
640
|
+
data = {name: "John", count: 5}
|
|
641
|
+
} as $message
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
### Environment Variables
|
|
645
|
+
|
|
646
|
+
```xs
|
|
647
|
+
util.get_env {} as $all_env_vars
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
### Set Response Headers
|
|
651
|
+
|
|
652
|
+
```xs
|
|
653
|
+
util.set_header {
|
|
654
|
+
name = "X-Custom-Header"
|
|
655
|
+
value = "custom-value"
|
|
656
|
+
}
|
|
657
|
+
```
|