emdash 0.0.0-a → 0.0.1

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.
Files changed (661) hide show
  1. package/README.md +87 -1
  2. package/dist/adapters-BLMa4JGD.d.mts +106 -0
  3. package/dist/adapters-BLMa4JGD.d.mts.map +1 -0
  4. package/dist/apply-Bjfq_b4-.mjs +1293 -0
  5. package/dist/apply-Bjfq_b4-.mjs.map +1 -0
  6. package/dist/astro/index.d.mts +51 -0
  7. package/dist/astro/index.d.mts.map +1 -0
  8. package/dist/astro/index.mjs +1333 -0
  9. package/dist/astro/index.mjs.map +1 -0
  10. package/dist/astro/middleware/auth.d.mts +31 -0
  11. package/dist/astro/middleware/auth.d.mts.map +1 -0
  12. package/dist/astro/middleware/auth.mjs +654 -0
  13. package/dist/astro/middleware/auth.mjs.map +1 -0
  14. package/dist/astro/middleware/redirect.d.mts +22 -0
  15. package/dist/astro/middleware/redirect.d.mts.map +1 -0
  16. package/dist/astro/middleware/redirect.mjs +63 -0
  17. package/dist/astro/middleware/redirect.mjs.map +1 -0
  18. package/dist/astro/middleware/request-context.d.mts +18 -0
  19. package/dist/astro/middleware/request-context.d.mts.map +1 -0
  20. package/dist/astro/middleware/request-context.mjs +1310 -0
  21. package/dist/astro/middleware/request-context.mjs.map +1 -0
  22. package/dist/astro/middleware/setup.d.mts +20 -0
  23. package/dist/astro/middleware/setup.d.mts.map +1 -0
  24. package/dist/astro/middleware/setup.mjs +47 -0
  25. package/dist/astro/middleware/setup.mjs.map +1 -0
  26. package/dist/astro/middleware.d.mts +13 -0
  27. package/dist/astro/middleware.d.mts.map +1 -0
  28. package/dist/astro/middleware.mjs +1613 -0
  29. package/dist/astro/middleware.mjs.map +1 -0
  30. package/dist/astro/types.d.mts +250 -0
  31. package/dist/astro/types.d.mts.map +1 -0
  32. package/dist/astro/types.mjs +1 -0
  33. package/dist/base64-MBPo9ozB.mjs +59 -0
  34. package/dist/base64-MBPo9ozB.mjs.map +1 -0
  35. package/dist/byline-CL847F26.mjs +213 -0
  36. package/dist/byline-CL847F26.mjs.map +1 -0
  37. package/dist/bylines-C2a-2TGt.mjs +136 -0
  38. package/dist/bylines-C2a-2TGt.mjs.map +1 -0
  39. package/dist/chunk-ClPoSABd.mjs +21 -0
  40. package/dist/cli/index.d.mts +1 -0
  41. package/dist/cli/index.mjs +3909 -0
  42. package/dist/cli/index.mjs.map +1 -0
  43. package/dist/client/cf-access.d.mts +60 -0
  44. package/dist/client/cf-access.d.mts.map +1 -0
  45. package/dist/client/cf-access.mjs +179 -0
  46. package/dist/client/cf-access.mjs.map +1 -0
  47. package/dist/client/index.d.mts +398 -0
  48. package/dist/client/index.d.mts.map +1 -0
  49. package/dist/client/index.mjs +346 -0
  50. package/dist/client/index.mjs.map +1 -0
  51. package/dist/config-CKE8p9xM.mjs +55 -0
  52. package/dist/config-CKE8p9xM.mjs.map +1 -0
  53. package/dist/connection-B4zVnQIa.mjs +40 -0
  54. package/dist/connection-B4zVnQIa.mjs.map +1 -0
  55. package/dist/content-D6C2WsZC.mjs +824 -0
  56. package/dist/content-D6C2WsZC.mjs.map +1 -0
  57. package/dist/db/index.d.mts +4 -0
  58. package/dist/db/index.mjs +62 -0
  59. package/dist/db/index.mjs.map +1 -0
  60. package/dist/db/libsql.d.mts +11 -0
  61. package/dist/db/libsql.d.mts.map +1 -0
  62. package/dist/db/libsql.mjs +17 -0
  63. package/dist/db/libsql.mjs.map +1 -0
  64. package/dist/db/postgres.d.mts +11 -0
  65. package/dist/db/postgres.d.mts.map +1 -0
  66. package/dist/db/postgres.mjs +30 -0
  67. package/dist/db/postgres.mjs.map +1 -0
  68. package/dist/db/sqlite.d.mts +11 -0
  69. package/dist/db/sqlite.d.mts.map +1 -0
  70. package/dist/db/sqlite.mjs +16 -0
  71. package/dist/db/sqlite.mjs.map +1 -0
  72. package/dist/default-Cyi4aAxu.mjs +81 -0
  73. package/dist/default-Cyi4aAxu.mjs.map +1 -0
  74. package/dist/dialect-helpers-B9uSp2GJ.mjs +90 -0
  75. package/dist/dialect-helpers-B9uSp2GJ.mjs.map +1 -0
  76. package/dist/error-Cxz0tQeO.mjs +27 -0
  77. package/dist/error-Cxz0tQeO.mjs.map +1 -0
  78. package/dist/index-C1xF3OGh.d.mts +4527 -0
  79. package/dist/index-C1xF3OGh.d.mts.map +1 -0
  80. package/dist/index.d.mts +16 -0
  81. package/dist/index.mjs +30 -0
  82. package/dist/load-yOOlckBj.mjs +28 -0
  83. package/dist/load-yOOlckBj.mjs.map +1 -0
  84. package/dist/loader-fz8Q_3EO.mjs +447 -0
  85. package/dist/loader-fz8Q_3EO.mjs.map +1 -0
  86. package/dist/manifest-schema-Dcl0R6nM.mjs +184 -0
  87. package/dist/manifest-schema-Dcl0R6nM.mjs.map +1 -0
  88. package/dist/media/index.d.mts +26 -0
  89. package/dist/media/index.d.mts.map +1 -0
  90. package/dist/media/index.mjs +55 -0
  91. package/dist/media/index.mjs.map +1 -0
  92. package/dist/media/local-runtime.d.mts +39 -0
  93. package/dist/media/local-runtime.d.mts.map +1 -0
  94. package/dist/media/local-runtime.mjs +133 -0
  95. package/dist/media/local-runtime.mjs.map +1 -0
  96. package/dist/media-DqHVh136.mjs +200 -0
  97. package/dist/media-DqHVh136.mjs.map +1 -0
  98. package/dist/mode-C2EzN1uE.mjs +23 -0
  99. package/dist/mode-C2EzN1uE.mjs.map +1 -0
  100. package/dist/page/index.d.mts +140 -0
  101. package/dist/page/index.d.mts.map +1 -0
  102. package/dist/page/index.mjs +416 -0
  103. package/dist/page/index.mjs.map +1 -0
  104. package/dist/placeholder-CmGAmqeO.d.mts +276 -0
  105. package/dist/placeholder-CmGAmqeO.d.mts.map +1 -0
  106. package/dist/placeholder-SmpOx-_v.mjs +243 -0
  107. package/dist/placeholder-SmpOx-_v.mjs.map +1 -0
  108. package/dist/plugin-utils.d.mts +58 -0
  109. package/dist/plugin-utils.d.mts.map +1 -0
  110. package/dist/plugin-utils.mjs +78 -0
  111. package/dist/plugin-utils.mjs.map +1 -0
  112. package/dist/plugins/adapt-sandbox-entry.d.mts +22 -0
  113. package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -0
  114. package/dist/plugins/adapt-sandbox-entry.mjs +113 -0
  115. package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -0
  116. package/dist/query-CS_iSj34.mjs +460 -0
  117. package/dist/query-CS_iSj34.mjs.map +1 -0
  118. package/dist/redirect-DIfIni3r.mjs +329 -0
  119. package/dist/redirect-DIfIni3r.mjs.map +1 -0
  120. package/dist/registry-D_w5HW4G.mjs +863 -0
  121. package/dist/registry-D_w5HW4G.mjs.map +1 -0
  122. package/dist/request-context.d.mts +49 -0
  123. package/dist/request-context.d.mts.map +1 -0
  124. package/dist/request-context.mjs +43 -0
  125. package/dist/request-context.mjs.map +1 -0
  126. package/dist/runner-B-u2F2b6.mjs +1412 -0
  127. package/dist/runner-B-u2F2b6.mjs.map +1 -0
  128. package/dist/runner-EAtf0ZIe.d.mts +27 -0
  129. package/dist/runner-EAtf0ZIe.d.mts.map +1 -0
  130. package/dist/runtime.d.mts +26 -0
  131. package/dist/runtime.d.mts.map +1 -0
  132. package/dist/runtime.mjs +42 -0
  133. package/dist/runtime.mjs.map +1 -0
  134. package/dist/search-DG603UrT.mjs +9211 -0
  135. package/dist/search-DG603UrT.mjs.map +1 -0
  136. package/dist/seed/index.d.mts +3 -0
  137. package/dist/seed/index.mjs +15 -0
  138. package/dist/seo/index.d.mts +70 -0
  139. package/dist/seo/index.d.mts.map +1 -0
  140. package/dist/seo/index.mjs +70 -0
  141. package/dist/seo/index.mjs.map +1 -0
  142. package/dist/storage/local.d.mts +39 -0
  143. package/dist/storage/local.d.mts.map +1 -0
  144. package/dist/storage/local.mjs +166 -0
  145. package/dist/storage/local.mjs.map +1 -0
  146. package/dist/storage/s3.d.mts +32 -0
  147. package/dist/storage/s3.d.mts.map +1 -0
  148. package/dist/storage/s3.mjs +175 -0
  149. package/dist/storage/s3.mjs.map +1 -0
  150. package/dist/tokens-DpgrkrXK.mjs +171 -0
  151. package/dist/tokens-DpgrkrXK.mjs.map +1 -0
  152. package/dist/transport-BFGblqwG.d.mts +42 -0
  153. package/dist/transport-BFGblqwG.d.mts.map +1 -0
  154. package/dist/transport-yxiQsi8I.mjs +418 -0
  155. package/dist/transport-yxiQsi8I.mjs.map +1 -0
  156. package/dist/types-BRuPJGdV.d.mts +102 -0
  157. package/dist/types-BRuPJGdV.d.mts.map +1 -0
  158. package/dist/types-C4-fAxN3.d.mts +182 -0
  159. package/dist/types-C4-fAxN3.d.mts.map +1 -0
  160. package/dist/types-CMMN0pNg.mjs +31 -0
  161. package/dist/types-CMMN0pNg.mjs.map +1 -0
  162. package/dist/types-CUBbjgmP.mjs +16 -0
  163. package/dist/types-CUBbjgmP.mjs.map +1 -0
  164. package/dist/types-DRjfYOEv.d.mts +426 -0
  165. package/dist/types-DRjfYOEv.d.mts.map +1 -0
  166. package/dist/types-DY5zk5HN.mjs +73 -0
  167. package/dist/types-DY5zk5HN.mjs.map +1 -0
  168. package/dist/types-DaNLHo_T.d.mts +184 -0
  169. package/dist/types-DaNLHo_T.d.mts.map +1 -0
  170. package/dist/types-DvhsUmSJ.d.mts +1111 -0
  171. package/dist/types-DvhsUmSJ.d.mts.map +1 -0
  172. package/dist/validate-CpBtVMsD.d.mts +378 -0
  173. package/dist/validate-CpBtVMsD.d.mts.map +1 -0
  174. package/dist/validate-CqRJb_xU.mjs +97 -0
  175. package/dist/validate-CqRJb_xU.mjs.map +1 -0
  176. package/dist/validate-O7PWmlnq.mjs +328 -0
  177. package/dist/validate-O7PWmlnq.mjs.map +1 -0
  178. package/locals.d.ts +46 -0
  179. package/package.json +233 -19
  180. package/src/api/authorize.ts +63 -0
  181. package/src/api/csrf.ts +48 -0
  182. package/src/api/error.ts +99 -0
  183. package/src/api/errors.ts +445 -0
  184. package/src/api/escape.ts +9 -0
  185. package/src/api/handlers/api-tokens.ts +240 -0
  186. package/src/api/handlers/comments.ts +314 -0
  187. package/src/api/handlers/content.ts +1315 -0
  188. package/src/api/handlers/dashboard.ts +205 -0
  189. package/src/api/handlers/device-flow.ts +687 -0
  190. package/src/api/handlers/index.ts +163 -0
  191. package/src/api/handlers/manifest.ts +158 -0
  192. package/src/api/handlers/marketplace.ts +930 -0
  193. package/src/api/handlers/media.ts +207 -0
  194. package/src/api/handlers/menus.ts +493 -0
  195. package/src/api/handlers/oauth-authorization.ts +429 -0
  196. package/src/api/handlers/oauth-clients.ts +353 -0
  197. package/src/api/handlers/oauth-user-lookup.ts +39 -0
  198. package/src/api/handlers/plugins.ts +254 -0
  199. package/src/api/handlers/redirects.ts +360 -0
  200. package/src/api/handlers/revision.ts +145 -0
  201. package/src/api/handlers/schema.ts +534 -0
  202. package/src/api/handlers/sections.ts +289 -0
  203. package/src/api/handlers/seo.ts +115 -0
  204. package/src/api/handlers/settings.ts +49 -0
  205. package/src/api/handlers/snapshot.ts +350 -0
  206. package/src/api/handlers/taxonomies.ts +523 -0
  207. package/src/api/index.ts +6 -0
  208. package/src/api/openapi/document.ts +2368 -0
  209. package/src/api/openapi/index.ts +1 -0
  210. package/src/api/parse.ts +139 -0
  211. package/src/api/redirect.ts +14 -0
  212. package/src/api/rev.ts +67 -0
  213. package/src/api/schemas/auth.ts +112 -0
  214. package/src/api/schemas/bylines.ts +85 -0
  215. package/src/api/schemas/comments.ts +117 -0
  216. package/src/api/schemas/common.ts +89 -0
  217. package/src/api/schemas/content.ts +191 -0
  218. package/src/api/schemas/import.ts +52 -0
  219. package/src/api/schemas/index.ts +17 -0
  220. package/src/api/schemas/media.ts +116 -0
  221. package/src/api/schemas/menus.ts +111 -0
  222. package/src/api/schemas/redirects.ts +155 -0
  223. package/src/api/schemas/schema.ts +203 -0
  224. package/src/api/schemas/search.ts +63 -0
  225. package/src/api/schemas/sections.ts +67 -0
  226. package/src/api/schemas/settings.ts +63 -0
  227. package/src/api/schemas/setup.ts +37 -0
  228. package/src/api/schemas/taxonomies.ts +113 -0
  229. package/src/api/schemas/users.ts +96 -0
  230. package/src/api/schemas/widgets.ts +80 -0
  231. package/src/api/site-url.ts +25 -0
  232. package/src/api/types.ts +82 -0
  233. package/src/astro/index.ts +27 -0
  234. package/src/astro/integration/index.ts +303 -0
  235. package/src/astro/integration/routes.ts +834 -0
  236. package/src/astro/integration/runtime.ts +338 -0
  237. package/src/astro/integration/virtual-modules.ts +469 -0
  238. package/src/astro/integration/vite-config.ts +328 -0
  239. package/src/astro/middleware/auth.ts +743 -0
  240. package/src/astro/middleware/redirect.ts +89 -0
  241. package/src/astro/middleware/request-context.ts +129 -0
  242. package/src/astro/middleware/setup.ts +89 -0
  243. package/src/astro/middleware.ts +398 -0
  244. package/src/astro/routes/PluginRegistry.tsx +15 -0
  245. package/src/astro/routes/admin.astro +81 -0
  246. package/src/astro/routes/api/admin/allowed-domains/[domain].ts +112 -0
  247. package/src/astro/routes/api/admin/allowed-domains/index.ts +108 -0
  248. package/src/astro/routes/api/admin/api-tokens/[id].ts +40 -0
  249. package/src/astro/routes/api/admin/api-tokens/index.ts +68 -0
  250. package/src/astro/routes/api/admin/bylines/[id]/index.ts +87 -0
  251. package/src/astro/routes/api/admin/bylines/index.ts +72 -0
  252. package/src/astro/routes/api/admin/comments/[id]/status.ts +120 -0
  253. package/src/astro/routes/api/admin/comments/[id].ts +64 -0
  254. package/src/astro/routes/api/admin/comments/bulk.ts +42 -0
  255. package/src/astro/routes/api/admin/comments/counts.ts +30 -0
  256. package/src/astro/routes/api/admin/comments/index.ts +46 -0
  257. package/src/astro/routes/api/admin/hooks/exclusive/[hookName].ts +91 -0
  258. package/src/astro/routes/api/admin/hooks/exclusive/index.ts +51 -0
  259. package/src/astro/routes/api/admin/oauth-clients/[id].ts +110 -0
  260. package/src/astro/routes/api/admin/oauth-clients/index.ts +71 -0
  261. package/src/astro/routes/api/admin/plugins/[id]/disable.ts +39 -0
  262. package/src/astro/routes/api/admin/plugins/[id]/enable.ts +39 -0
  263. package/src/astro/routes/api/admin/plugins/[id]/index.ts +38 -0
  264. package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +48 -0
  265. package/src/astro/routes/api/admin/plugins/[id]/update.ts +59 -0
  266. package/src/astro/routes/api/admin/plugins/index.ts +32 -0
  267. package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +61 -0
  268. package/src/astro/routes/api/admin/plugins/marketplace/[id]/index.ts +33 -0
  269. package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +62 -0
  270. package/src/astro/routes/api/admin/plugins/marketplace/index.ts +38 -0
  271. package/src/astro/routes/api/admin/plugins/updates.ts +28 -0
  272. package/src/astro/routes/api/admin/themes/marketplace/[id]/index.ts +33 -0
  273. package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +61 -0
  274. package/src/astro/routes/api/admin/themes/marketplace/index.ts +45 -0
  275. package/src/astro/routes/api/admin/users/[id]/disable.ts +69 -0
  276. package/src/astro/routes/api/admin/users/[id]/enable.ts +48 -0
  277. package/src/astro/routes/api/admin/users/[id]/index.ts +146 -0
  278. package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +72 -0
  279. package/src/astro/routes/api/admin/users/index.ts +66 -0
  280. package/src/astro/routes/api/auth/dev-bypass.ts +139 -0
  281. package/src/astro/routes/api/auth/invite/accept.ts +52 -0
  282. package/src/astro/routes/api/auth/invite/complete.ts +84 -0
  283. package/src/astro/routes/api/auth/invite/index.ts +99 -0
  284. package/src/astro/routes/api/auth/logout.ts +40 -0
  285. package/src/astro/routes/api/auth/magic-link/send.ts +89 -0
  286. package/src/astro/routes/api/auth/magic-link/verify.ts +71 -0
  287. package/src/astro/routes/api/auth/me.ts +60 -0
  288. package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +219 -0
  289. package/src/astro/routes/api/auth/oauth/[provider].ts +119 -0
  290. package/src/astro/routes/api/auth/passkey/[id].ts +124 -0
  291. package/src/astro/routes/api/auth/passkey/index.ts +54 -0
  292. package/src/astro/routes/api/auth/passkey/options.ts +82 -0
  293. package/src/astro/routes/api/auth/passkey/register/options.ts +86 -0
  294. package/src/astro/routes/api/auth/passkey/register/verify.ts +117 -0
  295. package/src/astro/routes/api/auth/passkey/verify.ts +66 -0
  296. package/src/astro/routes/api/auth/signup/complete.ts +85 -0
  297. package/src/astro/routes/api/auth/signup/request.ts +77 -0
  298. package/src/astro/routes/api/auth/signup/verify.ts +53 -0
  299. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +312 -0
  300. package/src/astro/routes/api/content/[collection]/[id]/compare.ts +28 -0
  301. package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +54 -0
  302. package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +61 -0
  303. package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +33 -0
  304. package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +107 -0
  305. package/src/astro/routes/api/content/[collection]/[id]/publish.ts +56 -0
  306. package/src/astro/routes/api/content/[collection]/[id]/restore.ts +54 -0
  307. package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +31 -0
  308. package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +105 -0
  309. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +140 -0
  310. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +30 -0
  311. package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +56 -0
  312. package/src/astro/routes/api/content/[collection]/[id].ts +137 -0
  313. package/src/astro/routes/api/content/[collection]/index.ts +59 -0
  314. package/src/astro/routes/api/content/[collection]/trash.ts +33 -0
  315. package/src/astro/routes/api/dashboard.ts +32 -0
  316. package/src/astro/routes/api/dev/emails.ts +36 -0
  317. package/src/astro/routes/api/import/probe.ts +47 -0
  318. package/src/astro/routes/api/import/wordpress/analyze.ts +510 -0
  319. package/src/astro/routes/api/import/wordpress/execute.ts +283 -0
  320. package/src/astro/routes/api/import/wordpress/media.ts +338 -0
  321. package/src/astro/routes/api/import/wordpress/prepare.ts +181 -0
  322. package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +393 -0
  323. package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +111 -0
  324. package/src/astro/routes/api/import/wordpress-plugin/callback.ts +58 -0
  325. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +347 -0
  326. package/src/astro/routes/api/manifest.ts +62 -0
  327. package/src/astro/routes/api/mcp.ts +124 -0
  328. package/src/astro/routes/api/media/[id]/confirm.ts +93 -0
  329. package/src/astro/routes/api/media/[id].ts +145 -0
  330. package/src/astro/routes/api/media/file/[key].ts +79 -0
  331. package/src/astro/routes/api/media/providers/[providerId]/[itemId].ts +86 -0
  332. package/src/astro/routes/api/media/providers/[providerId]/index.ts +111 -0
  333. package/src/astro/routes/api/media/providers/index.ts +30 -0
  334. package/src/astro/routes/api/media/upload-url.ts +137 -0
  335. package/src/astro/routes/api/media.ts +190 -0
  336. package/src/astro/routes/api/menus/[name]/items.ts +87 -0
  337. package/src/astro/routes/api/menus/[name]/reorder.ts +33 -0
  338. package/src/astro/routes/api/menus/[name].ts +65 -0
  339. package/src/astro/routes/api/menus/index.ts +47 -0
  340. package/src/astro/routes/api/oauth/authorize.ts +412 -0
  341. package/src/astro/routes/api/oauth/device/authorize.ts +45 -0
  342. package/src/astro/routes/api/oauth/device/code.ts +51 -0
  343. package/src/astro/routes/api/oauth/device/token.ts +69 -0
  344. package/src/astro/routes/api/oauth/token/refresh.ts +38 -0
  345. package/src/astro/routes/api/oauth/token/revoke.ts +38 -0
  346. package/src/astro/routes/api/oauth/token.ts +184 -0
  347. package/src/astro/routes/api/openapi.json.ts +32 -0
  348. package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +92 -0
  349. package/src/astro/routes/api/redirects/404s/index.ts +72 -0
  350. package/src/astro/routes/api/redirects/404s/summary.ts +33 -0
  351. package/src/astro/routes/api/redirects/[id].ts +84 -0
  352. package/src/astro/routes/api/redirects/index.ts +52 -0
  353. package/src/astro/routes/api/revisions/[revisionId]/index.ts +29 -0
  354. package/src/astro/routes/api/revisions/[revisionId]/restore.ts +62 -0
  355. package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +76 -0
  356. package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +52 -0
  357. package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +32 -0
  358. package/src/astro/routes/api/schema/collections/[slug]/index.ts +80 -0
  359. package/src/astro/routes/api/schema/collections/index.ts +47 -0
  360. package/src/astro/routes/api/schema/index.ts +109 -0
  361. package/src/astro/routes/api/schema/orphans/[slug].ts +36 -0
  362. package/src/astro/routes/api/schema/orphans/index.ts +26 -0
  363. package/src/astro/routes/api/search/enable.ts +64 -0
  364. package/src/astro/routes/api/search/index.ts +55 -0
  365. package/src/astro/routes/api/search/rebuild.ts +72 -0
  366. package/src/astro/routes/api/search/stats.ts +35 -0
  367. package/src/astro/routes/api/search/suggest.ts +53 -0
  368. package/src/astro/routes/api/sections/[slug].ts +84 -0
  369. package/src/astro/routes/api/sections/index.ts +52 -0
  370. package/src/astro/routes/api/settings/email.ts +150 -0
  371. package/src/astro/routes/api/settings.ts +67 -0
  372. package/src/astro/routes/api/setup/admin-verify.ts +100 -0
  373. package/src/astro/routes/api/setup/admin.ts +94 -0
  374. package/src/astro/routes/api/setup/dev-bypass.ts +199 -0
  375. package/src/astro/routes/api/setup/dev-reset.ts +40 -0
  376. package/src/astro/routes/api/setup/index.ts +126 -0
  377. package/src/astro/routes/api/setup/status.ts +122 -0
  378. package/src/astro/routes/api/snapshot.ts +75 -0
  379. package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +95 -0
  380. package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +69 -0
  381. package/src/astro/routes/api/taxonomies/index.ts +59 -0
  382. package/src/astro/routes/api/themes/preview.ts +77 -0
  383. package/src/astro/routes/api/typegen.ts +114 -0
  384. package/src/astro/routes/api/well-known/auth.ts +68 -0
  385. package/src/astro/routes/api/well-known/oauth-authorization-server.ts +44 -0
  386. package/src/astro/routes/api/well-known/oauth-protected-resource.ts +37 -0
  387. package/src/astro/routes/api/widget-areas/[name]/reorder.ts +72 -0
  388. package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +127 -0
  389. package/src/astro/routes/api/widget-areas/[name]/widgets.ts +80 -0
  390. package/src/astro/routes/api/widget-areas/[name].ts +87 -0
  391. package/src/astro/routes/api/widget-areas/index.ts +99 -0
  392. package/src/astro/routes/api/widget-components.ts +22 -0
  393. package/src/astro/routes/robots.txt.ts +77 -0
  394. package/src/astro/routes/sitemap.xml.ts +97 -0
  395. package/src/astro/storage/adapters.ts +74 -0
  396. package/src/astro/storage/index.ts +19 -0
  397. package/src/astro/storage/types.ts +60 -0
  398. package/src/astro/types.ts +346 -0
  399. package/src/auth/api-tokens.ts +25 -0
  400. package/src/auth/challenge-store.ts +80 -0
  401. package/src/auth/mode.ts +96 -0
  402. package/src/auth/oauth-state-store.ts +96 -0
  403. package/src/auth/passkey-config.ts +27 -0
  404. package/src/auth/rate-limit.ts +158 -0
  405. package/src/auth/scopes.ts +33 -0
  406. package/src/auth/types.ts +104 -0
  407. package/src/aws-sdk.d.ts +100 -0
  408. package/src/bylines/index.ts +237 -0
  409. package/src/cleanup.ts +153 -0
  410. package/src/cli/client-factory.ts +100 -0
  411. package/src/cli/commands/auth.ts +46 -0
  412. package/src/cli/commands/bundle-utils.ts +247 -0
  413. package/src/cli/commands/bundle.ts +609 -0
  414. package/src/cli/commands/content.ts +442 -0
  415. package/src/cli/commands/dev.ts +191 -0
  416. package/src/cli/commands/doctor.ts +211 -0
  417. package/src/cli/commands/export-seed.ts +630 -0
  418. package/src/cli/commands/import/wordpress.ts +1056 -0
  419. package/src/cli/commands/init.ts +192 -0
  420. package/src/cli/commands/login.ts +547 -0
  421. package/src/cli/commands/media.ts +165 -0
  422. package/src/cli/commands/menu.ts +67 -0
  423. package/src/cli/commands/plugin-init.ts +291 -0
  424. package/src/cli/commands/plugin-validate.ts +31 -0
  425. package/src/cli/commands/plugin.ts +33 -0
  426. package/src/cli/commands/publish.ts +699 -0
  427. package/src/cli/commands/schema.ts +233 -0
  428. package/src/cli/commands/search-cmd.ts +54 -0
  429. package/src/cli/commands/seed.ts +288 -0
  430. package/src/cli/commands/taxonomy.ts +128 -0
  431. package/src/cli/commands/types.ts +68 -0
  432. package/src/cli/credentials.ts +236 -0
  433. package/src/cli/index.ts +70 -0
  434. package/src/cli/output.ts +75 -0
  435. package/src/cli/wxr/parser.ts +969 -0
  436. package/src/client/cf-access.ts +193 -0
  437. package/src/client/index.ts +854 -0
  438. package/src/client/portable-text.ts +413 -0
  439. package/src/client/transport.ts +200 -0
  440. package/src/comments/moderator.ts +46 -0
  441. package/src/comments/notifications.ts +144 -0
  442. package/src/comments/query.ts +105 -0
  443. package/src/comments/service.ts +213 -0
  444. package/src/components/Break.astro +45 -0
  445. package/src/components/Button.astro +71 -0
  446. package/src/components/Buttons.astro +49 -0
  447. package/src/components/Code.astro +59 -0
  448. package/src/components/Columns.astro +59 -0
  449. package/src/components/CommentForm.astro +315 -0
  450. package/src/components/Comments.astro +232 -0
  451. package/src/components/Cover.astro +128 -0
  452. package/src/components/EmDashBodyEnd.astro +32 -0
  453. package/src/components/EmDashBodyStart.astro +32 -0
  454. package/src/components/EmDashHead.astro +53 -0
  455. package/src/components/EmDashImage.astro +178 -0
  456. package/src/components/EmDashMedia.astro +167 -0
  457. package/src/components/Embed.astro +128 -0
  458. package/src/components/File.astro +122 -0
  459. package/src/components/Gallery.astro +93 -0
  460. package/src/components/HtmlBlock.astro +33 -0
  461. package/src/components/Image.astro +178 -0
  462. package/src/components/InlineEditor.astro +27 -0
  463. package/src/components/InlinePortableTextEditor.tsx +1905 -0
  464. package/src/components/LiveSearch.astro +614 -0
  465. package/src/components/PortableText.astro +51 -0
  466. package/src/components/Pullquote.astro +51 -0
  467. package/src/components/Table.astro +108 -0
  468. package/src/components/WidgetArea.astro +22 -0
  469. package/src/components/WidgetRenderer.astro +72 -0
  470. package/src/components/index.ts +116 -0
  471. package/src/components/marks/Link.astro +31 -0
  472. package/src/components/marks/StrikeThrough.astro +7 -0
  473. package/src/components/marks/Subscript.astro +7 -0
  474. package/src/components/marks/Superscript.astro +7 -0
  475. package/src/components/marks/Underline.astro +7 -0
  476. package/src/components/widgets/Archives.astro +65 -0
  477. package/src/components/widgets/Categories.astro +35 -0
  478. package/src/components/widgets/RecentPosts.astro +51 -0
  479. package/src/components/widgets/Search.astro +18 -0
  480. package/src/components/widgets/Tags.astro +38 -0
  481. package/src/content/converters/index.ts +9 -0
  482. package/src/content/converters/portable-text-to-prosemirror.ts +385 -0
  483. package/src/content/converters/prosemirror-to-portable-text.ts +413 -0
  484. package/src/content/converters/types.ts +120 -0
  485. package/src/content/index.ts +5 -0
  486. package/src/database/connection.ts +67 -0
  487. package/src/database/dialect-helpers.ts +138 -0
  488. package/src/database/index.ts +5 -0
  489. package/src/database/migrations/001_initial.ts +136 -0
  490. package/src/database/migrations/002_media_status.ts +26 -0
  491. package/src/database/migrations/003_schema_registry.ts +79 -0
  492. package/src/database/migrations/004_plugins.ts +62 -0
  493. package/src/database/migrations/005_menus.ts +67 -0
  494. package/src/database/migrations/006_taxonomy_defs.ts +51 -0
  495. package/src/database/migrations/007_widgets.ts +42 -0
  496. package/src/database/migrations/008_auth.ts +194 -0
  497. package/src/database/migrations/009_user_disabled.ts +27 -0
  498. package/src/database/migrations/011_sections.ts +65 -0
  499. package/src/database/migrations/012_search.ts +25 -0
  500. package/src/database/migrations/013_scheduled_publishing.ts +51 -0
  501. package/src/database/migrations/014_draft_revisions.ts +72 -0
  502. package/src/database/migrations/015_indexes.ts +82 -0
  503. package/src/database/migrations/016_api_tokens.ts +89 -0
  504. package/src/database/migrations/017_authorization_codes.ts +45 -0
  505. package/src/database/migrations/018_seo.ts +56 -0
  506. package/src/database/migrations/019_i18n.ts +618 -0
  507. package/src/database/migrations/020_collection_url_pattern.ts +23 -0
  508. package/src/database/migrations/021_remove_section_categories.ts +43 -0
  509. package/src/database/migrations/022_marketplace_plugin_state.ts +46 -0
  510. package/src/database/migrations/023_plugin_metadata.ts +33 -0
  511. package/src/database/migrations/024_media_placeholders.ts +32 -0
  512. package/src/database/migrations/025_oauth_clients.ts +28 -0
  513. package/src/database/migrations/026_cron_tasks.ts +49 -0
  514. package/src/database/migrations/027_comments.ts +87 -0
  515. package/src/database/migrations/028_drop_author_url.ts +9 -0
  516. package/src/database/migrations/029_redirects.ts +67 -0
  517. package/src/database/migrations/030_widen_scheduled_index.ts +48 -0
  518. package/src/database/migrations/031_bylines.ts +90 -0
  519. package/src/database/migrations/032_rate_limits.ts +42 -0
  520. package/src/database/migrations/runner.ts +170 -0
  521. package/src/database/repositories/audit.ts +294 -0
  522. package/src/database/repositories/byline.ts +387 -0
  523. package/src/database/repositories/comment.ts +458 -0
  524. package/src/database/repositories/content.ts +1144 -0
  525. package/src/database/repositories/index.ts +30 -0
  526. package/src/database/repositories/media.ts +347 -0
  527. package/src/database/repositories/options.ts +150 -0
  528. package/src/database/repositories/plugin-storage.ts +373 -0
  529. package/src/database/repositories/redirect.ts +480 -0
  530. package/src/database/repositories/revision.ts +200 -0
  531. package/src/database/repositories/seo.ts +176 -0
  532. package/src/database/repositories/taxonomy.ts +294 -0
  533. package/src/database/repositories/types.ts +132 -0
  534. package/src/database/repositories/user.ts +258 -0
  535. package/src/database/transaction.ts +54 -0
  536. package/src/database/types.ts +501 -0
  537. package/src/database/validate.ts +138 -0
  538. package/src/db/adapters.ts +125 -0
  539. package/src/db/index.ts +37 -0
  540. package/src/db/libsql.ts +23 -0
  541. package/src/db/postgres.ts +30 -0
  542. package/src/db/sqlite.ts +27 -0
  543. package/src/emdash-runtime.ts +2096 -0
  544. package/src/fields/boolean.ts +34 -0
  545. package/src/fields/datetime.ts +44 -0
  546. package/src/fields/file.ts +41 -0
  547. package/src/fields/image.ts +34 -0
  548. package/src/fields/index.ts +42 -0
  549. package/src/fields/integer.ts +50 -0
  550. package/src/fields/json.ts +37 -0
  551. package/src/fields/multiselect.ts +48 -0
  552. package/src/fields/number.ts +52 -0
  553. package/src/fields/portable-text.ts +33 -0
  554. package/src/fields/reference.ts +29 -0
  555. package/src/fields/richtext.ts +31 -0
  556. package/src/fields/select.ts +46 -0
  557. package/src/fields/slug.ts +38 -0
  558. package/src/fields/text.ts +55 -0
  559. package/src/fields/textarea.ts +52 -0
  560. package/src/fields/types.ts +64 -0
  561. package/src/i18n/config.ts +68 -0
  562. package/src/import/index.ts +90 -0
  563. package/src/import/menus.ts +436 -0
  564. package/src/import/registry.ts +111 -0
  565. package/src/import/sections.ts +103 -0
  566. package/src/import/settings.ts +281 -0
  567. package/src/import/sources/wordpress-plugin.ts +641 -0
  568. package/src/import/sources/wordpress-rest.ts +191 -0
  569. package/src/import/sources/wxr.ts +330 -0
  570. package/src/import/ssrf.ts +260 -0
  571. package/src/import/types.ts +418 -0
  572. package/src/import/utils.ts +412 -0
  573. package/src/index.ts +481 -0
  574. package/src/loader.ts +770 -0
  575. package/src/mcp/server.ts +1463 -0
  576. package/src/media/index.ts +32 -0
  577. package/src/media/local-runtime.ts +213 -0
  578. package/src/media/local.ts +46 -0
  579. package/src/media/normalize.ts +190 -0
  580. package/src/media/placeholder.ts +150 -0
  581. package/src/media/provider-loader.ts +78 -0
  582. package/src/media/types.ts +279 -0
  583. package/src/menus/index.ts +324 -0
  584. package/src/menus/types.ts +112 -0
  585. package/src/page/context.ts +93 -0
  586. package/src/page/fragments.ts +89 -0
  587. package/src/page/index.ts +58 -0
  588. package/src/page/jsonld.ts +94 -0
  589. package/src/page/metadata.ts +185 -0
  590. package/src/page/seo-contributions.ts +136 -0
  591. package/src/plugin-utils.ts +80 -0
  592. package/src/plugins/adapt-sandbox-entry.ts +207 -0
  593. package/src/plugins/context.ts +833 -0
  594. package/src/plugins/cron.ts +361 -0
  595. package/src/plugins/define-plugin.ts +259 -0
  596. package/src/plugins/email-console.ts +73 -0
  597. package/src/plugins/email.ts +209 -0
  598. package/src/plugins/hooks.ts +1273 -0
  599. package/src/plugins/index.ts +193 -0
  600. package/src/plugins/manager.ts +595 -0
  601. package/src/plugins/manifest-schema.ts +230 -0
  602. package/src/plugins/marketplace.ts +460 -0
  603. package/src/plugins/request-meta.ts +139 -0
  604. package/src/plugins/routes.ts +302 -0
  605. package/src/plugins/sandbox/index.ts +18 -0
  606. package/src/plugins/sandbox/noop.ts +76 -0
  607. package/src/plugins/sandbox/types.ts +173 -0
  608. package/src/plugins/scheduler/node.ts +122 -0
  609. package/src/plugins/scheduler/piggyback.ts +71 -0
  610. package/src/plugins/scheduler/types.ts +27 -0
  611. package/src/plugins/state.ts +208 -0
  612. package/src/plugins/storage-indexes.ts +326 -0
  613. package/src/plugins/storage-query.ts +240 -0
  614. package/src/plugins/types.ts +1284 -0
  615. package/src/preview/helpers.ts +27 -0
  616. package/src/preview/index.ts +40 -0
  617. package/src/preview/tokens.ts +279 -0
  618. package/src/preview/urls.ts +118 -0
  619. package/src/query.ts +674 -0
  620. package/src/redirects/patterns.ts +224 -0
  621. package/src/request-context.ts +67 -0
  622. package/src/runtime.ts +21 -0
  623. package/src/schema/index.ts +29 -0
  624. package/src/schema/query.ts +44 -0
  625. package/src/schema/registry.ts +965 -0
  626. package/src/schema/types.ts +276 -0
  627. package/src/schema/zod-generator.ts +413 -0
  628. package/src/search/fts-manager.ts +452 -0
  629. package/src/search/index.ts +26 -0
  630. package/src/search/query.ts +396 -0
  631. package/src/search/text-extraction.ts +162 -0
  632. package/src/search/types.ts +114 -0
  633. package/src/sections/index.ts +226 -0
  634. package/src/sections/types.ts +86 -0
  635. package/src/seed/apply.ts +1141 -0
  636. package/src/seed/default.ts +86 -0
  637. package/src/seed/index.ts +28 -0
  638. package/src/seed/load.ts +35 -0
  639. package/src/seed/types.ts +341 -0
  640. package/src/seed/validate.ts +642 -0
  641. package/src/seo/index.ts +179 -0
  642. package/src/settings/index.ts +203 -0
  643. package/src/settings/types.ts +58 -0
  644. package/src/storage/index.ts +28 -0
  645. package/src/storage/local.ts +253 -0
  646. package/src/storage/s3.ts +271 -0
  647. package/src/storage/types.ts +204 -0
  648. package/src/taxonomies/index.ts +309 -0
  649. package/src/taxonomies/types.ts +61 -0
  650. package/src/ui.ts +75 -0
  651. package/src/utils/base64.ts +73 -0
  652. package/src/utils/hash.ts +36 -0
  653. package/src/utils/sanitize.ts +20 -0
  654. package/src/utils/slugify.ts +29 -0
  655. package/src/utils/url.ts +48 -0
  656. package/src/virtual-modules.d.ts +111 -0
  657. package/src/visual-editing/editable.ts +108 -0
  658. package/src/visual-editing/toolbar.ts +1229 -0
  659. package/src/widgets/components.ts +105 -0
  660. package/src/widgets/index.ts +131 -0
  661. package/src/widgets/types.ts +81 -0
@@ -0,0 +1,2368 @@
1
+ /**
2
+ * OpenAPI 3.1 document generator.
3
+ *
4
+ * Builds the full OpenAPI spec from Zod schemas. The Zod schemas are the
5
+ * single source of truth -- we never hand-write OpenAPI YAML.
6
+ *
7
+ * Covers all public API domains.
8
+ */
9
+
10
+ import { z } from "zod";
11
+ import { createDocument, type ZodOpenApiPathsObject, type oas31 } from "zod-openapi";
12
+
13
+ import {
14
+ commentBulkBody,
15
+ commentBulkResponseSchema,
16
+ commentCountsResponseSchema,
17
+ commentListQuery,
18
+ commentSchema,
19
+ commentStatusBody,
20
+ createCommentBody,
21
+ adminCommentListResponseSchema,
22
+ publicCommentListResponseSchema,
23
+ } from "../schemas/comments.js";
24
+ import { apiErrorSchema, deleteResponseSchema, successEnvelope } from "../schemas/common.js";
25
+ import {
26
+ contentCompareResponseSchema,
27
+ contentCreateBody,
28
+ contentItemSchema,
29
+ contentListQuery,
30
+ contentListResponseSchema,
31
+ contentResponseSchema,
32
+ contentScheduleBody,
33
+ contentTermsBody,
34
+ contentTrashQuery,
35
+ contentTranslationsResponseSchema,
36
+ contentUpdateBody,
37
+ trashedContentListResponseSchema,
38
+ } from "../schemas/content.js";
39
+ import {
40
+ mediaConfirmBody,
41
+ mediaConfirmResponseSchema,
42
+ mediaExistingResponseSchema,
43
+ mediaListQuery,
44
+ mediaListResponseSchema,
45
+ mediaResponseSchema,
46
+ mediaUpdateBody,
47
+ mediaUploadUrlBody,
48
+ mediaUploadUrlResponseSchema,
49
+ } from "../schemas/media.js";
50
+ import {
51
+ createMenuBody,
52
+ createMenuItemBody,
53
+ menuListItemSchema,
54
+ menuItemSchema,
55
+ menuWithItemsSchema,
56
+ reorderMenuItemsBody,
57
+ updateMenuBody,
58
+ updateMenuItemBody,
59
+ } from "../schemas/menus.js";
60
+ import {
61
+ createRedirectBody,
62
+ notFoundListQuery,
63
+ notFoundPruneBody,
64
+ notFoundListResponseSchema,
65
+ notFoundSummaryResponseSchema,
66
+ redirectListResponseSchema,
67
+ redirectSchema,
68
+ redirectsListQuery,
69
+ updateRedirectBody,
70
+ } from "../schemas/redirects.js";
71
+ import {
72
+ collectionGetQuery,
73
+ collectionListResponseSchema,
74
+ collectionResponseSchema,
75
+ collectionWithFieldsResponseSchema,
76
+ createCollectionBody,
77
+ createFieldBody,
78
+ fieldListResponseSchema,
79
+ fieldReorderBody,
80
+ fieldResponseSchema,
81
+ orphanedTableListResponseSchema,
82
+ orphanRegisterBody,
83
+ updateCollectionBody,
84
+ updateFieldBody,
85
+ } from "../schemas/schema.js";
86
+ import {
87
+ searchEnableBody,
88
+ searchQuery,
89
+ searchRebuildBody,
90
+ searchResponseSchema,
91
+ searchSuggestQuery,
92
+ } from "../schemas/search.js";
93
+ import {
94
+ createSectionBody,
95
+ sectionListResponseSchema,
96
+ sectionSchema,
97
+ sectionsListQuery,
98
+ updateSectionBody,
99
+ } from "../schemas/sections.js";
100
+ import { settingsUpdateBody, siteSettingsSchema } from "../schemas/settings.js";
101
+ import {
102
+ createTermBody,
103
+ taxonomyListResponseSchema,
104
+ termGetResponseSchema,
105
+ termListResponseSchema,
106
+ termResponseSchema,
107
+ updateTermBody,
108
+ } from "../schemas/taxonomies.js";
109
+ import {
110
+ allowedDomainCreateBody,
111
+ allowedDomainUpdateBody,
112
+ userDetailSchema,
113
+ userListResponseSchema,
114
+ userSchema,
115
+ userUpdateBody,
116
+ usersListQuery,
117
+ } from "../schemas/users.js";
118
+ import {
119
+ createWidgetAreaBody,
120
+ createWidgetBody,
121
+ reorderWidgetsBody,
122
+ updateWidgetBody,
123
+ widgetAreaSchema,
124
+ widgetAreaWithWidgetsSchema,
125
+ widgetSchema,
126
+ } from "../schemas/widgets.js";
127
+
128
+ // ---------------------------------------------------------------------------
129
+ // Helpers
130
+ // ---------------------------------------------------------------------------
131
+
132
+ const JSON_CONTENT = "application/json";
133
+
134
+ /** Standard error responses shared across all authenticated endpoints */
135
+ function standardErrors(
136
+ ...codes: number[]
137
+ ): Record<
138
+ string,
139
+ { description: string; content: Record<string, { schema: typeof apiErrorSchema }> }
140
+ > {
141
+ const responses: Record<
142
+ string,
143
+ { description: string; content: Record<string, { schema: typeof apiErrorSchema }> }
144
+ > = {};
145
+ const errorMap: Record<number, string> = {
146
+ 400: "Bad Request",
147
+ 401: "Not authenticated",
148
+ 403: "Forbidden",
149
+ 404: "Not Found",
150
+ 409: "Conflict",
151
+ 500: "Internal Server Error",
152
+ };
153
+ for (const code of codes) {
154
+ responses[String(code)] = {
155
+ description: errorMap[code] ?? `Error ${code}`,
156
+ content: { [JSON_CONTENT]: { schema: apiErrorSchema } },
157
+ };
158
+ }
159
+ return responses;
160
+ }
161
+
162
+ /** Common auth error responses (401 + 403) */
163
+ const authErrors = standardErrors(401, 403);
164
+
165
+ // ---------------------------------------------------------------------------
166
+ // Content routes
167
+ // ---------------------------------------------------------------------------
168
+
169
+ const contentPaths = {
170
+ "/_emdash/api/content/{collection}": {
171
+ get: {
172
+ operationId: "listContent",
173
+ summary: "List content items",
174
+ description: "Returns a paginated list of content items in the specified collection.",
175
+ tags: ["Content"],
176
+ requestParams: {
177
+ path: z.object({
178
+ collection: z.string().meta({ description: "Collection slug", example: "posts" }),
179
+ }),
180
+ query: contentListQuery,
181
+ },
182
+ responses: {
183
+ "200": {
184
+ description: "Content list",
185
+ content: {
186
+ [JSON_CONTENT]: {
187
+ schema: successEnvelope(contentListResponseSchema),
188
+ },
189
+ },
190
+ },
191
+ ...authErrors,
192
+ ...standardErrors(500),
193
+ },
194
+ },
195
+ post: {
196
+ operationId: "createContent",
197
+ summary: "Create a content item",
198
+ tags: ["Content"],
199
+ requestParams: {
200
+ path: z.object({
201
+ collection: z.string().meta({ description: "Collection slug" }),
202
+ }),
203
+ },
204
+ requestBody: {
205
+ content: { [JSON_CONTENT]: { schema: contentCreateBody } },
206
+ },
207
+ responses: {
208
+ "201": {
209
+ description: "Created content item",
210
+ content: {
211
+ [JSON_CONTENT]: {
212
+ schema: successEnvelope(contentResponseSchema),
213
+ },
214
+ },
215
+ },
216
+ ...authErrors,
217
+ ...standardErrors(400, 500),
218
+ },
219
+ },
220
+ },
221
+
222
+ "/_emdash/api/content/{collection}/{id}": {
223
+ get: {
224
+ operationId: "getContent",
225
+ summary: "Get a content item",
226
+ tags: ["Content"],
227
+ requestParams: {
228
+ path: z.object({
229
+ collection: z.string().meta({ description: "Collection slug" }),
230
+ id: z.string().meta({ description: "Content ID or slug" }),
231
+ }),
232
+ query: z.object({
233
+ locale: z.string().optional().meta({ description: "Locale filter" }),
234
+ }),
235
+ },
236
+ responses: {
237
+ "200": {
238
+ description: "Content item",
239
+ content: {
240
+ [JSON_CONTENT]: {
241
+ schema: successEnvelope(contentResponseSchema),
242
+ },
243
+ },
244
+ },
245
+ ...authErrors,
246
+ ...standardErrors(404, 500),
247
+ },
248
+ },
249
+ put: {
250
+ operationId: "updateContent",
251
+ summary: "Update a content item",
252
+ tags: ["Content"],
253
+ requestParams: {
254
+ path: z.object({
255
+ collection: z.string().meta({ description: "Collection slug" }),
256
+ id: z.string().meta({ description: "Content ID or slug" }),
257
+ }),
258
+ },
259
+ requestBody: {
260
+ content: { [JSON_CONTENT]: { schema: contentUpdateBody } },
261
+ },
262
+ responses: {
263
+ "200": {
264
+ description: "Updated content item",
265
+ content: {
266
+ [JSON_CONTENT]: {
267
+ schema: successEnvelope(contentResponseSchema),
268
+ },
269
+ },
270
+ },
271
+ ...authErrors,
272
+ ...standardErrors(400, 404, 409, 500),
273
+ },
274
+ },
275
+ delete: {
276
+ operationId: "deleteContent",
277
+ summary: "Delete a content item (soft delete)",
278
+ description:
279
+ "Moves the content item to trash. Use the permanent delete endpoint to remove permanently.",
280
+ tags: ["Content"],
281
+ requestParams: {
282
+ path: z.object({
283
+ collection: z.string().meta({ description: "Collection slug" }),
284
+ id: z.string().meta({ description: "Content ID or slug" }),
285
+ }),
286
+ },
287
+ responses: {
288
+ "200": {
289
+ description: "Deleted",
290
+ content: {
291
+ [JSON_CONTENT]: {
292
+ schema: successEnvelope(deleteResponseSchema),
293
+ },
294
+ },
295
+ },
296
+ ...authErrors,
297
+ ...standardErrors(404, 500),
298
+ },
299
+ },
300
+ },
301
+
302
+ "/_emdash/api/content/{collection}/{id}/publish": {
303
+ post: {
304
+ operationId: "publishContent",
305
+ summary: "Publish a content item",
306
+ tags: ["Content"],
307
+ requestParams: {
308
+ path: z.object({
309
+ collection: z.string().meta({ description: "Collection slug" }),
310
+ id: z.string().meta({ description: "Content ID or slug" }),
311
+ }),
312
+ },
313
+ responses: {
314
+ "200": {
315
+ description: "Published content item",
316
+ content: {
317
+ [JSON_CONTENT]: {
318
+ schema: successEnvelope(contentResponseSchema),
319
+ },
320
+ },
321
+ },
322
+ ...authErrors,
323
+ ...standardErrors(404, 500),
324
+ },
325
+ },
326
+ },
327
+
328
+ "/_emdash/api/content/{collection}/{id}/unpublish": {
329
+ post: {
330
+ operationId: "unpublishContent",
331
+ summary: "Unpublish a content item",
332
+ description: "Reverts content to draft status.",
333
+ tags: ["Content"],
334
+ requestParams: {
335
+ path: z.object({
336
+ collection: z.string().meta({ description: "Collection slug" }),
337
+ id: z.string().meta({ description: "Content ID or slug" }),
338
+ }),
339
+ },
340
+ responses: {
341
+ "200": {
342
+ description: "Unpublished content item",
343
+ content: {
344
+ [JSON_CONTENT]: {
345
+ schema: successEnvelope(contentResponseSchema),
346
+ },
347
+ },
348
+ },
349
+ ...authErrors,
350
+ ...standardErrors(404, 500),
351
+ },
352
+ },
353
+ },
354
+
355
+ "/_emdash/api/content/{collection}/{id}/schedule": {
356
+ post: {
357
+ operationId: "scheduleContent",
358
+ summary: "Schedule content for future publishing",
359
+ tags: ["Content"],
360
+ requestParams: {
361
+ path: z.object({
362
+ collection: z.string().meta({ description: "Collection slug" }),
363
+ id: z.string().meta({ description: "Content ID or slug" }),
364
+ }),
365
+ },
366
+ requestBody: {
367
+ content: { [JSON_CONTENT]: { schema: contentScheduleBody } },
368
+ },
369
+ responses: {
370
+ "200": {
371
+ description: "Scheduled content item",
372
+ content: {
373
+ [JSON_CONTENT]: {
374
+ schema: successEnvelope(contentResponseSchema),
375
+ },
376
+ },
377
+ },
378
+ ...authErrors,
379
+ ...standardErrors(400, 404, 500),
380
+ },
381
+ },
382
+ delete: {
383
+ operationId: "unscheduleContent",
384
+ summary: "Cancel scheduled publishing",
385
+ description: "Reverts a scheduled item to draft status.",
386
+ tags: ["Content"],
387
+ requestParams: {
388
+ path: z.object({
389
+ collection: z.string().meta({ description: "Collection slug" }),
390
+ id: z.string().meta({ description: "Content ID or slug" }),
391
+ }),
392
+ },
393
+ responses: {
394
+ "200": {
395
+ description: "Unscheduled content item",
396
+ content: {
397
+ [JSON_CONTENT]: {
398
+ schema: successEnvelope(contentResponseSchema),
399
+ },
400
+ },
401
+ },
402
+ ...authErrors,
403
+ ...standardErrors(404, 500),
404
+ },
405
+ },
406
+ },
407
+
408
+ "/_emdash/api/content/{collection}/{id}/duplicate": {
409
+ post: {
410
+ operationId: "duplicateContent",
411
+ summary: "Duplicate a content item",
412
+ tags: ["Content"],
413
+ requestParams: {
414
+ path: z.object({
415
+ collection: z.string().meta({ description: "Collection slug" }),
416
+ id: z.string().meta({ description: "Content ID or slug" }),
417
+ }),
418
+ },
419
+ responses: {
420
+ "201": {
421
+ description: "Duplicated content item",
422
+ content: {
423
+ [JSON_CONTENT]: {
424
+ schema: successEnvelope(z.object({ item: contentItemSchema })),
425
+ },
426
+ },
427
+ },
428
+ ...authErrors,
429
+ ...standardErrors(404, 500),
430
+ },
431
+ },
432
+ },
433
+
434
+ "/_emdash/api/content/{collection}/{id}/restore": {
435
+ post: {
436
+ operationId: "restoreContent",
437
+ summary: "Restore a content item from trash",
438
+ tags: ["Content"],
439
+ requestParams: {
440
+ path: z.object({
441
+ collection: z.string().meta({ description: "Collection slug" }),
442
+ id: z.string().meta({ description: "Content ID" }),
443
+ }),
444
+ },
445
+ responses: {
446
+ "200": {
447
+ description: "Restored",
448
+ content: {
449
+ [JSON_CONTENT]: {
450
+ schema: successEnvelope(z.object({ restored: z.literal(true) })),
451
+ },
452
+ },
453
+ },
454
+ ...authErrors,
455
+ ...standardErrors(404, 500),
456
+ },
457
+ },
458
+ },
459
+
460
+ "/_emdash/api/content/{collection}/{id}/permanent": {
461
+ delete: {
462
+ operationId: "permanentDeleteContent",
463
+ summary: "Permanently delete a content item",
464
+ description: "Permanently removes a trashed content item. This cannot be undone.",
465
+ tags: ["Content"],
466
+ requestParams: {
467
+ path: z.object({
468
+ collection: z.string().meta({ description: "Collection slug" }),
469
+ id: z.string().meta({ description: "Content ID" }),
470
+ }),
471
+ },
472
+ responses: {
473
+ "200": {
474
+ description: "Permanently deleted",
475
+ content: {
476
+ [JSON_CONTENT]: {
477
+ schema: successEnvelope(deleteResponseSchema),
478
+ },
479
+ },
480
+ },
481
+ ...authErrors,
482
+ ...standardErrors(404, 500),
483
+ },
484
+ },
485
+ },
486
+
487
+ "/_emdash/api/content/{collection}/{id}/compare": {
488
+ get: {
489
+ operationId: "compareContent",
490
+ summary: "Compare live and draft revisions",
491
+ tags: ["Content"],
492
+ requestParams: {
493
+ path: z.object({
494
+ collection: z.string().meta({ description: "Collection slug" }),
495
+ id: z.string().meta({ description: "Content ID or slug" }),
496
+ }),
497
+ },
498
+ responses: {
499
+ "200": {
500
+ description: "Comparison result",
501
+ content: {
502
+ [JSON_CONTENT]: {
503
+ schema: successEnvelope(contentCompareResponseSchema),
504
+ },
505
+ },
506
+ },
507
+ ...authErrors,
508
+ ...standardErrors(404, 500),
509
+ },
510
+ },
511
+ },
512
+
513
+ "/_emdash/api/content/{collection}/{id}/discard-draft": {
514
+ post: {
515
+ operationId: "discardDraft",
516
+ summary: "Discard draft changes",
517
+ description: "Reverts the content item to its live (published) version.",
518
+ tags: ["Content"],
519
+ requestParams: {
520
+ path: z.object({
521
+ collection: z.string().meta({ description: "Collection slug" }),
522
+ id: z.string().meta({ description: "Content ID or slug" }),
523
+ }),
524
+ },
525
+ responses: {
526
+ "200": {
527
+ description: "Content item reverted to live version",
528
+ content: {
529
+ [JSON_CONTENT]: {
530
+ schema: successEnvelope(contentResponseSchema),
531
+ },
532
+ },
533
+ },
534
+ ...authErrors,
535
+ ...standardErrors(404, 500),
536
+ },
537
+ },
538
+ },
539
+
540
+ "/_emdash/api/content/{collection}/{id}/translations": {
541
+ get: {
542
+ operationId: "getContentTranslations",
543
+ summary: "Get translations for a content item",
544
+ tags: ["Content"],
545
+ requestParams: {
546
+ path: z.object({
547
+ collection: z.string().meta({ description: "Collection slug" }),
548
+ id: z.string().meta({ description: "Content ID or slug" }),
549
+ }),
550
+ },
551
+ responses: {
552
+ "200": {
553
+ description: "Translation group members",
554
+ content: {
555
+ [JSON_CONTENT]: {
556
+ schema: successEnvelope(contentTranslationsResponseSchema),
557
+ },
558
+ },
559
+ },
560
+ ...authErrors,
561
+ ...standardErrors(404, 500),
562
+ },
563
+ },
564
+ },
565
+
566
+ "/_emdash/api/content/{collection}/{id}/terms": {
567
+ put: {
568
+ operationId: "setContentTerms",
569
+ summary: "Set taxonomy terms on a content item",
570
+ tags: ["Content"],
571
+ requestParams: {
572
+ path: z.object({
573
+ collection: z.string().meta({ description: "Collection slug" }),
574
+ id: z.string().meta({ description: "Content ID or slug" }),
575
+ }),
576
+ },
577
+ requestBody: {
578
+ content: { [JSON_CONTENT]: { schema: contentTermsBody } },
579
+ },
580
+ responses: {
581
+ "200": {
582
+ description: "Terms updated",
583
+ content: {
584
+ [JSON_CONTENT]: {
585
+ schema: successEnvelope(z.object({ termIds: z.array(z.string()) })),
586
+ },
587
+ },
588
+ },
589
+ ...authErrors,
590
+ ...standardErrors(400, 404, 500),
591
+ },
592
+ },
593
+ },
594
+
595
+ "/_emdash/api/content/{collection}/trash": {
596
+ get: {
597
+ operationId: "listTrashedContent",
598
+ summary: "List trashed content items",
599
+ tags: ["Content"],
600
+ requestParams: {
601
+ path: z.object({
602
+ collection: z.string().meta({ description: "Collection slug" }),
603
+ }),
604
+ query: contentTrashQuery,
605
+ },
606
+ responses: {
607
+ "200": {
608
+ description: "Trashed content list",
609
+ content: {
610
+ [JSON_CONTENT]: {
611
+ schema: successEnvelope(trashedContentListResponseSchema),
612
+ },
613
+ },
614
+ },
615
+ ...authErrors,
616
+ ...standardErrors(500),
617
+ },
618
+ },
619
+ },
620
+ } as const;
621
+
622
+ // ---------------------------------------------------------------------------
623
+ // Media routes
624
+ // ---------------------------------------------------------------------------
625
+
626
+ const mediaPaths = {
627
+ "/_emdash/api/media": {
628
+ get: {
629
+ operationId: "listMedia",
630
+ summary: "List media items",
631
+ tags: ["Media"],
632
+ requestParams: { query: mediaListQuery },
633
+ responses: {
634
+ "200": {
635
+ description: "Media list",
636
+ content: { [JSON_CONTENT]: { schema: successEnvelope(mediaListResponseSchema) } },
637
+ },
638
+ ...authErrors,
639
+ ...standardErrors(500),
640
+ },
641
+ },
642
+ },
643
+ "/_emdash/api/media/{id}": {
644
+ get: {
645
+ operationId: "getMedia",
646
+ summary: "Get a media item",
647
+ tags: ["Media"],
648
+ requestParams: {
649
+ path: z.object({ id: z.string().meta({ description: "Media ID" }) }),
650
+ },
651
+ responses: {
652
+ "200": {
653
+ description: "Media item",
654
+ content: { [JSON_CONTENT]: { schema: successEnvelope(mediaResponseSchema) } },
655
+ },
656
+ ...authErrors,
657
+ ...standardErrors(404, 500),
658
+ },
659
+ },
660
+ put: {
661
+ operationId: "updateMedia",
662
+ summary: "Update media metadata",
663
+ tags: ["Media"],
664
+ requestParams: {
665
+ path: z.object({ id: z.string().meta({ description: "Media ID" }) }),
666
+ },
667
+ requestBody: { content: { [JSON_CONTENT]: { schema: mediaUpdateBody } } },
668
+ responses: {
669
+ "200": {
670
+ description: "Updated media item",
671
+ content: { [JSON_CONTENT]: { schema: successEnvelope(mediaResponseSchema) } },
672
+ },
673
+ ...authErrors,
674
+ ...standardErrors(400, 404, 500),
675
+ },
676
+ },
677
+ delete: {
678
+ operationId: "deleteMedia",
679
+ summary: "Delete a media item",
680
+ tags: ["Media"],
681
+ requestParams: {
682
+ path: z.object({ id: z.string().meta({ description: "Media ID" }) }),
683
+ },
684
+ responses: {
685
+ "200": {
686
+ description: "Deleted",
687
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
688
+ },
689
+ ...authErrors,
690
+ ...standardErrors(404, 500),
691
+ },
692
+ },
693
+ },
694
+ "/_emdash/api/media/upload-url": {
695
+ post: {
696
+ operationId: "getMediaUploadUrl",
697
+ summary: "Get a signed URL for direct upload",
698
+ description:
699
+ "Returns a signed URL for direct-to-storage upload. Creates a pending media record.",
700
+ tags: ["Media"],
701
+ requestBody: { content: { [JSON_CONTENT]: { schema: mediaUploadUrlBody } } },
702
+ responses: {
703
+ "200": {
704
+ description: "Upload URL or existing media (deduplication)",
705
+ content: {
706
+ [JSON_CONTENT]: {
707
+ schema: successEnvelope(
708
+ z.union([mediaUploadUrlResponseSchema, mediaExistingResponseSchema]),
709
+ ),
710
+ },
711
+ },
712
+ },
713
+ ...authErrors,
714
+ ...standardErrors(400, 500),
715
+ },
716
+ },
717
+ },
718
+ "/_emdash/api/media/{id}/confirm": {
719
+ post: {
720
+ operationId: "confirmMediaUpload",
721
+ summary: "Confirm a media upload",
722
+ description: "Marks a pending media record as ready after the file has been uploaded.",
723
+ tags: ["Media"],
724
+ requestParams: {
725
+ path: z.object({ id: z.string().meta({ description: "Media ID" }) }),
726
+ },
727
+ requestBody: { content: { [JSON_CONTENT]: { schema: mediaConfirmBody } } },
728
+ responses: {
729
+ "200": {
730
+ description: "Confirmed media item with URL",
731
+ content: {
732
+ [JSON_CONTENT]: { schema: successEnvelope(mediaConfirmResponseSchema) },
733
+ },
734
+ },
735
+ ...authErrors,
736
+ ...standardErrors(400, 404, 500),
737
+ },
738
+ },
739
+ },
740
+ } as const;
741
+
742
+ // ---------------------------------------------------------------------------
743
+ // Schema routes
744
+ // ---------------------------------------------------------------------------
745
+
746
+ const schemaPaths = {
747
+ "/_emdash/api/schema/collections": {
748
+ get: {
749
+ operationId: "listCollections",
750
+ summary: "List all collections",
751
+ tags: ["Schema"],
752
+ responses: {
753
+ "200": {
754
+ description: "Collection list",
755
+ content: {
756
+ [JSON_CONTENT]: { schema: successEnvelope(collectionListResponseSchema) },
757
+ },
758
+ },
759
+ ...authErrors,
760
+ ...standardErrors(500),
761
+ },
762
+ },
763
+ post: {
764
+ operationId: "createCollection",
765
+ summary: "Create a collection",
766
+ tags: ["Schema"],
767
+ requestBody: { content: { [JSON_CONTENT]: { schema: createCollectionBody } } },
768
+ responses: {
769
+ "201": {
770
+ description: "Created collection",
771
+ content: {
772
+ [JSON_CONTENT]: { schema: successEnvelope(collectionResponseSchema) },
773
+ },
774
+ },
775
+ ...authErrors,
776
+ ...standardErrors(400, 409, 500),
777
+ },
778
+ },
779
+ },
780
+ "/_emdash/api/schema/collections/{slug}": {
781
+ get: {
782
+ operationId: "getCollection",
783
+ summary: "Get a collection",
784
+ tags: ["Schema"],
785
+ requestParams: {
786
+ path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }),
787
+ query: collectionGetQuery,
788
+ },
789
+ responses: {
790
+ "200": {
791
+ description: "Collection (optionally with fields)",
792
+ content: {
793
+ [JSON_CONTENT]: {
794
+ schema: successEnvelope(
795
+ z.union([
796
+ collectionResponseSchema.shape.item,
797
+ collectionWithFieldsResponseSchema.shape.item,
798
+ ]),
799
+ ),
800
+ },
801
+ },
802
+ },
803
+ ...authErrors,
804
+ ...standardErrors(404, 500),
805
+ },
806
+ },
807
+ put: {
808
+ operationId: "updateCollection",
809
+ summary: "Update a collection",
810
+ tags: ["Schema"],
811
+ requestParams: {
812
+ path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }),
813
+ },
814
+ requestBody: { content: { [JSON_CONTENT]: { schema: updateCollectionBody } } },
815
+ responses: {
816
+ "200": {
817
+ description: "Updated collection",
818
+ content: {
819
+ [JSON_CONTENT]: { schema: successEnvelope(collectionResponseSchema) },
820
+ },
821
+ },
822
+ ...authErrors,
823
+ ...standardErrors(400, 404, 500),
824
+ },
825
+ },
826
+ delete: {
827
+ operationId: "deleteCollection",
828
+ summary: "Delete a collection",
829
+ tags: ["Schema"],
830
+ requestParams: {
831
+ path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }),
832
+ },
833
+ responses: {
834
+ "200": {
835
+ description: "Deleted",
836
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
837
+ },
838
+ ...authErrors,
839
+ ...standardErrors(404, 500),
840
+ },
841
+ },
842
+ },
843
+ "/_emdash/api/schema/collections/{slug}/fields": {
844
+ get: {
845
+ operationId: "listFields",
846
+ summary: "List fields for a collection",
847
+ tags: ["Schema"],
848
+ requestParams: {
849
+ path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }),
850
+ },
851
+ responses: {
852
+ "200": {
853
+ description: "Field list",
854
+ content: { [JSON_CONTENT]: { schema: successEnvelope(fieldListResponseSchema) } },
855
+ },
856
+ ...authErrors,
857
+ ...standardErrors(404, 500),
858
+ },
859
+ },
860
+ post: {
861
+ operationId: "createField",
862
+ summary: "Create a field",
863
+ tags: ["Schema"],
864
+ requestParams: {
865
+ path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }),
866
+ },
867
+ requestBody: { content: { [JSON_CONTENT]: { schema: createFieldBody } } },
868
+ responses: {
869
+ "201": {
870
+ description: "Created field",
871
+ content: { [JSON_CONTENT]: { schema: successEnvelope(fieldResponseSchema) } },
872
+ },
873
+ ...authErrors,
874
+ ...standardErrors(400, 409, 500),
875
+ },
876
+ },
877
+ },
878
+ "/_emdash/api/schema/collections/{slug}/fields/{fieldSlug}": {
879
+ get: {
880
+ operationId: "getField",
881
+ summary: "Get a field",
882
+ tags: ["Schema"],
883
+ requestParams: {
884
+ path: z.object({
885
+ slug: z.string().meta({ description: "Collection slug" }),
886
+ fieldSlug: z.string().meta({ description: "Field slug" }),
887
+ }),
888
+ },
889
+ responses: {
890
+ "200": {
891
+ description: "Field",
892
+ content: { [JSON_CONTENT]: { schema: successEnvelope(fieldResponseSchema) } },
893
+ },
894
+ ...authErrors,
895
+ ...standardErrors(404, 500),
896
+ },
897
+ },
898
+ put: {
899
+ operationId: "updateField",
900
+ summary: "Update a field",
901
+ tags: ["Schema"],
902
+ requestParams: {
903
+ path: z.object({
904
+ slug: z.string().meta({ description: "Collection slug" }),
905
+ fieldSlug: z.string().meta({ description: "Field slug" }),
906
+ }),
907
+ },
908
+ requestBody: { content: { [JSON_CONTENT]: { schema: updateFieldBody } } },
909
+ responses: {
910
+ "200": {
911
+ description: "Updated field",
912
+ content: { [JSON_CONTENT]: { schema: successEnvelope(fieldResponseSchema) } },
913
+ },
914
+ ...authErrors,
915
+ ...standardErrors(400, 404, 500),
916
+ },
917
+ },
918
+ delete: {
919
+ operationId: "deleteField",
920
+ summary: "Delete a field",
921
+ tags: ["Schema"],
922
+ requestParams: {
923
+ path: z.object({
924
+ slug: z.string().meta({ description: "Collection slug" }),
925
+ fieldSlug: z.string().meta({ description: "Field slug" }),
926
+ }),
927
+ },
928
+ responses: {
929
+ "200": {
930
+ description: "Deleted",
931
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
932
+ },
933
+ ...authErrors,
934
+ ...standardErrors(404, 500),
935
+ },
936
+ },
937
+ },
938
+ "/_emdash/api/schema/collections/{slug}/fields/reorder": {
939
+ post: {
940
+ operationId: "reorderFields",
941
+ summary: "Reorder fields in a collection",
942
+ tags: ["Schema"],
943
+ requestParams: {
944
+ path: z.object({ slug: z.string().meta({ description: "Collection slug" }) }),
945
+ },
946
+ requestBody: { content: { [JSON_CONTENT]: { schema: fieldReorderBody } } },
947
+ responses: {
948
+ "200": {
949
+ description: "Reordered",
950
+ content: {
951
+ [JSON_CONTENT]: {
952
+ schema: successEnvelope(z.object({ success: z.literal(true) })),
953
+ },
954
+ },
955
+ },
956
+ ...authErrors,
957
+ ...standardErrors(400, 404, 500),
958
+ },
959
+ },
960
+ },
961
+ "/_emdash/api/schema/orphans": {
962
+ get: {
963
+ operationId: "listOrphanedTables",
964
+ summary: "List orphaned content tables",
965
+ description: "Finds ec_* tables without matching collection definitions.",
966
+ tags: ["Schema"],
967
+ responses: {
968
+ "200": {
969
+ description: "Orphaned tables",
970
+ content: {
971
+ [JSON_CONTENT]: { schema: successEnvelope(orphanedTableListResponseSchema) },
972
+ },
973
+ },
974
+ ...authErrors,
975
+ ...standardErrors(500),
976
+ },
977
+ },
978
+ },
979
+ "/_emdash/api/schema/orphans/{slug}": {
980
+ post: {
981
+ operationId: "registerOrphanedTable",
982
+ summary: "Register an orphaned table as a collection",
983
+ tags: ["Schema"],
984
+ requestParams: {
985
+ path: z.object({
986
+ slug: z.string().meta({ description: "Table slug (without ec_ prefix)" }),
987
+ }),
988
+ },
989
+ requestBody: { content: { [JSON_CONTENT]: { schema: orphanRegisterBody } } },
990
+ responses: {
991
+ "201": {
992
+ description: "Registered collection",
993
+ content: {
994
+ [JSON_CONTENT]: { schema: successEnvelope(collectionResponseSchema) },
995
+ },
996
+ },
997
+ ...authErrors,
998
+ ...standardErrors(400, 404, 500),
999
+ },
1000
+ },
1001
+ },
1002
+ } as const;
1003
+
1004
+ // ---------------------------------------------------------------------------
1005
+ // Comments routes
1006
+ // ---------------------------------------------------------------------------
1007
+
1008
+ const commentsPaths = {
1009
+ "/_emdash/api/comments/{collection}/{contentId}": {
1010
+ get: {
1011
+ operationId: "listPublicComments",
1012
+ summary: "List approved comments for content",
1013
+ description: "Public endpoint. Returns approved comments with optional threading.",
1014
+ tags: ["Comments"],
1015
+ requestParams: {
1016
+ path: z.object({
1017
+ collection: z.string().meta({ description: "Collection slug" }),
1018
+ contentId: z.string().meta({ description: "Content ID" }),
1019
+ }),
1020
+ query: z.object({
1021
+ limit: z.coerce.number().int().min(1).max(100).optional(),
1022
+ cursor: z.string().optional(),
1023
+ threaded: z
1024
+ .enum(["true", "false"])
1025
+ .transform((v) => v === "true")
1026
+ .optional(),
1027
+ }),
1028
+ },
1029
+ responses: {
1030
+ "200": {
1031
+ description: "Comment list",
1032
+ content: {
1033
+ [JSON_CONTENT]: {
1034
+ schema: successEnvelope(publicCommentListResponseSchema),
1035
+ },
1036
+ },
1037
+ },
1038
+ ...standardErrors(500),
1039
+ },
1040
+ },
1041
+ post: {
1042
+ operationId: "createComment",
1043
+ summary: "Submit a new comment",
1044
+ description: "Public endpoint. Comment enters moderation queue.",
1045
+ tags: ["Comments"],
1046
+ requestParams: {
1047
+ path: z.object({
1048
+ collection: z.string().meta({ description: "Collection slug" }),
1049
+ contentId: z.string().meta({ description: "Content ID" }),
1050
+ }),
1051
+ },
1052
+ requestBody: { content: { [JSON_CONTENT]: { schema: createCommentBody } } },
1053
+ responses: {
1054
+ "201": {
1055
+ description: "Comment created (pending moderation)",
1056
+ content: {
1057
+ [JSON_CONTENT]: {
1058
+ schema: successEnvelope(z.object({ id: z.string(), status: z.string() })),
1059
+ },
1060
+ },
1061
+ },
1062
+ ...standardErrors(400, 429, 500),
1063
+ },
1064
+ },
1065
+ },
1066
+ "/_emdash/api/admin/comments": {
1067
+ get: {
1068
+ operationId: "listAdminComments",
1069
+ summary: "List comments for moderation",
1070
+ tags: ["Comments"],
1071
+ requestParams: { query: commentListQuery },
1072
+ responses: {
1073
+ "200": {
1074
+ description: "Comment moderation inbox",
1075
+ content: {
1076
+ [JSON_CONTENT]: { schema: successEnvelope(adminCommentListResponseSchema) },
1077
+ },
1078
+ },
1079
+ ...authErrors,
1080
+ ...standardErrors(500),
1081
+ },
1082
+ },
1083
+ },
1084
+ "/_emdash/api/admin/comments/counts": {
1085
+ get: {
1086
+ operationId: "getCommentCounts",
1087
+ summary: "Get comment status counts",
1088
+ tags: ["Comments"],
1089
+ responses: {
1090
+ "200": {
1091
+ description: "Counts by status",
1092
+ content: {
1093
+ [JSON_CONTENT]: { schema: successEnvelope(commentCountsResponseSchema) },
1094
+ },
1095
+ },
1096
+ ...authErrors,
1097
+ ...standardErrors(500),
1098
+ },
1099
+ },
1100
+ },
1101
+ "/_emdash/api/admin/comments/bulk": {
1102
+ post: {
1103
+ operationId: "bulkCommentAction",
1104
+ summary: "Bulk approve, spam, trash, or delete comments",
1105
+ tags: ["Comments"],
1106
+ requestBody: { content: { [JSON_CONTENT]: { schema: commentBulkBody } } },
1107
+ responses: {
1108
+ "200": {
1109
+ description: "Bulk action result",
1110
+ content: {
1111
+ [JSON_CONTENT]: { schema: successEnvelope(commentBulkResponseSchema) },
1112
+ },
1113
+ },
1114
+ ...authErrors,
1115
+ ...standardErrors(400, 500),
1116
+ },
1117
+ },
1118
+ },
1119
+ "/_emdash/api/admin/comments/{id}": {
1120
+ get: {
1121
+ operationId: "getComment",
1122
+ summary: "Get a single comment",
1123
+ tags: ["Comments"],
1124
+ requestParams: {
1125
+ path: z.object({ id: z.string().meta({ description: "Comment ID" }) }),
1126
+ },
1127
+ responses: {
1128
+ "200": {
1129
+ description: "Comment",
1130
+ content: { [JSON_CONTENT]: { schema: successEnvelope(commentSchema) } },
1131
+ },
1132
+ ...authErrors,
1133
+ ...standardErrors(404, 500),
1134
+ },
1135
+ },
1136
+ delete: {
1137
+ operationId: "deleteComment",
1138
+ summary: "Permanently delete a comment",
1139
+ tags: ["Comments"],
1140
+ requestParams: {
1141
+ path: z.object({ id: z.string().meta({ description: "Comment ID" }) }),
1142
+ },
1143
+ responses: {
1144
+ "200": {
1145
+ description: "Deleted",
1146
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
1147
+ },
1148
+ ...authErrors,
1149
+ ...standardErrors(404, 500),
1150
+ },
1151
+ },
1152
+ },
1153
+ "/_emdash/api/admin/comments/{id}/status": {
1154
+ put: {
1155
+ operationId: "updateCommentStatus",
1156
+ summary: "Change comment status",
1157
+ tags: ["Comments"],
1158
+ requestParams: {
1159
+ path: z.object({ id: z.string().meta({ description: "Comment ID" }) }),
1160
+ },
1161
+ requestBody: { content: { [JSON_CONTENT]: { schema: commentStatusBody } } },
1162
+ responses: {
1163
+ "200": {
1164
+ description: "Updated comment",
1165
+ content: { [JSON_CONTENT]: { schema: successEnvelope(commentSchema) } },
1166
+ },
1167
+ ...authErrors,
1168
+ ...standardErrors(400, 404, 500),
1169
+ },
1170
+ },
1171
+ },
1172
+ } as const;
1173
+
1174
+ // ---------------------------------------------------------------------------
1175
+ // Taxonomy routes
1176
+ // ---------------------------------------------------------------------------
1177
+
1178
+ const taxonomyPaths = {
1179
+ "/_emdash/api/taxonomies": {
1180
+ get: {
1181
+ operationId: "listTaxonomies",
1182
+ summary: "List all taxonomy definitions",
1183
+ tags: ["Taxonomies"],
1184
+ responses: {
1185
+ "200": {
1186
+ description: "Taxonomy list",
1187
+ content: {
1188
+ [JSON_CONTENT]: { schema: successEnvelope(taxonomyListResponseSchema) },
1189
+ },
1190
+ },
1191
+ ...authErrors,
1192
+ ...standardErrors(500),
1193
+ },
1194
+ },
1195
+ },
1196
+ "/_emdash/api/taxonomies/{name}/terms": {
1197
+ get: {
1198
+ operationId: "listTerms",
1199
+ summary: "List terms for a taxonomy",
1200
+ description: "Returns a tree for hierarchical taxonomies, flat list otherwise.",
1201
+ tags: ["Taxonomies"],
1202
+ requestParams: {
1203
+ path: z.object({ name: z.string().meta({ description: "Taxonomy name" }) }),
1204
+ },
1205
+ responses: {
1206
+ "200": {
1207
+ description: "Term list",
1208
+ content: {
1209
+ [JSON_CONTENT]: { schema: successEnvelope(termListResponseSchema) },
1210
+ },
1211
+ },
1212
+ ...authErrors,
1213
+ ...standardErrors(404, 500),
1214
+ },
1215
+ },
1216
+ post: {
1217
+ operationId: "createTerm",
1218
+ summary: "Create a term",
1219
+ tags: ["Taxonomies"],
1220
+ requestParams: {
1221
+ path: z.object({ name: z.string().meta({ description: "Taxonomy name" }) }),
1222
+ },
1223
+ requestBody: { content: { [JSON_CONTENT]: { schema: createTermBody } } },
1224
+ responses: {
1225
+ "201": {
1226
+ description: "Created term",
1227
+ content: {
1228
+ [JSON_CONTENT]: { schema: successEnvelope(termResponseSchema) },
1229
+ },
1230
+ },
1231
+ ...authErrors,
1232
+ ...standardErrors(400, 409, 500),
1233
+ },
1234
+ },
1235
+ },
1236
+ "/_emdash/api/taxonomies/{name}/terms/{slug}": {
1237
+ get: {
1238
+ operationId: "getTerm",
1239
+ summary: "Get a term by slug",
1240
+ tags: ["Taxonomies"],
1241
+ requestParams: {
1242
+ path: z.object({
1243
+ name: z.string().meta({ description: "Taxonomy name" }),
1244
+ slug: z.string().meta({ description: "Term slug" }),
1245
+ }),
1246
+ },
1247
+ responses: {
1248
+ "200": {
1249
+ description: "Term with children and count",
1250
+ content: {
1251
+ [JSON_CONTENT]: { schema: successEnvelope(termGetResponseSchema) },
1252
+ },
1253
+ },
1254
+ ...authErrors,
1255
+ ...standardErrors(404, 500),
1256
+ },
1257
+ },
1258
+ put: {
1259
+ operationId: "updateTerm",
1260
+ summary: "Update a term",
1261
+ tags: ["Taxonomies"],
1262
+ requestParams: {
1263
+ path: z.object({
1264
+ name: z.string().meta({ description: "Taxonomy name" }),
1265
+ slug: z.string().meta({ description: "Term slug" }),
1266
+ }),
1267
+ },
1268
+ requestBody: { content: { [JSON_CONTENT]: { schema: updateTermBody } } },
1269
+ responses: {
1270
+ "200": {
1271
+ description: "Updated term",
1272
+ content: {
1273
+ [JSON_CONTENT]: { schema: successEnvelope(termResponseSchema) },
1274
+ },
1275
+ },
1276
+ ...authErrors,
1277
+ ...standardErrors(400, 404, 409, 500),
1278
+ },
1279
+ },
1280
+ delete: {
1281
+ operationId: "deleteTerm",
1282
+ summary: "Delete a term",
1283
+ tags: ["Taxonomies"],
1284
+ requestParams: {
1285
+ path: z.object({
1286
+ name: z.string().meta({ description: "Taxonomy name" }),
1287
+ slug: z.string().meta({ description: "Term slug" }),
1288
+ }),
1289
+ },
1290
+ responses: {
1291
+ "200": {
1292
+ description: "Deleted",
1293
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
1294
+ },
1295
+ ...authErrors,
1296
+ ...standardErrors(400, 404, 500),
1297
+ },
1298
+ },
1299
+ },
1300
+ } as const;
1301
+
1302
+ // ---------------------------------------------------------------------------
1303
+ // Menu routes
1304
+ // ---------------------------------------------------------------------------
1305
+
1306
+ const menuPaths = {
1307
+ "/_emdash/api/menus": {
1308
+ get: {
1309
+ operationId: "listMenus",
1310
+ summary: "List all menus with item counts",
1311
+ tags: ["Menus"],
1312
+ responses: {
1313
+ "200": {
1314
+ description: "Menu list",
1315
+ content: {
1316
+ [JSON_CONTENT]: {
1317
+ schema: successEnvelope(z.array(menuListItemSchema)),
1318
+ },
1319
+ },
1320
+ },
1321
+ ...authErrors,
1322
+ ...standardErrors(500),
1323
+ },
1324
+ },
1325
+ post: {
1326
+ operationId: "createMenu",
1327
+ summary: "Create a menu",
1328
+ tags: ["Menus"],
1329
+ requestBody: { content: { [JSON_CONTENT]: { schema: createMenuBody } } },
1330
+ responses: {
1331
+ "201": {
1332
+ description: "Created menu",
1333
+ content: {
1334
+ [JSON_CONTENT]: { schema: successEnvelope(menuWithItemsSchema) },
1335
+ },
1336
+ },
1337
+ ...authErrors,
1338
+ ...standardErrors(400, 409, 500),
1339
+ },
1340
+ },
1341
+ },
1342
+ "/_emdash/api/menus/{name}": {
1343
+ get: {
1344
+ operationId: "getMenu",
1345
+ summary: "Get a menu with all items",
1346
+ tags: ["Menus"],
1347
+ requestParams: {
1348
+ path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
1349
+ },
1350
+ responses: {
1351
+ "200": {
1352
+ description: "Menu with items",
1353
+ content: {
1354
+ [JSON_CONTENT]: { schema: successEnvelope(menuWithItemsSchema) },
1355
+ },
1356
+ },
1357
+ ...authErrors,
1358
+ ...standardErrors(404, 500),
1359
+ },
1360
+ },
1361
+ put: {
1362
+ operationId: "updateMenu",
1363
+ summary: "Update a menu",
1364
+ tags: ["Menus"],
1365
+ requestParams: {
1366
+ path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
1367
+ },
1368
+ requestBody: { content: { [JSON_CONTENT]: { schema: updateMenuBody } } },
1369
+ responses: {
1370
+ "200": {
1371
+ description: "Updated menu",
1372
+ content: {
1373
+ [JSON_CONTENT]: { schema: successEnvelope(menuWithItemsSchema) },
1374
+ },
1375
+ },
1376
+ ...authErrors,
1377
+ ...standardErrors(404, 500),
1378
+ },
1379
+ },
1380
+ delete: {
1381
+ operationId: "deleteMenu",
1382
+ summary: "Delete a menu and its items",
1383
+ tags: ["Menus"],
1384
+ requestParams: {
1385
+ path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
1386
+ },
1387
+ responses: {
1388
+ "200": {
1389
+ description: "Deleted",
1390
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
1391
+ },
1392
+ ...authErrors,
1393
+ ...standardErrors(404, 500),
1394
+ },
1395
+ },
1396
+ },
1397
+ "/_emdash/api/menus/{name}/items": {
1398
+ post: {
1399
+ operationId: "createMenuItem",
1400
+ summary: "Add an item to a menu",
1401
+ tags: ["Menus"],
1402
+ requestParams: {
1403
+ path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
1404
+ },
1405
+ requestBody: { content: { [JSON_CONTENT]: { schema: createMenuItemBody } } },
1406
+ responses: {
1407
+ "201": {
1408
+ description: "Created menu item",
1409
+ content: { [JSON_CONTENT]: { schema: successEnvelope(menuItemSchema) } },
1410
+ },
1411
+ ...authErrors,
1412
+ ...standardErrors(400, 404, 500),
1413
+ },
1414
+ },
1415
+ put: {
1416
+ operationId: "updateMenuItem",
1417
+ summary: "Update a menu item",
1418
+ tags: ["Menus"],
1419
+ requestParams: {
1420
+ path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
1421
+ query: z.object({ id: z.string().meta({ description: "Menu item ID" }) }),
1422
+ },
1423
+ requestBody: { content: { [JSON_CONTENT]: { schema: updateMenuItemBody } } },
1424
+ responses: {
1425
+ "200": {
1426
+ description: "Updated menu item",
1427
+ content: { [JSON_CONTENT]: { schema: successEnvelope(menuItemSchema) } },
1428
+ },
1429
+ ...authErrors,
1430
+ ...standardErrors(400, 404, 500),
1431
+ },
1432
+ },
1433
+ delete: {
1434
+ operationId: "deleteMenuItem",
1435
+ summary: "Delete a menu item",
1436
+ tags: ["Menus"],
1437
+ requestParams: {
1438
+ path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
1439
+ query: z.object({ id: z.string().meta({ description: "Menu item ID" }) }),
1440
+ },
1441
+ responses: {
1442
+ "200": {
1443
+ description: "Deleted",
1444
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
1445
+ },
1446
+ ...authErrors,
1447
+ ...standardErrors(404, 500),
1448
+ },
1449
+ },
1450
+ },
1451
+ "/_emdash/api/menus/{name}/reorder": {
1452
+ post: {
1453
+ operationId: "reorderMenuItems",
1454
+ summary: "Batch reorder menu items",
1455
+ tags: ["Menus"],
1456
+ requestParams: {
1457
+ path: z.object({ name: z.string().meta({ description: "Menu name" }) }),
1458
+ },
1459
+ requestBody: { content: { [JSON_CONTENT]: { schema: reorderMenuItemsBody } } },
1460
+ responses: {
1461
+ "200": {
1462
+ description: "Reordered items",
1463
+ content: {
1464
+ [JSON_CONTENT]: {
1465
+ schema: successEnvelope(z.array(menuItemSchema)),
1466
+ },
1467
+ },
1468
+ },
1469
+ ...authErrors,
1470
+ ...standardErrors(400, 404, 500),
1471
+ },
1472
+ },
1473
+ },
1474
+ } as const;
1475
+
1476
+ // ---------------------------------------------------------------------------
1477
+ // Section routes
1478
+ // ---------------------------------------------------------------------------
1479
+
1480
+ const sectionPaths = {
1481
+ "/_emdash/api/sections": {
1482
+ get: {
1483
+ operationId: "listSections",
1484
+ summary: "List sections",
1485
+ tags: ["Sections"],
1486
+ requestParams: { query: sectionsListQuery },
1487
+ responses: {
1488
+ "200": {
1489
+ description: "Section list",
1490
+ content: {
1491
+ [JSON_CONTENT]: { schema: successEnvelope(sectionListResponseSchema) },
1492
+ },
1493
+ },
1494
+ ...authErrors,
1495
+ ...standardErrors(500),
1496
+ },
1497
+ },
1498
+ post: {
1499
+ operationId: "createSection",
1500
+ summary: "Create a section",
1501
+ tags: ["Sections"],
1502
+ requestBody: { content: { [JSON_CONTENT]: { schema: createSectionBody } } },
1503
+ responses: {
1504
+ "201": {
1505
+ description: "Created section",
1506
+ content: { [JSON_CONTENT]: { schema: successEnvelope(sectionSchema) } },
1507
+ },
1508
+ ...authErrors,
1509
+ ...standardErrors(400, 409, 500),
1510
+ },
1511
+ },
1512
+ },
1513
+ "/_emdash/api/sections/{slug}": {
1514
+ get: {
1515
+ operationId: "getSection",
1516
+ summary: "Get a section by slug",
1517
+ tags: ["Sections"],
1518
+ requestParams: {
1519
+ path: z.object({ slug: z.string().meta({ description: "Section slug" }) }),
1520
+ },
1521
+ responses: {
1522
+ "200": {
1523
+ description: "Section",
1524
+ content: { [JSON_CONTENT]: { schema: successEnvelope(sectionSchema) } },
1525
+ },
1526
+ ...authErrors,
1527
+ ...standardErrors(404, 500),
1528
+ },
1529
+ },
1530
+ put: {
1531
+ operationId: "updateSection",
1532
+ summary: "Update a section",
1533
+ tags: ["Sections"],
1534
+ requestParams: {
1535
+ path: z.object({ slug: z.string().meta({ description: "Section slug" }) }),
1536
+ },
1537
+ requestBody: { content: { [JSON_CONTENT]: { schema: updateSectionBody } } },
1538
+ responses: {
1539
+ "200": {
1540
+ description: "Updated section",
1541
+ content: { [JSON_CONTENT]: { schema: successEnvelope(sectionSchema) } },
1542
+ },
1543
+ ...authErrors,
1544
+ ...standardErrors(400, 404, 409, 500),
1545
+ },
1546
+ },
1547
+ delete: {
1548
+ operationId: "deleteSection",
1549
+ summary: "Delete a section",
1550
+ tags: ["Sections"],
1551
+ requestParams: {
1552
+ path: z.object({ slug: z.string().meta({ description: "Section slug" }) }),
1553
+ },
1554
+ responses: {
1555
+ "200": {
1556
+ description: "Deleted",
1557
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
1558
+ },
1559
+ ...authErrors,
1560
+ ...standardErrors(403, 404, 500),
1561
+ },
1562
+ },
1563
+ },
1564
+ } as const;
1565
+
1566
+ // ---------------------------------------------------------------------------
1567
+ // Widget routes
1568
+ // ---------------------------------------------------------------------------
1569
+
1570
+ const widgetPaths = {
1571
+ "/_emdash/api/widget-areas": {
1572
+ get: {
1573
+ operationId: "listWidgetAreas",
1574
+ summary: "List all widget areas",
1575
+ tags: ["Widgets"],
1576
+ responses: {
1577
+ "200": {
1578
+ description: "Widget area list",
1579
+ content: {
1580
+ [JSON_CONTENT]: {
1581
+ schema: successEnvelope(z.object({ items: z.array(widgetAreaSchema) })),
1582
+ },
1583
+ },
1584
+ },
1585
+ ...authErrors,
1586
+ ...standardErrors(500),
1587
+ },
1588
+ },
1589
+ post: {
1590
+ operationId: "createWidgetArea",
1591
+ summary: "Create a widget area",
1592
+ tags: ["Widgets"],
1593
+ requestBody: { content: { [JSON_CONTENT]: { schema: createWidgetAreaBody } } },
1594
+ responses: {
1595
+ "201": {
1596
+ description: "Created widget area",
1597
+ content: { [JSON_CONTENT]: { schema: successEnvelope(widgetAreaSchema) } },
1598
+ },
1599
+ ...authErrors,
1600
+ ...standardErrors(400, 409, 500),
1601
+ },
1602
+ },
1603
+ },
1604
+ "/_emdash/api/widget-areas/{name}": {
1605
+ get: {
1606
+ operationId: "getWidgetArea",
1607
+ summary: "Get a widget area with widgets",
1608
+ tags: ["Widgets"],
1609
+ requestParams: {
1610
+ path: z.object({ name: z.string().meta({ description: "Widget area name" }) }),
1611
+ },
1612
+ responses: {
1613
+ "200": {
1614
+ description: "Widget area with widgets",
1615
+ content: {
1616
+ [JSON_CONTENT]: { schema: successEnvelope(widgetAreaWithWidgetsSchema) },
1617
+ },
1618
+ },
1619
+ ...authErrors,
1620
+ ...standardErrors(404, 500),
1621
+ },
1622
+ },
1623
+ delete: {
1624
+ operationId: "deleteWidgetArea",
1625
+ summary: "Delete a widget area and its widgets",
1626
+ tags: ["Widgets"],
1627
+ requestParams: {
1628
+ path: z.object({ name: z.string().meta({ description: "Widget area name" }) }),
1629
+ },
1630
+ responses: {
1631
+ "200": {
1632
+ description: "Deleted",
1633
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
1634
+ },
1635
+ ...authErrors,
1636
+ ...standardErrors(404, 500),
1637
+ },
1638
+ },
1639
+ },
1640
+ "/_emdash/api/widget-areas/{name}/widgets": {
1641
+ post: {
1642
+ operationId: "createWidget",
1643
+ summary: "Add a widget to an area",
1644
+ tags: ["Widgets"],
1645
+ requestParams: {
1646
+ path: z.object({ name: z.string().meta({ description: "Widget area name" }) }),
1647
+ },
1648
+ requestBody: { content: { [JSON_CONTENT]: { schema: createWidgetBody } } },
1649
+ responses: {
1650
+ "201": {
1651
+ description: "Created widget",
1652
+ content: { [JSON_CONTENT]: { schema: successEnvelope(widgetSchema) } },
1653
+ },
1654
+ ...authErrors,
1655
+ ...standardErrors(400, 404, 500),
1656
+ },
1657
+ },
1658
+ },
1659
+ "/_emdash/api/widget-areas/{name}/widgets/{id}": {
1660
+ put: {
1661
+ operationId: "updateWidget",
1662
+ summary: "Update a widget",
1663
+ tags: ["Widgets"],
1664
+ requestParams: {
1665
+ path: z.object({
1666
+ name: z.string().meta({ description: "Widget area name" }),
1667
+ id: z.string().meta({ description: "Widget ID" }),
1668
+ }),
1669
+ },
1670
+ requestBody: { content: { [JSON_CONTENT]: { schema: updateWidgetBody } } },
1671
+ responses: {
1672
+ "200": {
1673
+ description: "Updated widget",
1674
+ content: { [JSON_CONTENT]: { schema: successEnvelope(widgetSchema) } },
1675
+ },
1676
+ ...authErrors,
1677
+ ...standardErrors(400, 404, 500),
1678
+ },
1679
+ },
1680
+ delete: {
1681
+ operationId: "deleteWidget",
1682
+ summary: "Delete a widget",
1683
+ tags: ["Widgets"],
1684
+ requestParams: {
1685
+ path: z.object({
1686
+ name: z.string().meta({ description: "Widget area name" }),
1687
+ id: z.string().meta({ description: "Widget ID" }),
1688
+ }),
1689
+ },
1690
+ responses: {
1691
+ "200": {
1692
+ description: "Deleted",
1693
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
1694
+ },
1695
+ ...authErrors,
1696
+ ...standardErrors(404, 500),
1697
+ },
1698
+ },
1699
+ },
1700
+ "/_emdash/api/widget-areas/{name}/reorder": {
1701
+ post: {
1702
+ operationId: "reorderWidgets",
1703
+ summary: "Reorder widgets in an area",
1704
+ tags: ["Widgets"],
1705
+ requestParams: {
1706
+ path: z.object({ name: z.string().meta({ description: "Widget area name" }) }),
1707
+ },
1708
+ requestBody: { content: { [JSON_CONTENT]: { schema: reorderWidgetsBody } } },
1709
+ responses: {
1710
+ "200": {
1711
+ description: "Reordered",
1712
+ content: {
1713
+ [JSON_CONTENT]: {
1714
+ schema: successEnvelope(z.object({ success: z.literal(true) })),
1715
+ },
1716
+ },
1717
+ },
1718
+ ...authErrors,
1719
+ ...standardErrors(400, 404, 500),
1720
+ },
1721
+ },
1722
+ },
1723
+ } as const;
1724
+
1725
+ // ---------------------------------------------------------------------------
1726
+ // Settings routes
1727
+ // ---------------------------------------------------------------------------
1728
+
1729
+ const settingsPaths = {
1730
+ "/_emdash/api/settings": {
1731
+ get: {
1732
+ operationId: "getSettings",
1733
+ summary: "Get site settings",
1734
+ tags: ["Settings"],
1735
+ responses: {
1736
+ "200": {
1737
+ description: "Site settings",
1738
+ content: { [JSON_CONTENT]: { schema: successEnvelope(siteSettingsSchema) } },
1739
+ },
1740
+ ...authErrors,
1741
+ ...standardErrors(500),
1742
+ },
1743
+ },
1744
+ put: {
1745
+ operationId: "updateSettings",
1746
+ summary: "Update site settings",
1747
+ tags: ["Settings"],
1748
+ requestBody: { content: { [JSON_CONTENT]: { schema: settingsUpdateBody } } },
1749
+ responses: {
1750
+ "200": {
1751
+ description: "Updated settings",
1752
+ content: { [JSON_CONTENT]: { schema: successEnvelope(siteSettingsSchema) } },
1753
+ },
1754
+ ...authErrors,
1755
+ ...standardErrors(400, 500),
1756
+ },
1757
+ },
1758
+ },
1759
+ } as const;
1760
+
1761
+ // ---------------------------------------------------------------------------
1762
+ // Search routes
1763
+ // ---------------------------------------------------------------------------
1764
+
1765
+ const searchPaths = {
1766
+ "/_emdash/api/search": {
1767
+ get: {
1768
+ operationId: "search",
1769
+ summary: "Full-text search across collections",
1770
+ tags: ["Search"],
1771
+ requestParams: { query: searchQuery },
1772
+ responses: {
1773
+ "200": {
1774
+ description: "Search results",
1775
+ content: { [JSON_CONTENT]: { schema: successEnvelope(searchResponseSchema) } },
1776
+ },
1777
+ ...authErrors,
1778
+ ...standardErrors(500),
1779
+ },
1780
+ },
1781
+ },
1782
+ "/_emdash/api/search/suggest": {
1783
+ get: {
1784
+ operationId: "searchSuggest",
1785
+ summary: "Autocomplete search suggestions",
1786
+ tags: ["Search"],
1787
+ requestParams: { query: searchSuggestQuery },
1788
+ responses: {
1789
+ "200": {
1790
+ description: "Search suggestions",
1791
+ content: { [JSON_CONTENT]: { schema: successEnvelope(searchResponseSchema) } },
1792
+ },
1793
+ ...authErrors,
1794
+ ...standardErrors(500),
1795
+ },
1796
+ },
1797
+ },
1798
+ "/_emdash/api/search/rebuild": {
1799
+ post: {
1800
+ operationId: "rebuildSearchIndex",
1801
+ summary: "Rebuild the search index for a collection",
1802
+ tags: ["Search"],
1803
+ requestBody: { content: { [JSON_CONTENT]: { schema: searchRebuildBody } } },
1804
+ responses: {
1805
+ "200": {
1806
+ description: "Rebuild started",
1807
+ content: {
1808
+ [JSON_CONTENT]: {
1809
+ schema: successEnvelope(
1810
+ z.object({
1811
+ collection: z.string(),
1812
+ indexed: z.number().int(),
1813
+ }),
1814
+ ),
1815
+ },
1816
+ },
1817
+ },
1818
+ ...authErrors,
1819
+ ...standardErrors(400, 500),
1820
+ },
1821
+ },
1822
+ },
1823
+ "/_emdash/api/search/enable": {
1824
+ post: {
1825
+ operationId: "enableSearch",
1826
+ summary: "Enable or disable search for a collection",
1827
+ tags: ["Search"],
1828
+ requestBody: { content: { [JSON_CONTENT]: { schema: searchEnableBody } } },
1829
+ responses: {
1830
+ "200": {
1831
+ description: "Search config updated",
1832
+ content: {
1833
+ [JSON_CONTENT]: {
1834
+ schema: successEnvelope(
1835
+ z.object({
1836
+ collection: z.string(),
1837
+ enabled: z.boolean(),
1838
+ }),
1839
+ ),
1840
+ },
1841
+ },
1842
+ },
1843
+ ...authErrors,
1844
+ ...standardErrors(400, 500),
1845
+ },
1846
+ },
1847
+ },
1848
+ "/_emdash/api/search/stats": {
1849
+ get: {
1850
+ operationId: "getSearchStats",
1851
+ summary: "Get search index statistics",
1852
+ tags: ["Search"],
1853
+ responses: {
1854
+ "200": {
1855
+ description: "Search stats per collection",
1856
+ content: {
1857
+ [JSON_CONTENT]: {
1858
+ schema: successEnvelope(
1859
+ z.object({
1860
+ collections: z.array(
1861
+ z.object({
1862
+ collection: z.string(),
1863
+ enabled: z.boolean(),
1864
+ indexed: z.number().int(),
1865
+ }),
1866
+ ),
1867
+ }),
1868
+ ),
1869
+ },
1870
+ },
1871
+ },
1872
+ ...authErrors,
1873
+ ...standardErrors(500),
1874
+ },
1875
+ },
1876
+ },
1877
+ } as const;
1878
+
1879
+ // ---------------------------------------------------------------------------
1880
+ // Redirect routes
1881
+ // ---------------------------------------------------------------------------
1882
+
1883
+ const redirectPaths = {
1884
+ "/_emdash/api/redirects": {
1885
+ get: {
1886
+ operationId: "listRedirects",
1887
+ summary: "List redirects",
1888
+ tags: ["Redirects"],
1889
+ requestParams: { query: redirectsListQuery },
1890
+ responses: {
1891
+ "200": {
1892
+ description: "Redirect list",
1893
+ content: {
1894
+ [JSON_CONTENT]: { schema: successEnvelope(redirectListResponseSchema) },
1895
+ },
1896
+ },
1897
+ ...authErrors,
1898
+ ...standardErrors(500),
1899
+ },
1900
+ },
1901
+ post: {
1902
+ operationId: "createRedirect",
1903
+ summary: "Create a redirect rule",
1904
+ tags: ["Redirects"],
1905
+ requestBody: { content: { [JSON_CONTENT]: { schema: createRedirectBody } } },
1906
+ responses: {
1907
+ "201": {
1908
+ description: "Created redirect",
1909
+ content: { [JSON_CONTENT]: { schema: successEnvelope(redirectSchema) } },
1910
+ },
1911
+ ...authErrors,
1912
+ ...standardErrors(400, 409, 500),
1913
+ },
1914
+ },
1915
+ },
1916
+ "/_emdash/api/redirects/{id}": {
1917
+ get: {
1918
+ operationId: "getRedirect",
1919
+ summary: "Get a redirect",
1920
+ tags: ["Redirects"],
1921
+ requestParams: {
1922
+ path: z.object({ id: z.string().meta({ description: "Redirect ID" }) }),
1923
+ },
1924
+ responses: {
1925
+ "200": {
1926
+ description: "Redirect",
1927
+ content: { [JSON_CONTENT]: { schema: successEnvelope(redirectSchema) } },
1928
+ },
1929
+ ...authErrors,
1930
+ ...standardErrors(404, 500),
1931
+ },
1932
+ },
1933
+ put: {
1934
+ operationId: "updateRedirect",
1935
+ summary: "Update a redirect",
1936
+ tags: ["Redirects"],
1937
+ requestParams: {
1938
+ path: z.object({ id: z.string().meta({ description: "Redirect ID" }) }),
1939
+ },
1940
+ requestBody: { content: { [JSON_CONTENT]: { schema: updateRedirectBody } } },
1941
+ responses: {
1942
+ "200": {
1943
+ description: "Updated redirect",
1944
+ content: { [JSON_CONTENT]: { schema: successEnvelope(redirectSchema) } },
1945
+ },
1946
+ ...authErrors,
1947
+ ...standardErrors(400, 404, 409, 500),
1948
+ },
1949
+ },
1950
+ delete: {
1951
+ operationId: "deleteRedirect",
1952
+ summary: "Delete a redirect",
1953
+ tags: ["Redirects"],
1954
+ requestParams: {
1955
+ path: z.object({ id: z.string().meta({ description: "Redirect ID" }) }),
1956
+ },
1957
+ responses: {
1958
+ "200": {
1959
+ description: "Deleted",
1960
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
1961
+ },
1962
+ ...authErrors,
1963
+ ...standardErrors(404, 500),
1964
+ },
1965
+ },
1966
+ },
1967
+ "/_emdash/api/redirects/404s": {
1968
+ get: {
1969
+ operationId: "listNotFoundEntries",
1970
+ summary: "List 404 log entries",
1971
+ tags: ["Redirects"],
1972
+ requestParams: { query: notFoundListQuery },
1973
+ responses: {
1974
+ "200": {
1975
+ description: "404 log entries",
1976
+ content: {
1977
+ [JSON_CONTENT]: { schema: successEnvelope(notFoundListResponseSchema) },
1978
+ },
1979
+ },
1980
+ ...authErrors,
1981
+ ...standardErrors(500),
1982
+ },
1983
+ },
1984
+ delete: {
1985
+ operationId: "clearNotFoundLog",
1986
+ summary: "Clear all 404 log entries",
1987
+ tags: ["Redirects"],
1988
+ responses: {
1989
+ "200": {
1990
+ description: "Cleared",
1991
+ content: {
1992
+ [JSON_CONTENT]: {
1993
+ schema: successEnvelope(z.object({ deleted: z.number().int() })),
1994
+ },
1995
+ },
1996
+ },
1997
+ ...authErrors,
1998
+ ...standardErrors(500),
1999
+ },
2000
+ },
2001
+ post: {
2002
+ operationId: "pruneNotFoundLog",
2003
+ summary: "Prune old 404 log entries",
2004
+ tags: ["Redirects"],
2005
+ requestBody: { content: { [JSON_CONTENT]: { schema: notFoundPruneBody } } },
2006
+ responses: {
2007
+ "200": {
2008
+ description: "Pruned",
2009
+ content: {
2010
+ [JSON_CONTENT]: {
2011
+ schema: successEnvelope(z.object({ deleted: z.number().int() })),
2012
+ },
2013
+ },
2014
+ },
2015
+ ...authErrors,
2016
+ ...standardErrors(400, 500),
2017
+ },
2018
+ },
2019
+ },
2020
+ "/_emdash/api/redirects/404s/summary": {
2021
+ get: {
2022
+ operationId: "getNotFoundSummary",
2023
+ summary: "Get 404 summary grouped by path",
2024
+ tags: ["Redirects"],
2025
+ responses: {
2026
+ "200": {
2027
+ description: "404 summary",
2028
+ content: {
2029
+ [JSON_CONTENT]: { schema: successEnvelope(notFoundSummaryResponseSchema) },
2030
+ },
2031
+ },
2032
+ ...authErrors,
2033
+ ...standardErrors(500),
2034
+ },
2035
+ },
2036
+ },
2037
+ } as const;
2038
+
2039
+ // ---------------------------------------------------------------------------
2040
+ // User management routes
2041
+ // ---------------------------------------------------------------------------
2042
+
2043
+ const userPaths = {
2044
+ "/_emdash/api/admin/users": {
2045
+ get: {
2046
+ operationId: "listUsers",
2047
+ summary: "List users",
2048
+ tags: ["Users"],
2049
+ requestParams: { query: usersListQuery },
2050
+ responses: {
2051
+ "200": {
2052
+ description: "User list",
2053
+ content: { [JSON_CONTENT]: { schema: successEnvelope(userListResponseSchema) } },
2054
+ },
2055
+ ...authErrors,
2056
+ ...standardErrors(500),
2057
+ },
2058
+ },
2059
+ },
2060
+ "/_emdash/api/admin/users/{id}": {
2061
+ get: {
2062
+ operationId: "getUser",
2063
+ summary: "Get user details",
2064
+ tags: ["Users"],
2065
+ requestParams: {
2066
+ path: z.object({ id: z.string().meta({ description: "User ID" }) }),
2067
+ },
2068
+ responses: {
2069
+ "200": {
2070
+ description: "User detail",
2071
+ content: {
2072
+ [JSON_CONTENT]: {
2073
+ schema: successEnvelope(z.object({ item: userDetailSchema })),
2074
+ },
2075
+ },
2076
+ },
2077
+ ...authErrors,
2078
+ ...standardErrors(404, 500),
2079
+ },
2080
+ },
2081
+ put: {
2082
+ operationId: "updateUser",
2083
+ summary: "Update a user",
2084
+ tags: ["Users"],
2085
+ requestParams: {
2086
+ path: z.object({ id: z.string().meta({ description: "User ID" }) }),
2087
+ },
2088
+ requestBody: { content: { [JSON_CONTENT]: { schema: userUpdateBody } } },
2089
+ responses: {
2090
+ "200": {
2091
+ description: "Updated user",
2092
+ content: {
2093
+ [JSON_CONTENT]: {
2094
+ schema: successEnvelope(z.object({ item: userSchema })),
2095
+ },
2096
+ },
2097
+ },
2098
+ ...authErrors,
2099
+ ...standardErrors(400, 404, 409, 500),
2100
+ },
2101
+ },
2102
+ },
2103
+ "/_emdash/api/admin/users/{id}/disable": {
2104
+ post: {
2105
+ operationId: "disableUser",
2106
+ summary: "Disable a user account",
2107
+ tags: ["Users"],
2108
+ requestParams: {
2109
+ path: z.object({ id: z.string().meta({ description: "User ID" }) }),
2110
+ },
2111
+ responses: {
2112
+ "200": {
2113
+ description: "User disabled",
2114
+ content: {
2115
+ [JSON_CONTENT]: {
2116
+ schema: successEnvelope(z.object({ item: userSchema })),
2117
+ },
2118
+ },
2119
+ },
2120
+ ...authErrors,
2121
+ ...standardErrors(400, 404, 500),
2122
+ },
2123
+ },
2124
+ },
2125
+ "/_emdash/api/admin/users/{id}/enable": {
2126
+ post: {
2127
+ operationId: "enableUser",
2128
+ summary: "Enable a user account",
2129
+ tags: ["Users"],
2130
+ requestParams: {
2131
+ path: z.object({ id: z.string().meta({ description: "User ID" }) }),
2132
+ },
2133
+ responses: {
2134
+ "200": {
2135
+ description: "User enabled",
2136
+ content: {
2137
+ [JSON_CONTENT]: {
2138
+ schema: successEnvelope(z.object({ item: userSchema })),
2139
+ },
2140
+ },
2141
+ },
2142
+ ...authErrors,
2143
+ ...standardErrors(404, 500),
2144
+ },
2145
+ },
2146
+ },
2147
+ "/_emdash/api/admin/allowed-domains": {
2148
+ get: {
2149
+ operationId: "listAllowedDomains",
2150
+ summary: "List allowed email domains",
2151
+ tags: ["Users"],
2152
+ responses: {
2153
+ "200": {
2154
+ description: "Allowed domains list",
2155
+ content: {
2156
+ [JSON_CONTENT]: {
2157
+ schema: successEnvelope(
2158
+ z.object({
2159
+ items: z.array(
2160
+ z.object({
2161
+ domain: z.string(),
2162
+ defaultRole: z.number().int(),
2163
+ enabled: z.boolean(),
2164
+ createdAt: z.string(),
2165
+ }),
2166
+ ),
2167
+ }),
2168
+ ),
2169
+ },
2170
+ },
2171
+ },
2172
+ ...authErrors,
2173
+ ...standardErrors(500),
2174
+ },
2175
+ },
2176
+ post: {
2177
+ operationId: "createAllowedDomain",
2178
+ summary: "Add an allowed email domain",
2179
+ tags: ["Users"],
2180
+ requestBody: { content: { [JSON_CONTENT]: { schema: allowedDomainCreateBody } } },
2181
+ responses: {
2182
+ "201": {
2183
+ description: "Created",
2184
+ content: {
2185
+ [JSON_CONTENT]: {
2186
+ schema: successEnvelope(
2187
+ z.object({
2188
+ domain: z.string(),
2189
+ defaultRole: z.number().int(),
2190
+ enabled: z.boolean(),
2191
+ }),
2192
+ ),
2193
+ },
2194
+ },
2195
+ },
2196
+ ...authErrors,
2197
+ ...standardErrors(400, 409, 500),
2198
+ },
2199
+ },
2200
+ },
2201
+ "/_emdash/api/admin/allowed-domains/{domain}": {
2202
+ put: {
2203
+ operationId: "updateAllowedDomain",
2204
+ summary: "Update an allowed domain",
2205
+ tags: ["Users"],
2206
+ requestParams: {
2207
+ path: z.object({ domain: z.string().meta({ description: "Domain name" }) }),
2208
+ },
2209
+ requestBody: { content: { [JSON_CONTENT]: { schema: allowedDomainUpdateBody } } },
2210
+ responses: {
2211
+ "200": {
2212
+ description: "Updated",
2213
+ content: {
2214
+ [JSON_CONTENT]: {
2215
+ schema: successEnvelope(
2216
+ z.object({
2217
+ domain: z.string(),
2218
+ defaultRole: z.number().int(),
2219
+ enabled: z.boolean(),
2220
+ }),
2221
+ ),
2222
+ },
2223
+ },
2224
+ },
2225
+ ...authErrors,
2226
+ ...standardErrors(404, 500),
2227
+ },
2228
+ },
2229
+ delete: {
2230
+ operationId: "deleteAllowedDomain",
2231
+ summary: "Remove an allowed domain",
2232
+ tags: ["Users"],
2233
+ requestParams: {
2234
+ path: z.object({ domain: z.string().meta({ description: "Domain name" }) }),
2235
+ },
2236
+ responses: {
2237
+ "200": {
2238
+ description: "Deleted",
2239
+ content: { [JSON_CONTENT]: { schema: successEnvelope(deleteResponseSchema) } },
2240
+ },
2241
+ ...authErrors,
2242
+ ...standardErrors(404, 500),
2243
+ },
2244
+ },
2245
+ },
2246
+ } as const;
2247
+
2248
+ // ---------------------------------------------------------------------------
2249
+ // Merge all paths
2250
+ // ---------------------------------------------------------------------------
2251
+
2252
+ const allPaths = {
2253
+ ...contentPaths,
2254
+ ...mediaPaths,
2255
+ ...schemaPaths,
2256
+ ...commentsPaths,
2257
+ ...taxonomyPaths,
2258
+ ...menuPaths,
2259
+ ...sectionPaths,
2260
+ ...widgetPaths,
2261
+ ...settingsPaths,
2262
+ ...searchPaths,
2263
+ ...redirectPaths,
2264
+ ...userPaths,
2265
+ } as const;
2266
+
2267
+ // ---------------------------------------------------------------------------
2268
+ // Document
2269
+ // ---------------------------------------------------------------------------
2270
+
2271
+ /**
2272
+ * Generate the OpenAPI 3.1 document for the EmDash CMS API.
2273
+ *
2274
+ * Covers: Content, Media, Schema, Comments, Taxonomies, Menus,
2275
+ * Sections, Widgets, Settings, Search, Redirects, Users.
2276
+ */
2277
+ export function generateOpenApiDocument(): oas31.OpenAPIObject {
2278
+ return createDocument({
2279
+ openapi: "3.1.0",
2280
+ info: {
2281
+ title: "EmDash CMS API",
2282
+ version: "0.1.0",
2283
+ description:
2284
+ "REST API for the EmDash CMS. All endpoints require authentication and return responses wrapped in a `{ data }` envelope.",
2285
+ },
2286
+ servers: [
2287
+ {
2288
+ url: "{baseUrl}",
2289
+ description: "CMS instance",
2290
+ // Note: `description` on server variables is valid per OAS 3.1 spec but
2291
+ // swagger-parser rejects it as an unevaluated property. Omitted as a workaround.
2292
+ variables: {
2293
+ baseUrl: {
2294
+ default: "http://localhost:4321",
2295
+ },
2296
+ },
2297
+ },
2298
+ ],
2299
+ tags: [
2300
+ {
2301
+ name: "Content",
2302
+ description: "CRUD operations for content items across collections",
2303
+ },
2304
+ {
2305
+ name: "Media",
2306
+ description: "Media library — upload, manage, and serve files",
2307
+ },
2308
+ {
2309
+ name: "Schema",
2310
+ description: "Collection and field management",
2311
+ },
2312
+ {
2313
+ name: "Comments",
2314
+ description: "Public comments and admin moderation",
2315
+ },
2316
+ {
2317
+ name: "Taxonomies",
2318
+ description: "Taxonomy definitions and terms",
2319
+ },
2320
+ {
2321
+ name: "Menus",
2322
+ description: "Navigation menu management",
2323
+ },
2324
+ {
2325
+ name: "Sections",
2326
+ description: "Reusable content sections",
2327
+ },
2328
+ {
2329
+ name: "Widgets",
2330
+ description: "Widget areas and widget management",
2331
+ },
2332
+ {
2333
+ name: "Settings",
2334
+ description: "Site-wide settings",
2335
+ },
2336
+ {
2337
+ name: "Search",
2338
+ description: "Full-text search and index management",
2339
+ },
2340
+ {
2341
+ name: "Redirects",
2342
+ description: "Redirect rules and 404 logging",
2343
+ },
2344
+ {
2345
+ name: "Users",
2346
+ description: "User management and access control",
2347
+ },
2348
+ ],
2349
+ components: {
2350
+ securitySchemes: {
2351
+ session: {
2352
+ type: "apiKey",
2353
+ in: "cookie",
2354
+ name: "emdash_session",
2355
+ description: "Session cookie set by the auth endpoints",
2356
+ },
2357
+ bearer: {
2358
+ type: "http",
2359
+ scheme: "bearer",
2360
+ description: "OAuth2 or API token",
2361
+ },
2362
+ },
2363
+ },
2364
+ security: [{ session: [] }, { bearer: [] }],
2365
+ // eslint-disable-next-line typescript-eslint(no-unsafe-type-assertion) -- readonly const paths are compatible at runtime
2366
+ paths: allPaths as unknown as ZodOpenApiPathsObject,
2367
+ });
2368
+ }