@xano/developer-mcp 1.0.7 → 1.0.9
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 +28 -0
- package/dist/index.js +42 -1
- package/dist/templates/xanoscript-index.js +7 -0
- package/package.json +1 -1
- package/xanoscript_docs/README.md +38 -5
- package/xanoscript_docs/addons.md +285 -0
- package/xanoscript_docs/agents.md +84 -0
- package/xanoscript_docs/database.md +160 -0
- package/xanoscript_docs/debugging.md +342 -0
- package/xanoscript_docs/functions.md +172 -0
- package/xanoscript_docs/integrations.md +376 -7
- package/xanoscript_docs/performance.md +407 -0
- package/xanoscript_docs/realtime.md +382 -0
- package/xanoscript_docs/schema.md +292 -0
- package/xanoscript_docs/security.md +550 -0
- package/xanoscript_docs/streaming.md +318 -0
- package/xanoscript_docs/syntax.md +267 -0
- package/xanoscript_docs/triggers.md +354 -52
- package/xanoscript_docs/types.md +66 -21
|
@@ -4,7 +4,7 @@ applyTo: "functions/**/*.xs, apis/**/*.xs, tasks/*.xs"
|
|
|
4
4
|
|
|
5
5
|
# Integrations
|
|
6
6
|
|
|
7
|
-
Cloud services, Redis, storage, and security operations.
|
|
7
|
+
Cloud services, Redis, storage, archives, and security operations.
|
|
8
8
|
|
|
9
9
|
## Quick Reference
|
|
10
10
|
|
|
@@ -28,6 +28,8 @@ Cloud services, Redis, storage, and security operations.
|
|
|
28
28
|
| Redis | `redis.*` |
|
|
29
29
|
| Storage | `storage.*` |
|
|
30
30
|
| Security | `security.*` |
|
|
31
|
+
| Zip/Archive | `zip.*` |
|
|
32
|
+
| Lambda | `api.lambda` |
|
|
31
33
|
|
|
32
34
|
---
|
|
33
35
|
|
|
@@ -150,8 +152,9 @@ cloud.google.storage.sign_url {
|
|
|
150
152
|
|
|
151
153
|
## Elasticsearch
|
|
152
154
|
|
|
155
|
+
### Search Query
|
|
156
|
+
|
|
153
157
|
```xs
|
|
154
|
-
# Search
|
|
155
158
|
cloud.elasticsearch.query {
|
|
156
159
|
auth_type = "API Key"
|
|
157
160
|
key_id = $env.ES_KEY_ID
|
|
@@ -163,8 +166,12 @@ cloud.elasticsearch.query {
|
|
|
163
166
|
size = 10
|
|
164
167
|
sort = [{ field: "price", order: "asc" }]
|
|
165
168
|
} as $results
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Document Operations
|
|
166
172
|
|
|
167
|
-
|
|
173
|
+
```xs
|
|
174
|
+
// Get document
|
|
168
175
|
cloud.elasticsearch.document {
|
|
169
176
|
auth_type = "API Key"
|
|
170
177
|
key_id = $env.ES_KEY_ID
|
|
@@ -174,6 +181,188 @@ cloud.elasticsearch.document {
|
|
|
174
181
|
method = "GET"
|
|
175
182
|
doc_id = "product-123"
|
|
176
183
|
} as $doc
|
|
184
|
+
|
|
185
|
+
// Index document
|
|
186
|
+
cloud.elasticsearch.document {
|
|
187
|
+
auth_type = "API Key"
|
|
188
|
+
key_id = $env.ES_KEY_ID
|
|
189
|
+
access_key = $env.ES_ACCESS_KEY
|
|
190
|
+
base_url = "https://my-cluster.es.io"
|
|
191
|
+
index = "products"
|
|
192
|
+
method = "PUT"
|
|
193
|
+
doc_id = "product-123"
|
|
194
|
+
body = {
|
|
195
|
+
name: "Product Name",
|
|
196
|
+
category: "electronics",
|
|
197
|
+
price: 99.99
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Delete document
|
|
202
|
+
cloud.elasticsearch.document {
|
|
203
|
+
auth_type = "API Key"
|
|
204
|
+
key_id = $env.ES_KEY_ID
|
|
205
|
+
access_key = $env.ES_ACCESS_KEY
|
|
206
|
+
base_url = "https://my-cluster.es.io"
|
|
207
|
+
index = "products"
|
|
208
|
+
method = "DELETE"
|
|
209
|
+
doc_id = "product-123"
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Bulk Operations
|
|
214
|
+
|
|
215
|
+
```xs
|
|
216
|
+
cloud.elasticsearch.bulk {
|
|
217
|
+
auth_type = "API Key"
|
|
218
|
+
key_id = $env.ES_KEY_ID
|
|
219
|
+
access_key = $env.ES_ACCESS_KEY
|
|
220
|
+
base_url = "https://my-cluster.es.io"
|
|
221
|
+
index = "products"
|
|
222
|
+
operations = [
|
|
223
|
+
{ action: "index", id: "1", doc: { name: "Product 1" } },
|
|
224
|
+
{ action: "update", id: "2", doc: { price: 29.99 } },
|
|
225
|
+
{ action: "delete", id: "3" }
|
|
226
|
+
]
|
|
227
|
+
} as $result
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Advanced Search
|
|
231
|
+
|
|
232
|
+
```xs
|
|
233
|
+
cloud.elasticsearch.query {
|
|
234
|
+
auth_type = "API Key"
|
|
235
|
+
key_id = $env.ES_KEY_ID
|
|
236
|
+
access_key = $env.ES_ACCESS_KEY
|
|
237
|
+
base_url = "https://my-cluster.es.io"
|
|
238
|
+
index = "products"
|
|
239
|
+
return_type = "search"
|
|
240
|
+
query = {
|
|
241
|
+
bool: {
|
|
242
|
+
must: [
|
|
243
|
+
{ match: { name: $input.search } }
|
|
244
|
+
],
|
|
245
|
+
filter: [
|
|
246
|
+
{ range: { price: { gte: $input.min_price, lte: $input.max_price } } },
|
|
247
|
+
{ term: { is_active: true } }
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
aggregations = {
|
|
252
|
+
categories: { terms: { field: "category.keyword" } },
|
|
253
|
+
avg_price: { avg: { field: "price" } }
|
|
254
|
+
}
|
|
255
|
+
size = 20
|
|
256
|
+
from = $input.offset
|
|
257
|
+
} as $results
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## AWS OpenSearch
|
|
263
|
+
|
|
264
|
+
```xs
|
|
265
|
+
cloud.aws.opensearch.query {
|
|
266
|
+
region = "us-east-1"
|
|
267
|
+
access_key = $env.AWS_ACCESS_KEY
|
|
268
|
+
secret_key = $env.AWS_SECRET_KEY
|
|
269
|
+
endpoint = "https://search-domain.us-east-1.es.amazonaws.com"
|
|
270
|
+
index = "logs"
|
|
271
|
+
query = {
|
|
272
|
+
bool: {
|
|
273
|
+
must: [
|
|
274
|
+
{ match: { level: "error" } }
|
|
275
|
+
],
|
|
276
|
+
filter: [
|
|
277
|
+
{ range: { timestamp: { gte: "now-24h" } } }
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
size = 100
|
|
282
|
+
} as $logs
|
|
283
|
+
|
|
284
|
+
// Index document
|
|
285
|
+
cloud.aws.opensearch.document {
|
|
286
|
+
region = "us-east-1"
|
|
287
|
+
access_key = $env.AWS_ACCESS_KEY
|
|
288
|
+
secret_key = $env.AWS_SECRET_KEY
|
|
289
|
+
endpoint = "https://search-domain.us-east-1.es.amazonaws.com"
|
|
290
|
+
index = "logs"
|
|
291
|
+
method = "PUT"
|
|
292
|
+
doc_id = $log_id
|
|
293
|
+
body = $log_data
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Algolia
|
|
300
|
+
|
|
301
|
+
### Search
|
|
302
|
+
|
|
303
|
+
```xs
|
|
304
|
+
cloud.algolia.search {
|
|
305
|
+
app_id = $env.ALGOLIA_APP_ID
|
|
306
|
+
api_key = $env.ALGOLIA_API_KEY
|
|
307
|
+
index = "products"
|
|
308
|
+
query = $input.search
|
|
309
|
+
filters = "category:electronics AND price<100"
|
|
310
|
+
facets = ["category", "brand"]
|
|
311
|
+
hitsPerPage = 20
|
|
312
|
+
page = $input.page
|
|
313
|
+
} as $results
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Manage Records
|
|
317
|
+
|
|
318
|
+
```xs
|
|
319
|
+
// Add/update record
|
|
320
|
+
cloud.algolia.save_object {
|
|
321
|
+
app_id = $env.ALGOLIA_APP_ID
|
|
322
|
+
api_key = $env.ALGOLIA_ADMIN_KEY
|
|
323
|
+
index = "products"
|
|
324
|
+
object = {
|
|
325
|
+
objectID: $product.id|to_text,
|
|
326
|
+
name: $product.name,
|
|
327
|
+
category: $product.category,
|
|
328
|
+
price: $product.price
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Batch save
|
|
333
|
+
cloud.algolia.save_objects {
|
|
334
|
+
app_id = $env.ALGOLIA_APP_ID
|
|
335
|
+
api_key = $env.ALGOLIA_ADMIN_KEY
|
|
336
|
+
index = "products"
|
|
337
|
+
objects = $products|map:{
|
|
338
|
+
objectID: $$.id|to_text,
|
|
339
|
+
name: $$.name,
|
|
340
|
+
category: $$.category
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Delete record
|
|
345
|
+
cloud.algolia.delete_object {
|
|
346
|
+
app_id = $env.ALGOLIA_APP_ID
|
|
347
|
+
api_key = $env.ALGOLIA_ADMIN_KEY
|
|
348
|
+
index = "products"
|
|
349
|
+
objectID = $input.product_id|to_text
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Configure Index
|
|
354
|
+
|
|
355
|
+
```xs
|
|
356
|
+
cloud.algolia.set_settings {
|
|
357
|
+
app_id = $env.ALGOLIA_APP_ID
|
|
358
|
+
api_key = $env.ALGOLIA_ADMIN_KEY
|
|
359
|
+
index = "products"
|
|
360
|
+
settings = {
|
|
361
|
+
searchableAttributes: ["name", "description", "category"],
|
|
362
|
+
attributesForFaceting: ["category", "brand", "filterOnly(is_active)"],
|
|
363
|
+
ranking: ["typo", "geo", "words", "filters", "proximity", "attribute", "exact", "custom"]
|
|
364
|
+
}
|
|
365
|
+
}
|
|
177
366
|
```
|
|
178
367
|
|
|
179
368
|
---
|
|
@@ -410,10 +599,190 @@ api.request {
|
|
|
410
599
|
|
|
411
600
|
---
|
|
412
601
|
|
|
602
|
+
## Zip/Archive Operations
|
|
603
|
+
|
|
604
|
+
Create, modify, and extract ZIP archives.
|
|
605
|
+
|
|
606
|
+
### Create Archive
|
|
607
|
+
|
|
608
|
+
```xs
|
|
609
|
+
zip.create_archive {
|
|
610
|
+
filename = "export.zip"
|
|
611
|
+
} as $archive
|
|
612
|
+
|
|
613
|
+
// Add files
|
|
614
|
+
zip.add_to_archive {
|
|
615
|
+
archive = $archive
|
|
616
|
+
files = [
|
|
617
|
+
{ path: "data/users.json", content: $users|json_encode },
|
|
618
|
+
{ path: "data/orders.json", content: $orders|json_encode },
|
|
619
|
+
{ path: "readme.txt", content: "Export generated on " ~ now|format_timestamp:"Y-m-d" }
|
|
620
|
+
]
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
storage.create_file_resource {
|
|
624
|
+
filename = "export.zip"
|
|
625
|
+
filedata = $archive
|
|
626
|
+
} as $file
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### Add to Existing Archive
|
|
630
|
+
|
|
631
|
+
```xs
|
|
632
|
+
zip.add_to_archive {
|
|
633
|
+
archive = $input.zip_file
|
|
634
|
+
files = [
|
|
635
|
+
{ path: "additional/data.json", content: $data|json_encode }
|
|
636
|
+
]
|
|
637
|
+
} as $updated_archive
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
### Delete from Archive
|
|
641
|
+
|
|
642
|
+
```xs
|
|
643
|
+
zip.delete_from_archive {
|
|
644
|
+
archive = $input.zip_file
|
|
645
|
+
paths = ["old_file.txt", "deprecated/"]
|
|
646
|
+
} as $cleaned_archive
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### Extract Archive
|
|
650
|
+
|
|
651
|
+
```xs
|
|
652
|
+
zip.extract {
|
|
653
|
+
archive = $input.zip_file
|
|
654
|
+
target_path = "extracted/"
|
|
655
|
+
} as $extracted_files
|
|
656
|
+
|
|
657
|
+
// $extracted_files = [
|
|
658
|
+
// { path: "data/users.json", content: "..." },
|
|
659
|
+
// { path: "readme.txt", content: "..." }
|
|
660
|
+
// ]
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
### View Contents
|
|
664
|
+
|
|
665
|
+
```xs
|
|
666
|
+
zip.view_contents {
|
|
667
|
+
archive = $input.zip_file
|
|
668
|
+
} as $contents
|
|
669
|
+
|
|
670
|
+
// $contents = [
|
|
671
|
+
// { path: "data/users.json", size: 1234, compressed_size: 456 },
|
|
672
|
+
// { path: "readme.txt", size: 100, compressed_size: 80 }
|
|
673
|
+
// ]
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
### Full Example: Export & Download
|
|
677
|
+
|
|
678
|
+
```xs
|
|
679
|
+
query "export_data" {
|
|
680
|
+
input {
|
|
681
|
+
int[] user_ids
|
|
682
|
+
}
|
|
683
|
+
stack {
|
|
684
|
+
// Fetch data
|
|
685
|
+
db.query "user" {
|
|
686
|
+
where = $db.user.id in $input.user_ids
|
|
687
|
+
} as $users
|
|
688
|
+
|
|
689
|
+
db.query "order" {
|
|
690
|
+
where = $db.order.user_id in $input.user_ids
|
|
691
|
+
} as $orders
|
|
692
|
+
|
|
693
|
+
// Create archive
|
|
694
|
+
zip.create_archive {
|
|
695
|
+
filename = "user_export_" ~ now|format_timestamp:"Y-m-d" ~ ".zip"
|
|
696
|
+
} as $archive
|
|
697
|
+
|
|
698
|
+
zip.add_to_archive {
|
|
699
|
+
archive = $archive
|
|
700
|
+
files = [
|
|
701
|
+
{ path: "users.json", content: $users|json_encode },
|
|
702
|
+
{ path: "orders.json", content: $orders|json_encode },
|
|
703
|
+
{ path: "manifest.json", content: {
|
|
704
|
+
exported_at: now,
|
|
705
|
+
user_count: $users|count,
|
|
706
|
+
order_count: $orders|count
|
|
707
|
+
}|json_encode }
|
|
708
|
+
]
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
storage.create_file_resource {
|
|
712
|
+
filename = "export.zip"
|
|
713
|
+
filedata = $archive
|
|
714
|
+
} as $download
|
|
715
|
+
}
|
|
716
|
+
response = { download_url: $download.url }
|
|
717
|
+
}
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
---
|
|
721
|
+
|
|
722
|
+
## Lambda Integration
|
|
723
|
+
|
|
724
|
+
Invoke AWS Lambda functions or other serverless functions.
|
|
725
|
+
|
|
726
|
+
### api.lambda
|
|
727
|
+
|
|
728
|
+
```xs
|
|
729
|
+
api.lambda {
|
|
730
|
+
provider = "aws"
|
|
731
|
+
region = "us-east-1"
|
|
732
|
+
access_key = $env.AWS_ACCESS_KEY
|
|
733
|
+
secret_key = $env.AWS_SECRET_KEY
|
|
734
|
+
function_name = "process-image"
|
|
735
|
+
payload = {
|
|
736
|
+
image_url: $input.image_url,
|
|
737
|
+
operations: ["resize", "compress"]
|
|
738
|
+
}
|
|
739
|
+
invocation_type = "RequestResponse"
|
|
740
|
+
} as $result
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
### Invocation Types
|
|
744
|
+
|
|
745
|
+
| Type | Description |
|
|
746
|
+
|------|-------------|
|
|
747
|
+
| `RequestResponse` | Synchronous, wait for response |
|
|
748
|
+
| `Event` | Asynchronous, fire and forget |
|
|
749
|
+
| `DryRun` | Validate without executing |
|
|
750
|
+
|
|
751
|
+
### Async Lambda
|
|
752
|
+
|
|
753
|
+
```xs
|
|
754
|
+
// Fire and forget
|
|
755
|
+
api.lambda {
|
|
756
|
+
provider = "aws"
|
|
757
|
+
region = "us-east-1"
|
|
758
|
+
access_key = $env.AWS_ACCESS_KEY
|
|
759
|
+
secret_key = $env.AWS_SECRET_KEY
|
|
760
|
+
function_name = "send-notification"
|
|
761
|
+
payload = { user_id: $user.id, message: "Welcome!" }
|
|
762
|
+
invocation_type = "Event"
|
|
763
|
+
}
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
### With Timeout
|
|
767
|
+
|
|
768
|
+
```xs
|
|
769
|
+
api.lambda {
|
|
770
|
+
provider = "aws"
|
|
771
|
+
region = "us-east-1"
|
|
772
|
+
access_key = $env.AWS_ACCESS_KEY
|
|
773
|
+
secret_key = $env.AWS_SECRET_KEY
|
|
774
|
+
function_name = "heavy-processing"
|
|
775
|
+
payload = $input.data
|
|
776
|
+
timeout = 60000
|
|
777
|
+
} as $result
|
|
778
|
+
```
|
|
779
|
+
|
|
780
|
+
---
|
|
781
|
+
|
|
413
782
|
## Utilities
|
|
414
783
|
|
|
415
784
|
```xs
|
|
416
|
-
|
|
785
|
+
// Template engine (Twig)
|
|
417
786
|
util.template_engine {
|
|
418
787
|
value = """
|
|
419
788
|
Hello {{ $var.name }}!
|
|
@@ -423,10 +792,10 @@ util.template_engine {
|
|
|
423
792
|
"""
|
|
424
793
|
} as $rendered
|
|
425
794
|
|
|
426
|
-
|
|
795
|
+
// IP lookup
|
|
427
796
|
util.ip_lookup { value = $env.$remote_ip } as $location
|
|
428
797
|
|
|
429
|
-
|
|
798
|
+
// Geo distance
|
|
430
799
|
util.geo_distance {
|
|
431
800
|
latitude_1 = 40.71
|
|
432
801
|
longitude_1 = -74.00
|
|
@@ -434,6 +803,6 @@ util.geo_distance {
|
|
|
434
803
|
longitude_2 = -118.24
|
|
435
804
|
} as $distance_km
|
|
436
805
|
|
|
437
|
-
|
|
806
|
+
// Sleep
|
|
438
807
|
util.sleep { value = 5 }
|
|
439
808
|
```
|