@aphexcms/cms-core 11.1.0 → 11.2.0
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/dist/api/docs-ui.d.ts +22 -0
- package/dist/api/docs-ui.d.ts.map +1 -0
- package/dist/api/docs-ui.js +19 -0
- package/dist/api/schemas/assets.d.ts +11 -0
- package/dist/api/schemas/assets.d.ts.map +1 -1
- package/dist/api/schemas/assets.js +24 -0
- package/dist/auth/auth-hooks.d.ts.map +1 -1
- package/dist/auth/auth-hooks.js +4 -1
- package/dist/components/admin/AssetImage.svelte +33 -11
- package/dist/components/admin/AssetImage.svelte.d.ts +9 -0
- package/dist/components/admin/AssetImage.svelte.d.ts.map +1 -1
- package/dist/components/layout/OrganizationSwitcher.svelte +24 -23
- package/dist/components/layout/OrganizationSwitcher.svelte.d.ts.map +1 -1
- package/dist/components/layout/sidebar/NavUser.svelte +20 -13
- package/dist/components/layout/sidebar/NavUser.svelte.d.ts.map +1 -1
- package/dist/server/api/index.d.ts.map +1 -1
- package/dist/server/api/index.js +7 -0
- package/dist/server/api/openapi/generate.d.ts +13 -0
- package/dist/server/api/openapi/generate.d.ts.map +1 -0
- package/dist/server/api/openapi/generate.js +529 -0
- package/dist/server/api/openapi/json-schema.d.ts +45 -0
- package/dist/server/api/openapi/json-schema.d.ts.map +1 -0
- package/dist/server/api/openapi/json-schema.js +206 -0
- package/dist/server/api/openapi/registry.d.ts +78 -0
- package/dist/server/api/openapi/registry.d.ts.map +1 -0
- package/dist/server/api/openapi/registry.js +628 -0
- package/dist/server/api/routes/agent-change-sets.d.ts +6 -0
- package/dist/server/api/routes/agent-change-sets.d.ts.map +1 -1
- package/dist/server/api/routes/agent-change-sets.js +2 -1
- package/dist/server/api/routes/jobs.d.ts +32 -0
- package/dist/server/api/routes/jobs.d.ts.map +1 -1
- package/dist/server/api/routes/jobs.js +7 -3
- package/dist/server/api/routes/openapi.d.ts +34 -0
- package/dist/server/api/routes/openapi.d.ts.map +1 -0
- package/dist/server/api/routes/openapi.js +97 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/types/config.d.ts +15 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import { listDocumentsQuery, listDocumentsResponse, getDocumentsByIdsQuery, createDocumentRequest, createDocumentResponse, getDocumentResponse, updateDocumentRequest, updateDocumentResponse, deleteDocumentResponse, publishDocumentRequest, publishDocumentResponse, unpublishDocumentRequest, unpublishDocumentResponse, queryDocumentsRequest, listVersionsQuery, listVersionsResponse, getVersionResponse, restoreVersionRequest, restoreVersionResponse, scheduleDocumentRequest, scheduleDocumentResponse } from '../../../api/schemas/documents.js';
|
|
2
|
+
import { listAssetsQuery, listAssetsResponse, getAssetResponse, updateAssetRequest, updateAssetResponse, deleteAssetResponse, bulkDeleteAssetsRequest, bulkDeleteAssetsResponse, getAssetReferencesResponse, assetReferenceCountsRequest, assetReferenceCountsResponse, createUploadUrlRequest, confirmUploadRequest } from '../../../api/schemas/assets.js';
|
|
3
|
+
import { createOrganizationRequest, updateOrganizationRequest, switchOrganizationRequest, inviteMemberRequest, cancelInvitationRequest, removeMemberRequest, updateMemberRoleRequest } from '../../../api/schemas/organizations.js';
|
|
4
|
+
import { createRoleRequest, updateRoleRequest } from '../../../api/schemas/roles.js';
|
|
5
|
+
import { updateUserRequest, updateUserPreferencesRequest, requestPasswordResetRequest, resetPasswordRequest } from '../../../api/schemas/user.js';
|
|
6
|
+
import { jobActionRequestSchema } from '../../../api/schemas/jobs.js';
|
|
7
|
+
import { savePluginSettingsRequest } from '../../../api/schemas/plugin-settings.js';
|
|
8
|
+
import { agentChatRequest } from '../../../api/schemas/agent-chat.js';
|
|
9
|
+
import { recordWorkspaceOperationRequest } from '../../../api/schemas/agent-operations.js';
|
|
10
|
+
import { listJobsQuery, listEventsQuery, healthQuery } from '../routes/jobs.js';
|
|
11
|
+
import { listChangeSetsQuery } from '../routes/agent-change-sets.js';
|
|
12
|
+
export const ROUTE_REGISTRY = [
|
|
13
|
+
// ---------------- Documents ----------------
|
|
14
|
+
{
|
|
15
|
+
path: '/api/documents',
|
|
16
|
+
method: 'GET',
|
|
17
|
+
summary: 'List documents',
|
|
18
|
+
description: 'Filter by type and status with pagination. `perspective` selects draft or published data.',
|
|
19
|
+
tag: 'Documents',
|
|
20
|
+
auth: 'read',
|
|
21
|
+
query: listDocumentsQuery,
|
|
22
|
+
response: listDocumentsResponse
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
path: '/api/documents',
|
|
26
|
+
method: 'POST',
|
|
27
|
+
summary: 'Create a document',
|
|
28
|
+
description: 'Creates a draft. Returns 201 with the document and its validation result. Set `publish: true` to publish immediately — validation failures then return 400.',
|
|
29
|
+
tag: 'Documents',
|
|
30
|
+
auth: 'write',
|
|
31
|
+
request: createDocumentRequest,
|
|
32
|
+
response: createDocumentResponse,
|
|
33
|
+
expandDocumentData: true
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
path: '/api/documents/by-ids',
|
|
37
|
+
method: 'GET',
|
|
38
|
+
summary: 'Batch document lookup',
|
|
39
|
+
description: 'Fetch up to 100 documents in one round-trip by comma-separated id list.',
|
|
40
|
+
tag: 'Documents',
|
|
41
|
+
auth: 'read',
|
|
42
|
+
query: getDocumentsByIdsQuery
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
path: '/api/documents/query',
|
|
46
|
+
method: 'POST',
|
|
47
|
+
summary: 'Advanced query',
|
|
48
|
+
description: [
|
|
49
|
+
'Read-only despite being a POST — the filter payload is too complex for a query string. Accepted with a read-only API key.',
|
|
50
|
+
'',
|
|
51
|
+
'`where` is a map of field → `{ operator: value }`. Multiple fields are ANDed; `and` and `or` take arrays of nested `where` objects. Dot-notation reaches into nested fields (`"seo.title"`).',
|
|
52
|
+
'',
|
|
53
|
+
'```json',
|
|
54
|
+
'{',
|
|
55
|
+
' "type": "post",',
|
|
56
|
+
' "where": {',
|
|
57
|
+
' "title": { "contains": "incident" },',
|
|
58
|
+
' "or": [',
|
|
59
|
+
' { "slug": { "starts_with": "2026-" } },',
|
|
60
|
+
' { "featured": { "equals": true } }',
|
|
61
|
+
' ]',
|
|
62
|
+
' },',
|
|
63
|
+
' "sort": "-publishedAt",',
|
|
64
|
+
' "limit": 20',
|
|
65
|
+
'}',
|
|
66
|
+
'```',
|
|
67
|
+
'',
|
|
68
|
+
'**Operators are not validated.** An unrecognised one (`eq` instead of `equals`) is dropped rather than rejected, and the query then matches *every* document of that type — a typo widens the result set instead of narrowing it. A `where` of the wrong shape, or naming a field the schema does not declare, returns zero results with a 200 rather than an error. Check the operator list below against what you send.'
|
|
69
|
+
].join('\n'),
|
|
70
|
+
tag: 'Documents',
|
|
71
|
+
auth: 'read-via-post',
|
|
72
|
+
request: queryDocumentsRequest,
|
|
73
|
+
response: listDocumentsResponse,
|
|
74
|
+
bodyOverrides: {
|
|
75
|
+
where: { $ref: '#/components/schemas/WhereFilter' },
|
|
76
|
+
select: {
|
|
77
|
+
type: 'array',
|
|
78
|
+
items: { type: 'string' },
|
|
79
|
+
description: 'Field paths to return, e.g. `["title", "slug"]`. Not currently applied — the full document is returned regardless.'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
requestExample: {
|
|
83
|
+
type: 'post',
|
|
84
|
+
where: { title: { contains: 'incident' } },
|
|
85
|
+
sort: '-publishedAt',
|
|
86
|
+
limit: 20,
|
|
87
|
+
perspective: 'published'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
path: '/api/documents/:id',
|
|
92
|
+
method: 'GET',
|
|
93
|
+
summary: 'Get a document',
|
|
94
|
+
tag: 'Documents',
|
|
95
|
+
auth: 'read',
|
|
96
|
+
response: getDocumentResponse
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
path: '/api/documents/:id',
|
|
100
|
+
method: 'PUT',
|
|
101
|
+
summary: 'Update a document draft',
|
|
102
|
+
description: 'Pass `expectedRevision` (from `_meta.revision`) for compare-and-swap; a mismatch returns 409 with `currentRevision` rather than overwriting.',
|
|
103
|
+
tag: 'Documents',
|
|
104
|
+
auth: 'write',
|
|
105
|
+
request: updateDocumentRequest,
|
|
106
|
+
response: updateDocumentResponse,
|
|
107
|
+
expandDocumentData: true
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
path: '/api/documents/:id',
|
|
111
|
+
method: 'DELETE',
|
|
112
|
+
summary: 'Delete a document',
|
|
113
|
+
tag: 'Documents',
|
|
114
|
+
auth: 'write',
|
|
115
|
+
response: deleteDocumentResponse
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
path: '/api/documents/:id/publish',
|
|
119
|
+
method: 'POST',
|
|
120
|
+
summary: 'Publish a document',
|
|
121
|
+
description: 'Validates the draft and copies it to published data. 400 if validation fails.',
|
|
122
|
+
tag: 'Documents',
|
|
123
|
+
auth: 'write',
|
|
124
|
+
request: publishDocumentRequest,
|
|
125
|
+
response: publishDocumentResponse
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
path: '/api/documents/:id/publish',
|
|
129
|
+
method: 'DELETE',
|
|
130
|
+
summary: 'Unpublish a document',
|
|
131
|
+
tag: 'Documents',
|
|
132
|
+
auth: 'write',
|
|
133
|
+
request: unpublishDocumentRequest,
|
|
134
|
+
response: unpublishDocumentResponse
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
path: '/api/documents/:id/back-references',
|
|
138
|
+
method: 'GET',
|
|
139
|
+
summary: 'List documents referencing this one',
|
|
140
|
+
tag: 'Documents',
|
|
141
|
+
auth: 'read'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
path: '/api/documents/:id/schedule',
|
|
145
|
+
method: 'GET',
|
|
146
|
+
summary: 'Read the pending publish/unpublish schedule',
|
|
147
|
+
tag: 'Documents',
|
|
148
|
+
auth: 'read'
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
path: '/api/documents/:id/schedule',
|
|
152
|
+
method: 'POST',
|
|
153
|
+
summary: 'Schedule a publish or unpublish',
|
|
154
|
+
description: 'Enqueues a durable job that runs at `runAt`. At most one pending schedule per document — rescheduling cancels the prior one.',
|
|
155
|
+
tag: 'Documents',
|
|
156
|
+
auth: 'write',
|
|
157
|
+
request: scheduleDocumentRequest,
|
|
158
|
+
response: scheduleDocumentResponse
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
path: '/api/documents/:id/schedule',
|
|
162
|
+
method: 'DELETE',
|
|
163
|
+
summary: 'Cancel a pending schedule',
|
|
164
|
+
tag: 'Documents',
|
|
165
|
+
auth: 'write'
|
|
166
|
+
},
|
|
167
|
+
// ---------------- Versions ----------------
|
|
168
|
+
{
|
|
169
|
+
path: '/api/documents/:id/versions',
|
|
170
|
+
method: 'GET',
|
|
171
|
+
summary: 'List versions',
|
|
172
|
+
tag: 'Versions',
|
|
173
|
+
auth: 'read',
|
|
174
|
+
query: listVersionsQuery,
|
|
175
|
+
response: listVersionsResponse
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
path: '/api/documents/:id/versions/:version',
|
|
179
|
+
method: 'GET',
|
|
180
|
+
summary: 'Get one version',
|
|
181
|
+
tag: 'Versions',
|
|
182
|
+
auth: 'read',
|
|
183
|
+
response: getVersionResponse
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
path: '/api/documents/:id/versions/:version/restore',
|
|
187
|
+
method: 'POST',
|
|
188
|
+
summary: 'Restore a version into the draft',
|
|
189
|
+
tag: 'Versions',
|
|
190
|
+
auth: 'write',
|
|
191
|
+
request: restoreVersionRequest,
|
|
192
|
+
response: restoreVersionResponse
|
|
193
|
+
},
|
|
194
|
+
// ---------------- Assets ----------------
|
|
195
|
+
{
|
|
196
|
+
path: '/api/assets',
|
|
197
|
+
method: 'GET',
|
|
198
|
+
summary: 'List assets',
|
|
199
|
+
tag: 'Assets',
|
|
200
|
+
auth: 'read',
|
|
201
|
+
query: listAssetsQuery,
|
|
202
|
+
response: listAssetsResponse
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
path: '/api/assets',
|
|
206
|
+
method: 'POST',
|
|
207
|
+
summary: 'Upload an asset',
|
|
208
|
+
description: '`multipart/form-data`. Rejected with 413 above the configured upload ceiling (`upload.maxFileSize`).',
|
|
209
|
+
tag: 'Assets',
|
|
210
|
+
auth: 'write',
|
|
211
|
+
formData: {
|
|
212
|
+
fields: {
|
|
213
|
+
file: { type: 'string', format: 'binary', description: 'The file to upload.' },
|
|
214
|
+
title: { type: 'string' },
|
|
215
|
+
alt: { type: 'string' },
|
|
216
|
+
description: { type: 'string' }
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
path: '/api/assets/upload-url',
|
|
222
|
+
method: 'POST',
|
|
223
|
+
summary: 'Create a direct-upload URL',
|
|
224
|
+
description: 'Presigned upload straight to storage, bypassing the app. Enabled by `upload.direct`. Pair with `/api/assets/confirm`.',
|
|
225
|
+
tag: 'Assets',
|
|
226
|
+
auth: 'write',
|
|
227
|
+
request: createUploadUrlRequest
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
path: '/api/assets/confirm',
|
|
231
|
+
method: 'POST',
|
|
232
|
+
summary: 'Confirm a direct upload',
|
|
233
|
+
description: 'Registers an asset record for a file already written to storage.',
|
|
234
|
+
tag: 'Assets',
|
|
235
|
+
auth: 'write',
|
|
236
|
+
request: confirmUploadRequest
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
path: '/api/assets/bulk',
|
|
240
|
+
method: 'DELETE',
|
|
241
|
+
summary: 'Bulk delete assets',
|
|
242
|
+
tag: 'Assets',
|
|
243
|
+
auth: 'write',
|
|
244
|
+
request: bulkDeleteAssetsRequest,
|
|
245
|
+
response: bulkDeleteAssetsResponse
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
path: '/api/assets/references/counts',
|
|
249
|
+
method: 'POST',
|
|
250
|
+
summary: 'Reference counts for a list of assets',
|
|
251
|
+
tag: 'Assets',
|
|
252
|
+
auth: 'write',
|
|
253
|
+
request: assetReferenceCountsRequest,
|
|
254
|
+
response: assetReferenceCountsResponse
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
path: '/api/assets/:id',
|
|
258
|
+
method: 'GET',
|
|
259
|
+
summary: 'Get asset metadata',
|
|
260
|
+
tag: 'Assets',
|
|
261
|
+
auth: 'read',
|
|
262
|
+
response: getAssetResponse
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
path: '/api/assets/:id',
|
|
266
|
+
method: 'PATCH',
|
|
267
|
+
summary: 'Update asset metadata',
|
|
268
|
+
tag: 'Assets',
|
|
269
|
+
auth: 'write',
|
|
270
|
+
request: updateAssetRequest,
|
|
271
|
+
response: updateAssetResponse
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
path: '/api/assets/:id',
|
|
275
|
+
method: 'DELETE',
|
|
276
|
+
summary: 'Delete an asset',
|
|
277
|
+
tag: 'Assets',
|
|
278
|
+
auth: 'write',
|
|
279
|
+
response: deleteAssetResponse
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
path: '/api/assets/:id/references',
|
|
283
|
+
method: 'GET',
|
|
284
|
+
summary: 'List documents referencing this asset',
|
|
285
|
+
tag: 'Assets',
|
|
286
|
+
auth: 'read',
|
|
287
|
+
response: getAssetReferencesResponse
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
path: '/api/assets/:id/poster',
|
|
291
|
+
method: 'POST',
|
|
292
|
+
summary: 'Attach a poster image to a video asset',
|
|
293
|
+
description: '`multipart/form-data`.',
|
|
294
|
+
tag: 'Assets',
|
|
295
|
+
auth: 'write',
|
|
296
|
+
formData: {
|
|
297
|
+
fields: { file: { type: 'string', format: 'binary', description: 'Poster image.' } }
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
// ---------------- Schemas ----------------
|
|
301
|
+
{
|
|
302
|
+
path: '/api/schemas',
|
|
303
|
+
method: 'GET',
|
|
304
|
+
summary: 'List all registered schemas',
|
|
305
|
+
description: 'Read from live config, so validation functions and groups survive. This is the content model this instance is running.',
|
|
306
|
+
tag: 'Schemas',
|
|
307
|
+
auth: 'read'
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
path: '/api/schemas/:type',
|
|
311
|
+
method: 'GET',
|
|
312
|
+
summary: 'Get one schema',
|
|
313
|
+
tag: 'Schemas',
|
|
314
|
+
auth: 'read'
|
|
315
|
+
},
|
|
316
|
+
// ---------------- Organizations ----------------
|
|
317
|
+
{
|
|
318
|
+
path: '/api/organizations',
|
|
319
|
+
method: 'GET',
|
|
320
|
+
summary: 'List organizations the caller belongs to',
|
|
321
|
+
tag: 'Organizations',
|
|
322
|
+
auth: 'read'
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
path: '/api/organizations',
|
|
326
|
+
method: 'POST',
|
|
327
|
+
summary: 'Create an organization',
|
|
328
|
+
tag: 'Organizations',
|
|
329
|
+
auth: 'write',
|
|
330
|
+
request: createOrganizationRequest
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
path: '/api/organizations/switch',
|
|
334
|
+
method: 'POST',
|
|
335
|
+
summary: 'Switch the active organization',
|
|
336
|
+
tag: 'Organizations',
|
|
337
|
+
auth: 'write',
|
|
338
|
+
request: switchOrganizationRequest
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
path: '/api/organizations/members',
|
|
342
|
+
method: 'GET',
|
|
343
|
+
summary: 'List members of the active organization',
|
|
344
|
+
tag: 'Organizations',
|
|
345
|
+
auth: 'read'
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
path: '/api/organizations/members',
|
|
349
|
+
method: 'PATCH',
|
|
350
|
+
summary: "Update a member's role",
|
|
351
|
+
tag: 'Organizations',
|
|
352
|
+
auth: 'write',
|
|
353
|
+
request: updateMemberRoleRequest
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
path: '/api/organizations/members',
|
|
357
|
+
method: 'DELETE',
|
|
358
|
+
summary: 'Remove a member',
|
|
359
|
+
tag: 'Organizations',
|
|
360
|
+
auth: 'write',
|
|
361
|
+
request: removeMemberRequest
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
path: '/api/organizations/invitations',
|
|
365
|
+
method: 'POST',
|
|
366
|
+
summary: 'Invite a member',
|
|
367
|
+
tag: 'Organizations',
|
|
368
|
+
auth: 'write',
|
|
369
|
+
request: inviteMemberRequest
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
path: '/api/organizations/invitations',
|
|
373
|
+
method: 'DELETE',
|
|
374
|
+
summary: 'Cancel an invitation',
|
|
375
|
+
tag: 'Organizations',
|
|
376
|
+
auth: 'write',
|
|
377
|
+
request: cancelInvitationRequest
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
path: '/api/organizations/:id',
|
|
381
|
+
method: 'GET',
|
|
382
|
+
summary: 'Get an organization',
|
|
383
|
+
tag: 'Organizations',
|
|
384
|
+
auth: 'read'
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
path: '/api/organizations/:id',
|
|
388
|
+
method: 'PATCH',
|
|
389
|
+
summary: 'Update an organization',
|
|
390
|
+
tag: 'Organizations',
|
|
391
|
+
auth: 'write',
|
|
392
|
+
request: updateOrganizationRequest
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
path: '/api/organizations/:id',
|
|
396
|
+
method: 'DELETE',
|
|
397
|
+
summary: 'Delete an organization',
|
|
398
|
+
tag: 'Organizations',
|
|
399
|
+
auth: 'write'
|
|
400
|
+
},
|
|
401
|
+
// ---------------- Roles ----------------
|
|
402
|
+
{
|
|
403
|
+
path: '/api/roles',
|
|
404
|
+
method: 'GET',
|
|
405
|
+
summary: 'List built-in and custom roles',
|
|
406
|
+
tag: 'Roles',
|
|
407
|
+
auth: 'read'
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
path: '/api/roles',
|
|
411
|
+
method: 'POST',
|
|
412
|
+
summary: 'Create a custom role',
|
|
413
|
+
tag: 'Roles',
|
|
414
|
+
auth: 'write',
|
|
415
|
+
request: createRoleRequest
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
path: '/api/roles/:name',
|
|
419
|
+
method: 'PATCH',
|
|
420
|
+
summary: "Update a role's capabilities",
|
|
421
|
+
tag: 'Roles',
|
|
422
|
+
auth: 'write',
|
|
423
|
+
request: updateRoleRequest
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
path: '/api/roles/:name',
|
|
427
|
+
method: 'DELETE',
|
|
428
|
+
summary: 'Delete a custom role',
|
|
429
|
+
tag: 'Roles',
|
|
430
|
+
auth: 'write'
|
|
431
|
+
},
|
|
432
|
+
// ---------------- Plugin settings ----------------
|
|
433
|
+
{
|
|
434
|
+
path: '/api/plugin-settings',
|
|
435
|
+
method: 'GET',
|
|
436
|
+
summary: 'Read per-organization plugin settings',
|
|
437
|
+
description: 'Session only — API keys are rejected. Secret values are returned redacted.',
|
|
438
|
+
tag: 'Plugin settings',
|
|
439
|
+
auth: 'session'
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
path: '/api/plugin-settings/:pluginId',
|
|
443
|
+
method: 'PUT',
|
|
444
|
+
summary: "Save one plugin's settings",
|
|
445
|
+
description: 'Session only. `type: "secret"` values are encrypted at rest.',
|
|
446
|
+
tag: 'Plugin settings',
|
|
447
|
+
auth: 'session',
|
|
448
|
+
request: savePluginSettingsRequest
|
|
449
|
+
},
|
|
450
|
+
// ---------------- User ----------------
|
|
451
|
+
{
|
|
452
|
+
path: '/api/user',
|
|
453
|
+
method: 'PATCH',
|
|
454
|
+
summary: 'Update the signed-in profile',
|
|
455
|
+
tag: 'User',
|
|
456
|
+
auth: 'session',
|
|
457
|
+
request: updateUserRequest
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
path: '/api/user/cms-preference',
|
|
461
|
+
method: 'GET',
|
|
462
|
+
summary: 'Read editor preferences',
|
|
463
|
+
tag: 'User',
|
|
464
|
+
auth: 'session'
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
path: '/api/user/cms-preference',
|
|
468
|
+
method: 'PATCH',
|
|
469
|
+
summary: 'Update editor preferences',
|
|
470
|
+
tag: 'User',
|
|
471
|
+
auth: 'session',
|
|
472
|
+
request: updateUserPreferencesRequest
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
path: '/api/user/request-password-reset',
|
|
476
|
+
method: 'POST',
|
|
477
|
+
summary: 'Send a password-reset email',
|
|
478
|
+
tag: 'User',
|
|
479
|
+
auth: 'public',
|
|
480
|
+
request: requestPasswordResetRequest
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
path: '/api/user/reset-password',
|
|
484
|
+
method: 'POST',
|
|
485
|
+
summary: 'Complete a password reset',
|
|
486
|
+
tag: 'User',
|
|
487
|
+
auth: 'public',
|
|
488
|
+
request: resetPasswordRequest
|
|
489
|
+
},
|
|
490
|
+
// ---------------- Jobs & events ----------------
|
|
491
|
+
{
|
|
492
|
+
path: '/api/jobs',
|
|
493
|
+
method: 'GET',
|
|
494
|
+
summary: 'List queue jobs',
|
|
495
|
+
description: 'Observability over the durable spine. `?scope=all` crosses the tenant boundary and is super-admin only.',
|
|
496
|
+
tag: 'Jobs & events',
|
|
497
|
+
auth: 'read',
|
|
498
|
+
query: listJobsQuery
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
path: '/api/jobs/health',
|
|
502
|
+
method: 'GET',
|
|
503
|
+
summary: 'Queue health counters',
|
|
504
|
+
tag: 'Jobs & events',
|
|
505
|
+
auth: 'read',
|
|
506
|
+
query: healthQuery
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
path: '/api/jobs/:id/retry',
|
|
510
|
+
method: 'POST',
|
|
511
|
+
summary: 'Requeue a failed or dead-lettered job',
|
|
512
|
+
tag: 'Jobs & events',
|
|
513
|
+
auth: 'write',
|
|
514
|
+
request: jobActionRequestSchema
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
path: '/api/jobs/:id/cancel',
|
|
518
|
+
method: 'POST',
|
|
519
|
+
summary: 'Cancel a pending job',
|
|
520
|
+
tag: 'Jobs & events',
|
|
521
|
+
auth: 'write',
|
|
522
|
+
request: jobActionRequestSchema
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
path: '/api/events',
|
|
526
|
+
method: 'GET',
|
|
527
|
+
summary: 'List domain events',
|
|
528
|
+
description: 'The append-only fact log. Immutable — there is no write endpoint.',
|
|
529
|
+
tag: 'Jobs & events',
|
|
530
|
+
auth: 'read',
|
|
531
|
+
query: listEventsQuery
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
path: '/api/internal/workers/run',
|
|
535
|
+
method: 'POST',
|
|
536
|
+
summary: 'Run one worker tick (relay + execute)',
|
|
537
|
+
description: 'Machine-to-machine. Bearer `jobs.workerSecret`; returns 404 when that secret is unset, so it is never an unauthenticated surface.',
|
|
538
|
+
tag: 'Jobs & events',
|
|
539
|
+
auth: 'secret'
|
|
540
|
+
},
|
|
541
|
+
// ---------------- Agent ----------------
|
|
542
|
+
{
|
|
543
|
+
path: '/api/agent/chat',
|
|
544
|
+
method: 'POST',
|
|
545
|
+
summary: 'Streaming admin agent chat',
|
|
546
|
+
description: '404 unless `aiProvider` is configured.',
|
|
547
|
+
tag: 'Agent',
|
|
548
|
+
auth: 'session',
|
|
549
|
+
request: agentChatRequest
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
path: '/api/agent/operations',
|
|
553
|
+
method: 'POST',
|
|
554
|
+
summary: 'Record a workspace operation',
|
|
555
|
+
tag: 'Agent',
|
|
556
|
+
auth: 'session',
|
|
557
|
+
request: recordWorkspaceOperationRequest
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
path: '/api/agent/change-sets',
|
|
561
|
+
method: 'GET',
|
|
562
|
+
summary: 'List agent turns with their operations',
|
|
563
|
+
tag: 'Agent',
|
|
564
|
+
auth: 'read',
|
|
565
|
+
query: listChangeSetsQuery
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
path: '/api/agent/change-sets/:id',
|
|
569
|
+
method: 'GET',
|
|
570
|
+
summary: 'Get one agent turn in detail',
|
|
571
|
+
tag: 'Agent',
|
|
572
|
+
auth: 'read'
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
path: '/api/agent/change-sets/:id/undo',
|
|
576
|
+
method: 'POST',
|
|
577
|
+
summary: 'Undo an agent turn',
|
|
578
|
+
description: 'Restores each mutated document to its prior version, in reverse order.',
|
|
579
|
+
tag: 'Agent',
|
|
580
|
+
auth: 'write'
|
|
581
|
+
},
|
|
582
|
+
// ---------------- Meta ----------------
|
|
583
|
+
{
|
|
584
|
+
path: '/api/aphex-health',
|
|
585
|
+
method: 'GET',
|
|
586
|
+
summary: 'Health check',
|
|
587
|
+
description: 'Unauthenticated. The database decides the status code; storage is reported but never fails the check (it degrades to `status: "degraded"` with HTTP 200). Storage is only probed when `storageHealthCheck` is enabled. Note that the templates deploy `/healthz` instead, which 503s on storage failure.',
|
|
588
|
+
tag: 'Meta',
|
|
589
|
+
auth: 'public'
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
path: '/api/openapi.json',
|
|
593
|
+
method: 'GET',
|
|
594
|
+
summary: 'This document',
|
|
595
|
+
description: 'Generated per instance from the live schema config and the zod contracts.',
|
|
596
|
+
tag: 'Meta',
|
|
597
|
+
auth: 'read'
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
path: '/api/docs',
|
|
601
|
+
method: 'GET',
|
|
602
|
+
summary: 'Rendered API reference',
|
|
603
|
+
description: 'A Scalar reference over `/api/openapi.json`. Static HTML — it fetches the spec from the browser with your session, so the page itself carries no content. Signed out, it redirects to the login page rather than returning 401, because the response is HTML for a person. Set `openapi.docsUi: false` to unmount it, after which it answers 404.',
|
|
604
|
+
tag: 'Meta',
|
|
605
|
+
auth: 'read'
|
|
606
|
+
}
|
|
607
|
+
];
|
|
608
|
+
/** `METHOD path` key, matching the shape of Hono's `app.routes` entries. */
|
|
609
|
+
export function routeKey(method, path) {
|
|
610
|
+
return `${method.toUpperCase()} ${path}`;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* What each tag groups, for the rendered doc's section headers. Keyed by the
|
|
614
|
+
* `tag` values used above; a tag without an entry still renders, just bare.
|
|
615
|
+
*/
|
|
616
|
+
export const TAG_DESCRIPTIONS = {
|
|
617
|
+
Documents: 'Draft/published content. Every write is guarded by a monotonic `revision` — pass `expectedRevision` to turn a lost update into a 409 instead of a silent overwrite.',
|
|
618
|
+
Versions: 'Point-in-time snapshots of a document, and restoring one into the draft.',
|
|
619
|
+
Assets: 'Uploaded media and files, their metadata, and what references them.',
|
|
620
|
+
Schemas: 'The content model this instance is running.',
|
|
621
|
+
Organizations: 'Tenants, their members, and invitations.',
|
|
622
|
+
Roles: 'Built-in and custom roles, and the capabilities they carry.',
|
|
623
|
+
'Plugin settings': 'Per-organization plugin configuration, including encrypted secrets.',
|
|
624
|
+
User: 'The signed-in account and its editor preferences.',
|
|
625
|
+
'Jobs & events': 'The durable spine: an append-only domain-event log, the job queue that reacts to it, and the worker endpoint that drives a tick.',
|
|
626
|
+
Agent: 'The in-admin AI assistant and its audit/undo trail.',
|
|
627
|
+
Meta: 'Health and self-description.'
|
|
628
|
+
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import type { AphexEnv } from '../index.js';
|
|
4
|
+
/** Exported for the OpenAPI registry — see the note in `routes/jobs.ts`. */
|
|
5
|
+
export declare const listChangeSetsQuery: z.ZodObject<{
|
|
6
|
+
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
7
|
+
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
3
9
|
export declare const agentChangeSetsRouter: Hono<AphexEnv>;
|
|
4
10
|
//# sourceMappingURL=agent-change-sets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-change-sets.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/routes/agent-change-sets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-change-sets.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/routes/agent-change-sets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAeH,eAAO,MAAM,qBAAqB,EAAE,IAAI,CAAC,QAAQ,CAiI9C,CAAC"}
|
|
@@ -5,7 +5,8 @@ import { hasCapability } from '../../../types/capabilities.js';
|
|
|
5
5
|
import { RevisionConflictError } from '../../../db/interfaces/index.js';
|
|
6
6
|
import { cmsLogger } from '../../../utils/logger.js';
|
|
7
7
|
import { withCreatedByNames } from './resolve-created-by.js';
|
|
8
|
-
|
|
8
|
+
/** Exported for the OpenAPI registry — see the note in `routes/jobs.ts`. */
|
|
9
|
+
export const listChangeSetsQuery = z.object({
|
|
9
10
|
limit: z.coerce.number().int().min(1).max(200).optional(),
|
|
10
11
|
offset: z.coerce.number().int().min(0).optional()
|
|
11
12
|
});
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import type { AphexEnv } from '../index.js';
|
|
4
|
+
export declare const listJobsQuery: z.ZodObject<{
|
|
5
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
pending: "pending";
|
|
7
|
+
leased: "leased";
|
|
8
|
+
completed: "completed";
|
|
9
|
+
failed: "failed";
|
|
10
|
+
cancelled: "cancelled";
|
|
11
|
+
}>>;
|
|
12
|
+
type: z.ZodOptional<z.ZodString>;
|
|
13
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
14
|
+
all: "all";
|
|
15
|
+
organization: "organization";
|
|
16
|
+
}>>;
|
|
17
|
+
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
18
|
+
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const listEventsQuery: z.ZodObject<{
|
|
21
|
+
type: z.ZodOptional<z.ZodString>;
|
|
22
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
all: "all";
|
|
24
|
+
organization: "organization";
|
|
25
|
+
}>>;
|
|
26
|
+
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
27
|
+
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export declare const healthQuery: z.ZodObject<{
|
|
30
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
31
|
+
all: "all";
|
|
32
|
+
organization: "organization";
|
|
33
|
+
}>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
3
35
|
export declare const jobsRouter: Hono<AphexEnv>;
|
|
4
36
|
//# sourceMappingURL=jobs.d.ts.map
|