@xano/developer-mcp 1.0.10 → 1.0.12
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 +83 -70
- package/dist/api_docs/format.d.ts +5 -0
- package/dist/api_docs/format.js +158 -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/index.js +51 -175
- package/dist/templates/init-workspace.js +2 -16
- package/package.json +4 -7
- package/api_docs/addon.md +0 -193
- package/api_docs/agent.md +0 -154
- package/api_docs/api_group.md +0 -236
- package/api_docs/authentication.md +0 -68
- package/api_docs/file.md +0 -190
- package/api_docs/function.md +0 -217
- package/api_docs/history.md +0 -263
- package/api_docs/index.md +0 -104
- package/api_docs/mcp_server.md +0 -139
- package/api_docs/middleware.md +0 -205
- package/api_docs/realtime.md +0 -153
- package/api_docs/table.md +0 -151
- package/api_docs/task.md +0 -191
- package/api_docs/tool.md +0 -216
- package/api_docs/triggers.md +0 -344
- package/api_docs/workspace.md +0 -246
- /package/{xanoscript_docs → dist/xanoscript_docs}/README.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/addons.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/agents.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/apis.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/database.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/debugging.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/ephemeral.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/frontend.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/functions.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/integrations.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/mcp-servers.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/performance.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/realtime.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/schema.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/security.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/streaming.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/syntax.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/tables.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/tasks.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/testing.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/tools.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/triggers.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/types.md +0 -0
- /package/{xanoscript_docs → dist/xanoscript_docs}/version.json +0 -0
package/api_docs/middleware.md
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
# Middleware API
|
|
2
|
-
|
|
3
|
-
Middleware are reusable code blocks that run before or after API endpoints. They add common functionality like authentication, logging, or request/response transformation.
|
|
4
|
-
|
|
5
|
-
## Endpoints Overview
|
|
6
|
-
|
|
7
|
-
| Method | Endpoint | Description |
|
|
8
|
-
|--------|----------|-------------|
|
|
9
|
-
| GET | `/workspace/{workspace_id}/middleware` | List middlewares |
|
|
10
|
-
| GET | `/workspace/{workspace_id}/middleware/{middleware_id}` | Get middleware |
|
|
11
|
-
| POST | `/workspace/{workspace_id}/middleware` | Create middleware |
|
|
12
|
-
| PUT | `/workspace/{workspace_id}/middleware/{middleware_id}` | Update middleware |
|
|
13
|
-
| DELETE | `/workspace/{workspace_id}/middleware/{middleware_id}` | Delete middleware |
|
|
14
|
-
| PUT | `/workspace/{workspace_id}/middleware/{middleware_id}/security` | Update security |
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## List Middlewares
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
GET /workspace/{workspace_id}/middleware
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Query Parameters:**
|
|
25
|
-
| Parameter | Type | Default | Description |
|
|
26
|
-
|-----------|------|---------|-------------|
|
|
27
|
-
| `branch` | text | "" | Branch label |
|
|
28
|
-
| `page` | int | 1 | Page number |
|
|
29
|
-
| `per_page` | int | 50 | Items per page (1-10000) |
|
|
30
|
-
| `search` | text | "" | Search filter |
|
|
31
|
-
| `sort` | enum | "created_at" | Sort field |
|
|
32
|
-
| `order` | enum | "desc" | Sort order |
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Get Middleware
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
GET /workspace/{workspace_id}/middleware/{middleware_id}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Returns middleware definition including XanoScript.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Create Middleware
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
POST /workspace/{workspace_id}/middleware
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Content-Type:** `text/x-xanoscript`
|
|
53
|
-
|
|
54
|
-
**Query Parameters:**
|
|
55
|
-
- `branch` (text): Target branch label
|
|
56
|
-
|
|
57
|
-
### XanoScript Middleware Syntax
|
|
58
|
-
|
|
59
|
-
Middleware follows the same syntax as functions:
|
|
60
|
-
|
|
61
|
-
```xanoscript
|
|
62
|
-
middleware foo {
|
|
63
|
-
input {
|
|
64
|
-
int score
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
stack {
|
|
68
|
-
var $x1 {
|
|
69
|
-
value = $input.score + 1
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
response = $x1
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Common Use Cases
|
|
78
|
-
|
|
79
|
-
#### Authentication Check
|
|
80
|
-
|
|
81
|
-
```xanoscript
|
|
82
|
-
middleware auth_check {
|
|
83
|
-
input {
|
|
84
|
-
text token?
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
stack {
|
|
88
|
-
// Validate token
|
|
89
|
-
if $input.token == null {
|
|
90
|
-
precondition.abort {
|
|
91
|
-
status = 401
|
|
92
|
-
message = "Unauthorized"
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Decode and verify token
|
|
97
|
-
var $user {
|
|
98
|
-
value = decode_jwt($input.token)
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
response = $user
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
#### Request Logging
|
|
107
|
-
|
|
108
|
-
```xanoscript
|
|
109
|
-
middleware request_logger {
|
|
110
|
-
input {
|
|
111
|
-
text endpoint
|
|
112
|
-
json body?
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
stack {
|
|
116
|
-
db.insert request_log {
|
|
117
|
-
data = {
|
|
118
|
-
endpoint: $input.endpoint,
|
|
119
|
-
body: $input.body,
|
|
120
|
-
timestamp: now()
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
response = true
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
#### Rate Limiting
|
|
130
|
-
|
|
131
|
-
```xanoscript
|
|
132
|
-
middleware rate_limit {
|
|
133
|
-
input {
|
|
134
|
-
text client_ip
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
stack {
|
|
138
|
-
// Count recent requests
|
|
139
|
-
db.query rate_limit {
|
|
140
|
-
where = $db.rate_limit.ip == $input.client_ip
|
|
141
|
-
&& $db.rate_limit.timestamp > now() - 60
|
|
142
|
-
return = {type: "count"}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if $rate_limit > 100 {
|
|
146
|
-
precondition.abort {
|
|
147
|
-
status = 429
|
|
148
|
-
message = "Too many requests"
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Log this request
|
|
153
|
-
db.insert rate_limit {
|
|
154
|
-
data = {ip: $input.client_ip, timestamp: now()}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
response = true
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Use Cases
|
|
163
|
-
|
|
164
|
-
- Authentication and authorization
|
|
165
|
-
- Request logging
|
|
166
|
-
- Rate limiting
|
|
167
|
-
- Request/response transformation
|
|
168
|
-
- Error handling
|
|
169
|
-
- CORS headers
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## Update Middleware
|
|
174
|
-
|
|
175
|
-
```
|
|
176
|
-
PUT /workspace/{workspace_id}/middleware/{middleware_id}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
**Query Parameters:**
|
|
180
|
-
- `publish` (bool, default: true): Publish changes immediately
|
|
181
|
-
|
|
182
|
-
**Content-Type:** `text/x-xanoscript`
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
|
|
186
|
-
## Delete Middleware
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
DELETE /workspace/{workspace_id}/middleware/{middleware_id}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**Warning:** This action cannot be undone. Any API groups using this middleware will no longer have it applied.
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## Update Middleware Security
|
|
197
|
-
|
|
198
|
-
```
|
|
199
|
-
PUT /workspace/{workspace_id}/middleware/{middleware_id}/security
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Parameters:**
|
|
203
|
-
| Parameter | Type | Required | Description |
|
|
204
|
-
|-----------|------|----------|-------------|
|
|
205
|
-
| `guid` | text | Yes | New security GUID |
|
package/api_docs/realtime.md
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# Realtime API
|
|
2
|
-
|
|
3
|
-
Realtime channels enable real-time bidirectional communication between clients using WebSockets. They support features like presence, message history, and private messaging.
|
|
4
|
-
|
|
5
|
-
## Endpoints Overview
|
|
6
|
-
|
|
7
|
-
| Method | Endpoint | Description |
|
|
8
|
-
|--------|----------|-------------|
|
|
9
|
-
| GET | `/workspace/{workspace_id}/realtime/channel` | List channels |
|
|
10
|
-
| GET | `/workspace/{workspace_id}/realtime/channel/{channel_id}` | Get channel |
|
|
11
|
-
| POST | `/workspace/{workspace_id}/realtime/channel` | Create channel |
|
|
12
|
-
| PUT | `/workspace/{workspace_id}/realtime/channel/{channel_id}` | Update channel |
|
|
13
|
-
| DELETE | `/workspace/{workspace_id}/realtime/channel/{channel_id}` | Delete channel |
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## List Realtime Channels
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
GET /workspace/{workspace_id}/realtime/channel
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Query Parameters:**
|
|
24
|
-
| Parameter | Type | Default | Description |
|
|
25
|
-
|-----------|------|---------|-------------|
|
|
26
|
-
| `page` | int | 1 | Page number |
|
|
27
|
-
| `per_page` | int | 50 | Items per page (1-10000) |
|
|
28
|
-
| `search` | text | "" | Search filter |
|
|
29
|
-
| `sort` | enum | "name" | Sort field: "name" |
|
|
30
|
-
| `order` | enum | "desc" | Sort order |
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Get Realtime Channel
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
GET /workspace/{workspace_id}/realtime/channel/{channel_id}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Returns channel definition including XanoScript.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Create Realtime Channel
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
POST /workspace/{workspace_id}/realtime/channel
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**Content-Type:** `text/x-xanoscript`
|
|
51
|
-
|
|
52
|
-
### XanoScript Realtime Channel Syntax
|
|
53
|
-
|
|
54
|
-
```xanoscript
|
|
55
|
-
realtime_channel foo {
|
|
56
|
-
public_messaging = {active: false}
|
|
57
|
-
private_messaging = {active: false}
|
|
58
|
-
settings = {
|
|
59
|
-
anonymous_clients: false
|
|
60
|
-
nested_channels : false
|
|
61
|
-
message_history : 0
|
|
62
|
-
auth_channel : false
|
|
63
|
-
presence : false
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Messaging Options
|
|
69
|
-
|
|
70
|
-
| Field | Type | Description |
|
|
71
|
-
|-------|------|-------------|
|
|
72
|
-
| `public_messaging` | object | Configure public message broadcasting |
|
|
73
|
-
| `private_messaging` | object | Configure private direct messages |
|
|
74
|
-
|
|
75
|
-
### Settings
|
|
76
|
-
|
|
77
|
-
| Field | Type | Description |
|
|
78
|
-
|-------|------|-------------|
|
|
79
|
-
| `anonymous_clients` | bool | Allow connections without authentication |
|
|
80
|
-
| `nested_channels` | bool | Allow sub-channels (e.g., `chat/room1`) |
|
|
81
|
-
| `message_history` | int | Messages to keep in history (0 = disabled) |
|
|
82
|
-
| `auth_channel` | bool | Require authentication for channel access |
|
|
83
|
-
| `presence` | bool | Track online/offline status of users |
|
|
84
|
-
|
|
85
|
-
### Example: Chat Room Channel
|
|
86
|
-
|
|
87
|
-
```xanoscript
|
|
88
|
-
realtime_channel chat {
|
|
89
|
-
public_messaging = {active: true}
|
|
90
|
-
private_messaging = {active: true}
|
|
91
|
-
settings = {
|
|
92
|
-
anonymous_clients: false
|
|
93
|
-
nested_channels : true
|
|
94
|
-
message_history : 100
|
|
95
|
-
auth_channel : true
|
|
96
|
-
presence : true
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Example: Notifications Channel
|
|
102
|
-
|
|
103
|
-
```xanoscript
|
|
104
|
-
realtime_channel notifications {
|
|
105
|
-
public_messaging = {active: true}
|
|
106
|
-
private_messaging = {active: false}
|
|
107
|
-
settings = {
|
|
108
|
-
anonymous_clients: false
|
|
109
|
-
nested_channels : false
|
|
110
|
-
message_history : 50
|
|
111
|
-
auth_channel : true
|
|
112
|
-
presence : false
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Example: Public Broadcast Channel
|
|
118
|
-
|
|
119
|
-
```xanoscript
|
|
120
|
-
realtime_channel announcements {
|
|
121
|
-
public_messaging = {active: true}
|
|
122
|
-
private_messaging = {active: false}
|
|
123
|
-
settings = {
|
|
124
|
-
anonymous_clients: true
|
|
125
|
-
nested_channels : false
|
|
126
|
-
message_history : 10
|
|
127
|
-
auth_channel : false
|
|
128
|
-
presence : false
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## Update Realtime Channel
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
PUT /workspace/{workspace_id}/realtime/channel/{channel_id}
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Content-Type:** `text/x-xanoscript`
|
|
142
|
-
|
|
143
|
-
Send complete channel definition.
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
## Delete Realtime Channel
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
DELETE /workspace/{workspace_id}/realtime/channel/{channel_id}
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
**Warning:** This action cannot be undone. All connected clients will be disconnected.
|
package/api_docs/table.md
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
# Table API
|
|
2
|
-
|
|
3
|
-
Tables are database objects that store structured data. Tables are defined using XanoScript with schema definitions, indexes, and constraints.
|
|
4
|
-
|
|
5
|
-
## Endpoints Overview
|
|
6
|
-
|
|
7
|
-
| Method | Endpoint | Description |
|
|
8
|
-
|--------|----------|-------------|
|
|
9
|
-
| GET | `/workspace/{workspace_id}/table` | List all tables |
|
|
10
|
-
| GET | `/workspace/{workspace_id}/table/{table_id}` | Get table details |
|
|
11
|
-
| POST | `/workspace/{workspace_id}/table` | Create table |
|
|
12
|
-
| PUT | `/workspace/{workspace_id}/table/{table_id}` | Update table |
|
|
13
|
-
| DELETE | `/workspace/{workspace_id}/table/{table_id}` | Delete table |
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## List Tables
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
GET /workspace/{workspace_id}/table
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Query Parameters:**
|
|
24
|
-
| Parameter | Type | Default | Description |
|
|
25
|
-
|-----------|------|---------|-------------|
|
|
26
|
-
| `page` | int | 1 | Page number |
|
|
27
|
-
| `per_page` | int | 50 | Items per page (1-10000) |
|
|
28
|
-
| `search` | text | "" | Search filter |
|
|
29
|
-
| `sort` | enum | "name" | Sort: "created_at", "updated_at", "name" |
|
|
30
|
-
| `order` | enum | "asc" | Sort order: "asc", "desc" |
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Get Table
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
GET /workspace/{workspace_id}/table/{table_id}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Returns table definition including schema, indexes, and XanoScript.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Create Table
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
POST /workspace/{workspace_id}/table
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**Content-Type:** `text/x-xanoscript`
|
|
51
|
-
|
|
52
|
-
### XanoScript Table Syntax
|
|
53
|
-
|
|
54
|
-
```xanoscript
|
|
55
|
-
table book {
|
|
56
|
-
schema {
|
|
57
|
-
int id
|
|
58
|
-
text title
|
|
59
|
-
text description
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
index = [
|
|
63
|
-
{type: "primary", field: [{name: "id"}]}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Schema Field Types
|
|
69
|
-
|
|
70
|
-
| Type | Description |
|
|
71
|
-
|------|-------------|
|
|
72
|
-
| `int` | Integer |
|
|
73
|
-
| `text` | Text/string |
|
|
74
|
-
| `bool` | Boolean |
|
|
75
|
-
| `float` | Floating point number |
|
|
76
|
-
| `timestamp` | Timestamp/datetime |
|
|
77
|
-
| `date` | Date only |
|
|
78
|
-
| `time` | Time only |
|
|
79
|
-
| `json` | JSON object |
|
|
80
|
-
| `uuid` | UUID string |
|
|
81
|
-
| `enum` | Enumerated values |
|
|
82
|
-
| `object` | Nested object |
|
|
83
|
-
| `object[]` | Array of objects |
|
|
84
|
-
|
|
85
|
-
### Field Modifiers
|
|
86
|
-
|
|
87
|
-
| Modifier | Syntax | Description |
|
|
88
|
-
|----------|--------|-------------|
|
|
89
|
-
| Optional | `field_name?` | Nullable field |
|
|
90
|
-
| Default | `default = value` | Default value |
|
|
91
|
-
|
|
92
|
-
### Index Types
|
|
93
|
-
|
|
94
|
-
| Type | Description |
|
|
95
|
-
|------|-------------|
|
|
96
|
-
| `primary` | Primary key index |
|
|
97
|
-
| `unique` | Unique constraint |
|
|
98
|
-
| `index` | Regular index |
|
|
99
|
-
| `fulltext` | Full-text search index |
|
|
100
|
-
|
|
101
|
-
### Complete Example
|
|
102
|
-
|
|
103
|
-
```xanoscript
|
|
104
|
-
table user {
|
|
105
|
-
schema {
|
|
106
|
-
int id
|
|
107
|
-
text email
|
|
108
|
-
text password
|
|
109
|
-
text name?
|
|
110
|
-
timestamp created_at
|
|
111
|
-
bool active default = true
|
|
112
|
-
enum role {
|
|
113
|
-
values = ["admin", "user", "guest"]
|
|
114
|
-
default = "user"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
index = [
|
|
119
|
-
{type: "primary", field: [{name: "id"}]},
|
|
120
|
-
{type: "unique", field: [{name: "email"}]},
|
|
121
|
-
{type: "index", field: [{name: "created_at"}]}
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## Update Table
|
|
129
|
-
|
|
130
|
-
```
|
|
131
|
-
PUT /workspace/{workspace_id}/table/{table_id}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Content-Type:** `text/x-xanoscript`
|
|
135
|
-
|
|
136
|
-
Send complete table definition with updated schema.
|
|
137
|
-
|
|
138
|
-
**Notes:**
|
|
139
|
-
- Schema changes may trigger database migrations
|
|
140
|
-
- Removing fields or changing types may result in data loss
|
|
141
|
-
- Adding new fields typically requires default values for existing rows
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Delete Table
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
DELETE /workspace/{workspace_id}/table/{table_id}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**Warning:** This action cannot be undone. All data in the table will be permanently deleted.
|
package/api_docs/task.md
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
# Task API
|
|
2
|
-
|
|
3
|
-
Tasks are scheduled jobs that run automatically based on a cron-like schedule. They are defined using XanoScript.
|
|
4
|
-
|
|
5
|
-
**Note:** Task functionality is restricted to paid accounts.
|
|
6
|
-
|
|
7
|
-
## Endpoints Overview
|
|
8
|
-
|
|
9
|
-
| Method | Endpoint | Description |
|
|
10
|
-
|--------|----------|-------------|
|
|
11
|
-
| GET | `/workspace/{workspace_id}/task` | List tasks |
|
|
12
|
-
| GET | `/workspace/{workspace_id}/task/{task_id}` | Get task |
|
|
13
|
-
| POST | `/workspace/{workspace_id}/task` | Create task |
|
|
14
|
-
| PUT | `/workspace/{workspace_id}/task/{task_id}` | Update task |
|
|
15
|
-
| DELETE | `/workspace/{workspace_id}/task/{task_id}` | Delete task |
|
|
16
|
-
| PUT | `/workspace/{workspace_id}/task/{task_id}/security` | Update security |
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## List Tasks
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
GET /workspace/{workspace_id}/task
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Query Parameters:**
|
|
27
|
-
| Parameter | Type | Default | Description |
|
|
28
|
-
|-----------|------|---------|-------------|
|
|
29
|
-
| `branch` | text | "" | Branch label |
|
|
30
|
-
| `page` | int | 1 | Page number |
|
|
31
|
-
| `per_page` | int | 50 | Items per page (1-10000) |
|
|
32
|
-
| `search` | text | "" | Search filter |
|
|
33
|
-
| `sort` | enum | "created_at" | Sort field |
|
|
34
|
-
| `order` | enum | "desc" | Sort order |
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## Get Task
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
GET /workspace/{workspace_id}/task/{task_id}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Returns task definition including schedule and XanoScript.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Create Task
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
POST /workspace/{workspace_id}/task
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**Content-Type:** `text/x-xanoscript`
|
|
55
|
-
|
|
56
|
-
**Query Parameters:**
|
|
57
|
-
- `branch` (text): Target branch label
|
|
58
|
-
|
|
59
|
-
### XanoScript Task Syntax
|
|
60
|
-
|
|
61
|
-
```xanoscript
|
|
62
|
-
task foo {
|
|
63
|
-
stack {
|
|
64
|
-
var $x1 {
|
|
65
|
-
value = 1
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
schedule = [{starts_on: 2025-10-28 18:03:58+0000, freq: 900}]
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Stack Section
|
|
74
|
-
|
|
75
|
-
The task logic (same syntax as functions):
|
|
76
|
-
|
|
77
|
-
```xanoscript
|
|
78
|
-
stack {
|
|
79
|
-
db.query user {
|
|
80
|
-
where = $db.user.active == false
|
|
81
|
-
return = {type: "list"}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
foreach $user as $u {
|
|
85
|
-
// Process each user
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Schedule Section
|
|
91
|
-
|
|
92
|
-
#### Inline Format
|
|
93
|
-
```xanoscript
|
|
94
|
-
schedule = [{
|
|
95
|
-
starts_on: 2025-10-28 18:03:58+0000,
|
|
96
|
-
freq: 900
|
|
97
|
-
}]
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
#### Block Format
|
|
101
|
-
```xanoscript
|
|
102
|
-
schedule {
|
|
103
|
-
events = [{
|
|
104
|
-
starts_on: 2025-07-25 20:00:12+0000,
|
|
105
|
-
freq: 900
|
|
106
|
-
}]
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Schedule Options
|
|
111
|
-
|
|
112
|
-
| Field | Description |
|
|
113
|
-
|-------|-------------|
|
|
114
|
-
| `starts_on` | ISO timestamp when schedule begins |
|
|
115
|
-
| `freq` | Frequency in seconds between runs |
|
|
116
|
-
|
|
117
|
-
### Common Frequencies
|
|
118
|
-
|
|
119
|
-
| Seconds | Interval |
|
|
120
|
-
|---------|----------|
|
|
121
|
-
| 60 | Every minute |
|
|
122
|
-
| 300 | Every 5 minutes |
|
|
123
|
-
| 900 | Every 15 minutes |
|
|
124
|
-
| 3600 | Every hour |
|
|
125
|
-
| 86400 | Every day |
|
|
126
|
-
|
|
127
|
-
### Complete Example
|
|
128
|
-
|
|
129
|
-
```xanoscript
|
|
130
|
-
task cleanup_expired_sessions {
|
|
131
|
-
stack {
|
|
132
|
-
// Find expired sessions
|
|
133
|
-
db.query session {
|
|
134
|
-
where = $db.session.expires_at < now()
|
|
135
|
-
return = {type: "list"}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Delete each expired session
|
|
139
|
-
foreach $session as $s {
|
|
140
|
-
db.delete session {
|
|
141
|
-
where = $db.session.id == $s.id
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
var $deleted_count {
|
|
146
|
-
value = count($session)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
schedule = [{
|
|
151
|
-
starts_on: 2025-01-01 00:00:00+0000,
|
|
152
|
-
freq: 3600
|
|
153
|
-
}]
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
## Update Task
|
|
160
|
-
|
|
161
|
-
```
|
|
162
|
-
PUT /workspace/{workspace_id}/task/{task_id}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
**Query Parameters:**
|
|
166
|
-
- `publish` (bool, default: true): Publish changes immediately
|
|
167
|
-
|
|
168
|
-
**Content-Type:** `text/x-xanoscript`
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
## Delete Task
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
DELETE /workspace/{workspace_id}/task/{task_id}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
**Warning:** This action cannot be undone.
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
## Update Task Security
|
|
183
|
-
|
|
184
|
-
```
|
|
185
|
-
PUT /workspace/{workspace_id}/task/{task_id}/security
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**Parameters:**
|
|
189
|
-
| Parameter | Type | Required | Description |
|
|
190
|
-
|-----------|------|----------|-------------|
|
|
191
|
-
| `guid` | text | Yes | New security GUID |
|