dineway 0.1.9 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (720) hide show
  1. package/README.md +63 -17
  2. package/dist/activity-events-B4wp7CrU.mjs +540 -0
  3. package/dist/allowed-origins-C1AKK9AT.mjs +68 -0
  4. package/dist/api/route-utils.d.mts +42 -0
  5. package/dist/api/route-utils.mjs +26 -0
  6. package/dist/api/schemas/index.d.mts +3 -0
  7. package/dist/api/schemas/index.mjs +6 -0
  8. package/dist/api/schemas/setup.d.mts +42 -0
  9. package/dist/api/schemas/setup.mjs +39 -0
  10. package/dist/api-BR7Y0GBo.mjs +2704 -0
  11. package/dist/api-tokens-CPjC3zf8.mjs +3 -0
  12. package/dist/api-tokens-D7UjLbdt.mjs +153 -0
  13. package/dist/{apply-iVSqz2qs.mjs → apply-Bm5QgdrE.mjs} +15 -689
  14. package/dist/astro/index.d.mts +11 -6
  15. package/dist/astro/index.mjs +86 -11
  16. package/dist/astro/middleware/auth.d.mts +11 -7
  17. package/dist/astro/middleware/auth.mjs +19 -104
  18. package/dist/astro/middleware/redirect.mjs +24 -14
  19. package/dist/astro/middleware/request-context.mjs +9 -6
  20. package/dist/astro/middleware/setup.mjs +1 -1
  21. package/dist/astro/middleware.mjs +88 -145
  22. package/dist/astro/routes/PluginRegistry.d.mts +14 -0
  23. package/dist/astro/routes/PluginRegistry.mjs +24 -0
  24. package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts +14 -0
  25. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +65 -0
  26. package/dist/astro/routes/api/admin/allowed-domains/index.d.mts +14 -0
  27. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +65 -0
  28. package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts +10 -0
  29. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +33 -0
  30. package/dist/astro/routes/api/admin/api-tokens/index.d.mts +16 -0
  31. package/dist/astro/routes/api/admin/api-tokens/index.mjs +59 -0
  32. package/dist/astro/routes/api/admin/briefing.d.mts +7 -0
  33. package/dist/astro/routes/api/admin/briefing.mjs +71 -0
  34. package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts +9 -0
  35. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +74 -0
  36. package/dist/astro/routes/api/admin/bylines/index.d.mts +8 -0
  37. package/dist/astro/routes/api/admin/bylines/index.mjs +61 -0
  38. package/dist/astro/routes/api/admin/comments/_id_/status.d.mts +7 -0
  39. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +80 -0
  40. package/dist/astro/routes/api/admin/comments/_id_.d.mts +14 -0
  41. package/dist/astro/routes/api/admin/comments/_id_.mjs +46 -0
  42. package/dist/astro/routes/api/admin/comments/bulk.d.mts +7 -0
  43. package/dist/astro/routes/api/admin/comments/bulk.mjs +36 -0
  44. package/dist/astro/routes/api/admin/comments/counts.d.mts +7 -0
  45. package/dist/astro/routes/api/admin/comments/counts.mjs +24 -0
  46. package/dist/astro/routes/api/admin/comments/index.d.mts +10 -0
  47. package/dist/astro/routes/api/admin/comments/index.mjs +40 -0
  48. package/dist/astro/routes/api/admin/context/_id_/history.d.mts +7 -0
  49. package/dist/astro/routes/api/admin/context/_id_/history.mjs +46 -0
  50. package/dist/astro/routes/api/admin/context/_id_/index.d.mts +7 -0
  51. package/dist/astro/routes/api/admin/context/_id_/index.mjs +46 -0
  52. package/dist/astro/routes/api/admin/context/_id_/review.d.mts +7 -0
  53. package/dist/astro/routes/api/admin/context/_id_/review.mjs +61 -0
  54. package/dist/astro/routes/api/admin/context/_id_/supersede.d.mts +7 -0
  55. package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +64 -0
  56. package/dist/astro/routes/api/admin/context/diff.d.mts +7 -0
  57. package/dist/astro/routes/api/admin/context/diff.mjs +50 -0
  58. package/dist/astro/routes/api/admin/context/index.d.mts +8 -0
  59. package/dist/astro/routes/api/admin/context/index.mjs +72 -0
  60. package/dist/astro/routes/api/admin/context/stale.d.mts +7 -0
  61. package/dist/astro/routes/api/admin/context/stale.mjs +50 -0
  62. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.d.mts +7 -0
  63. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +52 -0
  64. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.d.mts +7 -0
  65. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +68 -0
  66. package/dist/astro/routes/api/admin/hitl-requests/index.d.mts +7 -0
  67. package/dist/astro/routes/api/admin/hitl-requests/index.mjs +56 -0
  68. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts +7 -0
  69. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +99 -0
  70. package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts +7 -0
  71. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +33 -0
  72. package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts +18 -0
  73. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +79 -0
  74. package/dist/astro/routes/api/admin/oauth-clients/index.d.mts +14 -0
  75. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +58 -0
  76. package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts +7 -0
  77. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +90 -0
  78. package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts +7 -0
  79. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +90 -0
  80. package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts +7 -0
  81. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +55 -0
  82. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts +7 -0
  83. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +99 -0
  84. package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts +7 -0
  85. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +132 -0
  86. package/dist/astro/routes/api/admin/plugins/index.d.mts +7 -0
  87. package/dist/astro/routes/api/admin/plugins/index.mjs +53 -0
  88. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts +7 -0
  89. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +36 -0
  90. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts +7 -0
  91. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +55 -0
  92. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts +7 -0
  93. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +129 -0
  94. package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts +7 -0
  95. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +62 -0
  96. package/dist/astro/routes/api/admin/plugins/updates.d.mts +7 -0
  97. package/dist/astro/routes/api/admin/plugins/updates.mjs +53 -0
  98. package/dist/astro/routes/api/admin/review-requests/_id_/index.d.mts +7 -0
  99. package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +26 -0
  100. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.d.mts +7 -0
  101. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +98 -0
  102. package/dist/astro/routes/api/admin/review-requests/index.d.mts +7 -0
  103. package/dist/astro/routes/api/admin/review-requests/index.mjs +31 -0
  104. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts +7 -0
  105. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +55 -0
  106. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts +7 -0
  107. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +36 -0
  108. package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts +7 -0
  109. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +71 -0
  110. package/dist/astro/routes/api/admin/users/_id_/disable.d.mts +7 -0
  111. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +38 -0
  112. package/dist/astro/routes/api/admin/users/_id_/enable.d.mts +7 -0
  113. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +29 -0
  114. package/dist/astro/routes/api/admin/users/_id_/index.d.mts +8 -0
  115. package/dist/astro/routes/api/admin/users/_id_/index.mjs +104 -0
  116. package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts +7 -0
  117. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +43 -0
  118. package/dist/astro/routes/api/admin/users/index.d.mts +7 -0
  119. package/dist/astro/routes/api/admin/users/index.mjs +54 -0
  120. package/dist/astro/routes/api/auth/dev-bypass.d.mts +8 -0
  121. package/dist/astro/routes/api/auth/dev-bypass.mjs +81 -0
  122. package/dist/astro/routes/api/auth/invite/accept.d.mts +7 -0
  123. package/dist/astro/routes/api/auth/invite/accept.mjs +31 -0
  124. package/dist/astro/routes/api/auth/invite/complete.d.mts +7 -0
  125. package/dist/astro/routes/api/auth/invite/complete.mjs +54 -0
  126. package/dist/astro/routes/api/auth/invite/index.d.mts +7 -0
  127. package/dist/astro/routes/api/auth/invite/index.mjs +51 -0
  128. package/dist/astro/routes/api/auth/invite/register-options.d.mts +7 -0
  129. package/dist/astro/routes/api/auth/invite/register-options.mjs +44 -0
  130. package/dist/astro/routes/api/auth/logout.d.mts +7 -0
  131. package/dist/astro/routes/api/auth/logout.mjs +24 -0
  132. package/dist/astro/routes/api/auth/magic-link/send.d.mts +7 -0
  133. package/dist/astro/routes/api/auth/magic-link/send.mjs +48 -0
  134. package/dist/astro/routes/api/auth/magic-link/verify.d.mts +7 -0
  135. package/dist/astro/routes/api/auth/magic-link/verify.mjs +32 -0
  136. package/dist/astro/routes/api/auth/me.d.mts +13 -0
  137. package/dist/astro/routes/api/auth/me.mjs +41 -0
  138. package/dist/astro/routes/api/auth/mode.d.mts +7 -0
  139. package/dist/astro/routes/api/auth/mode.mjs +28 -0
  140. package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts +7 -0
  141. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +114 -0
  142. package/dist/astro/routes/api/auth/oauth/_provider_.d.mts +7 -0
  143. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +58 -0
  144. package/dist/astro/routes/api/auth/passkey/_id_.d.mts +14 -0
  145. package/dist/astro/routes/api/auth/passkey/_id_.mjs +62 -0
  146. package/dist/astro/routes/api/auth/passkey/index.d.mts +7 -0
  147. package/dist/astro/routes/api/auth/passkey/index.mjs +25 -0
  148. package/dist/astro/routes/api/auth/passkey/options.d.mts +7 -0
  149. package/dist/astro/routes/api/auth/passkey/options.mjs +46 -0
  150. package/dist/astro/routes/api/auth/passkey/register/options.d.mts +7 -0
  151. package/dist/astro/routes/api/auth/passkey/register/options.mjs +44 -0
  152. package/dist/astro/routes/api/auth/passkey/register/verify.d.mts +7 -0
  153. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +59 -0
  154. package/dist/astro/routes/api/auth/passkey/verify.d.mts +7 -0
  155. package/dist/astro/routes/api/auth/passkey/verify.mjs +47 -0
  156. package/dist/astro/routes/api/auth/signup/complete.d.mts +7 -0
  157. package/dist/astro/routes/api/auth/signup/complete.mjs +55 -0
  158. package/dist/astro/routes/api/auth/signup/request.d.mts +7 -0
  159. package/dist/astro/routes/api/auth/signup/request.mjs +44 -0
  160. package/dist/astro/routes/api/auth/signup/verify.d.mts +7 -0
  161. package/dist/astro/routes/api/auth/signup/verify.mjs +32 -0
  162. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +14 -0
  163. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +193 -0
  164. package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts +7 -0
  165. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +17 -0
  166. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts +7 -0
  167. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +36 -0
  168. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts +7 -0
  169. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +39 -0
  170. package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts +7 -0
  171. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +31 -0
  172. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts +7 -0
  173. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +78 -0
  174. package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts +7 -0
  175. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +93 -0
  176. package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts +7 -0
  177. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +36 -0
  178. package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts +7 -0
  179. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +19 -0
  180. package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts +8 -0
  181. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +75 -0
  182. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts +14 -0
  183. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +85 -0
  184. package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts +7 -0
  185. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +40 -0
  186. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts +7 -0
  187. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +36 -0
  188. package/dist/astro/routes/api/content/_collection_/_id_.d.mts +9 -0
  189. package/dist/astro/routes/api/content/_collection_/_id_.mjs +114 -0
  190. package/dist/astro/routes/api/content/_collection_/index.d.mts +8 -0
  191. package/dist/astro/routes/api/content/_collection_/index.mjs +74 -0
  192. package/dist/astro/routes/api/content/_collection_/trash.d.mts +7 -0
  193. package/dist/astro/routes/api/content/_collection_/trash.mjs +23 -0
  194. package/dist/astro/routes/api/dashboard.d.mts +7 -0
  195. package/dist/astro/routes/api/dashboard.mjs +26 -0
  196. package/dist/astro/routes/api/dev/emails.d.mts +8 -0
  197. package/dist/astro/routes/api/dev/emails.mjs +17 -0
  198. package/dist/astro/routes/api/health.d.mts +7 -0
  199. package/dist/astro/routes/api/health.mjs +34 -0
  200. package/dist/astro/routes/api/import/probe.d.mts +17 -0
  201. package/dist/astro/routes/api/import/probe.mjs +33 -0
  202. package/dist/astro/routes/api/import/wordpress/analyze.d.mts +87 -0
  203. package/dist/astro/routes/api/import/wordpress/analyze.mjs +305 -0
  204. package/dist/astro/routes/api/import/wordpress/execute.d.mts +37 -0
  205. package/dist/astro/routes/api/import/wordpress/execute.mjs +198 -0
  206. package/dist/astro/routes/api/import/wordpress/media.d.mts +35 -0
  207. package/dist/astro/routes/api/import/wordpress/media.mjs +222 -0
  208. package/dist/astro/routes/api/import/wordpress/prepare.d.mts +19 -0
  209. package/dist/astro/routes/api/import/wordpress/prepare.mjs +156 -0
  210. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +21 -0
  211. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +290 -0
  212. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +15 -0
  213. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +69 -0
  214. package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts +7 -0
  215. package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +28 -0
  216. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +19 -0
  217. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +269 -0
  218. package/dist/astro/routes/api/manifest.d.mts +7 -0
  219. package/dist/astro/routes/api/manifest.mjs +50 -0
  220. package/dist/astro/routes/api/mcp.d.mts +15 -0
  221. package/dist/astro/routes/api/mcp.mjs +2701 -0
  222. package/dist/astro/routes/api/media/_id_/confirm.d.mts +10 -0
  223. package/dist/astro/routes/api/media/_id_/confirm.mjs +59 -0
  224. package/dist/astro/routes/api/media/_id_.d.mts +22 -0
  225. package/dist/astro/routes/api/media/_id_.mjs +81 -0
  226. package/dist/astro/routes/api/media/file/_...key_.d.mts +7 -0
  227. package/dist/astro/routes/api/media/file/_...key_.mjs +49 -0
  228. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts +14 -0
  229. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +49 -0
  230. package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts +14 -0
  231. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +72 -0
  232. package/dist/astro/routes/api/media/providers/index.d.mts +10 -0
  233. package/dist/astro/routes/api/media/providers/index.mjs +18 -0
  234. package/dist/astro/routes/api/media/upload-url.d.mts +10 -0
  235. package/dist/astro/routes/api/media/upload-url.mjs +82 -0
  236. package/dist/astro/routes/api/media.d.mts +16 -0
  237. package/dist/astro/routes/api/media.mjs +137 -0
  238. package/dist/astro/routes/api/menus/_name_/items.d.mts +9 -0
  239. package/dist/astro/routes/api/menus/_name_/items.mjs +165 -0
  240. package/dist/astro/routes/api/menus/_name_/reorder.d.mts +7 -0
  241. package/dist/astro/routes/api/menus/_name_/reorder.mjs +78 -0
  242. package/dist/astro/routes/api/menus/_name_.d.mts +9 -0
  243. package/dist/astro/routes/api/menus/_name_.mjs +124 -0
  244. package/dist/astro/routes/api/menus/index.d.mts +8 -0
  245. package/dist/astro/routes/api/menus/index.mjs +85 -0
  246. package/dist/astro/routes/api/oauth/authorize.d.mts +8 -0
  247. package/dist/astro/routes/api/oauth/authorize.mjs +265 -0
  248. package/dist/astro/routes/api/oauth/device/authorize.d.mts +7 -0
  249. package/dist/astro/routes/api/oauth/device/authorize.mjs +30 -0
  250. package/dist/astro/routes/api/oauth/device/code.d.mts +7 -0
  251. package/dist/astro/routes/api/oauth/device/code.mjs +34 -0
  252. package/dist/astro/routes/api/oauth/device/token.d.mts +7 -0
  253. package/dist/astro/routes/api/oauth/device/token.mjs +45 -0
  254. package/dist/astro/routes/api/oauth/register.d.mts +8 -0
  255. package/dist/astro/routes/api/oauth/register.mjs +115 -0
  256. package/dist/astro/routes/api/oauth/token/refresh.d.mts +7 -0
  257. package/dist/astro/routes/api/oauth/token/refresh.mjs +28 -0
  258. package/dist/astro/routes/api/oauth/token/revoke.d.mts +7 -0
  259. package/dist/astro/routes/api/oauth/token/revoke.mjs +25 -0
  260. package/dist/astro/routes/api/oauth/token.d.mts +8 -0
  261. package/dist/astro/routes/api/oauth/token.mjs +138 -0
  262. package/dist/astro/routes/api/openapi.json.d.mts +7 -0
  263. package/dist/astro/routes/api/openapi.json.mjs +2638 -0
  264. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts +11 -0
  265. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +77 -0
  266. package/dist/astro/routes/api/redirects/404s/index.d.mts +9 -0
  267. package/dist/astro/routes/api/redirects/404s/index.mjs +62 -0
  268. package/dist/astro/routes/api/redirects/404s/summary.d.mts +7 -0
  269. package/dist/astro/routes/api/redirects/404s/summary.mjs +34 -0
  270. package/dist/astro/routes/api/redirects/_id_.d.mts +9 -0
  271. package/dist/astro/routes/api/redirects/_id_.mjs +153 -0
  272. package/dist/astro/routes/api/redirects/index.d.mts +8 -0
  273. package/dist/astro/routes/api/redirects/index.mjs +98 -0
  274. package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts +7 -0
  275. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +16 -0
  276. package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts +7 -0
  277. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +23 -0
  278. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts +9 -0
  279. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +99 -0
  280. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts +8 -0
  281. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +81 -0
  282. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts +7 -0
  283. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +68 -0
  284. package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts +9 -0
  285. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +98 -0
  286. package/dist/astro/routes/api/schema/collections/index.d.mts +8 -0
  287. package/dist/astro/routes/api/schema/collections/index.mjs +78 -0
  288. package/dist/astro/routes/api/schema/index.d.mts +7 -0
  289. package/dist/astro/routes/api/schema/index.mjs +79 -0
  290. package/dist/astro/routes/api/schema/orphans/_slug_.d.mts +7 -0
  291. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +59 -0
  292. package/dist/astro/routes/api/schema/orphans/index.d.mts +7 -0
  293. package/dist/astro/routes/api/schema/orphans/index.mjs +54 -0
  294. package/dist/astro/routes/api/search/enable.d.mts +15 -0
  295. package/dist/astro/routes/api/search/enable.mjs +55 -0
  296. package/dist/astro/routes/api/search/index.d.mts +16 -0
  297. package/dist/astro/routes/api/search/index.mjs +52 -0
  298. package/dist/astro/routes/api/search/rebuild.d.mts +13 -0
  299. package/dist/astro/routes/api/search/rebuild.mjs +48 -0
  300. package/dist/astro/routes/api/search/stats.d.mts +10 -0
  301. package/dist/astro/routes/api/search/stats.mjs +28 -0
  302. package/dist/astro/routes/api/search/suggest.d.mts +15 -0
  303. package/dist/astro/routes/api/search/suggest.mjs +43 -0
  304. package/dist/astro/routes/api/sections/_slug_.d.mts +9 -0
  305. package/dist/astro/routes/api/sections/_slug_.mjs +157 -0
  306. package/dist/astro/routes/api/sections/index.d.mts +8 -0
  307. package/dist/astro/routes/api/sections/index.mjs +100 -0
  308. package/dist/astro/routes/api/settings/email.d.mts +17 -0
  309. package/dist/astro/routes/api/settings/email.mjs +102 -0
  310. package/dist/astro/routes/api/settings.d.mts +20 -0
  311. package/dist/astro/routes/api/settings.mjs +102 -0
  312. package/dist/astro/routes/api/setup/admin-verify.d.mts +7 -0
  313. package/dist/astro/routes/api/setup/admin-verify.mjs +67 -0
  314. package/dist/astro/routes/api/setup/admin.d.mts +7 -0
  315. package/dist/astro/routes/api/setup/admin.mjs +68 -0
  316. package/dist/astro/routes/api/setup/dev-bypass.d.mts +8 -0
  317. package/dist/astro/routes/api/setup/dev-bypass.mjs +137 -0
  318. package/dist/astro/routes/api/setup/dev-reset.d.mts +7 -0
  319. package/dist/astro/routes/api/setup/dev-reset.mjs +22 -0
  320. package/dist/astro/routes/api/setup/index.d.mts +7 -0
  321. package/dist/astro/routes/api/setup/index.mjs +93 -0
  322. package/dist/astro/routes/api/setup/status.d.mts +7 -0
  323. package/dist/astro/routes/api/setup/status.mjs +57 -0
  324. package/dist/astro/routes/api/snapshot.d.mts +7 -0
  325. package/dist/astro/routes/api/snapshot.mjs +227 -0
  326. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts +18 -0
  327. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +190 -0
  328. package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts +14 -0
  329. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +114 -0
  330. package/dist/astro/routes/api/taxonomies/index.d.mts +14 -0
  331. package/dist/astro/routes/api/taxonomies/index.mjs +104 -0
  332. package/dist/astro/routes/api/themes/preview.d.mts +7 -0
  333. package/dist/astro/routes/api/themes/preview.mjs +47 -0
  334. package/dist/astro/routes/api/typegen.d.mts +17 -0
  335. package/dist/astro/routes/api/typegen.mjs +75 -0
  336. package/dist/astro/routes/api/well-known/auth.d.mts +7 -0
  337. package/dist/astro/routes/api/well-known/auth.mjs +42 -0
  338. package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts +7 -0
  339. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +33 -0
  340. package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts +7 -0
  341. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +21 -0
  342. package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts +7 -0
  343. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +89 -0
  344. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts +8 -0
  345. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +159 -0
  346. package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts +7 -0
  347. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +105 -0
  348. package/dist/astro/routes/api/widget-areas/_name_.d.mts +8 -0
  349. package/dist/astro/routes/api/widget-areas/_name_.mjs +100 -0
  350. package/dist/astro/routes/api/widget-areas/index.d.mts +8 -0
  351. package/dist/astro/routes/api/widget-areas/index.mjs +109 -0
  352. package/dist/astro/routes/api/widget-components.d.mts +7 -0
  353. package/dist/astro/routes/api/widget-components.mjs +15 -0
  354. package/dist/astro/routes/robots.txt.d.mts +7 -0
  355. package/dist/astro/routes/robots.txt.mjs +60 -0
  356. package/dist/astro/routes/sitemap-_collection_.xml.d.mts +7 -0
  357. package/dist/astro/routes/sitemap-_collection_.xml.mjs +70 -0
  358. package/dist/astro/routes/sitemap.xml.d.mts +7 -0
  359. package/dist/astro/routes/sitemap.xml.mjs +63 -0
  360. package/dist/astro/types.d.mts +42 -9
  361. package/dist/auth/providers/github-admin.d.mts +9 -0
  362. package/dist/auth/providers/github-admin.mjs +27 -0
  363. package/dist/auth/providers/github.d.mts +12 -0
  364. package/dist/auth/providers/github.mjs +17 -0
  365. package/dist/auth/providers/google-admin.d.mts +9 -0
  366. package/dist/auth/providers/google-admin.mjs +43 -0
  367. package/dist/auth/providers/google.d.mts +12 -0
  368. package/dist/auth/providers/google.mjs +17 -0
  369. package/dist/auth-control-guard-DOZ3UCsP.mjs +13 -0
  370. package/dist/authorize-BAdbMCwC.mjs +36 -0
  371. package/dist/briefing-MVYe_Uyf.mjs +1294 -0
  372. package/dist/briefing-rty4O-wa.mjs +29 -0
  373. package/dist/{byline-OhH2dlRu.mjs → byline-naZxOPSa.mjs} +3 -3
  374. package/dist/{bylines-BGpD9_hy.mjs → bylines-C4LIBOOO.mjs} +20 -53
  375. package/dist/bylines-eVVCuOe4.d.mts +2023 -0
  376. package/dist/{cache-BdSY-gQN.mjs → cache-DEbQ13c9.mjs} +21 -11
  377. package/dist/challenge-store-DDTbisbf.mjs +48 -0
  378. package/dist/cli/index.mjs +142 -22
  379. package/dist/client/external-auth-headers.d.mts +1 -1
  380. package/dist/client/index.d.mts +1 -1
  381. package/dist/client/index.mjs +3 -3
  382. package/dist/comment-DFO-gWDH.mjs +246 -0
  383. package/dist/comments--BsZ9pqA.mjs +186 -0
  384. package/dist/components-BPknylYg.mjs +107 -0
  385. package/dist/{content-DWi4d0rT.mjs → content-CyLkb-qH.mjs} +33 -44
  386. package/dist/context-CNIkMzot.mjs +849 -0
  387. package/dist/context-DNfcm853.mjs +184 -0
  388. package/dist/context-route-helpers-MurhoxWF.mjs +45 -0
  389. package/dist/context-types-C-LwdAxx.mjs +23 -0
  390. package/dist/cron-CKxvBrRT.mjs +263 -0
  391. package/dist/dashboard-DqnYU8EU.mjs +120 -0
  392. package/dist/db/index.d.mts +3 -3
  393. package/dist/db/libsql.d.mts +1 -1
  394. package/dist/db/libsql.mjs +3 -3
  395. package/dist/db/postgres.d.mts +1 -1
  396. package/dist/db/sqlite.d.mts +1 -1
  397. package/dist/db/sqlite.mjs +1 -2
  398. package/dist/device-flow-BGEH5jfn.mjs +487 -0
  399. package/dist/email-console-CuefUXfX.mjs +36 -0
  400. package/dist/entity-aliases-C0v-yNET.mjs +51 -0
  401. package/dist/error-BMUPwxgx.mjs +435 -0
  402. package/dist/escape-BRVaw1Ai.mjs +8 -0
  403. package/dist/experimental-workflows-C9X7yblQ.mjs +38 -0
  404. package/dist/fts-manager-B1pTNEG_.mjs +297 -0
  405. package/dist/hash-CDX7M0ze.mjs +32 -0
  406. package/dist/hitl-requests-ChT32Ilo.mjs +118 -0
  407. package/dist/hitl-route-helpers-CSit54Ru.mjs +96 -0
  408. package/dist/import-BHRLhXAn.mjs +1323 -0
  409. package/dist/import-CNcKWTbp.mjs +243 -0
  410. package/dist/index-CYfhYgXd.d.mts +227 -0
  411. package/dist/index-EUAWaIxW.d.mts +835 -0
  412. package/dist/index.d.mts +17 -11
  413. package/dist/index.mjs +63 -22
  414. package/dist/jsonld-D2gUY4kA.d.mts +141 -0
  415. package/dist/{loader-sMG4TZ-u.mjs → loader-PZnPxFLc.mjs} +42 -5
  416. package/dist/{manifest-schema-D1MSVnoI.mjs → manifest-schema-CgFJAp0H.mjs} +22 -10
  417. package/dist/media/index.d.mts +2 -1
  418. package/dist/media/index.mjs +2 -1
  419. package/dist/media/local-runtime.d.mts +12 -7
  420. package/dist/media/local-runtime.mjs +3 -3
  421. package/dist/{media-DMTr80Gv.mjs → media-_7Fxdu45.mjs} +1 -1
  422. package/dist/menus-DS3_5nWY.mjs +312 -0
  423. package/dist/menus-DYW_UHjv.mjs +256 -0
  424. package/dist/normalize-C49G_o1k.mjs +126 -0
  425. package/dist/oauth-authorization-DxGjiWKL.mjs +283 -0
  426. package/dist/oauth-clients-DxO_NO7k.mjs +298 -0
  427. package/dist/oauth-state-store-C5UFhzwD.mjs +48 -0
  428. package/dist/oauth-user-lookup-Bi0ek9eM.mjs +25 -0
  429. package/dist/options-z8VVg1Ll.mjs +114 -0
  430. package/dist/page/index.d.mts +2 -139
  431. package/dist/page/index.mjs +1 -427
  432. package/dist/parse-C9106ehs.mjs +88 -0
  433. package/dist/passkey-config-BRSZx4pW.mjs +42 -0
  434. package/dist/{patterns-CrCYkMBb.mjs → patterns-K0DLqWir.mjs} +53 -1
  435. package/dist/placeholder-Bh1dfUOd.d.mts +40 -0
  436. package/dist/{placeholder-Cp8g5Emj.mjs → placeholder-C2P5fKa4.mjs} +1 -126
  437. package/dist/plugins/adapt-sandbox-entry.d.mts +10 -5
  438. package/dist/plugins/adapt-sandbox-entry.mjs +4 -4
  439. package/dist/plugins-D7-ILNib.mjs +3249 -0
  440. package/dist/preview-DvYRU-Oy.mjs +788 -0
  441. package/dist/provider-loader-BiQ6lNmf.d.mts +20 -0
  442. package/dist/provider-loader-C21b9OpH.mjs +36 -0
  443. package/dist/public-url-Cun8N3NU.mjs +71 -0
  444. package/dist/{query-kDmwCsHh.mjs → query-B9BO5goQ.mjs} +93 -19
  445. package/dist/query-CsbOywSY.mjs +35 -0
  446. package/dist/rate-limit-DmVTHI5v.mjs +112 -0
  447. package/dist/{redirect-DnEWAkVg.mjs → redirect-CGl64yOX.mjs} +9 -5
  448. package/dist/redirect-COZy-3iY.mjs +16 -0
  449. package/dist/redirects-Cgi_cZfN.mjs +499 -0
  450. package/dist/redirects-lrlmYXVE.mjs +1023 -0
  451. package/dist/{registry-C0zjeB9P.mjs → registry-C-_hxLqa.mjs} +26 -294
  452. package/dist/request-meta-DixlNKKa.mjs +130 -0
  453. package/dist/review-requests-C2DIHwlJ.mjs +148 -0
  454. package/dist/review-requests-DIyjw-K_.mjs +79 -0
  455. package/dist/{runner-CFI6B6J2.d.mts → runner-BU6Lo1ZS.d.mts} +1 -1
  456. package/dist/{index-yvc6E_17.d.mts → runtime-Db4LbNVZ.d.mts} +1188 -2484
  457. package/dist/runtime.d.mts +11 -24
  458. package/dist/runtime.mjs +4 -38
  459. package/dist/schema-BECjUhP8.mjs +8 -0
  460. package/dist/search-DqTHQqtV.mjs +337 -0
  461. package/dist/secrets-CkoJ9zN0.mjs +160 -0
  462. package/dist/sections-B61OxnfB.mjs +338 -0
  463. package/dist/seed/index.d.mts +2 -2
  464. package/dist/seed/index.mjs +18 -13
  465. package/dist/seo/index.d.mts +1 -1
  466. package/dist/seo-C007Luwn.mjs +85 -0
  467. package/dist/seo-CUQctrog.mjs +129 -0
  468. package/dist/seo-contributions-B1fWCnqY.mjs +429 -0
  469. package/dist/service-CyOsm0R6.mjs +194 -0
  470. package/dist/settings-DGtLLSaz.mjs +237 -0
  471. package/dist/settings-Dzgswvg4.mjs +50 -0
  472. package/dist/setup-complete-ChilE-da.mjs +21 -0
  473. package/dist/setup-nonce-BpmLXAuu.mjs +17 -0
  474. package/dist/sidecar-client-B1C6Cf80.mjs +66 -0
  475. package/dist/site-activity-B8FjLIVh.mjs +104 -0
  476. package/dist/site-context-WBxoD99D.mjs +4122 -0
  477. package/dist/site-url-BP7k7OCe.mjs +12 -0
  478. package/dist/slugify-PDTDtMXp.mjs +30 -0
  479. package/dist/ssrf-DDwRxF6B.mjs +248 -0
  480. package/dist/storage/local.d.mts +1 -1
  481. package/dist/storage/local.mjs +1 -1
  482. package/dist/storage/s3.d.mts +1 -1
  483. package/dist/storage/s3.mjs +2 -2
  484. package/dist/{taxonomies-1s5PaS_8.mjs → taxonomies-D2aZGuns.mjs} +11 -7
  485. package/dist/taxonomies-z6Lz91BC.mjs +355 -0
  486. package/dist/taxonomy-D5cbhc8u.mjs +165 -0
  487. package/dist/{tokens-CJz9ubV6.mjs → tokens-BOJw-D9F.mjs} +1 -1
  488. package/dist/{transport-DB5eDN4x.mjs → transport-D3i4yWRE.mjs} +5 -4
  489. package/dist/trusted-proxy-BbaZfkT9.mjs +30 -0
  490. package/dist/types-0Vr68fc2.d.mts +344 -0
  491. package/dist/types-BFmjniC2.d.mts +165 -0
  492. package/dist/{types-BawVha09.mjs → types-Bs6lTBBW.mjs} +1 -1
  493. package/dist/{types-BuMDPy5C.d.mts → types-C0mmVRJN.d.mts} +6 -0
  494. package/dist/{placeholder--wOi4TbO.d.mts → types-OPs5Q_sX.d.mts} +1 -38
  495. package/dist/{types-Cj0KMIZV.d.mts → types-Q616b2Hn.d.mts} +54 -16
  496. package/dist/ui/client-runtime.d.mts +12 -0
  497. package/dist/ui/client-runtime.mjs +32 -0
  498. package/dist/ui/server-runtime.d.mts +33 -0
  499. package/dist/ui/server-runtime.mjs +80 -0
  500. package/dist/url-DNjT2abR.mjs +49 -0
  501. package/dist/user-CcXq-zoL.mjs +154 -0
  502. package/dist/utils-C0ONdBul.mjs +285 -0
  503. package/dist/{validate-IPf8n4Fj.d.mts → validate-BwmQEbu8.d.mts} +3 -3
  504. package/dist/{validate-BZ5wnLLp.mjs → validate-C7TzfamJ.mjs} +1 -1
  505. package/dist/version-D3vDb22n.mjs +6 -0
  506. package/dist/widgets-B7DRpZvy.mjs +104 -0
  507. package/dist/wordpress-slugs-CnporCYH.mjs +14 -0
  508. package/dist/zod-generator-DBVP8D0P.mjs +132 -0
  509. package/locals.d.ts +1 -6
  510. package/package.json +81 -11
  511. package/src/components/Button.astro +1 -1
  512. package/src/components/CommentForm.astro +1 -1
  513. package/src/components/Comments.astro +1 -3
  514. package/src/components/DinewayBodyEnd.astro +5 -3
  515. package/src/components/DinewayBodyStart.astro +5 -3
  516. package/src/components/DinewayHead.astro +15 -9
  517. package/src/components/DinewayImage.astro +12 -8
  518. package/src/components/DinewayMedia.astro +15 -6
  519. package/src/components/Embed.astro +1 -2
  520. package/src/components/File.astro +1 -1
  521. package/src/components/Gallery.astro +5 -3
  522. package/src/components/HtmlBlock.astro +1 -1
  523. package/src/components/Image.astro +9 -3
  524. package/src/components/InlinePortableTextEditor.tsx +69 -20
  525. package/src/components/PortableText.astro +1 -1
  526. package/src/components/WidgetArea.astro +1 -1
  527. package/src/components/WidgetRenderer.astro +1 -3
  528. package/src/components/marks/Link.astro +1 -1
  529. package/src/components/widgets/Archives.astro +1 -1
  530. package/src/components/widgets/Categories.astro +1 -1
  531. package/src/components/widgets/RecentPosts.astro +1 -1
  532. package/src/components/widgets/Tags.astro +1 -1
  533. package/dist/error-BmL6QipT.mjs +0 -30
  534. package/dist/search-DxopAWxs.mjs +0 -11200
  535. package/dist/version-BPz1imu2.mjs +0 -6
  536. package/src/astro/routes/PluginRegistry.tsx +0 -21
  537. package/src/astro/routes/api/admin/allowed-domains/[domain].ts +0 -112
  538. package/src/astro/routes/api/admin/allowed-domains/index.ts +0 -108
  539. package/src/astro/routes/api/admin/api-tokens/[id].ts +0 -44
  540. package/src/astro/routes/api/admin/api-tokens/index.ts +0 -90
  541. package/src/astro/routes/api/admin/briefing.ts +0 -76
  542. package/src/astro/routes/api/admin/bylines/[id]/index.ts +0 -90
  543. package/src/astro/routes/api/admin/bylines/index.ts +0 -74
  544. package/src/astro/routes/api/admin/comments/[id]/status.ts +0 -120
  545. package/src/astro/routes/api/admin/comments/[id].ts +0 -64
  546. package/src/astro/routes/api/admin/comments/bulk.ts +0 -42
  547. package/src/astro/routes/api/admin/comments/counts.ts +0 -30
  548. package/src/astro/routes/api/admin/comments/index.ts +0 -46
  549. package/src/astro/routes/api/admin/context/[id]/history.ts +0 -35
  550. package/src/astro/routes/api/admin/context/[id]/index.ts +0 -35
  551. package/src/astro/routes/api/admin/context/[id]/review.ts +0 -57
  552. package/src/astro/routes/api/admin/context/[id]/supersede.ts +0 -58
  553. package/src/astro/routes/api/admin/context/diff.ts +0 -35
  554. package/src/astro/routes/api/admin/context/index.ts +0 -69
  555. package/src/astro/routes/api/admin/context/stale.ts +0 -35
  556. package/src/astro/routes/api/admin/hitl-requests/[id]/index.ts +0 -38
  557. package/src/astro/routes/api/admin/hitl-requests/[id]/resolve.ts +0 -54
  558. package/src/astro/routes/api/admin/hitl-requests/index.ts +0 -38
  559. package/src/astro/routes/api/admin/hooks/exclusive/[hookName].ts +0 -132
  560. package/src/astro/routes/api/admin/hooks/exclusive/index.ts +0 -51
  561. package/src/astro/routes/api/admin/oauth-clients/[id].ts +0 -137
  562. package/src/astro/routes/api/admin/oauth-clients/index.ts +0 -95
  563. package/src/astro/routes/api/admin/plugins/[id]/disable.ts +0 -91
  564. package/src/astro/routes/api/admin/plugins/[id]/enable.ts +0 -91
  565. package/src/astro/routes/api/admin/plugins/[id]/index.ts +0 -38
  566. package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +0 -98
  567. package/src/astro/routes/api/admin/plugins/[id]/update.ts +0 -154
  568. package/src/astro/routes/api/admin/plugins/index.ts +0 -32
  569. package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +0 -62
  570. package/src/astro/routes/api/admin/plugins/marketplace/[id]/index.ts +0 -33
  571. package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +0 -135
  572. package/src/astro/routes/api/admin/plugins/marketplace/index.ts +0 -38
  573. package/src/astro/routes/api/admin/plugins/updates.ts +0 -28
  574. package/src/astro/routes/api/admin/review-requests/[id]/index.ts +0 -35
  575. package/src/astro/routes/api/admin/review-requests/[id]/resolve.ts +0 -52
  576. package/src/astro/routes/api/admin/review-requests/index.ts +0 -35
  577. package/src/astro/routes/api/admin/themes/marketplace/[id]/index.ts +0 -33
  578. package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +0 -62
  579. package/src/astro/routes/api/admin/themes/marketplace/index.ts +0 -45
  580. package/src/astro/routes/api/admin/users/[id]/disable.ts +0 -72
  581. package/src/astro/routes/api/admin/users/[id]/enable.ts +0 -48
  582. package/src/astro/routes/api/admin/users/[id]/index.ts +0 -166
  583. package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +0 -72
  584. package/src/astro/routes/api/admin/users/index.ts +0 -66
  585. package/src/astro/routes/api/auth/dev-bypass.ts +0 -139
  586. package/src/astro/routes/api/auth/invite/accept.ts +0 -52
  587. package/src/astro/routes/api/auth/invite/complete.ts +0 -86
  588. package/src/astro/routes/api/auth/invite/index.ts +0 -99
  589. package/src/astro/routes/api/auth/invite/register-options.ts +0 -73
  590. package/src/astro/routes/api/auth/logout.ts +0 -40
  591. package/src/astro/routes/api/auth/magic-link/send.ts +0 -90
  592. package/src/astro/routes/api/auth/magic-link/verify.ts +0 -71
  593. package/src/astro/routes/api/auth/me.ts +0 -60
  594. package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +0 -221
  595. package/src/astro/routes/api/auth/oauth/[provider].ts +0 -120
  596. package/src/astro/routes/api/auth/passkey/[id].ts +0 -124
  597. package/src/astro/routes/api/auth/passkey/index.ts +0 -54
  598. package/src/astro/routes/api/auth/passkey/options.ts +0 -85
  599. package/src/astro/routes/api/auth/passkey/register/options.ts +0 -88
  600. package/src/astro/routes/api/auth/passkey/register/verify.ts +0 -119
  601. package/src/astro/routes/api/auth/passkey/verify.ts +0 -72
  602. package/src/astro/routes/api/auth/signup/complete.ts +0 -87
  603. package/src/astro/routes/api/auth/signup/request.ts +0 -89
  604. package/src/astro/routes/api/auth/signup/verify.ts +0 -53
  605. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +0 -310
  606. package/src/astro/routes/api/content/[collection]/[id]/compare.ts +0 -28
  607. package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +0 -68
  608. package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +0 -77
  609. package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +0 -42
  610. package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +0 -107
  611. package/src/astro/routes/api/content/[collection]/[id]/publish.ts +0 -100
  612. package/src/astro/routes/api/content/[collection]/[id]/restore.ts +0 -64
  613. package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +0 -31
  614. package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +0 -129
  615. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +0 -143
  616. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +0 -50
  617. package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +0 -69
  618. package/src/astro/routes/api/content/[collection]/[id].ts +0 -173
  619. package/src/astro/routes/api/content/[collection]/index.ts +0 -103
  620. package/src/astro/routes/api/content/[collection]/trash.ts +0 -33
  621. package/src/astro/routes/api/dashboard.ts +0 -32
  622. package/src/astro/routes/api/dev/emails.ts +0 -36
  623. package/src/astro/routes/api/health.ts +0 -54
  624. package/src/astro/routes/api/import/probe.ts +0 -47
  625. package/src/astro/routes/api/import/wordpress/analyze.ts +0 -523
  626. package/src/astro/routes/api/import/wordpress/execute.ts +0 -330
  627. package/src/astro/routes/api/import/wordpress/media.ts +0 -338
  628. package/src/astro/routes/api/import/wordpress/prepare.ts +0 -212
  629. package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +0 -425
  630. package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +0 -111
  631. package/src/astro/routes/api/import/wordpress-plugin/callback.ts +0 -58
  632. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +0 -399
  633. package/src/astro/routes/api/manifest.ts +0 -75
  634. package/src/astro/routes/api/mcp.ts +0 -125
  635. package/src/astro/routes/api/media/[id]/confirm.ts +0 -93
  636. package/src/astro/routes/api/media/[id].ts +0 -145
  637. package/src/astro/routes/api/media/file/[...key].ts +0 -79
  638. package/src/astro/routes/api/media/providers/[providerId]/[itemId].ts +0 -91
  639. package/src/astro/routes/api/media/providers/[providerId]/index.ts +0 -111
  640. package/src/astro/routes/api/media/providers/index.ts +0 -30
  641. package/src/astro/routes/api/media/upload-url.ts +0 -146
  642. package/src/astro/routes/api/media.ts +0 -204
  643. package/src/astro/routes/api/menus/[name]/items.ts +0 -206
  644. package/src/astro/routes/api/menus/[name]/reorder.ts +0 -79
  645. package/src/astro/routes/api/menus/[name].ts +0 -145
  646. package/src/astro/routes/api/menus/index.ts +0 -91
  647. package/src/astro/routes/api/oauth/authorize.ts +0 -430
  648. package/src/astro/routes/api/oauth/device/authorize.ts +0 -45
  649. package/src/astro/routes/api/oauth/device/code.ts +0 -56
  650. package/src/astro/routes/api/oauth/device/token.ts +0 -70
  651. package/src/astro/routes/api/oauth/register.ts +0 -182
  652. package/src/astro/routes/api/oauth/token/refresh.ts +0 -38
  653. package/src/astro/routes/api/oauth/token/revoke.ts +0 -38
  654. package/src/astro/routes/api/oauth/token.ts +0 -195
  655. package/src/astro/routes/api/openapi.json.ts +0 -33
  656. package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +0 -109
  657. package/src/astro/routes/api/redirects/404s/index.ts +0 -72
  658. package/src/astro/routes/api/redirects/404s/summary.ts +0 -33
  659. package/src/astro/routes/api/redirects/[id].ts +0 -183
  660. package/src/astro/routes/api/redirects/index.ts +0 -100
  661. package/src/astro/routes/api/revisions/[revisionId]/index.ts +0 -29
  662. package/src/astro/routes/api/revisions/[revisionId]/restore.ts +0 -62
  663. package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +0 -104
  664. package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +0 -67
  665. package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +0 -45
  666. package/src/astro/routes/api/schema/collections/[slug]/index.ts +0 -107
  667. package/src/astro/routes/api/schema/collections/index.ts +0 -61
  668. package/src/astro/routes/api/schema/index.ts +0 -109
  669. package/src/astro/routes/api/schema/orphans/[slug].ts +0 -36
  670. package/src/astro/routes/api/schema/orphans/index.ts +0 -26
  671. package/src/astro/routes/api/search/enable.ts +0 -64
  672. package/src/astro/routes/api/search/index.ts +0 -52
  673. package/src/astro/routes/api/search/rebuild.ts +0 -72
  674. package/src/astro/routes/api/search/stats.ts +0 -35
  675. package/src/astro/routes/api/search/suggest.ts +0 -50
  676. package/src/astro/routes/api/sections/[slug].ts +0 -203
  677. package/src/astro/routes/api/sections/index.ts +0 -107
  678. package/src/astro/routes/api/settings/email.ts +0 -150
  679. package/src/astro/routes/api/settings.ts +0 -116
  680. package/src/astro/routes/api/setup/admin-verify.ts +0 -122
  681. package/src/astro/routes/api/setup/admin.ts +0 -104
  682. package/src/astro/routes/api/setup/dev-bypass.ts +0 -200
  683. package/src/astro/routes/api/setup/dev-reset.ts +0 -40
  684. package/src/astro/routes/api/setup/index.ts +0 -128
  685. package/src/astro/routes/api/setup/status.ts +0 -122
  686. package/src/astro/routes/api/snapshot.ts +0 -76
  687. package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +0 -232
  688. package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +0 -131
  689. package/src/astro/routes/api/taxonomies/index.ts +0 -114
  690. package/src/astro/routes/api/themes/preview.ts +0 -78
  691. package/src/astro/routes/api/typegen.ts +0 -114
  692. package/src/astro/routes/api/well-known/auth.ts +0 -71
  693. package/src/astro/routes/api/well-known/oauth-authorization-server.ts +0 -48
  694. package/src/astro/routes/api/well-known/oauth-protected-resource.ts +0 -39
  695. package/src/astro/routes/api/widget-areas/[name]/reorder.ts +0 -114
  696. package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +0 -213
  697. package/src/astro/routes/api/widget-areas/[name]/widgets.ts +0 -126
  698. package/src/astro/routes/api/widget-areas/[name].ts +0 -135
  699. package/src/astro/routes/api/widget-areas/index.ts +0 -149
  700. package/src/astro/routes/api/widget-components.ts +0 -22
  701. package/src/astro/routes/robots.txt.ts +0 -81
  702. package/src/astro/routes/sitemap-[collection].xml.ts +0 -104
  703. package/src/astro/routes/sitemap.xml.ts +0 -92
  704. /package/dist/{adapters-C2ypTrZZ.d.mts → adapters-DuLQZhRY.d.mts} +0 -0
  705. /package/{src → dist}/astro/routes/admin.astro +0 -0
  706. /package/dist/{base64-F8-DUraK.mjs → base64-Cz-aU0X1.mjs} +0 -0
  707. /package/dist/{chunks--4F8ddV4.mjs → chunks-D_jVet6z.mjs} +0 -0
  708. /package/dist/{config-BXwuX8Bx.mjs → config-CAMFxGaV.mjs} +0 -0
  709. /package/dist/{db-errors-CEqD7qH9.mjs → db-errors-DyZkswzF.mjs} +0 -0
  710. /package/dist/{default-VjJyuuG9.mjs → default-D4ngTpW8.mjs} +0 -0
  711. /package/dist/{load-Coc9HpHH.mjs → load-B2XtDw__.mjs} +0 -0
  712. /package/dist/{mode-47goXBBK.mjs → mode-DUhxwUhv.mjs} +0 -0
  713. /package/dist/{request-cache-Dk5qPSOx.mjs → request-cache-DHMRr2Lf.mjs} +0 -0
  714. /package/dist/{transaction-Cn2rjY78.mjs → transaction-x2tJQ-A1.mjs} +0 -0
  715. /package/dist/{transport-Wge_IzKl.d.mts → transport-BXe1AM79.d.mts} +0 -0
  716. /package/dist/{types-CWbdtiux.d.mts → types-B7kpsMJ3.d.mts} +0 -0
  717. /package/dist/{types-BzcUjoqg.d.mts → types-DJlpx5Ay.d.mts} +0 -0
  718. /package/dist/{types-COeOq9nK.mjs → types-DL7Y8D_t.mjs} +0 -0
  719. /package/dist/{types-DOrVigru.d.mts → types-DZPw8Rru.d.mts} +0 -0
  720. /package/dist/{types-griIBQOQ.mjs → types-fAInWQDO.mjs} +0 -0
@@ -1,18 +1,210 @@
1
- import { _ as MediaValue, m as MediaProviderDescriptor } from "./placeholder--wOi4TbO.mjs";
2
- import { t as Database } from "./types-DOrVigru.mjs";
3
- import { a as ContentSeoInput, c as FindManyOptions, l as FindManyResult, o as CreateContentInput, r as ContentItem, t as BylineSummary, u as UpdateContentInput } from "./types-BzcUjoqg.mjs";
4
- import { A as PageMetadataContribution, B as PluginDefinition, D as PageFragmentContribution, H as PluginManifest, J as RequestMeta, O as PageFragmentEvent, W as PluginStorageConfig, X as ResolvedPlugin, a as CommentAfterModerateEvent, g as EmailMessage, h as CronEvent, j as PageMetadataEvent, r as CommentAfterCreateEvent, s as CommentBeforeCreateEvent, tt as StandardPluginDefinition, w as MediaItem$1 } from "./types-Cj0KMIZV.mjs";
5
- import { a as Collection, b as UpdateFieldInput, c as CollectionWithFields, d as CreateFieldInput, i as SiteSettings, p as Field, r as SiteSettingKey, u as CreateCollectionInput, y as UpdateCollectionInput } from "./types-BuMDPy5C.mjs";
6
- import { d as Storage } from "./types-CWbdtiux.mjs";
7
- import { t as DatabaseDescriptor } from "./adapters-C2ypTrZZ.mjs";
1
+ import { a as ContentSeoInput, c as FindManyOptions, l as FindManyResult, o as CreateContentInput, r as ContentItem, t as BylineSummary, u as UpdateContentInput } from "./types-DJlpx5Ay.mjs";
2
+ import { t as Database } from "./types-DZPw8Rru.mjs";
3
+ import { A as PageMetadataContribution, B as PluginDefinition, D as PageFragmentContribution, H as PluginManifest, J as RequestMeta, O as PageFragmentEvent, W as PluginStorageConfig, X as ResolvedPlugin, a as CommentAfterModerateEvent, g as EmailMessage, h as CronEvent, j as PageMetadataEvent, r as CommentAfterCreateEvent, s as CommentBeforeCreateEvent, tt as StandardPluginDefinition, w as MediaItem$1 } from "./types-Q616b2Hn.mjs";
4
+ import { a as Collection, b as UpdateFieldInput, c as CollectionWithFields, d as CreateFieldInput, p as Field, u as CreateCollectionInput, y as UpdateCollectionInput } from "./types-C0mmVRJN.mjs";
5
+ import { r as AuthProviderDescriptor, t as AuthDescriptor } from "./types-BFmjniC2.mjs";
6
+ import { t as DatabaseDescriptor } from "./adapters-DuLQZhRY.mjs";
7
+ import { d as MediaProviderDescriptor } from "./types-OPs5Q_sX.mjs";
8
+ import { xt as PortableTextBlock$1 } from "./index-EUAWaIxW.mjs";
9
+ import { S as ContentBylineInput } from "./index-CYfhYgXd.mjs";
10
+ import { d as Storage } from "./types-B7kpsMJ3.mjs";
8
11
  import { Kysely } from "kysely";
9
- import { z } from "astro/zod";
10
- import { z as z$1 } from "zod";
11
- import { PortableTextBlock } from "@dineway-ai/gutenberg-to-portable-text";
12
- import { Readable } from "node:stream";
12
+ import { z } from "zod";
13
13
  import { MiddlewareHandler } from "astro";
14
14
  import { LiveLoader } from "astro/loaders";
15
15
 
16
+ //#region src/api/types.d.ts
17
+ /**
18
+ * List response with cursor pagination
19
+ */
20
+ interface ListResponse<T> {
21
+ items: T[];
22
+ nextCursor?: string;
23
+ }
24
+ /**
25
+ * Content API responses
26
+ */
27
+ interface ContentListResponse extends ListResponse<ContentItem> {}
28
+ interface ContentResponse {
29
+ item: ContentItem;
30
+ /** Opaque revision token for optimistic concurrency */
31
+ _rev?: string;
32
+ }
33
+ /**
34
+ * Manifest API response
35
+ */
36
+ interface ManifestResponse {
37
+ version: string;
38
+ commit?: string;
39
+ hash: string;
40
+ features?: {
41
+ siteContextWorkflows: boolean;
42
+ };
43
+ collections: Record<string, {
44
+ label: string;
45
+ labelSingular: string;
46
+ supports: string[];
47
+ fields: Record<string, FieldDescriptor>;
48
+ }>;
49
+ plugins: Record<string, {
50
+ adminPages?: Array<{
51
+ path: string;
52
+ component: string;
53
+ }>;
54
+ widgets?: string[];
55
+ }>;
56
+ }
57
+ interface FieldDescriptor {
58
+ kind: string;
59
+ label?: string;
60
+ required?: boolean;
61
+ options?: Array<{
62
+ value: string;
63
+ label: string;
64
+ }> | Record<string, unknown>;
65
+ }
66
+ /**
67
+ * Discriminated union for handler results.
68
+ *
69
+ * Handlers return `ApiResult<T>` -- either `{ success: true, data: T }` or
70
+ * `{ success: false, error: { code, message } }`. The `success` literal
71
+ * enables TypeScript narrowing on `.data`.
72
+ *
73
+ * The generic `E` parameter defaults to `ErrorCode` but can be narrowed to
74
+ * `OAuthErrorCode` for OAuth token-endpoint handlers.
75
+ *
76
+ * Use `unwrapResult()` from `error.ts` to convert to an HTTP Response.
77
+ */
78
+ type ApiResult<T, E extends string = string> = {
79
+ success: true;
80
+ data: T;
81
+ } | {
82
+ success: false;
83
+ error: {
84
+ code: E;
85
+ message: string;
86
+ details?: Record<string, unknown>;
87
+ };
88
+ };
89
+ /**
90
+ * API request context
91
+ */
92
+ interface ApiContext {
93
+ userId?: string;
94
+ userRole?: string;
95
+ }
96
+ //#endregion
97
+ //#region src/api/error.d.ts
98
+ /**
99
+ * Create a standardized error response.
100
+ *
101
+ * Always returns `{ error: { code, message, details? } }` with correct Content-Type.
102
+ * Use this for all error responses in API routes.
103
+ */
104
+ declare function apiError(code: string, message: string, status: number, details?: Record<string, unknown>): Response;
105
+ /**
106
+ * Create a standardized success response.
107
+ *
108
+ * Always returns `{ data: T }` with correct status code.
109
+ * Use this for all success responses in API routes.
110
+ */
111
+ declare function apiSuccess<T>(data: T, status?: number): Response;
112
+ /**
113
+ * Handle an unknown error in a catch block.
114
+ *
115
+ * - Logs the full error server-side
116
+ * - Returns a generic message to the client (never leaks error.message)
117
+ * - Use `fallbackMessage` for the public-facing message
118
+ * - Use `fallbackCode` for the error code
119
+ */
120
+ declare function handleError(error: unknown, fallbackMessage: string, fallbackCode: string): Response;
121
+ //#endregion
122
+ //#region src/api/parse.d.ts
123
+ /**
124
+ * Result of parsing: either the validated data or an error Response.
125
+ * Routes should check `if (result instanceof Response) return result;`
126
+ */
127
+ type ParseResult<T> = T | Response;
128
+ /**
129
+ * Parse and validate a JSON request body against a Zod schema.
130
+ *
131
+ * Returns the validated data on success, or a 400 Response on failure.
132
+ * Replaces all `(await request.json()) as T` casts.
133
+ */
134
+ declare function parseBody<T extends z.ZodType>(request: Request, schema: T): Promise<ParseResult<z.infer<T>>>;
135
+ /**
136
+ * Parse and validate URL search params against a Zod schema.
137
+ *
138
+ * Converts searchParams to a plain object before validation.
139
+ * Zod coercion handles string -> number/boolean conversion.
140
+ * Replaces manual `url.searchParams.get()` + `parseInt()` patterns.
141
+ */
142
+ declare function parseQuery<T extends z.ZodType>(url: URL, schema: T): ParseResult<z.infer<T>>;
143
+ /**
144
+ * Type guard to check if a ParseResult is an error Response.
145
+ * Usage: `if (isParseError(result)) return result;`
146
+ */
147
+ declare function isParseError<T>(result: ParseResult<T>): result is Response;
148
+ //#endregion
149
+ //#region src/database/repositories/options.d.ts
150
+ /**
151
+ * Options repository for key-value settings storage
152
+ *
153
+ * Used for site settings, plugin configuration, and other arbitrary key-value data.
154
+ * Values are stored as JSON for flexibility.
155
+ */
156
+ declare class OptionsRepository {
157
+ private db;
158
+ constructor(db: Kysely<Database>);
159
+ /**
160
+ * Get an option value
161
+ */
162
+ get<T = unknown>(name: string): Promise<T | null>;
163
+ /**
164
+ * Get an option value with a default
165
+ */
166
+ getOrDefault<T>(name: string, defaultValue: T): Promise<T>;
167
+ /**
168
+ * Set an option value (creates or updates)
169
+ */
170
+ set<T = unknown>(name: string, value: T): Promise<void>;
171
+ /**
172
+ * Set an option value only if no row with that name exists.
173
+ *
174
+ * Returns true when the row was inserted, false when a row already existed,
175
+ * regardless of its value.
176
+ */
177
+ setIfAbsent<T = unknown>(name: string, value: T): Promise<boolean>;
178
+ /**
179
+ * Delete an option
180
+ */
181
+ delete(name: string): Promise<boolean>;
182
+ /**
183
+ * Check if an option exists
184
+ */
185
+ exists(name: string): Promise<boolean>;
186
+ /**
187
+ * Get multiple options at once
188
+ */
189
+ getMany<T = unknown>(names: string[]): Promise<Map<string, T>>;
190
+ /**
191
+ * Set multiple options at once
192
+ */
193
+ setMany<T = unknown>(options: Record<string, T>): Promise<void>;
194
+ /**
195
+ * Get all options (use sparingly)
196
+ */
197
+ getAll(): Promise<Map<string, unknown>>;
198
+ /**
199
+ * Get all options matching a prefix
200
+ */
201
+ getByPrefix<T = unknown>(prefix: string): Promise<Map<string, T>>;
202
+ /**
203
+ * Delete all options matching a prefix
204
+ */
205
+ deleteByPrefix(prefix: string): Promise<number>;
206
+ }
207
+ //#endregion
16
208
  //#region src/database/connection.d.ts
17
209
  interface DatabaseConfig {
18
210
  url: string;
@@ -158,8 +350,11 @@ declare class ContentRepository {
158
350
  * Syncs the draft revision's data into the content table columns so the
159
351
  * content table always reflects the published version.
160
352
  * If no draft revision exists, creates one from current data and publishes it.
353
+ *
354
+ * `publishedAt` overrides the publication timestamp. If omitted, an existing
355
+ * `published_at` is preserved and first publish falls back to the current time.
161
356
  */
162
- publish(type: string, id: string): Promise<ContentItem>;
357
+ publish(type: string, id: string, publishedAt?: string): Promise<ContentItem>;
163
358
  /**
164
359
  * Stage an existing revision as the draft for a content item.
165
360
  *
@@ -336,300 +531,118 @@ interface Revision {
336
531
  createdAt: string;
337
532
  }
338
533
  //#endregion
339
- //#region src/database/repositories/comment.d.ts
340
- /** Public-facing comment shape — no private fields */
341
- interface PublicComment {
534
+ //#region src/api/handlers/content.d.ts
535
+ /**
536
+ * Trashed content item with deletion timestamp
537
+ */
538
+ interface TrashedContentItem {
342
539
  id: string;
343
- parentId: string | null;
344
- authorName: string;
345
- isRegisteredUser: boolean;
346
- body: string;
540
+ type: string;
541
+ slug: string | null;
542
+ status: string;
543
+ data: Record<string, unknown>;
544
+ authorId: string | null;
347
545
  createdAt: string;
348
- replies?: PublicComment[];
349
- }
350
- //#endregion
351
- //#region src/database/repositories/byline.d.ts
352
- interface ContentBylineInput {
353
- bylineId: string;
354
- roleLabel?: string | null;
546
+ updatedAt: string;
547
+ publishedAt: string | null;
548
+ deletedAt: string;
355
549
  }
356
- //#endregion
357
- //#region src/fields/types.d.ts
358
550
  /**
359
- * SQLite column types that map from field types
551
+ * Create content list handler
360
552
  */
361
- type ColumnType = "TEXT" | "REAL" | "INTEGER" | "JSON";
553
+ declare function handleContentList(db: Kysely<Database>, collection: string, params: {
554
+ cursor?: string;
555
+ limit?: number;
556
+ status?: string;
557
+ orderBy?: string;
558
+ order?: "asc" | "desc";
559
+ locale?: string;
560
+ }): Promise<ApiResult<ContentListResponse>>;
362
561
  /**
363
- * Base field definition
364
- *
365
- * Note: schema uses z.ZodTypeAny to accommodate optional/default wrappers
562
+ * Get single content item
366
563
  */
367
- interface FieldDefinition<_T = unknown> {
368
- type: string;
369
- /**
370
- * The SQLite column type to use when storing this field
371
- */
372
- columnType: ColumnType;
373
- schema: z.ZodTypeAny;
374
- options?: unknown;
375
- ui?: FieldUIHints;
376
- }
564
+ declare function handleContentGet(db: Kysely<Database>, collection: string, id: string, locale?: string): Promise<ApiResult<ContentResponse>>;
377
565
  /**
378
- * UI hints for admin rendering
566
+ * Get a content item by id, including trashed items.
567
+ * Used by restore endpoint for ownership checks on soft-deleted items.
379
568
  */
380
- interface FieldUIHints {
381
- widget?: string;
382
- placeholder?: string;
383
- helpText?: string;
384
- rows?: number;
385
- min?: number | string;
386
- max?: number | string;
387
- [key: string]: unknown;
388
- }
569
+ declare function handleContentGetIncludingTrashed(db: Kysely<Database>, collection: string, id: string, locale?: string): Promise<ApiResult<ContentResponse>>;
389
570
  /**
390
- * Portable Text block structure
571
+ * Create content item.
572
+ *
573
+ * Content + SEO writes are wrapped in a transaction so either both succeed
574
+ * or neither does. If `body.seo` is provided for a non-SEO collection, the
575
+ * API returns a validation error rather than silently dropping it.
391
576
  */
392
- interface PortableTextBlock$2 {
393
- _type: string;
394
- _key: string;
395
- [key: string]: unknown;
396
- }
577
+ declare function handleContentCreate(db: Kysely<Database>, collection: string, body: {
578
+ data: Record<string, unknown>;
579
+ slug?: string;
580
+ status?: string;
581
+ authorId?: string;
582
+ bylines?: ContentBylineInput[];
583
+ locale?: string;
584
+ translationOf?: string;
585
+ seo?: ContentSeoInput;
586
+ createdAt?: string | null;
587
+ publishedAt?: string | null;
588
+ }): Promise<ApiResult<ContentResponse>>;
397
589
  /**
398
- * @deprecated Use MediaValue instead. ImageValue is an alias for backwards compatibility.
590
+ * Update content item.
591
+ * If `_rev` is provided, validates it against the current version before writing.
592
+ * No `_rev` = blind write (backwards-compatible for admin UI).
593
+ *
594
+ * Content + SEO writes are wrapped in a transaction for atomicity.
399
595
  */
400
- type ImageValue = MediaValue;
596
+ declare function handleContentUpdate(db: Kysely<Database>, collection: string, id: string, body: {
597
+ data?: Record<string, unknown>;
598
+ slug?: string;
599
+ status?: string;
600
+ authorId?: string | null;
601
+ bylines?: ContentBylineInput[];
602
+ _rev?: string;
603
+ seo?: ContentSeoInput;
604
+ publishedAt?: string | null;
605
+ }): Promise<ApiResult<ContentResponse>>;
401
606
  /**
402
- * File field value
607
+ * Duplicate content item.
608
+ *
609
+ * Only copies SEO data if the collection has SEO enabled.
610
+ * Always returns consistent `seo` shape for SEO-enabled collections.
403
611
  */
404
- interface FileValue {
405
- id: string;
406
- url: string;
407
- filename: string;
408
- mimeType: string;
409
- size: number;
410
- }
411
- //#endregion
412
- //#region src/fields/image.d.ts
612
+ declare function handleContentDuplicate(db: Kysely<Database>, collection: string, id: string, authorId?: string): Promise<ApiResult<{
613
+ item: ContentItem;
614
+ }>>;
413
615
  /**
414
- * Image field
415
- * References media items from the media library
616
+ * Delete content item (soft delete - moves to trash)
416
617
  */
417
- declare function image(options?: {
418
- required?: boolean;
419
- maxSize?: number;
420
- allowedTypes?: string[];
421
- }): FieldDefinition<ImageValue | undefined>;
422
- //#endregion
423
- //#region src/fields/reference.d.ts
618
+ declare function handleContentDelete(db: Kysely<Database>, collection: string, id: string): Promise<ApiResult<{
619
+ deleted: true;
620
+ }>>;
424
621
  /**
425
- * Reference field
426
- * References another content item by ID
622
+ * Restore content item from trash
427
623
  */
428
- declare function reference(collection: string, options?: {
429
- required?: boolean;
430
- }): FieldDefinition<string | undefined>;
431
- //#endregion
432
- //#region src/fields/portable-text.d.ts
624
+ declare function handleContentRestore(db: Kysely<Database>, collection: string, id: string): Promise<ApiResult<{
625
+ restored: true;
626
+ }>>;
433
627
  /**
434
- * Portable Text field
435
- * Stores structured content in Portable Text format
628
+ * Permanently delete content item (cannot be undone).
629
+ * Also cleans up associated SEO data.
436
630
  */
437
- declare function portableText(options?: {
438
- required?: boolean;
439
- }): FieldDefinition<PortableTextBlock$2[] | undefined>;
440
- //#endregion
441
- //#region src/api/types.d.ts
631
+ declare function handleContentPermanentDelete(db: Kysely<Database>, collection: string, id: string): Promise<ApiResult<{
632
+ deleted: true;
633
+ }>>;
442
634
  /**
443
- * List response with cursor pagination
635
+ * List trashed content items
444
636
  */
445
- interface ListResponse<T> {
446
- items: T[];
637
+ declare function handleContentListTrashed(db: Kysely<Database>, collection: string, options?: {
638
+ limit?: number;
639
+ cursor?: string;
640
+ }): Promise<ApiResult<{
641
+ items: TrashedContentItem[];
447
642
  nextCursor?: string;
448
- }
643
+ }>>;
449
644
  /**
450
- * Content API responses
451
- */
452
- interface ContentListResponse extends ListResponse<ContentItem> {}
453
- interface ContentResponse {
454
- item: ContentItem;
455
- /** Opaque revision token for optimistic concurrency */
456
- _rev?: string;
457
- }
458
- /**
459
- * Manifest API response
460
- */
461
- interface ManifestResponse {
462
- version: string;
463
- commit?: string;
464
- hash: string;
465
- features?: {
466
- siteContextWorkflows: boolean;
467
- };
468
- collections: Record<string, {
469
- label: string;
470
- labelSingular: string;
471
- supports: string[];
472
- fields: Record<string, FieldDescriptor>;
473
- }>;
474
- plugins: Record<string, {
475
- adminPages?: Array<{
476
- path: string;
477
- component: string;
478
- }>;
479
- widgets?: string[];
480
- }>;
481
- }
482
- interface FieldDescriptor {
483
- kind: string;
484
- label?: string;
485
- required?: boolean;
486
- options?: Array<{
487
- value: string;
488
- label: string;
489
- }>;
490
- }
491
- /**
492
- * Discriminated union for handler results.
493
- *
494
- * Handlers return `ApiResult<T>` -- either `{ success: true, data: T }` or
495
- * `{ success: false, error: { code, message } }`. The `success` literal
496
- * enables TypeScript narrowing on `.data`.
497
- *
498
- * The generic `E` parameter defaults to `ErrorCode` but can be narrowed to
499
- * `OAuthErrorCode` for OAuth token-endpoint handlers.
500
- *
501
- * Use `unwrapResult()` from `error.ts` to convert to an HTTP Response.
502
- */
503
- type ApiResult<T, E extends string = string> = {
504
- success: true;
505
- data: T;
506
- } | {
507
- success: false;
508
- error: {
509
- code: E;
510
- message: string;
511
- details?: Record<string, unknown>;
512
- };
513
- };
514
- /**
515
- * API request context
516
- */
517
- interface ApiContext {
518
- userId?: string;
519
- userRole?: string;
520
- }
521
- //#endregion
522
- //#region src/api/handlers/content.d.ts
523
- /**
524
- * Trashed content item with deletion timestamp
525
- */
526
- interface TrashedContentItem {
527
- id: string;
528
- type: string;
529
- slug: string | null;
530
- status: string;
531
- data: Record<string, unknown>;
532
- authorId: string | null;
533
- createdAt: string;
534
- updatedAt: string;
535
- publishedAt: string | null;
536
- deletedAt: string;
537
- }
538
- /**
539
- * Create content list handler
540
- */
541
- declare function handleContentList(db: Kysely<Database>, collection: string, params: {
542
- cursor?: string;
543
- limit?: number;
544
- status?: string;
545
- orderBy?: string;
546
- order?: "asc" | "desc";
547
- locale?: string;
548
- }): Promise<ApiResult<ContentListResponse>>;
549
- /**
550
- * Get single content item
551
- */
552
- declare function handleContentGet(db: Kysely<Database>, collection: string, id: string, locale?: string): Promise<ApiResult<ContentResponse>>;
553
- /**
554
- * Get a content item by id, including trashed items.
555
- * Used by restore endpoint for ownership checks on soft-deleted items.
556
- */
557
- declare function handleContentGetIncludingTrashed(db: Kysely<Database>, collection: string, id: string, locale?: string): Promise<ApiResult<ContentResponse>>;
558
- /**
559
- * Create content item.
560
- *
561
- * Content + SEO writes are wrapped in a transaction so either both succeed
562
- * or neither does. If `body.seo` is provided for a non-SEO collection, the
563
- * API returns a validation error rather than silently dropping it.
564
- */
565
- declare function handleContentCreate(db: Kysely<Database>, collection: string, body: {
566
- data: Record<string, unknown>;
567
- slug?: string;
568
- status?: string;
569
- authorId?: string;
570
- bylines?: ContentBylineInput[];
571
- locale?: string;
572
- translationOf?: string;
573
- seo?: ContentSeoInput;
574
- createdAt?: string | null;
575
- publishedAt?: string | null;
576
- }): Promise<ApiResult<ContentResponse>>;
577
- /**
578
- * Update content item.
579
- * If `_rev` is provided, validates it against the current version before writing.
580
- * No `_rev` = blind write (backwards-compatible for admin UI).
581
- *
582
- * Content + SEO writes are wrapped in a transaction for atomicity.
583
- */
584
- declare function handleContentUpdate(db: Kysely<Database>, collection: string, id: string, body: {
585
- data?: Record<string, unknown>;
586
- slug?: string;
587
- status?: string;
588
- authorId?: string | null;
589
- bylines?: ContentBylineInput[];
590
- _rev?: string;
591
- seo?: ContentSeoInput;
592
- }): Promise<ApiResult<ContentResponse>>;
593
- /**
594
- * Duplicate content item.
595
- *
596
- * Only copies SEO data if the collection has SEO enabled.
597
- * Always returns consistent `seo` shape for SEO-enabled collections.
598
- */
599
- declare function handleContentDuplicate(db: Kysely<Database>, collection: string, id: string, authorId?: string): Promise<ApiResult<{
600
- item: ContentItem;
601
- }>>;
602
- /**
603
- * Delete content item (soft delete - moves to trash)
604
- */
605
- declare function handleContentDelete(db: Kysely<Database>, collection: string, id: string): Promise<ApiResult<{
606
- deleted: true;
607
- }>>;
608
- /**
609
- * Restore content item from trash
610
- */
611
- declare function handleContentRestore(db: Kysely<Database>, collection: string, id: string): Promise<ApiResult<{
612
- restored: true;
613
- }>>;
614
- /**
615
- * Permanently delete content item (cannot be undone).
616
- * Also cleans up associated SEO data.
617
- */
618
- declare function handleContentPermanentDelete(db: Kysely<Database>, collection: string, id: string): Promise<ApiResult<{
619
- deleted: true;
620
- }>>;
621
- /**
622
- * List trashed content items
623
- */
624
- declare function handleContentListTrashed(db: Kysely<Database>, collection: string, options?: {
625
- limit?: number;
626
- cursor?: string;
627
- }): Promise<ApiResult<{
628
- items: TrashedContentItem[];
629
- nextCursor?: string;
630
- }>>;
631
- /**
632
- * Count trashed content items
645
+ * Count trashed content items
633
646
  */
634
647
  declare function handleContentCountTrashed(db: Kysely<Database>, collection: string): Promise<ApiResult<{
635
648
  count: number;
@@ -649,7 +662,9 @@ declare function handleContentUnschedule(db: Kysely<Database>, collection: strin
649
662
  * (syncDataColumns, slug sync, status/revision update) that must
650
663
  * be atomic to prevent FTS shadow table corruption on crash.
651
664
  */
652
- declare function handleContentPublish(db: Kysely<Database>, collection: string, id: string): Promise<ApiResult<ContentResponse>>;
665
+ declare function handleContentPublish(db: Kysely<Database>, collection: string, id: string, options?: {
666
+ publishedAt?: string;
667
+ }): Promise<ApiResult<ContentResponse>>;
653
668
  /**
654
669
  * Unpublish content (revert to draft).
655
670
  *
@@ -813,6 +828,10 @@ declare class SchemaRegistry {
813
828
  * List all collections
814
829
  */
815
830
  listCollections(): Promise<Collection[]>;
831
+ /**
832
+ * List all collections with their fields using bounded query shapes.
833
+ */
834
+ listCollectionsWithFields(): Promise<CollectionWithFields[]>;
816
835
  /**
817
836
  * Get a collection by slug
818
837
  */
@@ -952,22 +971,6 @@ declare class SchemaRegistry {
952
971
  private slugToLabel;
953
972
  }
954
973
  //#endregion
955
- //#region src/schema/query.d.ts
956
- /**
957
- * Get collection metadata by slug.
958
- *
959
- * @example
960
- * ```ts
961
- * import { getCollectionInfo } from "dineway";
962
- *
963
- * const info = await getCollectionInfo("posts");
964
- * if (info?.commentsEnabled) {
965
- * // render comment UI
966
- * }
967
- * ```
968
- */
969
- declare function getCollectionInfo(slug: string): Promise<Collection | null>;
970
- //#endregion
971
974
  //#region src/sections/types.d.ts
972
975
  /**
973
976
  * Section source types
@@ -982,7 +985,7 @@ interface Section {
982
985
  title: string;
983
986
  description?: string;
984
987
  keywords: string[];
985
- content: PortableTextBlock$2[];
988
+ content: PortableTextBlock$1[];
986
989
  previewUrl?: string;
987
990
  source: SectionSource;
988
991
  themeId?: string;
@@ -997,7 +1000,7 @@ interface CreateSectionInput {
997
1000
  title: string;
998
1001
  description?: string;
999
1002
  keywords?: string[];
1000
- content: PortableTextBlock$2[];
1003
+ content: PortableTextBlock$1[];
1001
1004
  previewMediaId?: string;
1002
1005
  source?: SectionSource;
1003
1006
  themeId?: string;
@@ -1010,7 +1013,7 @@ interface UpdateSectionInput {
1010
1013
  title?: string;
1011
1014
  description?: string;
1012
1015
  keywords?: string[];
1013
- content?: PortableTextBlock$2[];
1016
+ content?: PortableTextBlock$1[];
1014
1017
  previewMediaId?: string | null;
1015
1018
  }
1016
1019
  /**
@@ -1292,7 +1295,7 @@ interface PortableTextUnknownBlock {
1292
1295
  /**
1293
1296
  * Any Portable Text block
1294
1297
  */
1295
- type PortableTextBlock$1 = PortableTextTextBlock | PortableTextImageBlock | PortableTextCodeBlock | PortableTextUnknownBlock;
1298
+ type PortableTextBlock = PortableTextTextBlock | PortableTextImageBlock | PortableTextCodeBlock | PortableTextUnknownBlock;
1296
1299
  /**
1297
1300
  * ProseMirror JSON types (simplified for TipTap)
1298
1301
  */
@@ -1316,13 +1319,13 @@ interface ProseMirrorDocument {
1316
1319
  /**
1317
1320
  * Convert ProseMirror document to Portable Text
1318
1321
  */
1319
- declare function prosemirrorToPortableText(doc: ProseMirrorDocument): PortableTextBlock$1[];
1322
+ declare function prosemirrorToPortableText(doc: ProseMirrorDocument): PortableTextBlock[];
1320
1323
  //#endregion
1321
1324
  //#region src/content/converters/portable-text-to-prosemirror.d.ts
1322
1325
  /**
1323
1326
  * Convert Portable Text to ProseMirror document
1324
1327
  */
1325
- declare function portableTextToProsemirror(blocks: PortableTextBlock$1[]): ProseMirrorDocument;
1328
+ declare function portableTextToProsemirror(blocks: PortableTextBlock[]): ProseMirrorDocument;
1326
1329
  //#endregion
1327
1330
  //#region src/utils/hash.d.ts
1328
1331
  /**
@@ -1341,392 +1344,54 @@ declare function hashString(content: string): Promise<string>;
1341
1344
  */
1342
1345
  declare function computeContentHash(content: Uint8Array | ArrayBuffer): Promise<string>;
1343
1346
  //#endregion
1344
- //#region src/utils/slugify.d.ts
1345
- /**
1346
- * Decode a URI-encoded slug route parameter before database lookup.
1347
- */
1348
- declare function decodeSlug(raw: string | undefined): string | undefined;
1349
- //#endregion
1350
- //#region src/utils/url.d.ts
1351
- /**
1352
- * URL scheme validation utilities
1353
- *
1354
- * Prevents XSS via dangerous URL schemes (javascript:, data:, vbscript:, etc.)
1355
- * by allowlisting known-safe schemes before rendering into href attributes.
1356
- */
1347
+ //#region src/after.d.ts
1357
1348
  /**
1358
- * Returns the URL unchanged if it uses a safe scheme, otherwise returns "#".
1359
- *
1360
- * Use this at the render layer as the primary defense against XSS via
1361
- * dangerous URL schemes like `javascript:`, `data:`, or `vbscript:`.
1349
+ * Defer work past the current synchronous path.
1362
1350
  *
1363
- * @example
1364
- * ```ts
1365
- * sanitizeHref("https://example.com") // "https://example.com"
1366
- * sanitizeHref("/about") // "/about"
1367
- * sanitizeHref("#section") // "#section"
1368
- * sanitizeHref("mailto:a@b.com") // "mailto:a@b.com"
1369
- * sanitizeHref("javascript:alert(1)") // "#"
1370
- * sanitizeHref("data:text/html,<script>") // "#"
1371
- * sanitizeHref("") // "#"
1372
- * ```
1373
- */
1374
- declare function sanitizeHref(url: string | undefined | null): string;
1375
- /**
1376
- * Returns true if the URL uses a safe scheme for rendering in href attributes.
1351
+ * Use this for best-effort bookkeeping that should not block runtime
1352
+ * initialization or response handling. Node keeps the process alive for
1353
+ * pending work; callers that need stronger durability should await their own
1354
+ * operation instead of using this helper.
1377
1355
  */
1378
- declare function isSafeHref(url: string): boolean;
1356
+ type AfterCallback = () => void | Promise<void>;
1357
+ declare function after(fn: AfterCallback): void;
1379
1358
  //#endregion
1380
- //#region src/visual-editing/editable.d.ts
1359
+ //#region src/i18n/config.d.ts
1381
1360
  /**
1382
- * Visual editing annotation system
1361
+ * Dineway i18n Configuration
1383
1362
  *
1384
- * Creates Proxy objects that emit data-dineway-ref attributes when spread onto elements.
1363
+ * Reads locale configuration from the virtual module (sourced from Astro config).
1364
+ * Initialized during runtime startup, then available via getI18nConfig().
1385
1365
  */
1386
- interface CMSAnnotation {
1387
- collection: string;
1388
- id: string;
1389
- field?: string;
1390
- /** Entry status — only present on entry-level annotations (not field-level) */
1391
- status?: string;
1392
- /** Whether the entry has unpublished draft changes */
1393
- hasDraft?: boolean;
1394
- }
1395
- /** The shape returned when spreading an edit annotation onto an element */
1396
- interface FieldAnnotation {
1397
- "data-dineway-ref": string;
1398
- }
1399
- interface EditableOptions {
1400
- /** Entry status: "draft", "published", "scheduled" */
1401
- status?: string;
1402
- /** true when draftRevisionId exists and differs from liveRevisionId */
1403
- hasDraft?: boolean;
1366
+ interface I18nConfig {
1367
+ defaultLocale: string;
1368
+ locales: string[];
1369
+ fallback?: Record<string, string>;
1370
+ prefixDefaultLocale?: boolean;
1404
1371
  }
1405
1372
  /**
1406
- * Create an editable proxy for an entry.
1407
- *
1408
- * Usage:
1409
- * - `{...entry.edit}` - entry-level annotation (includes status/hasDraft)
1410
- * - `{...entry.edit.title}` - field-level annotation
1411
- * - `{...entry.edit['nested.field']}` - nested field (bracket notation)
1373
+ * Get the current i18n config.
1374
+ * Returns null if i18n is not configured.
1412
1375
  */
1413
- declare function createEditable(collection: string, id: string, options?: EditableOptions): EditProxy;
1376
+ declare function getI18nConfig(): I18nConfig | null;
1414
1377
  /**
1415
- * Create a noop proxy for production mode.
1416
- * Spreading this produces no attributes.
1378
+ * Check if i18n is enabled.
1379
+ * Returns true when multiple locales are configured.
1417
1380
  */
1418
- declare function createNoop(): EditProxy;
1381
+ declare function isI18nEnabled(): boolean;
1419
1382
  /**
1420
- * Visual editing proxy type.
1421
- *
1422
- * Spread directly onto elements for entry-level annotations: `{...entry.edit}`
1423
- * Access a field for field-level annotations: `{...entry.edit.title}`
1424
- *
1425
- * In production, spreading produces no attributes (noop).
1383
+ * Resolve fallback locale chain for a given locale.
1384
+ * Returns array of locales to try, from most preferred to least.
1385
+ * Always ends with defaultLocale.
1426
1386
  */
1427
- type EditProxy = {
1428
- readonly [field: string]: Partial<FieldAnnotation>;
1429
- };
1387
+ declare function getFallbackChain(locale: string): string[];
1430
1388
  //#endregion
1431
- //#region src/query.d.ts
1389
+ //#region src/preview/sidecar-client.d.ts
1432
1390
  /**
1433
- * Collection type registry for type-safe queries.
1434
- *
1435
- * This interface is extended by the generated dineway-env.d.ts file
1436
- * to provide type inference for collection names and their data shapes.
1437
- *
1438
- * @example
1439
- * ```ts
1440
- * // In dineway-env.d.ts (generated):
1441
- * declare module "dineway" {
1442
- * interface DinewayCollections {
1443
- * posts: { title: string; content: PortableTextBlock[]; };
1444
- * pages: { title: string; body: PortableTextBlock[]; };
1445
- * }
1446
- * }
1391
+ * Preview sidecar protocol helpers.
1447
1392
  *
1448
- * // Then in your code:
1449
- * const { entries } = await getDinewayCollection("posts");
1450
- * // entries[0].data.title is typed as string
1451
- * ```
1452
- */
1453
- interface DinewayCollections {}
1454
- /**
1455
- * Helper type to infer the data type for a collection.
1456
- * Returns the registered type if known, otherwise falls back to Record<string, unknown>.
1457
- */
1458
- type InferCollectionData<T extends string> = T extends keyof DinewayCollections ? DinewayCollections[T] : Record<string, unknown>;
1459
- /**
1460
- * Sort direction
1461
- */
1462
- type SortDirection$1 = "asc" | "desc";
1463
- /**
1464
- * Order by specification - field name to direction
1465
- * @example { created_at: "desc" } - Sort by created_at descending
1466
- * @example { title: "asc" } - Sort by title ascending
1467
- * @example { published_at: "desc", title: "asc" } - Multi-field sort
1468
- */
1469
- type OrderBySpec$1 = Record<string, SortDirection$1>;
1470
- interface CollectionFilter$1 {
1471
- status?: "draft" | "published" | "archived";
1472
- limit?: number;
1473
- /**
1474
- * Opaque cursor for keyset pagination.
1475
- * Pass the `nextCursor` value from a previous result to fetch the next page.
1476
- * @example
1477
- * ```ts
1478
- * const cursor = Astro.url.searchParams.get("cursor") ?? undefined;
1479
- * const { entries, nextCursor } = await getDinewayCollection("posts", {
1480
- * limit: 10,
1481
- * cursor,
1482
- * });
1483
- * ```
1484
- */
1485
- cursor?: string;
1486
- /**
1487
- * Filter by field values or taxonomy terms
1488
- * @example { category: 'news' } - Filter by taxonomy term
1489
- * @example { category: ['news', 'featured'] } - Filter by multiple terms (OR)
1490
- */
1491
- where?: Record<string, string | string[]>;
1492
- /**
1493
- * Order results by field(s)
1494
- * @default { created_at: "desc" }
1495
- * @example { created_at: "desc" } - Sort by created_at descending (default)
1496
- * @example { title: "asc" } - Sort by title ascending
1497
- * @example { published_at: "desc", title: "asc" } - Multi-field sort
1498
- */
1499
- orderBy?: OrderBySpec$1;
1500
- /**
1501
- * Filter by locale. When set, only returns entries in this locale.
1502
- * Only relevant when i18n is configured.
1503
- * @example "en" — English entries only
1504
- * @example "fr" — French entries only
1505
- */
1506
- locale?: string;
1507
- }
1508
- interface ContentEntry<T = Record<string, unknown>> {
1509
- id: string;
1510
- data: T;
1511
- /** Visual editing annotations. Spread onto elements: {...entry.edit.title} */
1512
- edit: EditProxy;
1513
- }
1514
- /** Cache hint returned by the content loader for route caching */
1515
- interface CacheHint {
1516
- tags?: string[];
1517
- lastModified?: Date;
1518
- }
1519
- /**
1520
- * Result from getDinewayCollection
1521
- */
1522
- interface CollectionResult<T> {
1523
- /** The entries (empty array if error or none found) */
1524
- entries: ContentEntry<T>[];
1525
- /** Error if the query failed */
1526
- error?: Error;
1527
- /** Cache hint for route caching (pass to Astro.cache.set()) */
1528
- cacheHint: CacheHint;
1529
- /**
1530
- * Opaque cursor for the next page.
1531
- * Undefined when there are no more results.
1532
- * Pass this as `cursor` in the next query to get the next page.
1533
- */
1534
- nextCursor?: string;
1535
- }
1536
- /**
1537
- * Result from getDinewayEntry
1538
- */
1539
- interface EntryResult<T> {
1540
- /** The entry, or null if not found */
1541
- entry: ContentEntry<T> | null;
1542
- /** Error if the query failed (not set for "not found", only for actual errors) */
1543
- error?: Error;
1544
- /** Whether we're in preview mode (valid token was provided) */
1545
- isPreview: boolean;
1546
- /** Set when a fallback locale was used instead of the requested locale */
1547
- fallbackLocale?: string;
1548
- /** Cache hint for route caching (pass to Astro.cache.set()) */
1549
- cacheHint: CacheHint;
1550
- }
1551
- /** Edit metadata attached to PT arrays in edit mode */
1552
- interface EditFieldMeta {
1553
- collection: string;
1554
- id: string;
1555
- field: string;
1556
- }
1557
- /**
1558
- * Read edit metadata from a value (returns undefined if not tagged).
1559
- * Uses Object.getOwnPropertyDescriptor to access Symbol-keyed property
1560
- * without an unsafe type assertion.
1561
- */
1562
- declare function getEditMeta(value: unknown): EditFieldMeta | undefined;
1563
- /**
1564
- * Get all entries of a content type
1565
- *
1566
- * Returns { entries, error } for graceful error handling.
1567
- *
1568
- * When dineway-env.d.ts is generated, the collection name will be
1569
- * type-checked and the return type will be inferred automatically.
1570
- *
1571
- * @example
1572
- * ```ts
1573
- * import { getDinewayCollection } from "dineway";
1574
- *
1575
- * const { entries: posts, error } = await getDinewayCollection("posts");
1576
- * if (error) {
1577
- * console.error("Failed to load posts:", error);
1578
- * return;
1579
- * }
1580
- * // posts[0].data.title is typed (if dineway-env.d.ts exists)
1581
- *
1582
- * // With filters
1583
- * const { entries: drafts } = await getDinewayCollection("posts", { status: "draft" });
1584
- * ```
1585
- */
1586
- declare function getDinewayCollection<T extends string, D = InferCollectionData<T>>(type: T, filter?: CollectionFilter$1): Promise<CollectionResult<D>>;
1587
- /**
1588
- * Get a single entry by type and ID/slug
1589
- *
1590
- * Returns { entry, error, isPreview } for graceful error handling.
1591
- * - entry is null if not found (not an error)
1592
- * - error is set only for actual errors (db issues, etc.)
1593
- *
1594
- * Preview mode is detected automatically from request context (ALS).
1595
- * When the URL has a valid `_preview` token, the middleware sets preview
1596
- * context and this function serves draft revision data if available.
1597
- *
1598
- * @example
1599
- * ```ts
1600
- * import { getDinewayEntry } from "dineway";
1601
- *
1602
- * // Simple usage — preview just works via middleware
1603
- * const { entry: post, isPreview, error } = await getDinewayEntry("posts", "my-slug");
1604
- * if (!post) return Astro.redirect("/404");
1605
- * ```
1606
- */
1607
- declare function getDinewayEntry<T extends string, D = InferCollectionData<T>>(type: T, id: string, options?: {
1608
- locale?: string;
1609
- }): Promise<EntryResult<D>>;
1610
- /**
1611
- * Translation summary for a single locale variant
1612
- */
1613
- interface TranslationSummary {
1614
- /** Content item ID */
1615
- id: string;
1616
- /** Locale code (e.g. "en", "fr") */
1617
- locale: string;
1618
- /** URL slug */
1619
- slug: string | null;
1620
- /** Current status */
1621
- status: string;
1622
- }
1623
- /**
1624
- * Result from getTranslations
1625
- */
1626
- interface TranslationsResult {
1627
- /** The translation group ID (shared across locales) */
1628
- translationGroup: string;
1629
- /** All locale variants in this group */
1630
- translations: TranslationSummary[];
1631
- /** Error if the query failed */
1632
- error?: Error;
1633
- }
1634
- /**
1635
- * Get all translations of a content item.
1636
- *
1637
- * Given a content entry, returns all locale variants that share the same
1638
- * translation group. This is useful for building language switcher UI.
1639
- *
1640
- * @example
1641
- * ```ts
1642
- * import { getDinewayEntry, getTranslations } from "dineway";
1643
- *
1644
- * const { entry: post } = await getDinewayEntry("posts", "hello-world", { locale: "en" });
1645
- * const { translations } = await getTranslations("posts", post.data.id);
1646
- * // translations = [{ id: "...", locale: "en", slug: "hello-world", status: "published" }, ...]
1647
- * ```
1648
- */
1649
- declare function getTranslations(type: string, id: string): Promise<TranslationsResult>;
1650
- /**
1651
- * Result from resolveDinewayPath
1652
- */
1653
- interface ResolvePathResult<T = Record<string, unknown>> {
1654
- /** The matched entry */
1655
- entry: ContentEntry<T>;
1656
- /** The collection slug that matched */
1657
- collection: string;
1658
- /** Extracted parameters from the URL pattern (e.g. { slug: "my-post" }) */
1659
- params: Record<string, string>;
1660
- }
1661
- /**
1662
- * Resolve a URL path to a content entry by matching against collection URL patterns.
1663
- *
1664
- * Loads all collections with a `urlPattern` set, converts each pattern to a regex,
1665
- * and tests the given path. On match, extracts the slug and fetches the entry.
1666
- *
1667
- * @example
1668
- * ```ts
1669
- * import { resolveDinewayPath } from "dineway";
1670
- *
1671
- * // Given pages with urlPattern "/{slug}" and posts with "/blog/{slug}":
1672
- * const result = await resolveDinewayPath("/blog/hello-world");
1673
- * if (result) {
1674
- * console.log(result.collection); // "posts"
1675
- * console.log(result.params.slug); // "hello-world"
1676
- * console.log(result.entry.data); // post data
1677
- * }
1678
- * ```
1679
- */
1680
- declare function resolveDinewayPath<T = Record<string, unknown>>(path: string): Promise<ResolvePathResult<T> | null>;
1681
- //#endregion
1682
- //#region src/after.d.ts
1683
- /**
1684
- * Defer work past the current synchronous path.
1685
- *
1686
- * Use this for best-effort bookkeeping that should not block runtime
1687
- * initialization or response handling. Node keeps the process alive for
1688
- * pending work; callers that need stronger durability should await their own
1689
- * operation instead of using this helper.
1690
- */
1691
- type AfterCallback = () => void | Promise<void>;
1692
- declare function after(fn: AfterCallback): void;
1693
- //#endregion
1694
- //#region src/i18n/config.d.ts
1695
- /**
1696
- * Dineway i18n Configuration
1697
- *
1698
- * Reads locale configuration from the virtual module (sourced from Astro config).
1699
- * Initialized during runtime startup, then available via getI18nConfig().
1700
- */
1701
- interface I18nConfig {
1702
- defaultLocale: string;
1703
- locales: string[];
1704
- fallback?: Record<string, string>;
1705
- prefixDefaultLocale?: boolean;
1706
- }
1707
- /**
1708
- * Get the current i18n config.
1709
- * Returns null if i18n is not configured.
1710
- */
1711
- declare function getI18nConfig(): I18nConfig | null;
1712
- /**
1713
- * Check if i18n is enabled.
1714
- * Returns true when multiple locales are configured.
1715
- */
1716
- declare function isI18nEnabled(): boolean;
1717
- /**
1718
- * Resolve fallback locale chain for a given locale.
1719
- * Returns array of locales to try, from most preferred to least.
1720
- * Always ends with defaultLocale.
1721
- */
1722
- declare function getFallbackChain(locale: string): string[];
1723
- //#endregion
1724
- //#region src/preview/sidecar-client.d.ts
1725
- /**
1726
- * Preview sidecar protocol helpers.
1727
- *
1728
- * These utilities define the signed URL and snapshot-auth contract shared
1729
- * by preview sidecars and the source site serving snapshot exports.
1393
+ * These utilities define the signed URL and snapshot-auth contract shared
1394
+ * by preview sidecars and the source site serving snapshot exports.
1730
1395
  */
1731
1396
  interface PreviewSidecarSignature {
1732
1397
  source: string;
@@ -1913,143 +1578,6 @@ declare function getDb(): Promise<Kysely<Database>>;
1913
1578
  */
1914
1579
  declare function dinewayLoader(): LiveLoader<EntryData, EntryFilter, CollectionFilter>;
1915
1580
  //#endregion
1916
- //#region src/cli/wxr/parser.d.ts
1917
- /**
1918
- * Parsed WordPress export data
1919
- */
1920
- interface WxrData {
1921
- /** Site metadata */
1922
- site: WxrSite;
1923
- /** Posts (including custom post types) */
1924
- posts: WxrPost[];
1925
- /** Media attachments */
1926
- attachments: WxrAttachment[];
1927
- /** Categories */
1928
- categories: WxrCategory[];
1929
- /** Tags */
1930
- tags: WxrTag[];
1931
- /** Authors */
1932
- authors: WxrAuthor[];
1933
- /** All taxonomy terms (including custom taxonomies and nav_menu) */
1934
- terms: WxrTerm[];
1935
- /** Parsed navigation menus */
1936
- navMenus: WxrNavMenu[];
1937
- }
1938
- interface WxrSite {
1939
- title?: string;
1940
- link?: string;
1941
- description?: string;
1942
- language?: string;
1943
- baseSiteUrl?: string;
1944
- baseBlogUrl?: string;
1945
- }
1946
- interface WxrPost {
1947
- id?: number;
1948
- title?: string;
1949
- link?: string;
1950
- pubDate?: string;
1951
- creator?: string;
1952
- guid?: string;
1953
- description?: string;
1954
- content?: string;
1955
- excerpt?: string;
1956
- postDate?: string;
1957
- postDateGmt?: string;
1958
- postModified?: string;
1959
- postModifiedGmt?: string;
1960
- commentStatus?: string;
1961
- pingStatus?: string;
1962
- status?: string;
1963
- postType?: string;
1964
- postName?: string;
1965
- postPassword?: string;
1966
- isSticky?: boolean;
1967
- /** Parent post ID for hierarchical content (pages) */
1968
- postParent?: number;
1969
- /** Menu order for sorting */
1970
- menuOrder?: number;
1971
- categories: string[];
1972
- tags: string[];
1973
- /** Custom taxonomy assignments beyond categories/tags */
1974
- customTaxonomies?: Map<string, string[]>;
1975
- meta: Map<string, string>;
1976
- }
1977
- interface WxrAttachment {
1978
- id?: number;
1979
- title?: string;
1980
- url?: string;
1981
- postDate?: string;
1982
- meta: Map<string, string>;
1983
- }
1984
- interface WxrCategory {
1985
- id?: number;
1986
- nicename?: string;
1987
- name?: string;
1988
- parent?: string;
1989
- description?: string;
1990
- }
1991
- interface WxrTag {
1992
- id?: number;
1993
- slug?: string;
1994
- name?: string;
1995
- description?: string;
1996
- }
1997
- /**
1998
- * Generic taxonomy term (categories, tags, nav_menu, custom taxonomies)
1999
- */
2000
- interface WxrTerm {
2001
- id: number;
2002
- taxonomy: string;
2003
- slug: string;
2004
- name: string;
2005
- parent?: string;
2006
- description?: string;
2007
- }
2008
- /**
2009
- * Navigation menu structure
2010
- */
2011
- interface WxrNavMenu {
2012
- id: number;
2013
- name: string;
2014
- label: string;
2015
- items: WxrNavMenuItem[];
2016
- }
2017
- /**
2018
- * Navigation menu item
2019
- */
2020
- interface WxrNavMenuItem {
2021
- id: number;
2022
- menuId: number;
2023
- parentId?: number;
2024
- sortOrder: number;
2025
- type: "custom" | "post_type" | "taxonomy";
2026
- objectType?: string;
2027
- objectId?: number;
2028
- url?: string;
2029
- title: string;
2030
- target?: string;
2031
- classes?: string;
2032
- }
2033
- interface WxrAuthor {
2034
- id?: number;
2035
- login?: string;
2036
- email?: string;
2037
- displayName?: string;
2038
- firstName?: string;
2039
- lastName?: string;
2040
- }
2041
- /**
2042
- * Parse a WordPress WXR export file
2043
- */
2044
- declare function parseWxr(stream: Readable): Promise<WxrData>;
2045
- /**
2046
- * Parse a WordPress WXR export from a string
2047
- *
2048
- * Uses the non-streaming SAX parser API for compatibility with
2049
- * environments that don't expose Node.js streams.
2050
- */
2051
- declare function parseWxrString(xml: string): Promise<WxrData>;
2052
- //#endregion
2053
1581
  //#region src/plugins/define-plugin.d.ts
2054
1582
  /**
2055
1583
  * Define a Dineway plugin.
@@ -2087,7 +1615,7 @@ declare function parseWxrString(xml: string): Promise<WxrData>;
2087
1615
  * export default definePlugin({
2088
1616
  * id: "my-plugin",
2089
1617
  * version: "1.0.0",
2090
- * capabilities: ["read:content"],
1618
+ * capabilities: ["content:read"],
2091
1619
  * hooks: {
2092
1620
  * "content:beforeSave": async (event, ctx) => {
2093
1621
  * ctx.log.info("Saving content", { collection: event.collection });
@@ -2107,960 +1635,446 @@ declare function parseWxrString(xml: string): Promise<WxrData>;
2107
1635
  declare function definePlugin<TStorage extends PluginStorageConfig>(definition: PluginDefinition<TStorage>): ResolvedPlugin<TStorage>;
2108
1636
  declare function definePlugin(definition: StandardPluginDefinition): StandardPluginDefinition;
2109
1637
  //#endregion
2110
- //#region src/auth/types.d.ts
2111
- /**
2112
- * Auth Provider Types
2113
- *
2114
- * Defines the interfaces for pluggable authentication providers.
2115
- * External auth adapters implement these interfaces.
2116
- */
2117
- /**
2118
- * Result of authenticating a request via an external auth provider
2119
- */
2120
- interface AuthResult {
2121
- /** User's email address */
2122
- email: string;
2123
- /** User's display name */
2124
- name: string;
2125
- /** Resolved role level (e.g., 50 for Admin, 30 for Editor) */
2126
- role: number;
2127
- /** Provider-specific subject ID */
2128
- subject?: string;
2129
- /** Additional provider-specific data */
2130
- metadata?: Record<string, unknown>;
2131
- }
2132
- /**
2133
- * Auth descriptor - returned by auth adapter functions (e.g., access())
2134
- *
2135
- * Similar to DatabaseDescriptor and StorageDescriptor, this allows
2136
- * auth providers to be configured at build time and loaded at runtime.
2137
- */
2138
- interface AuthDescriptor {
2139
- /**
2140
- * Auth provider type identifier
2141
- * @example "header-auth", "okta", "auth0"
2142
- */
2143
- type: string;
2144
- /**
2145
- * Module specifier to import at runtime
2146
- * The module must export an `authenticate` function.
2147
- * @example "@acme/dineway-header-auth"
2148
- */
2149
- entrypoint: string;
2150
- /**
2151
- * Provider-specific configuration (JSON-serializable)
2152
- */
2153
- config: unknown;
2154
- }
1638
+ //#region src/plugins/manifest-schema.d.ts
2155
1639
  /**
2156
- * Auth provider module interface
1640
+ * Zod schema matching the PluginManifest interface from types.ts.
2157
1641
  *
2158
- * Modules specified by AuthDescriptor.entrypoint must export
2159
- * an `authenticate` function matching this signature.
2160
- */
2161
- interface AuthProviderModule {
2162
- /**
2163
- * Authenticate a request using the provider
2164
- *
2165
- * @param request - The incoming HTTP request
2166
- * @param config - Provider-specific configuration from AuthDescriptor
2167
- * @returns Authentication result if valid, throws if invalid
2168
- */
2169
- authenticate(request: Request, config: unknown): Promise<AuthResult>;
2170
- }
2171
- /**
2172
- * Configuration options common to external auth providers
2173
- */
2174
- interface ExternalAuthConfig {
2175
- /**
2176
- * Automatically create Dineway users on first login
2177
- * @default true
2178
- */
2179
- autoProvision?: boolean;
2180
- /**
2181
- * Role level for users not matching any group in roleMapping
2182
- * @default 30 (Editor)
2183
- */
2184
- defaultRole?: number;
2185
- /**
2186
- * Update user's role on each login based on current IdP groups
2187
- * When false, role is only set on first provisioning
2188
- * @default false
2189
- */
2190
- syncRoles?: boolean;
2191
- /**
2192
- * Map IdP group names to Dineway role levels
2193
- * First match wins if user is in multiple groups
2194
- *
2195
- * @example
2196
- * ```ts
2197
- * roleMapping: {
2198
- * "Admins": 50, // Admin
2199
- * "Developers": 40, // Developer
2200
- * "Content Team": 30, // Editor
2201
- * }
2202
- * ```
2203
- */
2204
- roleMapping?: Record<string, number>;
2205
- }
2206
- //#endregion
2207
- //#region src/astro/storage/types.d.ts
2208
- /**
2209
- * Serializable storage configuration descriptor
2210
- */
2211
- interface StorageDescriptor {
2212
- /** Module path exporting createStorage function */
2213
- entrypoint: string;
2214
- /** Serializable config passed to createStorage at runtime */
2215
- config: unknown;
2216
- }
2217
- /**
2218
- * S3-compatible storage configuration
1642
+ * Every JSON.parse of a manifest.json should validate through this.
2219
1643
  */
2220
- interface S3StorageConfig {
2221
- /** S3 endpoint URL */
2222
- endpoint: string;
2223
- /** Bucket name */
2224
- bucket: string;
2225
- /**
2226
- * Access key ID.
2227
- * May be resolved from `S3_ACCESS_KEY_ID` at runtime on Node.
2228
- * Must be provided together with `secretAccessKey`, or both omitted.
2229
- */
2230
- accessKeyId?: string;
2231
- /**
2232
- * Secret access key.
2233
- * May be resolved from `S3_SECRET_ACCESS_KEY` at runtime on Node.
2234
- * Must be provided together with `accessKeyId`, or both omitted.
2235
- */
2236
- secretAccessKey?: string;
2237
- /** Optional region (defaults to "auto") */
2238
- region?: string;
2239
- /** Optional public URL prefix for CDN */
2240
- publicUrl?: string;
2241
- }
2242
- /**
2243
- * Local filesystem storage configuration
2244
- */
2245
- interface LocalStorageConfig {
2246
- /** Directory path for storing files */
2247
- directory: string;
2248
- /** Base URL for serving files */
2249
- baseUrl: string;
2250
- }
1644
+ declare const pluginManifestSchema: z.ZodObject<{
1645
+ id: z.ZodString;
1646
+ version: z.ZodString;
1647
+ capabilities: z.ZodArray<z.ZodEnum<{
1648
+ "network:request": "network:request";
1649
+ "network:request:unrestricted": "network:request:unrestricted";
1650
+ "content:read": "content:read";
1651
+ "content:write": "content:write";
1652
+ "media:read": "media:read";
1653
+ "media:write": "media:write";
1654
+ "users:read": "users:read";
1655
+ "email:send": "email:send";
1656
+ "hooks.email-transport:register": "hooks.email-transport:register";
1657
+ "hooks.email-events:register": "hooks.email-events:register";
1658
+ "hooks.page-fragments:register": "hooks.page-fragments:register";
1659
+ }>>;
1660
+ allowedHosts: z.ZodArray<z.ZodString>;
1661
+ storage: z.ZodRecord<z.ZodString, z.ZodObject<{
1662
+ indexes: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
1663
+ uniqueIndexes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
1664
+ }, z.core.$strip>>;
1665
+ hooks: z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
1666
+ "plugin:install": "plugin:install";
1667
+ "plugin:activate": "plugin:activate";
1668
+ "plugin:deactivate": "plugin:deactivate";
1669
+ "plugin:uninstall": "plugin:uninstall";
1670
+ "content:beforeSave": "content:beforeSave";
1671
+ "content:afterSave": "content:afterSave";
1672
+ "content:beforeDelete": "content:beforeDelete";
1673
+ "content:afterDelete": "content:afterDelete";
1674
+ "content:afterPublish": "content:afterPublish";
1675
+ "content:afterUnpublish": "content:afterUnpublish";
1676
+ "media:beforeUpload": "media:beforeUpload";
1677
+ "media:afterUpload": "media:afterUpload";
1678
+ cron: "cron";
1679
+ "email:beforeSend": "email:beforeSend";
1680
+ "email:deliver": "email:deliver";
1681
+ "email:afterSend": "email:afterSend";
1682
+ "comment:beforeCreate": "comment:beforeCreate";
1683
+ "comment:moderate": "comment:moderate";
1684
+ "comment:afterCreate": "comment:afterCreate";
1685
+ "comment:afterModerate": "comment:afterModerate";
1686
+ "page:metadata": "page:metadata";
1687
+ "page:fragments": "page:fragments";
1688
+ }>, z.ZodObject<{
1689
+ name: z.ZodEnum<{
1690
+ "plugin:install": "plugin:install";
1691
+ "plugin:activate": "plugin:activate";
1692
+ "plugin:deactivate": "plugin:deactivate";
1693
+ "plugin:uninstall": "plugin:uninstall";
1694
+ "content:beforeSave": "content:beforeSave";
1695
+ "content:afterSave": "content:afterSave";
1696
+ "content:beforeDelete": "content:beforeDelete";
1697
+ "content:afterDelete": "content:afterDelete";
1698
+ "content:afterPublish": "content:afterPublish";
1699
+ "content:afterUnpublish": "content:afterUnpublish";
1700
+ "media:beforeUpload": "media:beforeUpload";
1701
+ "media:afterUpload": "media:afterUpload";
1702
+ cron: "cron";
1703
+ "email:beforeSend": "email:beforeSend";
1704
+ "email:deliver": "email:deliver";
1705
+ "email:afterSend": "email:afterSend";
1706
+ "comment:beforeCreate": "comment:beforeCreate";
1707
+ "comment:moderate": "comment:moderate";
1708
+ "comment:afterCreate": "comment:afterCreate";
1709
+ "comment:afterModerate": "comment:afterModerate";
1710
+ "page:metadata": "page:metadata";
1711
+ "page:fragments": "page:fragments";
1712
+ }>;
1713
+ exclusive: z.ZodOptional<z.ZodBoolean>;
1714
+ priority: z.ZodOptional<z.ZodNumber>;
1715
+ timeout: z.ZodOptional<z.ZodNumber>;
1716
+ }, z.core.$strip>]>>;
1717
+ routes: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1718
+ name: z.ZodString;
1719
+ public: z.ZodOptional<z.ZodBoolean>;
1720
+ }, z.core.$strip>]>>;
1721
+ admin: z.ZodObject<{
1722
+ entry: z.ZodOptional<z.ZodString>;
1723
+ settingsSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
1724
+ type: z.ZodLiteral<"string">;
1725
+ default: z.ZodOptional<z.ZodString>;
1726
+ multiline: z.ZodOptional<z.ZodBoolean>;
1727
+ label: z.ZodString;
1728
+ description: z.ZodOptional<z.ZodString>;
1729
+ }, z.core.$strip>, z.ZodObject<{
1730
+ type: z.ZodLiteral<"number">;
1731
+ default: z.ZodOptional<z.ZodNumber>;
1732
+ min: z.ZodOptional<z.ZodNumber>;
1733
+ max: z.ZodOptional<z.ZodNumber>;
1734
+ label: z.ZodString;
1735
+ description: z.ZodOptional<z.ZodString>;
1736
+ }, z.core.$strip>, z.ZodObject<{
1737
+ type: z.ZodLiteral<"boolean">;
1738
+ default: z.ZodOptional<z.ZodBoolean>;
1739
+ label: z.ZodString;
1740
+ description: z.ZodOptional<z.ZodString>;
1741
+ }, z.core.$strip>, z.ZodObject<{
1742
+ type: z.ZodLiteral<"select">;
1743
+ options: z.ZodArray<z.ZodObject<{
1744
+ value: z.ZodString;
1745
+ label: z.ZodString;
1746
+ }, z.core.$strip>>;
1747
+ default: z.ZodOptional<z.ZodString>;
1748
+ label: z.ZodString;
1749
+ description: z.ZodOptional<z.ZodString>;
1750
+ }, z.core.$strip>, z.ZodObject<{
1751
+ type: z.ZodLiteral<"secret">;
1752
+ label: z.ZodString;
1753
+ description: z.ZodOptional<z.ZodString>;
1754
+ }, z.core.$strip>, z.ZodObject<{
1755
+ type: z.ZodLiteral<"url">;
1756
+ default: z.ZodOptional<z.ZodString>;
1757
+ placeholder: z.ZodOptional<z.ZodString>;
1758
+ label: z.ZodString;
1759
+ description: z.ZodOptional<z.ZodString>;
1760
+ }, z.core.$strip>, z.ZodObject<{
1761
+ type: z.ZodLiteral<"email">;
1762
+ default: z.ZodOptional<z.ZodString>;
1763
+ placeholder: z.ZodOptional<z.ZodString>;
1764
+ label: z.ZodString;
1765
+ description: z.ZodOptional<z.ZodString>;
1766
+ }, z.core.$strip>], "type">>>;
1767
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
1768
+ path: z.ZodString;
1769
+ label: z.ZodString;
1770
+ icon: z.ZodOptional<z.ZodString>;
1771
+ }, z.core.$strip>>>;
1772
+ widgets: z.ZodOptional<z.ZodArray<z.ZodObject<{
1773
+ id: z.ZodString;
1774
+ size: z.ZodOptional<z.ZodEnum<{
1775
+ full: "full";
1776
+ half: "half";
1777
+ third: "third";
1778
+ }>>;
1779
+ title: z.ZodOptional<z.ZodString>;
1780
+ }, z.core.$strip>>>;
1781
+ fieldWidgets: z.ZodOptional<z.ZodArray<z.ZodObject<{
1782
+ name: z.ZodString;
1783
+ label: z.ZodString;
1784
+ fieldTypes: z.ZodArray<z.ZodEnum<{
1785
+ string: "string";
1786
+ number: "number";
1787
+ boolean: "boolean";
1788
+ file: "file";
1789
+ slug: "slug";
1790
+ datetime: "datetime";
1791
+ image: "image";
1792
+ text: "text";
1793
+ integer: "integer";
1794
+ select: "select";
1795
+ multiSelect: "multiSelect";
1796
+ portableText: "portableText";
1797
+ reference: "reference";
1798
+ json: "json";
1799
+ repeater: "repeater";
1800
+ }>>;
1801
+ elements: z.ZodOptional<z.ZodArray<z.ZodObject<{
1802
+ type: z.ZodString;
1803
+ action_id: z.ZodString;
1804
+ label: z.ZodOptional<z.ZodString>;
1805
+ }, z.core.$loose>>>;
1806
+ }, z.core.$strip>>>;
1807
+ }, z.core.$strip>;
1808
+ }, z.core.$strip>;
1809
+ type ValidatedPluginManifest = z.infer<typeof pluginManifestSchema>;
2251
1810
  //#endregion
2252
- //#region src/astro/integration/runtime.d.ts
2253
- /**
2254
- * Admin page definition (copied from plugins/types to avoid circular deps)
2255
- */
2256
- interface PluginAdminPage {
2257
- path: string;
2258
- label: string;
2259
- icon?: string;
2260
- }
1811
+ //#region src/plugins/hooks.d.ts
1812
+ type HookNameV2 = "plugin:install" | "plugin:activate" | "plugin:deactivate" | "plugin:uninstall" | "content:beforeSave" | "content:afterSave" | "content:beforeDelete" | "content:afterDelete" | "content:afterPublish" | "content:afterUnpublish" | "media:beforeUpload" | "media:afterUpload" | "cron" | "email:beforeSend" | "email:deliver" | "email:afterSend" | "comment:beforeCreate" | "comment:moderate" | "comment:afterCreate" | "comment:afterModerate" | "page:metadata" | "page:fragments";
2261
1813
  /**
2262
- * Dashboard widget definition (copied from plugins/types to avoid circular deps)
1814
+ * Hook execution result
2263
1815
  */
2264
- interface PluginDashboardWidget {
2265
- id: string;
2266
- size?: "full" | "half" | "third";
2267
- title?: string;
1816
+ interface HookResult<T> {
1817
+ success: boolean;
1818
+ value?: T;
1819
+ error?: Error;
1820
+ pluginId: string;
1821
+ duration: number;
2268
1822
  }
2269
1823
  /**
2270
- * Plugin descriptor - returned by plugin factory functions
2271
- *
2272
- * Contains all static metadata needed for manifest and admin UI,
2273
- * plus the entrypoint for runtime instantiation.
2274
- *
2275
- * @example
2276
- * ```ts
2277
- * export function myPlugin(options?: MyPluginOptions): PluginDescriptor {
2278
- * return {
2279
- * id: "my-plugin",
2280
- * version: "1.0.0",
2281
- * entrypoint: "@my-org/dineway-plugin-foo",
2282
- * options: options ?? {},
2283
- * adminEntry: "@my-org/dineway-plugin-foo/admin",
2284
- * adminPages: [{ path: "/settings", label: "Settings" }],
2285
- * };
2286
- * }
2287
- * ```
2288
- */
2289
- /**
2290
- * Storage collection declaration for sandboxed plugins
1824
+ * Hook pipeline for executing hooks in order
2291
1825
  */
2292
- interface StorageCollectionDeclaration {
2293
- indexes?: string[];
2294
- uniqueIndexes?: string[];
2295
- }
2296
- interface PluginDescriptor<TOptions = Record<string, unknown>> {
2297
- /** Unique plugin identifier */
2298
- id: string;
2299
- /** Plugin version (semver) */
2300
- version: string;
2301
- /** Module specifier to import (e.g., "@dineway-ai/plugin-api-test") */
2302
- entrypoint: string;
1826
+ declare class HookPipeline {
1827
+ private hooks;
1828
+ private pluginMap;
1829
+ private contextFactory;
1830
+ /** Stored so setContextFactory can merge incrementally. */
1831
+ private contextFactoryOptions;
1832
+ /** Hook names where at least one handler declared exclusive: true */
1833
+ private exclusiveHookNames;
2303
1834
  /**
2304
- * Options to pass to createPlugin(). Native format only.
2305
- * Standard-format plugins configure themselves via KV settings
2306
- * and Block Kit admin pages -- not constructor options.
1835
+ * Selected provider plugin ID for each exclusive hook.
1836
+ * Set by the PluginManager after resolution.
2307
1837
  */
2308
- options?: TOptions;
1838
+ private exclusiveSelections;
1839
+ constructor(plugins: ResolvedPlugin[], factoryOptions?: PluginContextFactoryOptions);
2309
1840
  /**
2310
- * Plugin format. Determines how the entrypoint is loaded:
2311
- * - `"standard"` -- exports `definePlugin({ hooks, routes })` as default.
2312
- * Wrapped with `adaptSandboxEntry` for in-process execution. Can run in both
2313
- * `plugins: []` (in-process) and `sandboxed: []` (isolate).
2314
- * - `"native"` -- exports `createPlugin(options)` returning a `ResolvedPlugin`.
2315
- * Can only run in `plugins: []`. Cannot be sandboxed or published to marketplace.
2316
- *
2317
- * Defaults to `"native"` when unset.
1841
+ * Set or update the context factory options.
2318
1842
  *
1843
+ * When called on a pipeline that already has a factory, the new options
1844
+ * are merged on top of the existing ones so that callers don't need to
1845
+ * repeat every field (e.g. adding `cronReschedule` without losing
1846
+ * `storage` / `getUploadUrl`).
2319
1847
  */
2320
- format?: "standard" | "native";
2321
- /** Admin UI module specifier (e.g., "@dineway-ai/plugin-audit-log/admin") */
2322
- adminEntry?: string;
2323
- /** Module specifier for site-side Astro rendering components (must export `blockComponents`) */
2324
- componentsEntry?: string;
2325
- /** Admin pages for navigation */
2326
- adminPages?: PluginAdminPage[];
2327
- /** Dashboard widgets */
2328
- adminWidgets?: PluginDashboardWidget[];
1848
+ setContextFactory(options: Partial<PluginContextFactoryOptions>): void;
2329
1849
  /**
2330
- * Capabilities the plugin requests.
2331
- * For standard-format plugins, capabilities are enforced in both trusted and
2332
- * sandboxed modes via the PluginContextFactory.
1850
+ * Get context for a plugin
2333
1851
  */
2334
- capabilities?: string[];
1852
+ private getContext;
2335
1853
  /**
2336
- * Allowed hosts for network:fetch capability
2337
- * Supports wildcards like "*.example.com"
1854
+ * Get typed hooks for a specific hook name.
1855
+ * The internal map stores ResolvedHook<unknown>, but we know each name
1856
+ * maps to a specific handler type via HookHandlerMap.
1857
+ *
1858
+ * Exclusive hooks that have a selected provider are filtered out — they
1859
+ * should only run via invokeExclusiveHook(), not in the regular pipeline.
2338
1860
  */
2339
- allowedHosts?: string[];
1861
+ private getTypedHooks;
2340
1862
  /**
2341
- * Storage collections the plugin declares
2342
- * Sandboxed plugins can only access declared collections.
1863
+ * Register all hooks from plugins.
1864
+ *
1865
+ * Registers each hook name individually to preserve type safety. The
1866
+ * internal map stores ResolvedHook<unknown> since it's keyed by string,
1867
+ * but getTypedHooks() restores the correct handler type on retrieval.
2343
1868
  */
2344
- storage?: Record<string, StorageCollectionDeclaration>;
2345
- }
2346
- /**
2347
- * Sandboxed plugin descriptor - same format as PluginDescriptor
2348
- *
2349
- * These run in isolated environments provided by the configured sandbox runner.
2350
- * The `entrypoint` is resolved to a file and bundled at build time.
2351
- */
2352
- type SandboxedPluginDescriptor<TOptions = Record<string, unknown>> = PluginDescriptor<TOptions>;
2353
- interface DinewayFontsConfig {
1869
+ private registerPlugins;
2354
1870
  /**
2355
- * Additional Noto Sans or compatible script families to include in the admin UI.
1871
+ * Maps hook names to the capability required to register them.
2356
1872
  *
2357
- * Use script names like "arabic", "farsi", "japanese", or "chinese-simplified".
1873
+ * Hooks not listed here have no capability requirement (e.g. lifecycle
1874
+ * hooks, cron). Any plugin declaring a listed hook without the required
1875
+ * capability will have that hook silently skipped at registration time.
2358
1876
  */
2359
- scripts?: string[];
2360
- }
2361
- interface DinewayConfig {
1877
+ private static readonly HOOK_REQUIRED_CAPABILITY;
2362
1878
  /**
2363
- * Database configuration
2364
- *
2365
- * Use one of the adapter functions:
2366
- * - `libsql({ url: process.env.DINEWAY_DATABASE_URL || "file:./data.db" })` - Default Node/libSQL path
2367
- * - `sqlite({ url: "file:./data.db" })` - Local SQLite only
2368
- * - `postgres({ connectionString: process.env.DATABASE_URL! })` - PostgreSQL deployments
2369
- *
2370
- * @example
2371
- * ```ts
2372
- * import { libsql } from "dineway/db";
2373
- *
2374
- * dineway({
2375
- * database: libsql({ url: process.env.DINEWAY_DATABASE_URL || "file:./data.db" }),
2376
- * })
2377
- * ```
1879
+ * Register a single plugin's hook by name
2378
1880
  */
2379
- database?: DatabaseDescriptor;
1881
+ private registerPluginHook;
2380
1882
  /**
2381
- * Storage configuration (for media)
1883
+ * Register a single hook
2382
1884
  */
2383
- storage?: StorageDescriptor;
1885
+ private registerHook;
2384
1886
  /**
2385
- * Trusted plugins to load (run in main isolate)
2386
- *
2387
- * @example
2388
- * ```ts
2389
- * import { auditLogPlugin } from "@dineway-ai/plugin-audit-log";
2390
- * import { webhookNotifierPlugin } from "@dineway-ai/plugin-webhook-notifier";
2391
- *
2392
- * dineway({
2393
- * plugins: [
2394
- * auditLogPlugin(),
2395
- * webhookNotifierPlugin({ url: "https://example.com/webhook" }),
2396
- * ],
2397
- * })
2398
- * ```
1887
+ * Sort hooks by priority and dependencies
2399
1888
  */
2400
- plugins?: PluginDescriptor[];
1889
+ private sortHooks;
2401
1890
  /**
2402
- * Sandboxed plugins to load (run behind the configured `SandboxRunner`)
2403
- *
2404
- * Uses the same format as `plugins`; the configured sandbox runner decides
2405
- * how isolation is enforced for the current runtime.
2406
- *
2407
- * @example
2408
- * ```ts
2409
- * import { untrustedPlugin } from "some-third-party-plugin";
2410
- *
2411
- * dineway({
2412
- * plugins: [trustedPlugin()], // runs in host
2413
- * sandboxed: [untrustedPlugin()], // runs in the default Node sandbox
2414
- * })
2415
- * ```
1891
+ * Execute a hook with timeout
2416
1892
  */
2417
- sandboxed?: SandboxedPluginDescriptor[];
1893
+ private executeWithTimeout;
2418
1894
  /**
2419
- * Optional module that exports a custom sandbox runner factory.
2420
- * When omitted, Dineway uses its built-in Node sandbox runner.
2421
- *
2422
- * @example
2423
- * ```ts
2424
- * import { createNodeSandboxRunner } from "dineway";
2425
- *
2426
- * export const createSandboxRunner = createNodeSandboxRunner;
2427
- * ```
2428
- *
2429
- * @example
2430
- * ```ts
2431
- * dineway({
2432
- * sandboxRunner: "./src/sandbox-runner.ts",
2433
- * })
2434
- * ```
1895
+ * Run plugin:install hooks
2435
1896
  */
2436
- sandboxRunner?: string;
1897
+ runPluginInstall(pluginId: string): Promise<HookResult<void>[]>;
2437
1898
  /**
2438
- * Authentication configuration
2439
- *
2440
- * Use an auth descriptor or an adapter function from a provider package.
2441
- *
2442
- * When an external auth provider is configured, passkey auth is disabled.
2443
- *
2444
- * @example
2445
- * ```ts
2446
- * dineway({
2447
- * auth: {
2448
- * type: "header-auth",
2449
- * entrypoint: "./src/header-auth.ts",
2450
- * config: {
2451
- * userHeader: "x-forwarded-user-email",
2452
- * roleHeader: "x-forwarded-user-role",
2453
- * },
2454
- * },
2455
- * })
2456
- * ```
1899
+ * Run plugin:activate hooks
2457
1900
  */
2458
- auth?: AuthDescriptor;
1901
+ runPluginActivate(pluginId: string): Promise<HookResult<void>[]>;
2459
1902
  /**
2460
- * MCP (Model Context Protocol) server endpoint.
2461
- *
2462
- * Exposes an MCP Streamable HTTP server at `/_dineway/api/mcp`
2463
- * that allows AI agents and tools to interact with the CMS using
2464
- * the standardized MCP protocol.
2465
- *
2466
- * Enabled by default. The endpoint requires bearer token auth, so
2467
- * it has no practical effect unless the user creates an API token
2468
- * or configures an OAuth client. Set to `false` to disable.
2469
- *
2470
- * @default true
2471
- *
2472
- * @example
2473
- * ```ts
2474
- * dineway({
2475
- * mcp: false,
2476
- * })
2477
- * ```
1903
+ * Run plugin:deactivate hooks
2478
1904
  */
2479
- mcp?: boolean;
1905
+ runPluginDeactivate(pluginId: string): Promise<HookResult<void>[]>;
2480
1906
  /**
2481
- * Plugin marketplace URL
2482
- *
2483
- * When set, enables the marketplace features: browse, install, update,
2484
- * and uninstall plugins from a remote marketplace.
2485
- *
2486
- * Must be an HTTPS URL in production, or localhost/127.0.0.1 in dev.
2487
- * Marketplace plugins run in the built-in Node sandbox runner unless
2488
- * `sandboxRunner` is set to override it.
2489
- *
2490
- * @example
2491
- * ```ts
2492
- * dineway({
2493
- * marketplace: "https://marketplace.example.com",
2494
- * })
2495
- * ```
1907
+ * Run plugin:uninstall hooks
2496
1908
  */
2497
- marketplace?: string;
1909
+ runPluginUninstall(pluginId: string, deleteData: boolean): Promise<HookResult<void>[]>;
1910
+ private runLifecycleHook;
2498
1911
  /**
2499
- * Maximum allowed media file upload size in bytes.
2500
- *
2501
- * Applies to both direct multipart uploads and signed-URL uploads.
2502
- * When omitted, Dineway defaults to 52_428_800 (50 MB).
2503
- *
2504
- * @example
2505
- * ```ts
2506
- * dineway({ maxUploadSize: 100 * 1024 * 1024 }) // 100 MB
2507
- * ```
1912
+ * Run content:beforeSave hooks
1913
+ * Returns modified content from the pipeline
2508
1914
  */
2509
- maxUploadSize?: number;
1915
+ runContentBeforeSave(content: Record<string, unknown>, collection: string, isNew: boolean): Promise<{
1916
+ content: Record<string, unknown>;
1917
+ results: HookResult<Record<string, unknown>>[];
1918
+ }>;
2510
1919
  /**
2511
- * Admin UI branding.
2512
- *
2513
- * Use this to customize the logo, name, and favicon shown in the
2514
- * Dineway admin panel without changing public site identity settings.
2515
- *
2516
- * @example
2517
- * ```ts
2518
- * dineway({
2519
- * admin: {
2520
- * logo: "/images/agency-logo.svg",
2521
- * siteName: "Agency Console",
2522
- * favicon: "/agency-favicon.ico",
2523
- * },
2524
- * })
2525
- * ```
1920
+ * Run content:afterSave hooks
2526
1921
  */
2527
- admin?: {
2528
- /** URL or path to a custom logo image for the admin UI. */logo?: string; /** Custom name displayed in the admin sidebar and browser tab. */
2529
- siteName?: string; /** URL or path to a custom favicon for the admin panel. */
2530
- favicon?: string;
2531
- };
1922
+ runContentAfterSave(content: Record<string, unknown>, collection: string, isNew: boolean): Promise<HookResult<void>[]>;
2532
1923
  /**
2533
- * Admin UI font configuration.
2534
- *
2535
- * By default, Dineway uses the Astro Font API to load Noto Sans at
2536
- * build time and self-host the generated font files. Set to false to
2537
- * disable Dineway-managed fonts and use system fonts.
2538
- *
2539
- * @example
2540
- * ```ts
2541
- * dineway({
2542
- * fonts: {
2543
- * scripts: ["arabic", "farsi", "japanese"],
2544
- * },
2545
- * })
2546
- * ```
1924
+ * Run content:beforeDelete hooks
1925
+ * Returns whether deletion is allowed
2547
1926
  */
2548
- fonts?: false | DinewayFontsConfig;
1927
+ runContentBeforeDelete(id: string, collection: string): Promise<{
1928
+ allowed: boolean;
1929
+ results: HookResult<boolean>[];
1930
+ }>;
2549
1931
  /**
2550
- * Public browser-facing origin for the site.
2551
- *
2552
- * Use when `Astro.url` / `request.url` do not match what users open — common with a
2553
- * **TLS-terminating reverse proxy**: the app often sees `http://` on the internal hop
2554
- * while the browser uses `https://`, which breaks WebAuthn, CSRF, OAuth, and redirect URLs.
1932
+ * Run content:afterDelete hooks
1933
+ */
1934
+ runContentAfterDelete(id: string, collection: string, permanent: boolean): Promise<HookResult<void>[]>;
1935
+ /**
1936
+ * Run content:afterPublish hooks (fire-and-forget).
1937
+ */
1938
+ runContentAfterPublish(content: Record<string, unknown>, collection: string): Promise<HookResult<void>[]>;
1939
+ /**
1940
+ * Run content:afterUnpublish hooks (fire-and-forget).
1941
+ */
1942
+ runContentAfterUnpublish(content: Record<string, unknown>, collection: string): Promise<HookResult<void>[]>;
1943
+ /**
1944
+ * Run media:beforeUpload hooks
1945
+ */
1946
+ runMediaBeforeUpload(file: {
1947
+ name: string;
1948
+ type: string;
1949
+ size: number;
1950
+ }): Promise<{
1951
+ file: {
1952
+ name: string;
1953
+ type: string;
1954
+ size: number;
1955
+ };
1956
+ results: HookResult<{
1957
+ name: string;
1958
+ type: string;
1959
+ size: number;
1960
+ }>[];
1961
+ }>;
1962
+ /**
1963
+ * Run media:afterUpload hooks
1964
+ */
1965
+ runMediaAfterUpload(media: {
1966
+ id: string;
1967
+ filename: string;
1968
+ mimeType: string;
1969
+ size: number | null;
1970
+ url: string;
1971
+ createdAt: string;
1972
+ }): Promise<HookResult<void>[]>;
1973
+ /**
1974
+ * Invoke the cron hook for a specific plugin.
2555
1975
  *
2556
- * Set to the full origin users type in the address bar (no path), e.g.
2557
- * `https://mysite.example.com`. When not set, falls back to environment variables
2558
- * `DINEWAY_SITE_URL` > `SITE_URL`, then to the request URL's origin.
1976
+ * Unlike other hooks which broadcast to all plugins, the cron hook is
1977
+ * dispatched only to the target plugin the one that owns the task.
1978
+ */
1979
+ invokeCronHook(pluginId: string, event: CronEvent): Promise<HookResult<void>>;
1980
+ /**
1981
+ * Run email:beforeSend hooks (middleware pipeline).
2559
1982
  *
2560
- * Replaces `passkeyPublicOrigin` (which only fixed passkeys).
1983
+ * Each handler receives the message and returns a modified message or
1984
+ * `false` to cancel delivery. The pipeline chains message transformations —
1985
+ * each handler receives the output of the previous one.
2561
1986
  */
2562
- siteUrl?: string;
1987
+ runEmailBeforeSend(message: EmailMessage, source: string): Promise<{
1988
+ message: EmailMessage | false;
1989
+ results: HookResult<EmailMessage | false>[];
1990
+ }>;
2563
1991
  /**
2564
- * Reverse-proxy headers that Dineway may trust for client IP resolution.
1992
+ * Run email:afterSend hooks (fire-and-forget).
2565
1993
  *
2566
- * Defaults to no trusted headers. Set this only when Dineway is deployed
2567
- * behind a reverse proxy you control and that proxy strips or overwrites
2568
- * incoming client-supplied copies of these headers.
1994
+ * Errors are logged but don't propagate they don't affect the caller.
1995
+ */
1996
+ runEmailAfterSend(message: EmailMessage, source: string): Promise<HookResult<void>[]>;
1997
+ /**
1998
+ * Run comment:beforeCreate hooks (middleware pipeline).
2569
1999
  *
2570
- * When omitted, Dineway falls back to `DINEWAY_TRUSTED_PROXY_HEADERS`.
2000
+ * Each handler receives the event and returns a modified event or
2001
+ * `false` to reject the comment. The pipeline chains transformations —
2002
+ * each handler receives the output of the previous one.
2003
+ */
2004
+ runCommentBeforeCreate(event: CommentBeforeCreateEvent): Promise<CommentBeforeCreateEvent | false>;
2005
+ /**
2006
+ * Run comment:afterCreate hooks (fire-and-forget).
2571
2007
  *
2572
- * @example
2573
- * ```ts
2574
- * dineway({
2575
- * trustedProxyHeaders: ["x-real-ip", "x-forwarded-for"],
2576
- * })
2577
- * ```
2008
+ * Errors are logged but don't propagate — they don't affect the caller.
2578
2009
  */
2579
- trustedProxyHeaders?: string[];
2010
+ runCommentAfterCreate(event: CommentAfterCreateEvent): Promise<void>;
2580
2011
  /**
2581
- * Enable playground mode for ephemeral "try Dineway" sites.
2012
+ * Run comment:afterModerate hooks (fire-and-forget).
2582
2013
  *
2583
- * When set, the integration injects a playground middleware (order: "pre")
2584
- * that runs BEFORE the normal Dineway middleware chain. It creates an
2585
- * isolated session database per visitor, runs migrations, applies the
2586
- * seed, creates an anonymous admin user, and stashes the request-scoped
2587
- * database on locals so the runtime and request-context middleware can
2588
- * pick it up.
2589
- *
2590
- * Setup and auth middleware are skipped because the playground middleware
2591
- * handles bootstrap and user injection.
2592
- *
2593
- * For the first portable release, playground sidecars are explicitly
2594
- * single-instance only.
2595
- *
2596
- * @example
2597
- * ```ts
2598
- * import { fileURLToPath } from "node:url";
2599
- * import { libsql } from "dineway/db";
2600
- *
2601
- * dineway({
2602
- * database: libsql({ url: process.env.DINEWAY_DATABASE_URL || "file:./playground.db" }),
2603
- * playground: {
2604
- * middlewareEntrypoint: fileURLToPath(
2605
- * new URL("./src/playground-middleware.ts", import.meta.url)
2606
- * ),
2607
- * },
2608
- * })
2609
- * ```
2014
+ * Errors are logged but don't propagate they don't affect the caller.
2610
2015
  */
2611
- playground?: {
2612
- /** Module path for the playground middleware. */middlewareEntrypoint: string;
2613
- };
2016
+ runCommentAfterModerate(event: CommentAfterModerateEvent): Promise<void>;
2614
2017
  /**
2615
- * Media providers for browsing and uploading media
2616
- *
2617
- * The local media provider (using storage adapter) is available by default.
2618
- * Additional providers can be added for external services like Unsplash,
2619
- * Cloudinary, Mux, and other provider packages.
2620
- *
2621
- * @example
2622
- * ```ts
2623
- * import { unsplash } from "@dineway-ai/provider-unsplash";
2624
- *
2625
- * dineway({
2626
- * mediaProviders: [
2627
- * unsplash({ accessKey: "..." }),
2628
- * ],
2629
- * })
2630
- * ```
2018
+ * Run page:metadata hooks. Each handler returns contributions that are
2019
+ * merged by the metadata collector. Errors are logged but don't propagate.
2631
2020
  */
2632
- mediaProviders?: MediaProviderDescriptor[];
2633
- }
2634
- /**
2635
- * Get stored config from global
2636
- * This is set by the virtual module at build time
2637
- */
2638
- declare function getStoredConfig(): DinewayConfig | null;
2639
- declare global {
2640
- var __dinewayConfig: DinewayConfig | undefined;
2641
- }
2642
- //#endregion
2643
- //#region src/plugins/manifest-schema.d.ts
2644
- /**
2645
- * Zod schema matching the PluginManifest interface from types.ts.
2646
- *
2647
- * Every JSON.parse of a manifest.json should validate through this.
2648
- */
2649
- declare const pluginManifestSchema: z$1.ZodObject<{
2650
- id: z$1.ZodString;
2651
- version: z$1.ZodString;
2652
- capabilities: z$1.ZodArray<z$1.ZodEnum<{
2653
- "network:fetch": "network:fetch";
2654
- "network:fetch:any": "network:fetch:any";
2655
- "read:content": "read:content";
2656
- "write:content": "write:content";
2657
- "read:media": "read:media";
2658
- "write:media": "write:media";
2659
- "read:users": "read:users";
2660
- "email:send": "email:send";
2661
- "email:provide": "email:provide";
2662
- "email:intercept": "email:intercept";
2663
- "page:inject": "page:inject";
2021
+ runPageMetadata(event: PageMetadataEvent): Promise<Array<{
2022
+ pluginId: string;
2023
+ contributions: PageMetadataContribution[];
2664
2024
  }>>;
2665
- allowedHosts: z$1.ZodArray<z$1.ZodString>;
2666
- storage: z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
2667
- indexes: z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>;
2668
- uniqueIndexes: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodArray<z$1.ZodString>]>>>;
2669
- }, z$1.core.$strip>>;
2670
- hooks: z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodEnum<{
2671
- "plugin:install": "plugin:install";
2672
- "plugin:activate": "plugin:activate";
2673
- "plugin:deactivate": "plugin:deactivate";
2674
- "plugin:uninstall": "plugin:uninstall";
2675
- "content:beforeSave": "content:beforeSave";
2676
- "content:afterSave": "content:afterSave";
2677
- "content:beforeDelete": "content:beforeDelete";
2678
- "content:afterDelete": "content:afterDelete";
2679
- "content:afterPublish": "content:afterPublish";
2680
- "content:afterUnpublish": "content:afterUnpublish";
2681
- "media:beforeUpload": "media:beforeUpload";
2682
- "media:afterUpload": "media:afterUpload";
2683
- cron: "cron";
2684
- "email:beforeSend": "email:beforeSend";
2685
- "email:deliver": "email:deliver";
2686
- "email:afterSend": "email:afterSend";
2687
- "comment:beforeCreate": "comment:beforeCreate";
2688
- "comment:moderate": "comment:moderate";
2689
- "comment:afterCreate": "comment:afterCreate";
2690
- "comment:afterModerate": "comment:afterModerate";
2691
- "page:metadata": "page:metadata";
2692
- "page:fragments": "page:fragments";
2693
- }>, z$1.ZodObject<{
2694
- name: z$1.ZodEnum<{
2695
- "plugin:install": "plugin:install";
2696
- "plugin:activate": "plugin:activate";
2697
- "plugin:deactivate": "plugin:deactivate";
2698
- "plugin:uninstall": "plugin:uninstall";
2699
- "content:beforeSave": "content:beforeSave";
2700
- "content:afterSave": "content:afterSave";
2701
- "content:beforeDelete": "content:beforeDelete";
2702
- "content:afterDelete": "content:afterDelete";
2703
- "content:afterPublish": "content:afterPublish";
2704
- "content:afterUnpublish": "content:afterUnpublish";
2705
- "media:beforeUpload": "media:beforeUpload";
2706
- "media:afterUpload": "media:afterUpload";
2707
- cron: "cron";
2708
- "email:beforeSend": "email:beforeSend";
2709
- "email:deliver": "email:deliver";
2710
- "email:afterSend": "email:afterSend";
2711
- "comment:beforeCreate": "comment:beforeCreate";
2712
- "comment:moderate": "comment:moderate";
2713
- "comment:afterCreate": "comment:afterCreate";
2714
- "comment:afterModerate": "comment:afterModerate";
2715
- "page:metadata": "page:metadata";
2716
- "page:fragments": "page:fragments";
2717
- }>;
2718
- exclusive: z$1.ZodOptional<z$1.ZodBoolean>;
2719
- priority: z$1.ZodOptional<z$1.ZodNumber>;
2720
- timeout: z$1.ZodOptional<z$1.ZodNumber>;
2721
- }, z$1.core.$strip>]>>;
2722
- routes: z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
2723
- name: z$1.ZodString;
2724
- public: z$1.ZodOptional<z$1.ZodBoolean>;
2725
- }, z$1.core.$strip>]>>;
2726
- admin: z$1.ZodObject<{
2727
- entry: z$1.ZodOptional<z$1.ZodString>;
2728
- settingsSchema: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
2729
- type: z$1.ZodLiteral<"string">;
2730
- default: z$1.ZodOptional<z$1.ZodString>;
2731
- multiline: z$1.ZodOptional<z$1.ZodBoolean>;
2732
- label: z$1.ZodString;
2733
- description: z$1.ZodOptional<z$1.ZodString>;
2734
- }, z$1.core.$strip>, z$1.ZodObject<{
2735
- type: z$1.ZodLiteral<"number">;
2736
- default: z$1.ZodOptional<z$1.ZodNumber>;
2737
- min: z$1.ZodOptional<z$1.ZodNumber>;
2738
- max: z$1.ZodOptional<z$1.ZodNumber>;
2739
- label: z$1.ZodString;
2740
- description: z$1.ZodOptional<z$1.ZodString>;
2741
- }, z$1.core.$strip>, z$1.ZodObject<{
2742
- type: z$1.ZodLiteral<"boolean">;
2743
- default: z$1.ZodOptional<z$1.ZodBoolean>;
2744
- label: z$1.ZodString;
2745
- description: z$1.ZodOptional<z$1.ZodString>;
2746
- }, z$1.core.$strip>, z$1.ZodObject<{
2747
- type: z$1.ZodLiteral<"select">;
2748
- options: z$1.ZodArray<z$1.ZodObject<{
2749
- value: z$1.ZodString;
2750
- label: z$1.ZodString;
2751
- }, z$1.core.$strip>>;
2752
- default: z$1.ZodOptional<z$1.ZodString>;
2753
- label: z$1.ZodString;
2754
- description: z$1.ZodOptional<z$1.ZodString>;
2755
- }, z$1.core.$strip>, z$1.ZodObject<{
2756
- type: z$1.ZodLiteral<"secret">;
2757
- label: z$1.ZodString;
2758
- description: z$1.ZodOptional<z$1.ZodString>;
2759
- }, z$1.core.$strip>], "type">>>;
2760
- pages: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2761
- path: z$1.ZodString;
2762
- label: z$1.ZodString;
2763
- icon: z$1.ZodOptional<z$1.ZodString>;
2764
- }, z$1.core.$strip>>>;
2765
- widgets: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2766
- id: z$1.ZodString;
2767
- size: z$1.ZodOptional<z$1.ZodEnum<{
2768
- full: "full";
2769
- half: "half";
2770
- third: "third";
2771
- }>>;
2772
- title: z$1.ZodOptional<z$1.ZodString>;
2773
- }, z$1.core.$strip>>>;
2774
- fieldWidgets: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2775
- name: z$1.ZodString;
2776
- label: z$1.ZodString;
2777
- fieldTypes: z$1.ZodArray<z$1.ZodEnum<{
2778
- string: "string";
2779
- number: "number";
2780
- boolean: "boolean";
2781
- text: "text";
2782
- integer: "integer";
2783
- datetime: "datetime";
2784
- select: "select";
2785
- multiSelect: "multiSelect";
2786
- portableText: "portableText";
2787
- image: "image";
2788
- file: "file";
2789
- reference: "reference";
2790
- json: "json";
2791
- slug: "slug";
2792
- repeater: "repeater";
2793
- }>>;
2794
- elements: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
2795
- type: z$1.ZodString;
2796
- action_id: z$1.ZodString;
2797
- label: z$1.ZodOptional<z$1.ZodString>;
2798
- }, z$1.core.$loose>>>;
2799
- }, z$1.core.$strip>>>;
2800
- }, z$1.core.$strip>;
2801
- }, z$1.core.$strip>;
2802
- type ValidatedPluginManifest = z$1.infer<typeof pluginManifestSchema>;
2803
- //#endregion
2804
- //#region src/plugins/hooks.d.ts
2805
- type HookNameV2 = "plugin:install" | "plugin:activate" | "plugin:deactivate" | "plugin:uninstall" | "content:beforeSave" | "content:afterSave" | "content:beforeDelete" | "content:afterDelete" | "content:afterPublish" | "content:afterUnpublish" | "media:beforeUpload" | "media:afterUpload" | "cron" | "email:beforeSend" | "email:deliver" | "email:afterSend" | "comment:beforeCreate" | "comment:moderate" | "comment:afterCreate" | "comment:afterModerate" | "page:metadata" | "page:fragments";
2806
- /**
2807
- * Hook execution result
2808
- */
2809
- interface HookResult<T> {
2810
- success: boolean;
2811
- value?: T;
2812
- error?: Error;
2813
- pluginId: string;
2814
- duration: number;
2815
- }
2816
- /**
2817
- * Hook pipeline for executing hooks in order
2818
- */
2819
- declare class HookPipeline {
2820
- private hooks;
2821
- private pluginMap;
2822
- private contextFactory;
2823
- /** Stored so setContextFactory can merge incrementally. */
2824
- private contextFactoryOptions;
2825
- /** Hook names where at least one handler declared exclusive: true */
2826
- private exclusiveHookNames;
2827
- /**
2828
- * Selected provider plugin ID for each exclusive hook.
2829
- * Set by the PluginManager after resolution.
2830
- */
2831
- private exclusiveSelections;
2832
- constructor(plugins: ResolvedPlugin[], factoryOptions?: PluginContextFactoryOptions);
2833
- /**
2834
- * Set or update the context factory options.
2835
- *
2836
- * When called on a pipeline that already has a factory, the new options
2837
- * are merged on top of the existing ones so that callers don't need to
2838
- * repeat every field (e.g. adding `cronReschedule` without losing
2839
- * `storage` / `getUploadUrl`).
2840
- */
2841
- setContextFactory(options: Partial<PluginContextFactoryOptions>): void;
2842
- /**
2843
- * Get context for a plugin
2844
- */
2845
- private getContext;
2846
- /**
2847
- * Get typed hooks for a specific hook name.
2848
- * The internal map stores ResolvedHook<unknown>, but we know each name
2849
- * maps to a specific handler type via HookHandlerMap.
2850
- *
2851
- * Exclusive hooks that have a selected provider are filtered out — they
2852
- * should only run via invokeExclusiveHook(), not in the regular pipeline.
2853
- */
2854
- private getTypedHooks;
2855
- /**
2856
- * Register all hooks from plugins.
2857
- *
2858
- * Registers each hook name individually to preserve type safety. The
2859
- * internal map stores ResolvedHook<unknown> since it's keyed by string,
2860
- * but getTypedHooks() restores the correct handler type on retrieval.
2861
- */
2862
- private registerPlugins;
2863
2025
  /**
2864
- * Maps hook names to the capability required to register them.
2865
- *
2866
- * Hooks not listed here have no capability requirement (e.g. lifecycle
2867
- * hooks, cron). Any plugin declaring a listed hook without the required
2868
- * capability will have that hook silently skipped at registration time.
2026
+ * Run page:fragments hooks. Only trusted plugins should be registered
2027
+ * for this hook. Errors are logged but don't propagate.
2869
2028
  */
2870
- private static readonly HOOK_REQUIRED_CAPABILITY;
2029
+ runPageFragments(event: PageFragmentEvent): Promise<Array<{
2030
+ pluginId: string;
2031
+ contributions: PageFragmentContribution[];
2032
+ }>>;
2871
2033
  /**
2872
- * Register a single plugin's hook by name
2034
+ * Check if any hooks are registered for a given name
2873
2035
  */
2874
- private registerPluginHook;
2036
+ hasHooks(name: HookNameV2): boolean;
2875
2037
  /**
2876
- * Register a single hook
2038
+ * Get hook count for debugging
2877
2039
  */
2878
- private registerHook;
2040
+ getHookCount(name: HookNameV2): number;
2879
2041
  /**
2880
- * Sort hooks by priority and dependencies
2042
+ * Get all registered hook names
2881
2043
  */
2882
- private sortHooks;
2044
+ getRegisteredHooks(): HookNameV2[];
2883
2045
  /**
2884
- * Execute a hook with timeout
2046
+ * Returns hook names where at least one handler declared exclusive: true
2885
2047
  */
2886
- private executeWithTimeout;
2048
+ getRegisteredExclusiveHooks(): string[];
2887
2049
  /**
2888
- * Run plugin:install hooks
2050
+ * Check if a hook is exclusive
2889
2051
  */
2890
- runPluginInstall(pluginId: string): Promise<HookResult<void>[]>;
2052
+ isExclusiveHook(name: string): boolean;
2891
2053
  /**
2892
- * Run plugin:activate hooks
2054
+ * Set the selected provider for an exclusive hook.
2055
+ * Called by PluginManager after resolution.
2893
2056
  */
2894
- runPluginActivate(pluginId: string): Promise<HookResult<void>[]>;
2057
+ setExclusiveSelection(hookName: string, pluginId: string): void;
2895
2058
  /**
2896
- * Run plugin:deactivate hooks
2059
+ * Clear the selected provider for an exclusive hook.
2897
2060
  */
2898
- runPluginDeactivate(pluginId: string): Promise<HookResult<void>[]>;
2061
+ clearExclusiveSelection(hookName: string): void;
2899
2062
  /**
2900
- * Run plugin:uninstall hooks
2063
+ * Get the selected provider for an exclusive hook (if any).
2901
2064
  */
2902
- runPluginUninstall(pluginId: string, deleteData: boolean): Promise<HookResult<void>[]>;
2903
- private runLifecycleHook;
2065
+ getExclusiveSelection(hookName: string): string | undefined;
2904
2066
  /**
2905
- * Run content:beforeSave hooks
2906
- * Returns modified content from the pipeline
2067
+ * Get all plugins that registered a handler for a given exclusive hook.
2907
2068
  */
2908
- runContentBeforeSave(content: Record<string, unknown>, collection: string, isNew: boolean): Promise<{
2909
- content: Record<string, unknown>;
2910
- results: HookResult<Record<string, unknown>>[];
2069
+ getExclusiveHookProviders(hookName: string): Array<{
2070
+ pluginId: string;
2911
2071
  }>;
2912
2072
  /**
2913
- * Run content:afterSave hooks
2914
- */
2915
- runContentAfterSave(content: Record<string, unknown>, collection: string, isNew: boolean): Promise<HookResult<void>[]>;
2916
- /**
2917
- * Run content:beforeDelete hooks
2918
- * Returns whether deletion is allowed
2073
+ * Get all plugins that registered a non-exclusive handler for a given hook,
2074
+ * preserving priority order. This partitions with getExclusiveHookProviders().
2919
2075
  */
2920
- runContentBeforeDelete(id: string, collection: string): Promise<{
2921
- allowed: boolean;
2922
- results: HookResult<boolean>[];
2923
- }>;
2924
- /**
2925
- * Run content:afterDelete hooks
2926
- */
2927
- runContentAfterDelete(id: string, collection: string, permanent: boolean): Promise<HookResult<void>[]>;
2928
- /**
2929
- * Run content:afterPublish hooks (fire-and-forget).
2930
- */
2931
- runContentAfterPublish(content: Record<string, unknown>, collection: string): Promise<HookResult<void>[]>;
2932
- /**
2933
- * Run content:afterUnpublish hooks (fire-and-forget).
2934
- */
2935
- runContentAfterUnpublish(content: Record<string, unknown>, collection: string): Promise<HookResult<void>[]>;
2936
- /**
2937
- * Run media:beforeUpload hooks
2938
- */
2939
- runMediaBeforeUpload(file: {
2940
- name: string;
2941
- type: string;
2942
- size: number;
2943
- }): Promise<{
2944
- file: {
2945
- name: string;
2946
- type: string;
2947
- size: number;
2948
- };
2949
- results: HookResult<{
2950
- name: string;
2951
- type: string;
2952
- size: number;
2953
- }>[];
2954
- }>;
2955
- /**
2956
- * Run media:afterUpload hooks
2957
- */
2958
- runMediaAfterUpload(media: {
2959
- id: string;
2960
- filename: string;
2961
- mimeType: string;
2962
- size: number | null;
2963
- url: string;
2964
- createdAt: string;
2965
- }): Promise<HookResult<void>[]>;
2966
- /**
2967
- * Invoke the cron hook for a specific plugin.
2968
- *
2969
- * Unlike other hooks which broadcast to all plugins, the cron hook is
2970
- * dispatched only to the target plugin — the one that owns the task.
2971
- */
2972
- invokeCronHook(pluginId: string, event: CronEvent): Promise<HookResult<void>>;
2973
- /**
2974
- * Run email:beforeSend hooks (middleware pipeline).
2975
- *
2976
- * Each handler receives the message and returns a modified message or
2977
- * `false` to cancel delivery. The pipeline chains message transformations —
2978
- * each handler receives the output of the previous one.
2979
- */
2980
- runEmailBeforeSend(message: EmailMessage, source: string): Promise<{
2981
- message: EmailMessage | false;
2982
- results: HookResult<EmailMessage | false>[];
2983
- }>;
2984
- /**
2985
- * Run email:afterSend hooks (fire-and-forget).
2986
- *
2987
- * Errors are logged but don't propagate — they don't affect the caller.
2988
- */
2989
- runEmailAfterSend(message: EmailMessage, source: string): Promise<HookResult<void>[]>;
2990
- /**
2991
- * Run comment:beforeCreate hooks (middleware pipeline).
2992
- *
2993
- * Each handler receives the event and returns a modified event or
2994
- * `false` to reject the comment. The pipeline chains transformations —
2995
- * each handler receives the output of the previous one.
2996
- */
2997
- runCommentBeforeCreate(event: CommentBeforeCreateEvent): Promise<CommentBeforeCreateEvent | false>;
2998
- /**
2999
- * Run comment:afterCreate hooks (fire-and-forget).
3000
- *
3001
- * Errors are logged but don't propagate — they don't affect the caller.
3002
- */
3003
- runCommentAfterCreate(event: CommentAfterCreateEvent): Promise<void>;
3004
- /**
3005
- * Run comment:afterModerate hooks (fire-and-forget).
3006
- *
3007
- * Errors are logged but don't propagate — they don't affect the caller.
3008
- */
3009
- runCommentAfterModerate(event: CommentAfterModerateEvent): Promise<void>;
3010
- /**
3011
- * Run page:metadata hooks. Each handler returns contributions that are
3012
- * merged by the metadata collector. Errors are logged but don't propagate.
3013
- */
3014
- runPageMetadata(event: PageMetadataEvent): Promise<Array<{
3015
- pluginId: string;
3016
- contributions: PageMetadataContribution[];
3017
- }>>;
3018
- /**
3019
- * Run page:fragments hooks. Only trusted plugins should be registered
3020
- * for this hook. Errors are logged but don't propagate.
3021
- */
3022
- runPageFragments(event: PageFragmentEvent): Promise<Array<{
3023
- pluginId: string;
3024
- contributions: PageFragmentContribution[];
3025
- }>>;
3026
- /**
3027
- * Check if any hooks are registered for a given name
3028
- */
3029
- hasHooks(name: HookNameV2): boolean;
3030
- /**
3031
- * Get hook count for debugging
3032
- */
3033
- getHookCount(name: HookNameV2): number;
3034
- /**
3035
- * Get all registered hook names
3036
- */
3037
- getRegisteredHooks(): HookNameV2[];
3038
- /**
3039
- * Returns hook names where at least one handler declared exclusive: true
3040
- */
3041
- getRegisteredExclusiveHooks(): string[];
3042
- /**
3043
- * Check if a hook is exclusive
3044
- */
3045
- isExclusiveHook(name: string): boolean;
3046
- /**
3047
- * Set the selected provider for an exclusive hook.
3048
- * Called by PluginManager after resolution.
3049
- */
3050
- setExclusiveSelection(hookName: string, pluginId: string): void;
3051
- /**
3052
- * Clear the selected provider for an exclusive hook.
3053
- */
3054
- clearExclusiveSelection(hookName: string): void;
3055
- /**
3056
- * Get the selected provider for an exclusive hook (if any).
3057
- */
3058
- getExclusiveSelection(hookName: string): string | undefined;
3059
- /**
3060
- * Get all plugins that registered a handler for a given exclusive hook.
3061
- */
3062
- getExclusiveHookProviders(hookName: string): Array<{
3063
- pluginId: string;
2076
+ getHookProviders(hookName: string): Array<{
2077
+ pluginId: string;
3064
2078
  }>;
3065
2079
  /**
3066
2080
  * Invoke an exclusive hook — dispatch only to the selected provider.
@@ -3511,419 +2525,6 @@ declare class NodeSandboxRunner implements SandboxRunner {
3511
2525
  }
3512
2526
  declare function createNodeSandboxRunner(options: SandboxRunnerRuntimeOptions): SandboxRunner;
3513
2527
  //#endregion
3514
- //#region src/import/types.d.ts
3515
- /** Author info from WordPress */
3516
- interface WpAuthorInfo {
3517
- id?: number;
3518
- login?: string;
3519
- email?: string;
3520
- displayName?: string;
3521
- postCount: number;
3522
- }
3523
- /** File-based input (WXR upload) */
3524
- interface FileInput {
3525
- type: "file";
3526
- file: File;
3527
- }
3528
- /** URL-based input (REST API probe) */
3529
- interface UrlInput {
3530
- type: "url";
3531
- url: string;
3532
- /** Optional auth token for authenticated requests */
3533
- token?: string;
3534
- }
3535
- /** OAuth-based input (WordPress.com) */
3536
- interface OAuthInput {
3537
- type: "oauth";
3538
- url: string;
3539
- accessToken: string;
3540
- /** Site ID for WordPress.com */
3541
- siteId?: string;
3542
- }
3543
- type SourceInput = FileInput | UrlInput | OAuthInput;
3544
- /** Auth requirements for an import source */
3545
- interface SourceAuth {
3546
- type: "oauth" | "token" | "password" | "none";
3547
- /** OAuth provider identifier */
3548
- provider?: string;
3549
- /** OAuth authorization URL */
3550
- oauthUrl?: string;
3551
- /** Human-readable instructions */
3552
- instructions?: string;
3553
- }
3554
- /** What the source can provide */
3555
- interface SourceCapabilities {
3556
- /** Can fetch published content without auth */
3557
- publicContent: boolean;
3558
- /** Can fetch drafts/private (may need auth) */
3559
- privateContent: boolean;
3560
- /** Can fetch all custom post types */
3561
- customPostTypes: boolean;
3562
- /** Can fetch all meta fields */
3563
- allMeta: boolean;
3564
- /** Can stream media directly */
3565
- mediaStream: boolean;
3566
- }
3567
- /** Suggested next action after probe */
3568
- type SuggestedAction = {
3569
- type: "proceed";
3570
- } | {
3571
- type: "oauth";
3572
- url: string;
3573
- provider: string;
3574
- } | {
3575
- type: "upload";
3576
- instructions: string;
3577
- } | {
3578
- type: "install-plugin";
3579
- instructions: string;
3580
- };
3581
- /** Detected i18n/multilingual plugin info */
3582
- interface I18nDetection {
3583
- /** Multilingual plugin name (e.g. "wpml", "polylang") */
3584
- plugin: string;
3585
- /** BCP 47 default locale */
3586
- defaultLocale: string;
3587
- /** All configured locales */
3588
- locales: string[];
3589
- }
3590
- /** Result of probing a URL for a specific source */
3591
- interface SourceProbeResult {
3592
- /** Which source can handle this */
3593
- sourceId: string;
3594
- /** Confidence level */
3595
- confidence: "definite" | "likely" | "possible";
3596
- /** What we detected */
3597
- detected: {
3598
- platform: string;
3599
- version?: string;
3600
- siteTitle?: string;
3601
- siteUrl?: string;
3602
- };
3603
- /** What capabilities are available */
3604
- capabilities: SourceCapabilities;
3605
- /** What auth is needed, if any */
3606
- auth?: SourceAuth;
3607
- /** Suggested next step */
3608
- suggestedAction: SuggestedAction;
3609
- /** Preview data if available (e.g., post counts from REST API) */
3610
- preview?: {
3611
- posts?: number;
3612
- pages?: number;
3613
- media?: number;
3614
- };
3615
- /** Detected multilingual plugin. Absent when none detected. */
3616
- i18n?: I18nDetection;
3617
- }
3618
- /** Combined probe result from all sources */
3619
- interface ProbeResult {
3620
- url: string;
3621
- isWordPress: boolean;
3622
- /** Best matching source (highest confidence) */
3623
- bestMatch: SourceProbeResult | null;
3624
- /** All matching sources */
3625
- allMatches: SourceProbeResult[];
3626
- }
3627
- /** Field definition for import */
3628
- interface ImportFieldDef {
3629
- slug: string;
3630
- label: string;
3631
- type: string;
3632
- required: boolean;
3633
- searchable?: boolean;
3634
- }
3635
- /** Field compatibility with existing schema */
3636
- type FieldCompatibility = "compatible" | "type_mismatch" | "missing";
3637
- /** Schema status for a collection */
3638
- interface CollectionSchemaStatus {
3639
- exists: boolean;
3640
- fieldStatus: Record<string, {
3641
- status: FieldCompatibility;
3642
- existingType?: string;
3643
- requiredType: string;
3644
- }>;
3645
- canImport: boolean;
3646
- reason?: string;
3647
- }
3648
- /** Analysis of a single post type */
3649
- interface PostTypeAnalysis {
3650
- name: string;
3651
- count: number;
3652
- suggestedCollection: string;
3653
- requiredFields: ImportFieldDef[];
3654
- schemaStatus: CollectionSchemaStatus;
3655
- }
3656
- /** Attachment/media info */
3657
- interface AttachmentInfo {
3658
- id?: number;
3659
- title?: string;
3660
- url?: string;
3661
- filename?: string;
3662
- mimeType?: string;
3663
- alt?: string;
3664
- caption?: string;
3665
- width?: number;
3666
- height?: number;
3667
- }
3668
- /** Navigation menu analysis */
3669
- interface NavMenuAnalysis {
3670
- /** Menu name/slug */
3671
- name: string;
3672
- /** Menu display label */
3673
- label: string;
3674
- /** Number of items in this menu */
3675
- itemCount: number;
3676
- }
3677
- /** Custom taxonomy analysis */
3678
- interface TaxonomyAnalysis {
3679
- /** Taxonomy slug (e.g., 'genre', 'portfolio_category') */
3680
- slug: string;
3681
- /** Number of terms in this taxonomy */
3682
- termCount: number;
3683
- /** Sample term names */
3684
- sampleTerms: string[];
3685
- }
3686
- /** Reusable block analysis (wp_block post type) */
3687
- interface ReusableBlockAnalysis {
3688
- /** Original WP ID */
3689
- id: number;
3690
- /** Block title */
3691
- title: string;
3692
- /** Block slug */
3693
- slug: string;
3694
- }
3695
- /** Normalized analysis result - same format for all sources */
3696
- interface ImportAnalysis {
3697
- /** Source that produced this analysis */
3698
- sourceId: string;
3699
- site: {
3700
- title: string;
3701
- url: string;
3702
- };
3703
- postTypes: PostTypeAnalysis[];
3704
- attachments: {
3705
- count: number;
3706
- items: AttachmentInfo[];
3707
- };
3708
- categories: number;
3709
- tags: number;
3710
- authors: WpAuthorInfo[];
3711
- /** Navigation menus found in the export */
3712
- navMenus?: NavMenuAnalysis[];
3713
- /** Custom taxonomies (beyond categories/tags) */
3714
- customTaxonomies?: TaxonomyAnalysis[];
3715
- /** Reusable blocks (wp_block post type) - will be imported as sections */
3716
- reusableBlocks?: ReusableBlockAnalysis[];
3717
- /** Source-specific custom fields analysis */
3718
- customFields?: Array<{
3719
- key: string;
3720
- count: number;
3721
- samples: string[];
3722
- suggestedField: string;
3723
- suggestedType: "string" | "number" | "boolean" | "date" | "json";
3724
- isInternal: boolean;
3725
- }>;
3726
- /** Detected multilingual plugin. Absent when none detected. */
3727
- i18n?: I18nDetection;
3728
- }
3729
- /** Normalized content item - produced by all sources */
3730
- interface NormalizedItem {
3731
- /** Original ID from source */
3732
- sourceId: string | number;
3733
- /** WordPress post type */
3734
- postType: string;
3735
- /** Content status */
3736
- status: "publish" | "draft" | "pending" | "private" | "future";
3737
- /** URL slug */
3738
- slug: string;
3739
- /** Title */
3740
- title: string;
3741
- /** Content as Portable Text (already converted) */
3742
- content: PortableTextBlock[];
3743
- /** Excerpt/summary */
3744
- excerpt?: string;
3745
- /** Publication date */
3746
- date: Date;
3747
- /** Last modified date */
3748
- modified?: Date;
3749
- /** Author identifier */
3750
- author?: string;
3751
- /** Category slugs */
3752
- categories?: string[];
3753
- /** Tag slugs */
3754
- tags?: string[];
3755
- /** Custom meta fields */
3756
- meta?: Record<string, unknown>;
3757
- /** Featured image URL */
3758
- featuredImage?: string;
3759
- /** Parent post ID (for hierarchical content like pages) */
3760
- parentId?: string | number;
3761
- /** Menu order for sorting */
3762
- menuOrder?: number;
3763
- /** Custom taxonomy assignments beyond categories/tags */
3764
- customTaxonomies?: Record<string, string[]>;
3765
- /** BCP 47 locale code. When omitted, defaults to defaultLocale. */
3766
- locale?: string;
3767
- /**
3768
- * Source-side translation group ID (opaque string from the origin system).
3769
- * Items sharing the same translationGroup are linked as translations.
3770
- * Resolved to a Dineway translation_group ULID during execute.
3771
- */
3772
- translationGroup?: string;
3773
- }
3774
- /** Post type mapping configuration */
3775
- interface PostTypeMapping {
3776
- enabled: boolean;
3777
- collection: string;
3778
- }
3779
- /** Import configuration */
3780
- interface ImportConfig {
3781
- postTypeMappings: Record<string, PostTypeMapping>;
3782
- skipExisting?: boolean;
3783
- }
3784
- /** Options for fetching content */
3785
- interface FetchOptions {
3786
- /** Post types to fetch */
3787
- postTypes: string[];
3788
- /** Whether to include drafts */
3789
- includeDrafts?: boolean;
3790
- /** Limit number of items (for testing) */
3791
- limit?: number;
3792
- }
3793
- /** Import result */
3794
- interface ImportResult {
3795
- success: boolean;
3796
- imported: number;
3797
- skipped: number;
3798
- errors: Array<{
3799
- title: string;
3800
- error: string;
3801
- }>;
3802
- byCollection: Record<string, number>;
3803
- }
3804
- /**
3805
- * An import source provides content from an external system.
3806
- * All sources produce the same normalized analysis and content format.
3807
- */
3808
- interface ImportSource {
3809
- /** Unique identifier */
3810
- id: string;
3811
- /** Display name */
3812
- name: string;
3813
- /** Description for UI */
3814
- description: string;
3815
- /** Icon identifier */
3816
- icon: "upload" | "globe" | "wordpress" | "plug";
3817
- /** Whether this source requires a file upload */
3818
- requiresFile?: boolean;
3819
- /** Whether this source can probe URLs */
3820
- canProbe?: boolean;
3821
- /**
3822
- * Probe a URL to see if this source can handle it.
3823
- * Returns null if not applicable.
3824
- */
3825
- probe?(url: string): Promise<SourceProbeResult | null>;
3826
- /**
3827
- * Analyze content from this source.
3828
- * Returns normalized ImportAnalysis.
3829
- */
3830
- analyze(input: SourceInput, context: ImportContext): Promise<ImportAnalysis>;
3831
- /**
3832
- * Stream content items for import.
3833
- * Yields normalized content items.
3834
- */
3835
- fetchContent(input: SourceInput, options: FetchOptions): AsyncGenerator<NormalizedItem>;
3836
- /**
3837
- * Fetch a media item's data.
3838
- * Used for media import.
3839
- */
3840
- fetchMedia?(url: string, input: SourceInput): Promise<Blob>;
3841
- }
3842
- /** Context passed to import sources */
3843
- interface ImportContext {
3844
- /** Database connection for schema checks */
3845
- db?: unknown;
3846
- /** Function to check existing collections */
3847
- getExistingCollections?: () => Promise<Map<string, {
3848
- slug: string;
3849
- fields: Map<string, {
3850
- type: string;
3851
- }>;
3852
- }>>;
3853
- }
3854
- //#endregion
3855
- //#region src/import/sections.d.ts
3856
- /**
3857
- * Result of sections import operation
3858
- */
3859
- interface SectionsImportResult {
3860
- /** Number of sections created */
3861
- sectionsCreated: number;
3862
- /** Number of sections skipped (already exist) */
3863
- sectionsSkipped: number;
3864
- /** Errors encountered during import */
3865
- errors: Array<{
3866
- title: string;
3867
- error: string;
3868
- }>;
3869
- }
3870
- /**
3871
- * Import reusable blocks (wp_block post type) from WXR as sections
3872
- *
3873
- * @param posts - All posts from WXR (will filter to wp_block)
3874
- * @param db - Database connection
3875
- * @returns Import result with counts
3876
- */
3877
- declare function importReusableBlocksAsSections(posts: WxrPost[], db: Kysely<Database>): Promise<SectionsImportResult>;
3878
- //#endregion
3879
- //#region src/import/registry.d.ts
3880
- /**
3881
- * Register an import source
3882
- */
3883
- declare function registerSource(source: ImportSource): void;
3884
- /**
3885
- * Get a source by ID
3886
- */
3887
- declare function getSource(id: string): ImportSource | undefined;
3888
- /**
3889
- * Get all registered sources
3890
- */
3891
- declare function getAllSources(): ImportSource[];
3892
- /**
3893
- * Get sources that can handle file uploads
3894
- */
3895
- declare function getFileSources(): ImportSource[];
3896
- /**
3897
- * Get sources that can probe URLs
3898
- */
3899
- declare function getUrlSources(): ImportSource[];
3900
- /**
3901
- * Probe a URL against all registered sources
3902
- *
3903
- * Returns probe results sorted by confidence (definite > likely > possible)
3904
- */
3905
- declare function probeUrl(url: string): Promise<ProbeResult>;
3906
- /**
3907
- * Clear all registered sources (useful for testing)
3908
- */
3909
- declare function clearSources(): void;
3910
- //#endregion
3911
- //#region src/import/sources/wxr.d.ts
3912
- declare const wxrSource: ImportSource;
3913
- /**
3914
- * Parse a WXR date with the correct fallback chain:
3915
- * 1. GMT date (always UTC, most reliable)
3916
- * 2. pubDate (RFC 2822, includes timezone offset)
3917
- * 3. Site-local date (MySQL datetime without timezone, imprecise but best available)
3918
- *
3919
- * Returns undefined when none of the inputs yield a valid date.
3920
- * Callers that need a guaranteed Date should use `?? new Date()`.
3921
- */
3922
- declare function parseWxrDate(gmtDate: string | undefined, pubDate: string | undefined, localDate: string | undefined): Date | undefined;
3923
- //#endregion
3924
- //#region src/import/sources/wordpress-rest.d.ts
3925
- declare const wordpressRestSource: ImportSource;
3926
- //#endregion
3927
2528
  //#region src/preview/tokens.d.ts
3928
2529
  /**
3929
2530
  * Preview token generation and verification
@@ -4039,8 +2640,16 @@ interface GetPreviewUrlOptions {
4039
2640
  expiresIn?: string | number;
4040
2641
  /** Base URL of the site. If not provided, returns a relative URL. */
4041
2642
  baseUrl?: string;
4042
- /** Custom path pattern. Use {collection} and {id} as placeholders. Default: "/{collection}/{id}" */
2643
+ /**
2644
+ * Custom path pattern. Supports `{collection}`, `{id}`, and `{locale}` placeholders.
2645
+ * Default: "/{collection}/{id}".
2646
+ */
4043
2647
  pathPattern?: string;
2648
+ /**
2649
+ * Locale segment substituted for `{locale}`. Use an empty string to omit the
2650
+ * locale segment; adjacent slashes are collapsed.
2651
+ */
2652
+ locale?: string;
4044
2653
  }
4045
2654
  /**
4046
2655
  * Generate a preview URL for content
@@ -4166,227 +2775,7 @@ interface PreviewToolbarConfig {
4166
2775
  }
4167
2776
  declare function renderPreviewToolbar(config: PreviewToolbarConfig): string;
4168
2777
  //#endregion
4169
- //#region src/settings/index.d.ts
4170
- /**
4171
- * Get a single site setting by key
4172
- *
4173
- * Returns `undefined` if the setting has not been configured.
4174
- * For media settings (logo, favicon), the URL is resolved automatically.
4175
- *
4176
- * @param key - The setting key (e.g., "title", "logo", "social")
4177
- * @returns The setting value, or undefined if not set
4178
- *
4179
- * @example
4180
- * ```ts
4181
- * import { getSiteSetting } from "dineway";
4182
- *
4183
- * const title = await getSiteSetting("title");
4184
- * const logo = await getSiteSetting("logo");
4185
- * console.log(logo?.url); // Resolved URL
4186
- * ```
4187
- */
4188
- declare function getSiteSetting<K extends SiteSettingKey>(key: K): Promise<SiteSettings[K] | undefined>;
4189
- /**
4190
- * Get all site settings
4191
- *
4192
- * Returns all configured settings. Unset values are undefined.
4193
- * Media references (logo/favicon) are resolved to include URLs.
4194
- *
4195
- * @example
4196
- * ```ts
4197
- * import { getSiteSettings } from "dineway";
4198
- *
4199
- * const settings = await getSiteSettings();
4200
- * console.log(settings.title); // "My Site"
4201
- * console.log(settings.logo?.url); // "/_dineway/api/media/file/abc123"
4202
- * ```
4203
- */
4204
- declare function getSiteSettings(): Promise<Partial<SiteSettings>>;
4205
- /**
4206
- * Set site settings (internal function used by admin API)
4207
- *
4208
- * Merges provided settings with existing ones. Only provided fields are updated.
4209
- * Media references should include just the mediaId; URLs are resolved on read.
4210
- *
4211
- * @param settings - Partial settings object with values to update
4212
- * @param db - Kysely database instance
4213
- * @returns Promise that resolves when settings are saved
4214
- *
4215
- * @internal
4216
- *
4217
- * @example
4218
- * ```ts
4219
- * // Update multiple settings at once
4220
- * await setSiteSettings({
4221
- * title: "My Site",
4222
- * tagline: "Welcome",
4223
- * logo: { mediaId: "med_123", alt: "Logo" }
4224
- * }, db);
4225
- * ```
4226
- */
4227
- declare function setSiteSettings(settings: Partial<SiteSettings>, db: Kysely<Database>): Promise<void>;
4228
- /**
4229
- * Get a single plugin setting by key.
4230
- *
4231
- * Plugin settings are stored in the options table under
4232
- * `plugin:<pluginId>:settings:<key>`.
4233
- */
4234
- declare function getPluginSetting<T = unknown>(pluginId: string, key: string): Promise<T | undefined>;
4235
- /**
4236
- * Get all persisted plugin settings for a plugin.
4237
- *
4238
- * Defaults declared in `admin.settingsSchema` are not materialized
4239
- * automatically; callers should apply their own fallback defaults.
4240
- */
4241
- declare function getPluginSettings(pluginId: string): Promise<Record<string, unknown>>;
4242
- //#endregion
4243
- //#region src/comments/query.d.ts
4244
- interface GetCommentsOptions {
4245
- collection: string;
4246
- contentId: string;
4247
- threaded?: boolean;
4248
- }
4249
- interface GetCommentsResult {
4250
- items: PublicComment[];
4251
- total: number;
4252
- }
4253
- /**
4254
- * Get approved comments for a content item.
4255
- *
4256
- * @example
4257
- * ```ts
4258
- * import { getComments } from "dineway";
4259
- *
4260
- * const { items, total } = await getComments({
4261
- * collection: "posts",
4262
- * contentId: post.id,
4263
- * threaded: true,
4264
- * });
4265
- * ```
4266
- */
4267
- declare function getComments(options: GetCommentsOptions): Promise<GetCommentsResult>;
4268
- /**
4269
- * Get the count of approved comments for a content item.
4270
- *
4271
- * @example
4272
- * ```ts
4273
- * import { getCommentCount } from "dineway";
4274
- *
4275
- * const count = await getCommentCount("posts", post.id);
4276
- * ```
4277
- */
4278
- declare function getCommentCount(collection: string, contentId: string): Promise<number>;
4279
- //#endregion
4280
- //#region src/menus/types.d.ts
4281
- /**
4282
- * Menu item types
4283
- */
4284
- type MenuItemType = string;
4285
- /**
4286
- * Menu item as returned to templates (with resolved URL)
4287
- */
4288
- interface MenuItem {
4289
- id: string;
4290
- label: string;
4291
- url: string;
4292
- target?: string;
4293
- titleAttr?: string;
4294
- cssClasses?: string;
4295
- children: MenuItem[];
4296
- }
4297
- /**
4298
- * Menu as returned to templates
4299
- */
4300
- interface Menu {
4301
- id: string;
4302
- name: string;
4303
- label: string;
4304
- items: MenuItem[];
4305
- }
4306
- /**
4307
- * Input for creating a menu item
4308
- */
4309
- interface CreateMenuItemInput {
4310
- type: MenuItemType;
4311
- label: string;
4312
- referenceCollection?: string;
4313
- referenceId?: string;
4314
- customUrl?: string;
4315
- target?: string;
4316
- titleAttr?: string;
4317
- cssClasses?: string;
4318
- parentId?: string;
4319
- sortOrder?: number;
4320
- }
4321
- /**
4322
- * Input for updating a menu item
4323
- */
4324
- interface UpdateMenuItemInput {
4325
- label?: string;
4326
- customUrl?: string;
4327
- target?: string;
4328
- titleAttr?: string;
4329
- cssClasses?: string;
4330
- parentId?: string | null;
4331
- sortOrder?: number;
4332
- }
4333
- /**
4334
- * Input for creating a menu
4335
- */
4336
- interface CreateMenuInput {
4337
- name: string;
4338
- label: string;
4339
- }
4340
- /**
4341
- * Input for updating a menu
4342
- */
4343
- interface UpdateMenuInput {
4344
- label?: string;
4345
- }
4346
- /**
4347
- * Input for reordering menu items
4348
- */
4349
- interface ReorderMenuItemsInput {
4350
- items: Array<{
4351
- id: string;
4352
- parentId: string | null;
4353
- sortOrder: number;
4354
- }>;
4355
- }
4356
- //#endregion
4357
- //#region src/menus/index.d.ts
4358
- /**
4359
- * Get menu by name with resolved URLs
4360
- *
4361
- * @example
4362
- * ```ts
4363
- * import { getMenu } from "dineway";
4364
- *
4365
- * const menu = await getMenu("primary");
4366
- * if (menu) {
4367
- * console.log(menu.items); // Array of MenuItem with resolved URLs
4368
- * }
4369
- * ```
4370
- */
4371
- declare function getMenu(name: string): Promise<Menu | null>;
4372
- /**
4373
- * Get all menus (without items - for admin list)
4374
- *
4375
- * @example
4376
- * ```ts
4377
- * import { getMenus } from "dineway";
4378
- *
4379
- * const menus = await getMenus();
4380
- * console.log(menus); // [{ id, name, label }]
4381
- * ```
4382
- */
4383
- declare function getMenus(): Promise<Array<{
4384
- id: string;
4385
- name: string;
4386
- label: string;
4387
- }>>;
4388
- //#endregion
4389
- //#region src/bylines/index.d.ts
2778
+ //#region src/bylines/index.d.ts
4390
2779
  /**
4391
2780
  * Get a byline by ID.
4392
2781
  *
@@ -4416,170 +2805,6 @@ declare function getByline(id: string): Promise<BylineSummary | null>;
4416
2805
  */
4417
2806
  declare function getBylineBySlug(slug: string): Promise<BylineSummary | null>;
4418
2807
  //#endregion
4419
- //#region src/taxonomies/types.d.ts
4420
- /**
4421
- * Taxonomy types for Dineway Agentic Web builder
4422
- */
4423
- /**
4424
- * Taxonomy definition - describes a taxonomy like "category" or "tag"
4425
- */
4426
- interface TaxonomyDef {
4427
- id: string;
4428
- name: string;
4429
- label: string;
4430
- labelSingular?: string;
4431
- hierarchical: boolean;
4432
- collections: string[];
4433
- }
4434
- /**
4435
- * Taxonomy term - a specific term within a taxonomy (e.g., "News" in "category")
4436
- */
4437
- interface TaxonomyTerm {
4438
- id: string;
4439
- name: string;
4440
- slug: string;
4441
- label: string;
4442
- parentId?: string;
4443
- description?: string;
4444
- children: TaxonomyTerm[];
4445
- count?: number;
4446
- }
4447
- /**
4448
- * Flat version for DB row
4449
- */
4450
- interface TaxonomyTermRow {
4451
- id: string;
4452
- name: string;
4453
- slug: string;
4454
- label: string;
4455
- parent_id: string | null;
4456
- data: string | null;
4457
- }
4458
- /**
4459
- * Input for creating a term
4460
- */
4461
- interface CreateTermInput {
4462
- slug: string;
4463
- label: string;
4464
- parentId?: string;
4465
- description?: string;
4466
- }
4467
- /**
4468
- * Input for updating a term
4469
- */
4470
- interface UpdateTermInput {
4471
- slug?: string;
4472
- label?: string;
4473
- parentId?: string | null;
4474
- description?: string;
4475
- }
4476
- //#endregion
4477
- //#region src/taxonomies/index.d.ts
4478
- /**
4479
- * Get all taxonomy definitions
4480
- */
4481
- declare function getTaxonomyDefs(): Promise<TaxonomyDef[]>;
4482
- /**
4483
- * Get a single taxonomy definition by name
4484
- */
4485
- declare function getTaxonomyDef(name: string): Promise<TaxonomyDef | null>;
4486
- /**
4487
- * Get all terms for a taxonomy (as tree for hierarchical, flat for tags)
4488
- */
4489
- declare function getTaxonomyTerms(taxonomyName: string): Promise<TaxonomyTerm[]>;
4490
- /**
4491
- * Get a single term by taxonomy and slug
4492
- */
4493
- declare function getTerm(taxonomyName: string, slug: string): Promise<TaxonomyTerm | null>;
4494
- /**
4495
- * Get terms assigned to an entry
4496
- */
4497
- declare function getEntryTerms(collection: string, entryId: string, taxonomyName?: string): Promise<TaxonomyTerm[]>;
4498
- /**
4499
- * Get terms for multiple entries in a single query (batched API)
4500
- *
4501
- * This is more efficient than calling getEntryTerms for each entry
4502
- * when you need terms for a list of entries.
4503
- *
4504
- * @param collection - The collection type (e.g., "posts")
4505
- * @param entryIds - Array of entry IDs
4506
- * @param taxonomyName - The taxonomy name (e.g., "categories")
4507
- * @returns Map from entry ID to array of terms
4508
- */
4509
- declare function getTermsForEntries(collection: string, entryIds: string[], taxonomyName: string): Promise<Map<string, TaxonomyTerm[]>>;
4510
- /**
4511
- * Get entries by term (wraps getDinewayCollection)
4512
- */
4513
- declare function getEntriesByTerm(collection: string, taxonomyName: string, termSlug: string): Promise<Array<{
4514
- id: string;
4515
- data: Record<string, unknown>;
4516
- }>>;
4517
- //#endregion
4518
- //#region src/widgets/types.d.ts
4519
- type WidgetType = "content" | "menu" | "component";
4520
- interface Widget {
4521
- id: string;
4522
- type: WidgetType;
4523
- title?: string;
4524
- content?: PortableTextBlock$2[];
4525
- menuName?: string;
4526
- componentId?: string;
4527
- componentProps?: Record<string, unknown>;
4528
- }
4529
- interface WidgetArea {
4530
- id: string;
4531
- name: string;
4532
- label: string;
4533
- description?: string;
4534
- widgets: Widget[];
4535
- }
4536
- interface WidgetComponentDef {
4537
- id: string;
4538
- label: string;
4539
- description?: string;
4540
- props: Record<string, PropDef>;
4541
- }
4542
- interface PropDef {
4543
- type: "string" | "number" | "boolean" | "select";
4544
- label: string;
4545
- default?: unknown;
4546
- options?: Array<{
4547
- value: string;
4548
- label: string;
4549
- }>;
4550
- }
4551
- interface CreateWidgetAreaInput {
4552
- name: string;
4553
- label: string;
4554
- description?: string;
4555
- }
4556
- interface CreateWidgetInput {
4557
- type: WidgetType;
4558
- title?: string;
4559
- content?: PortableTextBlock$2[];
4560
- menuName?: string;
4561
- componentId?: string;
4562
- componentProps?: Record<string, unknown>;
4563
- }
4564
- interface UpdateWidgetInput extends Partial<CreateWidgetInput> {}
4565
- interface ReorderWidgetsInput {
4566
- widgetIds: string[];
4567
- }
4568
- //#endregion
4569
- //#region src/widgets/index.d.ts
4570
- /**
4571
- * Get a widget area by name, with all its widgets
4572
- */
4573
- declare function getWidgetArea(name: string): Promise<WidgetArea | null>;
4574
- /**
4575
- * Get all widget areas with their widgets
4576
- */
4577
- declare function getWidgetAreas(): Promise<WidgetArea[]>;
4578
- /**
4579
- * Get available widget components (for admin UI)
4580
- */
4581
- declare function getWidgetComponents(): WidgetComponentDef[];
4582
- //#endregion
4583
2808
  //#region src/search/types.d.ts
4584
2809
  /**
4585
2810
  * Search Types
@@ -4637,7 +2862,12 @@ interface SearchResult {
4637
2862
  locale: string;
4638
2863
  /** Entry title (if available) */
4639
2864
  title?: string;
4640
- /** Highlighted snippet showing match context */
2865
+ /**
2866
+ * Highlighted snippet showing match context.
2867
+ *
2868
+ * Safe to render as HTML: source text is escaped, and matched terms
2869
+ * are wrapped in literal `<mark>...</mark>` tags.
2870
+ */
4641
2871
  snippet?: string;
4642
2872
  /** Relevance score (higher = more relevant) */
4643
2873
  score: number;
@@ -4883,7 +3113,7 @@ declare function getSearchStats(db: Kysely<Database>): Promise<SearchStats>;
4883
3113
  * // Returns: "Hello World"
4884
3114
  * ```
4885
3115
  */
4886
- declare function extractPlainText(blocks: PortableTextBlock$1[] | string | null | undefined): string;
3116
+ declare function extractPlainText(blocks: PortableTextBlock[] | string | null | undefined): string;
4887
3117
  /**
4888
3118
  * Extract searchable text from a content entry
4889
3119
  *
@@ -4895,4 +3125,478 @@ declare function extractPlainText(blocks: PortableTextBlock$1[] | string | null
4895
3125
  */
4896
3126
  declare function extractSearchableFields(entry: Record<string, unknown>, fields: string[]): Record<string, string>;
4897
3127
  //#endregion
4898
- export { GetCommentsOptions as $, ContentResponse as $i, SessionDatabaseFactory as $n, ProseMirrorDocument as $r, OAuthInput as $t, getEntryTerms as A, handleRevisionRestore as Ai, AuthProviderModule as An, getDinewayEntry as Ar, wordpressRestSource as At, UpdateTermInput as B, handleContentGetIncludingTrashed as Bi, WxrTag as Bn, sanitizeHref as Br, importReusableBlocksAsSections as Bt, ReorderWidgetsInput as C, handleMediaGet as Ci, DinewayConfig as Cn, EditFieldMeta as Cr, GeneratePreviewTokenOptions as Ct, WidgetComponentDef as D, RevisionResponse as Di, S3StorageConfig as Dn, TranslationSummary as Dr, generatePreviewToken as Dt, WidgetArea as E, RevisionListResponse as Ei, LocalStorageConfig as En, ResolvePathResult as Er, VerifyPreviewTokenResult as Et, getTermsForEntries as F, handleContentCreate as Fi, WxrAuthor as Fn, EditProxy as Fr, getFileSources as Ft, CreateMenuInput as G, handleContentRestore as Gi, EntryFilter as Gn, prosemirrorToPortableText as Gr, FileInput as Gt, getBylineBySlug as H, handleContentListTrashed as Hi, parseWxrString as Hn, computeContentHash as Hr, CollectionSchemaStatus as Ht, CreateTermInput as I, handleContentDelete as Ii, WxrCategory as In, FieldAnnotation as Ir, getSource as It, MenuItem as J, handleContentUnpublish as Ji, FilePreviewMiddlewareConfig as Jn, PortableTextLinkMark as Jr, ImportContext as Jt, CreateMenuItemInput as K, handleContentSchedule as Ki, dinewayLoader as Kn, PortableTextCodeBlock as Kr, ImportAnalysis as Kt, TaxonomyDef as L, handleContentDiscardDraft as Li, WxrData as Ln, createEditable as Lr, getUrlSources as Lt, getTaxonomyDefs as M, handleContentCompare as Mi, ExternalAuthConfig as Mn, getTranslations as Mr, wxrSource as Mt, getTaxonomyTerms as N, handleContentCountScheduled as Ni, definePlugin as Nn, resolveDinewayPath as Nr, clearSources as Nt, WidgetType as O, handleRevisionGet as Oi, StorageDescriptor as On, TranslationsResult as Or, parseContentId as Ot, getTerm as P, handleContentCountTrashed as Pi, WxrAttachment as Pn, CMSAnnotation as Pr, getAllSources as Pt, UpdateMenuItemInput as Q, ContentListResponse as Qi, SessionCleanupResult as Qn, PortableTextUnknownBlock as Qr, NormalizedItem as Qt, TaxonomyTerm as R, handleContentDuplicate as Ri, WxrPost as Rn, createNoop as Rr, probeUrl as Rt, PropDef as S, handleMediaDelete as Si, pluginManifestSchema as Sn, DinewayCollections as Sr, getPreviewUrl as St, Widget as T, handleMediaUpdate as Ti, getStoredConfig as Tn, InferCollectionData as Tr, VerifyPreviewTokenOptions as Tt, getMenu as U, handleContentPermanentDelete as Ui, CollectionFilter as Un, hashString as Ur, FetchOptions as Ut, getByline as V, handleContentList as Vi, parseWxr as Vn, decodeSlug as Vr, AttachmentInfo as Vt, getMenus as W, handleContentPublish as Wi, EntryData as Wn, portableTextToProsemirror as Wr, FieldCompatibility as Wt, ReorderMenuItemsInput as X, handleContentUpdate as Xi, FileSessionDatabaseFactory as Xn, PortableTextSpan as Xr, ImportResult as Xt, MenuItemType as Y, handleContentUnschedule as Yi, createFilePreviewMiddleware as Yn, PortableTextMarkDef as Yr, ImportFieldDef as Yt, UpdateMenuInput as Z, ApiContext as Zi, FileSessionDatabaseFactoryOptions as Zn, PortableTextTextBlock as Zr, ImportSource as Zt, getWidgetArea as _, SchemaError as _i, EmailPipeline as _n, after as _r, isBlockedInPreview as _t, search as a, image as aa, SandboxRunner as ai, SourceInput as an, PreviewSidecarClient as ar, getSiteSetting as at, CreateWidgetAreaInput as b, MediaResponse as bi, createHookPipeline as bn, CollectionResult as br, GetPreviewUrlOptions as bt, FTSManager as c, FileValue as ca, SerializedRequest as ci, UrlInput as cn, defaultPreviewSidecarClient as cr, PreviewToolbarConfig as ct, SearchOptions as d, CreateMediaInput as da, CreateSectionInput as di, NoopSandboxRunner as dn, verifyPreviewSignature as dr, ApplySnapshotToDatabaseOptions as dt, FieldDescriptor as ea, ProseMirrorMark as ei, PostTypeAnalysis as en, SessionDatabaseHandle as er, GetCommentsResult as et, SearchResponse as f, MediaItem as fa, GetSectionsOptions as fi, SandboxNotAvailableError as fn, I18nConfig as fr, applySnapshotToDatabase as ft, Suggestion as g, DinewayDatabaseError as ga, getCollectionInfo as gi, PluginRouteError as gn, AfterCallback as gr, renderPreviewLoadingPage as gt, SuggestOptions as h, DatabaseConfig as ha, UpdateSectionInput as hi, createPluginManager as hn, isI18nEnabled as hr, Snapshot as ht, getSuggestions as i, reference as ia, SandboxOptions as ii, SourceCapabilities as in, SessionOpenOrCreateOptions as ir, getPluginSettings as it, getTaxonomyDef as j, generateManifest as ji, AuthResult as jn, getEditMeta as jr, parseWxrDate as jt, getEntriesByTerm as k, handleRevisionList as ki, AuthDescriptor as kn, getDinewayCollection as kr, verifyPreviewToken as kt, CollectionSearchOptions as l, ImageValue as la, getSection as li, NodeSandboxRunner as ln, parsePreviewSignatureHeader as lr, renderPreviewToolbar as lt, SearchStats as m, ContentRepository as ma, SectionSource as mi, PluginManager as mn, getI18nConfig as mr, getAppliedSnapshotMeta as mt, extractSearchableFields as n, ManifestResponse as na, SandboxEmailMessage as ni, ProbeResult as nn, SessionDatabaseLimitError as nr, getComments as nt, searchCollection as o, FieldDefinition as oa, SandboxRunnerFactory as oi, SourceProbeResult as on, PreviewSidecarSignature as or, getSiteSettings as ot, SearchResult as p, MediaRepository as pa, Section as pi, createNoopSandboxRunner as pn, getFallbackChain as pr, dropSessionDatabaseTables as pt, Menu as q, handleContentTranslations as qi, getDb as qn, PortableTextImageBlock as qr, ImportConfig as qt, getSearchStats as r, portableText as ra, SandboxEmailSendCallback as ri, SourceAuth as rn, SessionOpenOptions as rr, getPluginSetting as rt, searchWithDb as s, FieldUIHints as sa, SandboxedPlugin as si, SuggestedAction as sn, buildPreviewSignatureHeader as sr, setSiteSettings as st, extractPlainText as t, ListResponse as ta, ProseMirrorNode as ti, PostTypeMapping as tn, SessionDatabaseInfo as tr, getCommentCount as tt, SearchConfig as u, PortableTextBlock$2 as ua, getSections as ui, createNodeSandboxRunner as un, signPreviewUrl as ur, AppliedSnapshotMeta as ut, getWidgetAreas as v, SchemaRegistry as vi, HookPipeline as vn, CacheHint as vr, getPreviewToken as vt, UpdateWidgetInput as w, handleMediaList as wi, PluginDescriptor as wn, EntryResult as wr, PreviewTokenPayload as wt, CreateWidgetInput as x, handleMediaCreate as xi, ValidatedPluginManifest as xn, ContentEntry as xr, buildPreviewUrl as xt, getWidgetComponents as y, MediaListResponse as yi, HookResult as yn, CollectionFilter$1 as yr, isPreviewRequest as yt, TaxonomyTermRow as z, handleContentGet as zi, WxrSite as zn, isSafeHref as zr, registerSource as zt };
3128
+ //#region src/astro/storage/types.d.ts
3129
+ /**
3130
+ * Serializable storage configuration descriptor
3131
+ */
3132
+ interface StorageDescriptor {
3133
+ /** Module path exporting createStorage function */
3134
+ entrypoint: string;
3135
+ /** Serializable config passed to createStorage at runtime */
3136
+ config: unknown;
3137
+ }
3138
+ /**
3139
+ * S3-compatible storage configuration
3140
+ */
3141
+ interface S3StorageConfig {
3142
+ /** S3 endpoint URL */
3143
+ endpoint: string;
3144
+ /** Bucket name */
3145
+ bucket: string;
3146
+ /**
3147
+ * Access key ID.
3148
+ * May be resolved from `S3_ACCESS_KEY_ID` at runtime on Node.
3149
+ * Must be provided together with `secretAccessKey`, or both omitted.
3150
+ */
3151
+ accessKeyId?: string;
3152
+ /**
3153
+ * Secret access key.
3154
+ * May be resolved from `S3_SECRET_ACCESS_KEY` at runtime on Node.
3155
+ * Must be provided together with `accessKeyId`, or both omitted.
3156
+ */
3157
+ secretAccessKey?: string;
3158
+ /** Optional region (defaults to "auto") */
3159
+ region?: string;
3160
+ /** Optional public URL prefix for CDN */
3161
+ publicUrl?: string;
3162
+ }
3163
+ /**
3164
+ * Local filesystem storage configuration
3165
+ */
3166
+ interface LocalStorageConfig {
3167
+ /** Directory path for storing files */
3168
+ directory: string;
3169
+ /** Base URL for serving files */
3170
+ baseUrl: string;
3171
+ }
3172
+ //#endregion
3173
+ //#region src/astro/integration/runtime.d.ts
3174
+ /**
3175
+ * Admin page definition (copied from plugins/types to avoid circular deps)
3176
+ */
3177
+ interface PluginAdminPage {
3178
+ path: string;
3179
+ label: string;
3180
+ icon?: string;
3181
+ }
3182
+ /**
3183
+ * Dashboard widget definition (copied from plugins/types to avoid circular deps)
3184
+ */
3185
+ interface PluginDashboardWidget {
3186
+ id: string;
3187
+ size?: "full" | "half" | "third";
3188
+ title?: string;
3189
+ }
3190
+ /**
3191
+ * Plugin descriptor - returned by plugin factory functions
3192
+ *
3193
+ * Contains all static metadata needed for manifest and admin UI,
3194
+ * plus the entrypoint for runtime instantiation.
3195
+ *
3196
+ * @example
3197
+ * ```ts
3198
+ * export function myPlugin(options?: MyPluginOptions): PluginDescriptor {
3199
+ * return {
3200
+ * id: "my-plugin",
3201
+ * version: "1.0.0",
3202
+ * entrypoint: "@my-org/dineway-plugin-foo",
3203
+ * options: options ?? {},
3204
+ * adminEntry: "@my-org/dineway-plugin-foo/admin",
3205
+ * adminPages: [{ path: "/settings", label: "Settings" }],
3206
+ * };
3207
+ * }
3208
+ * ```
3209
+ */
3210
+ /**
3211
+ * Storage collection declaration for sandboxed plugins
3212
+ */
3213
+ interface StorageCollectionDeclaration {
3214
+ indexes?: string[];
3215
+ uniqueIndexes?: string[];
3216
+ }
3217
+ interface PluginDescriptor<TOptions = Record<string, unknown>> {
3218
+ /** Unique plugin identifier */
3219
+ id: string;
3220
+ /** Plugin version (semver) */
3221
+ version: string;
3222
+ /** Module specifier to import (e.g., "@dineway-ai/plugin-api-test") */
3223
+ entrypoint: string;
3224
+ /**
3225
+ * Options to pass to createPlugin(). Native format only.
3226
+ * Standard-format plugins configure themselves via KV settings
3227
+ * and Block Kit admin pages -- not constructor options.
3228
+ */
3229
+ options?: TOptions;
3230
+ /**
3231
+ * Plugin format. Determines how the entrypoint is loaded:
3232
+ * - `"standard"` -- exports `definePlugin({ hooks, routes })` as default.
3233
+ * Wrapped with `adaptSandboxEntry` for in-process execution. Can run in both
3234
+ * `plugins: []` (in-process) and `sandboxed: []` (isolate).
3235
+ * - `"native"` -- exports `createPlugin(options)` returning a `ResolvedPlugin`.
3236
+ * Can only run in `plugins: []`. Cannot be sandboxed or published to marketplace.
3237
+ *
3238
+ * Defaults to `"native"` when unset.
3239
+ *
3240
+ */
3241
+ format?: "standard" | "native";
3242
+ /** Admin UI module specifier (e.g., "@dineway-ai/plugin-audit-log/admin") */
3243
+ adminEntry?: string;
3244
+ /** Module specifier for site-side Astro rendering components (must export `blockComponents`) */
3245
+ componentsEntry?: string;
3246
+ /** Admin pages for navigation */
3247
+ adminPages?: PluginAdminPage[];
3248
+ /** Dashboard widgets */
3249
+ adminWidgets?: PluginDashboardWidget[];
3250
+ /**
3251
+ * Capabilities the plugin requests.
3252
+ * For standard-format plugins, capabilities are enforced in both trusted and
3253
+ * sandboxed modes via the PluginContextFactory.
3254
+ */
3255
+ capabilities?: string[];
3256
+ /**
3257
+ * Allowed hosts for network:request capability
3258
+ * Supports wildcards like "*.example.com"
3259
+ */
3260
+ allowedHosts?: string[];
3261
+ /**
3262
+ * Storage collections the plugin declares
3263
+ * Sandboxed plugins can only access declared collections.
3264
+ */
3265
+ storage?: Record<string, StorageCollectionDeclaration>;
3266
+ }
3267
+ /**
3268
+ * Sandboxed plugin descriptor - same format as PluginDescriptor
3269
+ *
3270
+ * These run in isolated environments provided by the configured sandbox runner.
3271
+ * The `entrypoint` is resolved to a file and bundled at build time.
3272
+ */
3273
+ type SandboxedPluginDescriptor<TOptions = Record<string, unknown>> = PluginDescriptor<TOptions>;
3274
+ interface DinewayFontsConfig {
3275
+ /**
3276
+ * Additional Noto Sans or compatible script families to include in the admin UI.
3277
+ *
3278
+ * Use script names like "arabic", "farsi", "japanese", or "chinese-simplified".
3279
+ */
3280
+ scripts?: string[];
3281
+ }
3282
+ interface DinewayConfig {
3283
+ /**
3284
+ * Database configuration
3285
+ *
3286
+ * Use one of the adapter functions:
3287
+ * - `libsql({ url: process.env.DINEWAY_DATABASE_URL || "file:./data.db" })` - Default Node/libSQL path
3288
+ * - `sqlite({ url: "file:./data.db" })` - Local SQLite only
3289
+ * - `postgres({ connectionString: process.env.DATABASE_URL! })` - PostgreSQL deployments
3290
+ *
3291
+ * @example
3292
+ * ```ts
3293
+ * import { libsql } from "dineway/db";
3294
+ *
3295
+ * dineway({
3296
+ * database: libsql({ url: process.env.DINEWAY_DATABASE_URL || "file:./data.db" }),
3297
+ * })
3298
+ * ```
3299
+ */
3300
+ database?: DatabaseDescriptor;
3301
+ /**
3302
+ * Storage configuration (for media)
3303
+ */
3304
+ storage?: StorageDescriptor;
3305
+ /**
3306
+ * Trusted plugins to load (run in main isolate)
3307
+ *
3308
+ * @example
3309
+ * ```ts
3310
+ * import { auditLogPlugin } from "@dineway-ai/plugin-audit-log";
3311
+ * import { webhookNotifierPlugin } from "@dineway-ai/plugin-webhook-notifier";
3312
+ *
3313
+ * dineway({
3314
+ * plugins: [
3315
+ * auditLogPlugin(),
3316
+ * webhookNotifierPlugin({ url: "https://example.com/webhook" }),
3317
+ * ],
3318
+ * })
3319
+ * ```
3320
+ */
3321
+ plugins?: PluginDescriptor[];
3322
+ /**
3323
+ * Sandboxed plugins to load (run behind the configured `SandboxRunner`)
3324
+ *
3325
+ * Uses the same format as `plugins`; the configured sandbox runner decides
3326
+ * how isolation is enforced for the current runtime.
3327
+ *
3328
+ * @example
3329
+ * ```ts
3330
+ * import { untrustedPlugin } from "some-third-party-plugin";
3331
+ *
3332
+ * dineway({
3333
+ * plugins: [trustedPlugin()], // runs in host
3334
+ * sandboxed: [untrustedPlugin()], // runs in the default Node sandbox
3335
+ * })
3336
+ * ```
3337
+ */
3338
+ sandboxed?: SandboxedPluginDescriptor[];
3339
+ /**
3340
+ * Optional module that exports a custom sandbox runner factory.
3341
+ * When omitted, Dineway uses its built-in Node sandbox runner.
3342
+ *
3343
+ * @example
3344
+ * ```ts
3345
+ * import { createNodeSandboxRunner } from "dineway";
3346
+ *
3347
+ * export const createSandboxRunner = createNodeSandboxRunner;
3348
+ * ```
3349
+ *
3350
+ * @example
3351
+ * ```ts
3352
+ * dineway({
3353
+ * sandboxRunner: "./src/sandbox-runner.ts",
3354
+ * })
3355
+ * ```
3356
+ */
3357
+ sandboxRunner?: string;
3358
+ /**
3359
+ * Authentication configuration
3360
+ *
3361
+ * Use an auth descriptor or an adapter function from a provider package.
3362
+ *
3363
+ * When an external auth provider is configured, passkey auth is disabled.
3364
+ *
3365
+ * @example
3366
+ * ```ts
3367
+ * dineway({
3368
+ * auth: {
3369
+ * type: "header-auth",
3370
+ * entrypoint: "./src/header-auth.ts",
3371
+ * config: {
3372
+ * userHeader: "x-forwarded-user-email",
3373
+ * roleHeader: "x-forwarded-user-role",
3374
+ * },
3375
+ * },
3376
+ * })
3377
+ * ```
3378
+ */
3379
+ auth?: AuthDescriptor;
3380
+ /**
3381
+ * Interactive login providers shown on the admin login page and setup wizard.
3382
+ *
3383
+ * These are additive to built-in passkey auth. Transparent request auth still
3384
+ * uses `auth`; when `auth` is configured, the external provider owns login.
3385
+ */
3386
+ authProviders?: AuthProviderDescriptor[];
3387
+ /**
3388
+ * MCP (Model Context Protocol) server endpoint.
3389
+ *
3390
+ * Exposes an MCP Streamable HTTP server at `/_dineway/api/mcp`
3391
+ * that allows AI agents and tools to interact with the CMS using
3392
+ * the standardized MCP protocol.
3393
+ *
3394
+ * Enabled by default. The endpoint requires bearer token auth, so
3395
+ * it has no practical effect unless the user creates an API token
3396
+ * or configures an OAuth client. Set to `false` to disable.
3397
+ *
3398
+ * @default true
3399
+ *
3400
+ * @example
3401
+ * ```ts
3402
+ * dineway({
3403
+ * mcp: false,
3404
+ * })
3405
+ * ```
3406
+ */
3407
+ mcp?: boolean;
3408
+ /**
3409
+ * Plugin marketplace URL
3410
+ *
3411
+ * When set, enables the marketplace features: browse, install, update,
3412
+ * and uninstall plugins from a remote marketplace.
3413
+ *
3414
+ * Must be an HTTPS URL in production, or localhost/127.0.0.1 in dev.
3415
+ * Marketplace plugins run in the built-in Node sandbox runner unless
3416
+ * `sandboxRunner` is set to override it.
3417
+ *
3418
+ * @example
3419
+ * ```ts
3420
+ * dineway({
3421
+ * marketplace: "https://marketplace.example.com",
3422
+ * })
3423
+ * ```
3424
+ */
3425
+ marketplace?: string;
3426
+ /**
3427
+ * Maximum allowed media file upload size in bytes.
3428
+ *
3429
+ * Applies to both direct multipart uploads and signed-URL uploads.
3430
+ * When omitted, Dineway defaults to 52_428_800 (50 MB).
3431
+ *
3432
+ * @example
3433
+ * ```ts
3434
+ * dineway({ maxUploadSize: 100 * 1024 * 1024 }) // 100 MB
3435
+ * ```
3436
+ */
3437
+ maxUploadSize?: number;
3438
+ /**
3439
+ * Admin UI branding.
3440
+ *
3441
+ * Use this to customize the logo, name, and favicon shown in the
3442
+ * Dineway admin panel without changing public site identity settings.
3443
+ *
3444
+ * @example
3445
+ * ```ts
3446
+ * dineway({
3447
+ * admin: {
3448
+ * logo: "/images/agency-logo.svg",
3449
+ * siteName: "Agency Console",
3450
+ * favicon: "/agency-favicon.ico",
3451
+ * },
3452
+ * })
3453
+ * ```
3454
+ */
3455
+ admin?: {
3456
+ /** URL or path to a custom logo image for the admin UI. */logo?: string; /** Custom name displayed in the admin sidebar and browser tab. */
3457
+ siteName?: string; /** URL or path to a custom favicon for the admin panel. */
3458
+ favicon?: string;
3459
+ };
3460
+ /**
3461
+ * Admin UI font configuration.
3462
+ *
3463
+ * By default, Dineway uses the Astro Font API to load Noto Sans at
3464
+ * build time and self-host the generated font files. Set to false to
3465
+ * disable Dineway-managed fonts and use system fonts.
3466
+ *
3467
+ * @example
3468
+ * ```ts
3469
+ * dineway({
3470
+ * fonts: {
3471
+ * scripts: ["arabic", "farsi", "japanese"],
3472
+ * },
3473
+ * })
3474
+ * ```
3475
+ */
3476
+ fonts?: false | DinewayFontsConfig;
3477
+ /**
3478
+ * Public browser-facing origin for the site.
3479
+ *
3480
+ * Use when `Astro.url` / `request.url` do not match what users open — common with a
3481
+ * **TLS-terminating reverse proxy**: the app often sees `http://` on the internal hop
3482
+ * while the browser uses `https://`, which breaks WebAuthn, CSRF, OAuth, and redirect URLs.
3483
+ *
3484
+ * Set to the full origin users type in the address bar (no path), e.g.
3485
+ * `https://mysite.example.com`. When not set, falls back to environment variables
3486
+ * `DINEWAY_SITE_URL` > `SITE_URL`, then to the request URL's origin.
3487
+ *
3488
+ * Replaces `passkeyPublicOrigin` (which only fixed passkeys).
3489
+ */
3490
+ siteUrl?: string;
3491
+ /**
3492
+ * Additional origins accepted by passkey verification.
3493
+ *
3494
+ * When the same Dineway deployment is reachable under several hostnames
3495
+ * sharing a registrable parent (e.g. `https://example.com` plus
3496
+ * `https://preview.example.com`), the canonical `siteUrl` defines the
3497
+ * `rpId` and the entries here are the additional origins from which
3498
+ * assertions are accepted. Each entry must be the same hostname as
3499
+ * `siteUrl` or a subdomain of it; WebAuthn requires `rpId` to be a
3500
+ * registrable suffix of every origin.
3501
+ *
3502
+ * Merged at runtime with the `DINEWAY_ALLOWED_ORIGINS` env var
3503
+ * (comma-separated), falling back to `ALLOWED_ORIGINS` when the prefixed
3504
+ * variable is absent. Validation:
3505
+ * - Config-declared entries are shape-checked at Astro startup.
3506
+ * - Subdomain relationship to `siteUrl` is checked at startup when
3507
+ * `siteUrl` is also config-declared, otherwise at first passkey
3508
+ * verification because `siteUrl` may come from `DINEWAY_SITE_URL`.
3509
+ *
3510
+ * Mismatches throw with a source-attributed message naming
3511
+ * `config.allowedOrigins`, `DINEWAY_ALLOWED_ORIGINS`, or `ALLOWED_ORIGINS`.
3512
+ *
3513
+ * @example
3514
+ * ```ts
3515
+ * dineway({
3516
+ * siteUrl: "https://example.com",
3517
+ * allowedOrigins: ["https://preview.example.com"],
3518
+ * })
3519
+ * ```
3520
+ */
3521
+ allowedOrigins?: string[];
3522
+ /**
3523
+ * Reverse-proxy headers that Dineway may trust for client IP resolution.
3524
+ *
3525
+ * Defaults to no trusted headers. Set this only when Dineway is deployed
3526
+ * behind a reverse proxy you control and that proxy strips or overwrites
3527
+ * incoming client-supplied copies of these headers.
3528
+ *
3529
+ * When omitted, Dineway falls back to `DINEWAY_TRUSTED_PROXY_HEADERS`.
3530
+ *
3531
+ * @example
3532
+ * ```ts
3533
+ * dineway({
3534
+ * trustedProxyHeaders: ["x-real-ip", "x-forwarded-for"],
3535
+ * })
3536
+ * ```
3537
+ */
3538
+ trustedProxyHeaders?: string[];
3539
+ /**
3540
+ * Enable playground mode for ephemeral "try Dineway" sites.
3541
+ *
3542
+ * When set, the integration injects a playground middleware (order: "pre")
3543
+ * that runs BEFORE the normal Dineway middleware chain. It creates an
3544
+ * isolated session database per visitor, runs migrations, applies the
3545
+ * seed, creates an anonymous admin user, and stashes the request-scoped
3546
+ * database on locals so the runtime and request-context middleware can
3547
+ * pick it up.
3548
+ *
3549
+ * Setup and auth middleware are skipped because the playground middleware
3550
+ * handles bootstrap and user injection.
3551
+ *
3552
+ * For the first portable release, playground sidecars are explicitly
3553
+ * single-instance only.
3554
+ *
3555
+ * @example
3556
+ * ```ts
3557
+ * import { fileURLToPath } from "node:url";
3558
+ * import { libsql } from "dineway/db";
3559
+ *
3560
+ * dineway({
3561
+ * database: libsql({ url: process.env.DINEWAY_DATABASE_URL || "file:./playground.db" }),
3562
+ * playground: {
3563
+ * middlewareEntrypoint: fileURLToPath(
3564
+ * new URL("./src/playground-middleware.ts", import.meta.url)
3565
+ * ),
3566
+ * },
3567
+ * })
3568
+ * ```
3569
+ */
3570
+ playground?: {
3571
+ /** Module path for the playground middleware. */middlewareEntrypoint: string;
3572
+ };
3573
+ /**
3574
+ * Media providers for browsing and uploading media
3575
+ *
3576
+ * The local media provider (using storage adapter) is available by default.
3577
+ * Additional providers can be added for external services like Unsplash,
3578
+ * Cloudinary, Mux, and other provider packages.
3579
+ *
3580
+ * @example
3581
+ * ```ts
3582
+ * import { unsplash } from "@dineway-ai/provider-unsplash";
3583
+ *
3584
+ * dineway({
3585
+ * mediaProviders: [
3586
+ * unsplash({ accessKey: "..." }),
3587
+ * ],
3588
+ * })
3589
+ * ```
3590
+ */
3591
+ mediaProviders?: MediaProviderDescriptor[];
3592
+ }
3593
+ /**
3594
+ * Get stored config from global
3595
+ * This is set by the virtual module at build time
3596
+ */
3597
+ declare function getStoredConfig(): DinewayConfig | null;
3598
+ declare global {
3599
+ var __dinewayConfig: DinewayConfig | undefined;
3600
+ }
3601
+ //#endregion
3602
+ export { createPluginManager as $, isParseError as $n, SandboxOptions as $t, dropSessionDatabaseTables as A, handleContentDelete as An, verifyPreviewSignature as At, GeneratePreviewTokenOptions as B, handleContentSchedule as Bn, prosemirrorToPortableText as Bt, getByline as C, handleRevisionList as Cn, SessionOpenOrCreateOptions as Ct, AppliedSnapshotMeta as D, handleContentCountScheduled as Dn, defaultPreviewSidecarClient as Dt, renderPreviewToolbar as E, handleContentCompare as En, buildPreviewSignatureHeader as Et, getPreviewToken as F, handleContentList as Fn, AfterCallback as Ft, parseContentId as G, CreateMediaInput as Gn, PortableTextSpan as Gt, VerifyPreviewTokenOptions as H, handleContentUnpublish as Hn, PortableTextImageBlock as Ht, isPreviewRequest as I, handleContentListTrashed as In, after as It, createNodeSandboxRunner as J, ContentRepository as Jn, ProseMirrorDocument as Jt, verifyPreviewToken as K, MediaItem as Kn, PortableTextTextBlock as Kt, GetPreviewUrlOptions as L, handleContentPermanentDelete as Ln, computeContentHash as Lt, Snapshot as M, handleContentDuplicate as Mn, getFallbackChain as Mt, renderPreviewLoadingPage as N, handleContentGet as Nn, getI18nConfig as Nt, ApplySnapshotToDatabaseOptions as O, handleContentCountTrashed as On, parsePreviewSignatureHeader as Ot, isBlockedInPreview as P, handleContentGetIncludingTrashed as Pn, isI18nEnabled as Pt, PluginManager as Q, ParseResult as Qn, SandboxEmailSendCallback as Qt, buildPreviewUrl as R, handleContentPublish as Rn, hashString as Rt, Suggestion as S, handleRevisionGet as Sn, SessionOpenOptions as St, PreviewToolbarConfig as T, generateManifest as Tn, PreviewSidecarSignature as Tt, VerifyPreviewTokenResult as U, handleContentUnschedule as Un, PortableTextLinkMark as Ut, PreviewTokenPayload as V, handleContentTranslations as Vn, PortableTextCodeBlock as Vt, generatePreviewToken as W, handleContentUpdate as Wn, PortableTextMarkDef as Wt, SandboxNotAvailableError as X, DinewayDatabaseError as Xn, ProseMirrorNode as Xt, NoopSandboxRunner as Y, DatabaseConfig as Yn, ProseMirrorMark as Yt, createNoopSandboxRunner as Z, OptionsRepository as Zn, SandboxEmailMessage as Zt, SearchOptions as _, handleMediaGet as _n, SessionCleanupResult as _t, S3StorageConfig as a, getSections as an, ApiContext as ar, ValidatedPluginManifest as at, SearchStats as b, RevisionListResponse as bn, SessionDatabaseInfo as bt, extractSearchableFields as c, Section as cn, FieldDescriptor as cr, CollectionFilter as ct, search as d, SchemaError as dn, dinewayLoader as dt, SandboxRunner as en, parseBody as er, PluginRouteError as et, searchCollection as f, SchemaRegistry as fn, getDb as ft, SearchConfig as g, handleMediaDelete as gn, FileSessionDatabaseFactoryOptions as gt, CollectionSearchOptions as h, handleMediaCreate as hn, FileSessionDatabaseFactory as ht, LocalStorageConfig as i, getSection as in, handleError as ir, createHookPipeline as it, getAppliedSnapshotMeta as j, handleContentDiscardDraft as jn, I18nConfig as jt, applySnapshotToDatabase as k, handleContentCreate as kn, signPreviewUrl as kt, getSearchStats as l, SectionSource as ln, ListResponse as lr, EntryData as lt, FTSManager as m, MediaResponse as mn, createFilePreviewMiddleware as mt, PluginDescriptor as n, SandboxedPlugin as nn, apiError as nr, HookPipeline as nt, StorageDescriptor as o, CreateSectionInput as on, ContentListResponse as or, pluginManifestSchema as ot, searchWithDb as p, MediaListResponse as pn, FilePreviewMiddlewareConfig as pt, NodeSandboxRunner as q, MediaRepository as qn, PortableTextUnknownBlock as qt, getStoredConfig as r, SerializedRequest as rn, apiSuccess as rr, HookResult as rt, extractPlainText as s, GetSectionsOptions as sn, ContentResponse as sr, definePlugin as st, DinewayConfig as t, SandboxRunnerFactory as tn, parseQuery as tr, EmailPipeline as tt, getSuggestions as u, UpdateSectionInput as un, ManifestResponse as ur, EntryFilter as ut, SearchResponse as v, handleMediaList as vn, SessionDatabaseFactory as vt, getBylineBySlug as w, handleRevisionRestore as wn, PreviewSidecarClient as wt, SuggestOptions as x, RevisionResponse as xn, SessionDatabaseLimitError as xt, SearchResult as y, handleMediaUpdate as yn, SessionDatabaseHandle as yt, getPreviewUrl as z, handleContentRestore as zn, portableTextToProsemirror as zt };