@xano/developer-mcp 1.0.20 → 1.0.22
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 +100 -19
- package/dist/index.js +4 -227
- package/dist/meta_api_docs/format.d.ts +16 -1
- package/dist/meta_api_docs/format.js +24 -6
- package/dist/meta_api_docs/format.test.d.ts +1 -0
- package/dist/meta_api_docs/format.test.js +274 -0
- package/dist/meta_api_docs/index.test.d.ts +1 -0
- package/dist/meta_api_docs/index.test.js +128 -0
- package/dist/meta_api_docs/types.test.d.ts +1 -0
- package/dist/meta_api_docs/types.test.js +132 -0
- package/dist/run_api_docs/format.d.ts +1 -0
- package/dist/run_api_docs/format.js +3 -170
- package/dist/run_api_docs/format.test.d.ts +1 -0
- package/dist/run_api_docs/format.test.js +86 -0
- package/dist/run_api_docs/index.test.d.ts +1 -0
- package/dist/run_api_docs/index.test.js +127 -0
- package/dist/templates/init-workspace.js +4 -4
- package/dist/templates/xanoscript-index.d.ts +3 -1
- package/dist/templates/xanoscript-index.js +54 -51
- package/dist/xanoscript.d.ts +41 -0
- package/dist/xanoscript.js +261 -0
- package/dist/xanoscript.test.d.ts +1 -0
- package/dist/xanoscript.test.js +303 -0
- package/dist/xanoscript_docs/README.md +53 -37
- package/dist/xanoscript_docs/agents.md +1 -1
- package/dist/xanoscript_docs/apis.md +6 -3
- package/dist/xanoscript_docs/branch.md +239 -0
- package/dist/xanoscript_docs/functions.md +6 -6
- package/dist/xanoscript_docs/integrations.md +43 -1
- package/dist/xanoscript_docs/middleware.md +321 -0
- package/dist/xanoscript_docs/performance.md +1 -1
- package/dist/xanoscript_docs/realtime.md +113 -1
- package/dist/xanoscript_docs/tasks.md +2 -2
- package/dist/xanoscript_docs/tools.md +3 -3
- package/dist/xanoscript_docs/types.md +25 -8
- package/dist/xanoscript_docs/workspace.md +209 -0
- 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 +6 -2
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "tables/*.xs"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Tables
|
|
6
|
+
|
|
7
|
+
Database schema definitions with columns, types, indexes, and relationships.
|
|
8
|
+
|
|
9
|
+
## Quick Reference
|
|
10
|
+
|
|
11
|
+
```xs
|
|
12
|
+
table "<name>" {
|
|
13
|
+
schema {
|
|
14
|
+
int id primary=true
|
|
15
|
+
text name
|
|
16
|
+
timestamp created_at default=now
|
|
17
|
+
}
|
|
18
|
+
index idx_name { columns = [name] }
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Table Definition
|
|
25
|
+
|
|
26
|
+
### Basic Table
|
|
27
|
+
|
|
28
|
+
```xs
|
|
29
|
+
table "user" {
|
|
30
|
+
schema {
|
|
31
|
+
int id primary=true
|
|
32
|
+
text name
|
|
33
|
+
text email
|
|
34
|
+
timestamp created_at default=now
|
|
35
|
+
timestamp? updated_at
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### With All Options
|
|
41
|
+
|
|
42
|
+
```xs
|
|
43
|
+
table "product" {
|
|
44
|
+
schema {
|
|
45
|
+
int id primary=true
|
|
46
|
+
text name
|
|
47
|
+
text? description
|
|
48
|
+
decimal price
|
|
49
|
+
int stock default=0
|
|
50
|
+
bool active default=true
|
|
51
|
+
json metadata
|
|
52
|
+
timestamp created_at default=now
|
|
53
|
+
timestamp? updated_at
|
|
54
|
+
timestamp? deleted_at
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
index idx_active { columns = [active] }
|
|
58
|
+
index idx_created { columns = [created_at] }
|
|
59
|
+
index idx_price { columns = [price] }
|
|
60
|
+
|
|
61
|
+
history {
|
|
62
|
+
enabled = true
|
|
63
|
+
retention = 30
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Column Types
|
|
71
|
+
|
|
72
|
+
| Type | Description | Example |
|
|
73
|
+
|------|-------------|---------|
|
|
74
|
+
| `int` | Integer | `int id` |
|
|
75
|
+
| `decimal` | Floating-point | `decimal price` |
|
|
76
|
+
| `text` | String | `text name` |
|
|
77
|
+
| `email` | Email format | `email user_email` |
|
|
78
|
+
| `password` | Hashed password | `password pwd` |
|
|
79
|
+
| `bool` | Boolean | `bool active` |
|
|
80
|
+
| `date` | Date only | `date birth_date` |
|
|
81
|
+
| `time` | Time only | `time start_time` |
|
|
82
|
+
| `timestamp` | Date and time | `timestamp created_at` |
|
|
83
|
+
| `json` | JSON object/array | `json metadata` |
|
|
84
|
+
| `uuid` | UUID identifier | `uuid guid` |
|
|
85
|
+
| `file` | File reference | `file avatar` |
|
|
86
|
+
| `array` | Array type | `array<text> tags` |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Column Modifiers
|
|
91
|
+
|
|
92
|
+
### Primary Key
|
|
93
|
+
|
|
94
|
+
```xs
|
|
95
|
+
int id primary=true
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Optional (Nullable)
|
|
99
|
+
|
|
100
|
+
```xs
|
|
101
|
+
text? middle_name // Can be null
|
|
102
|
+
timestamp? deleted_at // Can be null
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Default Values
|
|
106
|
+
|
|
107
|
+
```xs
|
|
108
|
+
int count default=0
|
|
109
|
+
bool active default=true
|
|
110
|
+
text status default="pending"
|
|
111
|
+
timestamp created_at default=now
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Unique Constraint
|
|
115
|
+
|
|
116
|
+
```xs
|
|
117
|
+
text email unique=true
|
|
118
|
+
text username unique=true
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Description
|
|
122
|
+
|
|
123
|
+
```xs
|
|
124
|
+
text internal_code description="For internal use only"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Indexes
|
|
130
|
+
|
|
131
|
+
### Single Column Index
|
|
132
|
+
|
|
133
|
+
```xs
|
|
134
|
+
index idx_email { columns = [email] }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Unique Index
|
|
138
|
+
|
|
139
|
+
```xs
|
|
140
|
+
index idx_email { columns = [email] unique=true }
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Composite Index
|
|
144
|
+
|
|
145
|
+
```xs
|
|
146
|
+
index idx_user_status {
|
|
147
|
+
columns = [user_id, status]
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Partial Index (with condition)
|
|
152
|
+
|
|
153
|
+
```xs
|
|
154
|
+
index idx_active_users {
|
|
155
|
+
columns = [email]
|
|
156
|
+
where = "active = true"
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Foreign Keys (Table Links)
|
|
163
|
+
|
|
164
|
+
Reference another table:
|
|
165
|
+
|
|
166
|
+
```xs
|
|
167
|
+
table "order" {
|
|
168
|
+
schema {
|
|
169
|
+
int id primary=true
|
|
170
|
+
tablelink user_id table=user // References user.id
|
|
171
|
+
decimal total
|
|
172
|
+
text status
|
|
173
|
+
timestamp created_at default=now
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Table Link Options
|
|
179
|
+
|
|
180
|
+
```xs
|
|
181
|
+
// Basic reference
|
|
182
|
+
tablelink user_id table=user
|
|
183
|
+
|
|
184
|
+
// With custom display
|
|
185
|
+
tablelink user_id table=user display=name
|
|
186
|
+
|
|
187
|
+
// Nullable reference
|
|
188
|
+
tablelink? category_id table=category
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## History Tracking
|
|
194
|
+
|
|
195
|
+
Track changes to records:
|
|
196
|
+
|
|
197
|
+
```xs
|
|
198
|
+
table "document" {
|
|
199
|
+
schema {
|
|
200
|
+
int id primary=true
|
|
201
|
+
text title
|
|
202
|
+
text content
|
|
203
|
+
int version default=1
|
|
204
|
+
timestamp created_at default=now
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
history {
|
|
208
|
+
enabled = true
|
|
209
|
+
retention = 90 // Days to keep history
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Common Table Patterns
|
|
217
|
+
|
|
218
|
+
### User Table
|
|
219
|
+
|
|
220
|
+
```xs
|
|
221
|
+
table "user" {
|
|
222
|
+
schema {
|
|
223
|
+
int id primary=true
|
|
224
|
+
text name
|
|
225
|
+
text email unique=true
|
|
226
|
+
password password_hash
|
|
227
|
+
text? avatar
|
|
228
|
+
text role default="user"
|
|
229
|
+
bool active default=true
|
|
230
|
+
bool verified default=false
|
|
231
|
+
timestamp? last_login
|
|
232
|
+
timestamp created_at default=now
|
|
233
|
+
timestamp? updated_at
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
index idx_email { columns = [email] unique=true }
|
|
237
|
+
index idx_role { columns = [role] }
|
|
238
|
+
index idx_active { columns = [active] }
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Product Table
|
|
243
|
+
|
|
244
|
+
```xs
|
|
245
|
+
table "product" {
|
|
246
|
+
schema {
|
|
247
|
+
int id primary=true
|
|
248
|
+
text name
|
|
249
|
+
text? description
|
|
250
|
+
text sku unique=true
|
|
251
|
+
decimal price
|
|
252
|
+
decimal? sale_price
|
|
253
|
+
int stock default=0
|
|
254
|
+
tablelink category_id table=category
|
|
255
|
+
array<text> tags
|
|
256
|
+
json attributes
|
|
257
|
+
bool active default=true
|
|
258
|
+
bool featured default=false
|
|
259
|
+
timestamp created_at default=now
|
|
260
|
+
timestamp? updated_at
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
index idx_sku { columns = [sku] unique=true }
|
|
264
|
+
index idx_category { columns = [category_id] }
|
|
265
|
+
index idx_active { columns = [active] }
|
|
266
|
+
index idx_featured { columns = [featured] where = "featured = true" }
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Order Table
|
|
271
|
+
|
|
272
|
+
```xs
|
|
273
|
+
table "order" {
|
|
274
|
+
schema {
|
|
275
|
+
int id primary=true
|
|
276
|
+
text order_number unique=true
|
|
277
|
+
tablelink user_id table=user
|
|
278
|
+
decimal subtotal
|
|
279
|
+
decimal? discount
|
|
280
|
+
decimal tax
|
|
281
|
+
decimal total
|
|
282
|
+
text status default="pending"
|
|
283
|
+
json shipping_address
|
|
284
|
+
json? billing_address
|
|
285
|
+
text? notes
|
|
286
|
+
timestamp? paid_at
|
|
287
|
+
timestamp? shipped_at
|
|
288
|
+
timestamp? delivered_at
|
|
289
|
+
timestamp created_at default=now
|
|
290
|
+
timestamp? updated_at
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
index idx_user { columns = [user_id] }
|
|
294
|
+
index idx_status { columns = [status] }
|
|
295
|
+
index idx_created { columns = [created_at] }
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Order Items (Join Table)
|
|
300
|
+
|
|
301
|
+
```xs
|
|
302
|
+
table "order_item" {
|
|
303
|
+
schema {
|
|
304
|
+
int id primary=true
|
|
305
|
+
tablelink order_id table=order
|
|
306
|
+
tablelink product_id table=product
|
|
307
|
+
int quantity
|
|
308
|
+
decimal unit_price
|
|
309
|
+
decimal total
|
|
310
|
+
timestamp created_at default=now
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
index idx_order { columns = [order_id] }
|
|
314
|
+
index idx_product { columns = [product_id] }
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Session Table
|
|
319
|
+
|
|
320
|
+
```xs
|
|
321
|
+
table "session" {
|
|
322
|
+
schema {
|
|
323
|
+
int id primary=true
|
|
324
|
+
text token unique=true
|
|
325
|
+
tablelink user_id table=user
|
|
326
|
+
json data
|
|
327
|
+
text ip_address
|
|
328
|
+
text user_agent
|
|
329
|
+
timestamp expires_at
|
|
330
|
+
timestamp created_at default=now
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
index idx_token { columns = [token] unique=true }
|
|
334
|
+
index idx_user { columns = [user_id] }
|
|
335
|
+
index idx_expires { columns = [expires_at] }
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Audit Log Table
|
|
340
|
+
|
|
341
|
+
```xs
|
|
342
|
+
table "audit_log" {
|
|
343
|
+
schema {
|
|
344
|
+
int id primary=true
|
|
345
|
+
tablelink? user_id table=user
|
|
346
|
+
text action
|
|
347
|
+
text entity_type
|
|
348
|
+
int entity_id
|
|
349
|
+
json old_data
|
|
350
|
+
json new_data
|
|
351
|
+
text ip_address
|
|
352
|
+
timestamp created_at default=now
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
index idx_user { columns = [user_id] }
|
|
356
|
+
index idx_entity { columns = [entity_type, entity_id] }
|
|
357
|
+
index idx_created { columns = [created_at] }
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## Vector Column (AI/ML)
|
|
364
|
+
|
|
365
|
+
For AI embeddings:
|
|
366
|
+
|
|
367
|
+
```xs
|
|
368
|
+
table "document" {
|
|
369
|
+
schema {
|
|
370
|
+
int id primary=true
|
|
371
|
+
text title
|
|
372
|
+
text content
|
|
373
|
+
vector embedding dimensions=1536 // OpenAI embeddings
|
|
374
|
+
timestamp created_at default=now
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
index idx_embedding {
|
|
378
|
+
columns = [embedding]
|
|
379
|
+
type = "ivfflat"
|
|
380
|
+
options = {lists: 100}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Geo Column
|
|
388
|
+
|
|
389
|
+
For location data:
|
|
390
|
+
|
|
391
|
+
```xs
|
|
392
|
+
table "store" {
|
|
393
|
+
schema {
|
|
394
|
+
int id primary=true
|
|
395
|
+
text name
|
|
396
|
+
text address
|
|
397
|
+
geo location
|
|
398
|
+
timestamp created_at default=now
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
index idx_location {
|
|
402
|
+
columns = [location]
|
|
403
|
+
type = "gist"
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Best Practices
|
|
411
|
+
|
|
412
|
+
### Naming Conventions
|
|
413
|
+
|
|
414
|
+
- Use singular table names: `user`, `product`, `order`
|
|
415
|
+
- Use snake_case for column names
|
|
416
|
+
- Prefix indexes with `idx_`
|
|
417
|
+
- Use descriptive index names
|
|
418
|
+
|
|
419
|
+
### Always Include
|
|
420
|
+
|
|
421
|
+
- `id` as primary key
|
|
422
|
+
- `created_at` timestamp
|
|
423
|
+
- `updated_at` for mutable data
|
|
424
|
+
|
|
425
|
+
### Soft Deletes
|
|
426
|
+
|
|
427
|
+
```xs
|
|
428
|
+
table "resource" {
|
|
429
|
+
schema {
|
|
430
|
+
// ... other columns
|
|
431
|
+
timestamp? deleted_at // NULL = active, timestamp = deleted
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
index idx_active {
|
|
435
|
+
columns = [deleted_at]
|
|
436
|
+
where = "deleted_at IS NULL"
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Timestamps
|
|
442
|
+
|
|
443
|
+
```xs
|
|
444
|
+
timestamp created_at default=now
|
|
445
|
+
timestamp? updated_at // Set on updates
|
|
446
|
+
timestamp? deleted_at // For soft deletes
|
|
447
|
+
```
|