emdash 1.0.0 → 1.0.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2449) hide show
  1. package/README.md +4 -0
  2. package/dist/action-token-DBki7IT4.mjs +26 -0
  3. package/dist/action-token-DBki7IT4.mjs.map +1 -0
  4. package/dist/activation-DDuqAat2.mjs +387 -0
  5. package/dist/activation-DDuqAat2.mjs.map +1 -0
  6. package/dist/adapters-DcqT_GzQ.d.mts +171 -0
  7. package/dist/adapters-DcqT_GzQ.d.mts.map +1 -0
  8. package/dist/after-PcEvMY_6.mjs +96 -0
  9. package/dist/after-PcEvMY_6.mjs.map +1 -0
  10. package/dist/allowed-origins-CFtudhyw.mjs +116 -0
  11. package/dist/allowed-origins-CFtudhyw.mjs.map +1 -0
  12. package/dist/api/route-utils.d.mts +69 -0
  13. package/dist/api/route-utils.d.mts.map +1 -0
  14. package/dist/api/route-utils.mjs +85 -0
  15. package/dist/api/route-utils.mjs.map +1 -0
  16. package/dist/api/schemas/index.d.mts +2 -0
  17. package/dist/api/schemas/index.mjs +13 -0
  18. package/dist/api-BJFwdTiG.mjs +4974 -0
  19. package/dist/api-BJFwdTiG.mjs.map +1 -0
  20. package/dist/api-tokens-BLz2MtQs.mjs +3 -0
  21. package/dist/api-tokens-P3mAaQgr.mjs +166 -0
  22. package/dist/api-tokens-P3mAaQgr.mjs.map +1 -0
  23. package/dist/apply-BNvvsD51.mjs +1672 -0
  24. package/dist/apply-BNvvsD51.mjs.map +1 -0
  25. package/dist/approvals-quy61IC4.mjs +460 -0
  26. package/dist/approvals-quy61IC4.mjs.map +1 -0
  27. package/dist/artifact-fetch-CWxyELVI.mjs +659 -0
  28. package/dist/artifact-fetch-CWxyELVI.mjs.map +1 -0
  29. package/dist/astro/image-endpoint.d.mts +8 -0
  30. package/dist/astro/image-endpoint.d.mts.map +1 -0
  31. package/dist/astro/image-endpoint.mjs +55 -0
  32. package/dist/astro/image-endpoint.mjs.map +1 -0
  33. package/dist/astro/index.d.mts +39 -7
  34. package/dist/astro/index.d.mts.map +1 -1
  35. package/dist/astro/index.mjs +908 -514
  36. package/dist/astro/index.mjs.map +1 -1
  37. package/dist/astro/middleware/auth.d.mts +15 -7
  38. package/dist/astro/middleware/auth.d.mts.map +1 -1
  39. package/dist/astro/middleware/auth.mjs +146 -211
  40. package/dist/astro/middleware/auth.mjs.map +1 -1
  41. package/dist/astro/middleware/media-usage-write-fence.d.mts +15 -0
  42. package/dist/astro/middleware/media-usage-write-fence.d.mts.map +1 -0
  43. package/dist/astro/middleware/media-usage-write-fence.mjs +117 -0
  44. package/dist/astro/middleware/media-usage-write-fence.mjs.map +1 -0
  45. package/dist/astro/middleware/redirect.d.mts.map +1 -1
  46. package/dist/astro/middleware/redirect.mjs +48 -15
  47. package/dist/astro/middleware/redirect.mjs.map +1 -1
  48. package/dist/astro/middleware/request-context.d.mts +5 -1
  49. package/dist/astro/middleware/request-context.d.mts.map +1 -1
  50. package/dist/astro/middleware/request-context.mjs +542 -76
  51. package/dist/astro/middleware/request-context.mjs.map +1 -1
  52. package/dist/astro/middleware/setup.mjs +1 -1
  53. package/dist/astro/middleware.d.mts +66 -4
  54. package/dist/astro/middleware.d.mts.map +1 -1
  55. package/dist/astro/middleware.mjs +817 -1844
  56. package/dist/astro/middleware.mjs.map +1 -1
  57. package/dist/astro/routes/PluginRegistry.d.mts +19 -0
  58. package/dist/astro/routes/PluginRegistry.d.mts.map +1 -0
  59. package/dist/astro/routes/PluginRegistry.mjs +26 -0
  60. package/dist/astro/routes/PluginRegistry.mjs.map +1 -0
  61. package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts +15 -0
  62. package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts.map +1 -0
  63. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +78 -0
  64. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs.map +1 -0
  65. package/dist/astro/routes/api/admin/allowed-domains/index.d.mts +15 -0
  66. package/dist/astro/routes/api/admin/allowed-domains/index.d.mts.map +1 -0
  67. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +78 -0
  68. package/dist/astro/routes/api/admin/allowed-domains/index.mjs.map +1 -0
  69. package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts +11 -0
  70. package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts.map +1 -0
  71. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +35 -0
  72. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs.map +1 -0
  73. package/dist/astro/routes/api/admin/api-tokens/index.d.mts +17 -0
  74. package/dist/astro/routes/api/admin/api-tokens/index.d.mts.map +1 -0
  75. package/dist/astro/routes/api/admin/api-tokens/index.mjs +54 -0
  76. package/dist/astro/routes/api/admin/api-tokens/index.mjs.map +1 -0
  77. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts +8 -0
  78. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.d.mts.map +1 -0
  79. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +25 -0
  80. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs.map +1 -0
  81. package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts +10 -0
  82. package/dist/astro/routes/api/admin/byline-fields/_slug_.d.mts.map +1 -0
  83. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +66 -0
  84. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs.map +1 -0
  85. package/dist/astro/routes/api/admin/byline-fields/index.d.mts +9 -0
  86. package/dist/astro/routes/api/admin/byline-fields/index.d.mts.map +1 -0
  87. package/dist/astro/routes/api/admin/byline-fields/index.mjs +54 -0
  88. package/dist/astro/routes/api/admin/byline-fields/index.mjs.map +1 -0
  89. package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts +8 -0
  90. package/dist/astro/routes/api/admin/byline-fields/reorder.d.mts.map +1 -0
  91. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +38 -0
  92. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs.map +1 -0
  93. package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts +10 -0
  94. package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts.map +1 -0
  95. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +92 -0
  96. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -0
  97. package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts +9 -0
  98. package/dist/astro/routes/api/admin/bylines/_id_/translations.d.mts.map +1 -0
  99. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +84 -0
  100. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -0
  101. package/dist/astro/routes/api/admin/bylines/index.d.mts +9 -0
  102. package/dist/astro/routes/api/admin/bylines/index.d.mts.map +1 -0
  103. package/dist/astro/routes/api/admin/bylines/index.mjs +91 -0
  104. package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -0
  105. package/dist/astro/routes/api/admin/comments/_id_/status.d.mts +8 -0
  106. package/dist/astro/routes/api/admin/comments/_id_/status.d.mts.map +1 -0
  107. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +59 -0
  108. package/dist/astro/routes/api/admin/comments/_id_/status.mjs.map +1 -0
  109. package/dist/astro/routes/api/admin/comments/_id_.d.mts +15 -0
  110. package/dist/astro/routes/api/admin/comments/_id_.d.mts.map +1 -0
  111. package/dist/astro/routes/api/admin/comments/_id_.mjs +51 -0
  112. package/dist/astro/routes/api/admin/comments/_id_.mjs.map +1 -0
  113. package/dist/astro/routes/api/admin/comments/bulk.d.mts +8 -0
  114. package/dist/astro/routes/api/admin/comments/bulk.d.mts.map +1 -0
  115. package/dist/astro/routes/api/admin/comments/bulk.mjs +49 -0
  116. package/dist/astro/routes/api/admin/comments/bulk.mjs.map +1 -0
  117. package/dist/astro/routes/api/admin/comments/counts.d.mts +8 -0
  118. package/dist/astro/routes/api/admin/comments/counts.d.mts.map +1 -0
  119. package/dist/astro/routes/api/admin/comments/counts.mjs +29 -0
  120. package/dist/astro/routes/api/admin/comments/counts.mjs.map +1 -0
  121. package/dist/astro/routes/api/admin/comments/index.d.mts +11 -0
  122. package/dist/astro/routes/api/admin/comments/index.d.mts.map +1 -0
  123. package/dist/astro/routes/api/admin/comments/index.mjs +53 -0
  124. package/dist/astro/routes/api/admin/comments/index.mjs.map +1 -0
  125. package/dist/astro/routes/api/admin/core-update.d.mts +8 -0
  126. package/dist/astro/routes/api/admin/core-update.d.mts.map +1 -0
  127. package/dist/astro/routes/api/admin/core-update.mjs +28 -0
  128. package/dist/astro/routes/api/admin/core-update.mjs.map +1 -0
  129. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts +8 -0
  130. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts.map +1 -0
  131. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +50 -0
  132. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs.map +1 -0
  133. package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts +8 -0
  134. package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts.map +1 -0
  135. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +35 -0
  136. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs.map +1 -0
  137. package/dist/astro/routes/api/admin/media-usage/activation.d.mts +9 -0
  138. package/dist/astro/routes/api/admin/media-usage/activation.d.mts.map +1 -0
  139. package/dist/astro/routes/api/admin/media-usage/activation.mjs +54 -0
  140. package/dist/astro/routes/api/admin/media-usage/activation.mjs.map +1 -0
  141. package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.d.mts +8 -0
  142. package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.d.mts.map +1 -0
  143. package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs +45 -0
  144. package/dist/astro/routes/api/admin/media-usage/collection-deletions/index.mjs.map +1 -0
  145. package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.d.mts +8 -0
  146. package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.d.mts.map +1 -0
  147. package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs +45 -0
  148. package/dist/astro/routes/api/admin/media-usage/collection-deletions/retry.mjs.map +1 -0
  149. package/dist/astro/routes/api/admin/media-usage/progress.d.mts +9 -0
  150. package/dist/astro/routes/api/admin/media-usage/progress.d.mts.map +1 -0
  151. package/dist/astro/routes/api/admin/media-usage/progress.mjs +56 -0
  152. package/dist/astro/routes/api/admin/media-usage/progress.mjs.map +1 -0
  153. package/dist/astro/routes/api/admin/media-usage/repair.d.mts +8 -0
  154. package/dist/astro/routes/api/admin/media-usage/repair.d.mts.map +1 -0
  155. package/dist/astro/routes/api/admin/media-usage/repair.mjs +53 -0
  156. package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -0
  157. package/dist/astro/routes/api/admin/media-usage/work/index.d.mts +8 -0
  158. package/dist/astro/routes/api/admin/media-usage/work/index.d.mts.map +1 -0
  159. package/dist/astro/routes/api/admin/media-usage/work/index.mjs +46 -0
  160. package/dist/astro/routes/api/admin/media-usage/work/index.mjs.map +1 -0
  161. package/dist/astro/routes/api/admin/media-usage/work/retry.d.mts +8 -0
  162. package/dist/astro/routes/api/admin/media-usage/work/retry.d.mts.map +1 -0
  163. package/dist/astro/routes/api/admin/media-usage/work/retry.mjs +46 -0
  164. package/dist/astro/routes/api/admin/media-usage/work/retry.mjs.map +1 -0
  165. package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts +19 -0
  166. package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts.map +1 -0
  167. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +71 -0
  168. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs.map +1 -0
  169. package/dist/astro/routes/api/admin/oauth-clients/index.d.mts +15 -0
  170. package/dist/astro/routes/api/admin/oauth-clients/index.d.mts.map +1 -0
  171. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +52 -0
  172. package/dist/astro/routes/api/admin/oauth-clients/index.mjs.map +1 -0
  173. package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts +8 -0
  174. package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts.map +1 -0
  175. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +28 -0
  176. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -0
  177. package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts +8 -0
  178. package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts.map +1 -0
  179. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +28 -0
  180. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -0
  181. package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts +8 -0
  182. package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts.map +1 -0
  183. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +105 -0
  184. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -0
  185. package/dist/astro/routes/api/admin/plugins/_id_/mcp.d.mts +8 -0
  186. package/dist/astro/routes/api/admin/plugins/_id_/mcp.d.mts.map +1 -0
  187. package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +41 -0
  188. package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs.map +1 -0
  189. package/dist/astro/routes/api/admin/plugins/_id_/settings.d.mts +9 -0
  190. package/dist/astro/routes/api/admin/plugins/_id_/settings.d.mts.map +1 -0
  191. package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +116 -0
  192. package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -0
  193. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts +8 -0
  194. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts.map +1 -0
  195. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +112 -0
  196. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -0
  197. package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts +8 -0
  198. package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts.map +1 -0
  199. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +139 -0
  200. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -0
  201. package/dist/astro/routes/api/admin/plugins/index.d.mts +8 -0
  202. package/dist/astro/routes/api/admin/plugins/index.d.mts.map +1 -0
  203. package/dist/astro/routes/api/admin/plugins/index.mjs +103 -0
  204. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -0
  205. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts +8 -0
  206. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts.map +1 -0
  207. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +44 -0
  208. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs.map +1 -0
  209. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts +8 -0
  210. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts.map +1 -0
  211. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +99 -0
  212. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -0
  213. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts +8 -0
  214. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts.map +1 -0
  215. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +142 -0
  216. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -0
  217. package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts +8 -0
  218. package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts.map +1 -0
  219. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +106 -0
  220. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -0
  221. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.d.mts +8 -0
  222. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.d.mts.map +1 -0
  223. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +112 -0
  224. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -0
  225. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts +8 -0
  226. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.d.mts.map +1 -0
  227. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +160 -0
  228. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -0
  229. package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts +8 -0
  230. package/dist/astro/routes/api/admin/plugins/registry/artifact.d.mts.map +1 -0
  231. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +362 -0
  232. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -0
  233. package/dist/astro/routes/api/admin/plugins/registry/install.d.mts +8 -0
  234. package/dist/astro/routes/api/admin/plugins/registry/install.d.mts.map +1 -0
  235. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +155 -0
  236. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -0
  237. package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.d.mts +8 -0
  238. package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.d.mts.map +1 -0
  239. package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.mjs +221 -0
  240. package/dist/astro/routes/api/admin/plugins/registry/publisher-handle.mjs.map +1 -0
  241. package/dist/astro/routes/api/admin/plugins/registry/verify.d.mts +8 -0
  242. package/dist/astro/routes/api/admin/plugins/registry/verify.d.mts.map +1 -0
  243. package/dist/astro/routes/api/admin/plugins/registry/verify.mjs +117 -0
  244. package/dist/astro/routes/api/admin/plugins/registry/verify.mjs.map +1 -0
  245. package/dist/astro/routes/api/admin/plugins/updates.d.mts +8 -0
  246. package/dist/astro/routes/api/admin/plugins/updates.d.mts.map +1 -0
  247. package/dist/astro/routes/api/admin/plugins/updates.mjs +109 -0
  248. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -0
  249. package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.d.mts +8 -0
  250. package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.d.mts.map +1 -0
  251. package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.mjs +29 -0
  252. package/dist/astro/routes/api/admin/scheduled-policy-rejections/_collection_/_id_.mjs.map +1 -0
  253. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts +8 -0
  254. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts.map +1 -0
  255. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +99 -0
  256. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -0
  257. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts +8 -0
  258. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts.map +1 -0
  259. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +44 -0
  260. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs.map +1 -0
  261. package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts +8 -0
  262. package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts.map +1 -0
  263. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +115 -0
  264. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -0
  265. package/dist/astro/routes/api/admin/transfer/_...path_.d.mts +12 -0
  266. package/dist/astro/routes/api/admin/transfer/_...path_.d.mts.map +1 -0
  267. package/dist/astro/routes/api/admin/transfer/_...path_.mjs +144 -0
  268. package/dist/astro/routes/api/admin/transfer/_...path_.mjs.map +1 -0
  269. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.d.mts +8 -0
  270. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.d.mts.map +1 -0
  271. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs +69 -0
  272. package/dist/astro/routes/api/admin/transfer/approvals/_id_/approve.mjs.map +1 -0
  273. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.d.mts +8 -0
  274. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.d.mts.map +1 -0
  275. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs +69 -0
  276. package/dist/astro/routes/api/admin/transfer/approvals/_id_/deny.mjs.map +1 -0
  277. package/dist/astro/routes/api/admin/transfer/approvals/index.d.mts +8 -0
  278. package/dist/astro/routes/api/admin/transfer/approvals/index.d.mts.map +1 -0
  279. package/dist/astro/routes/api/admin/transfer/approvals/index.mjs +68 -0
  280. package/dist/astro/routes/api/admin/transfer/approvals/index.mjs.map +1 -0
  281. package/dist/astro/routes/api/admin/transfer/capabilities.d.mts +8 -0
  282. package/dist/astro/routes/api/admin/transfer/capabilities.d.mts.map +1 -0
  283. package/dist/astro/routes/api/admin/transfer/capabilities.mjs +71 -0
  284. package/dist/astro/routes/api/admin/transfer/capabilities.mjs.map +1 -0
  285. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.d.mts +8 -0
  286. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.d.mts.map +1 -0
  287. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs +68 -0
  288. package/dist/astro/routes/api/admin/transfer/exports/_id_/advance.mjs.map +1 -0
  289. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.d.mts +8 -0
  290. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.d.mts.map +1 -0
  291. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs +71 -0
  292. package/dist/astro/routes/api/admin/transfer/exports/_id_/archive.mjs.map +1 -0
  293. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.d.mts +8 -0
  294. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.d.mts.map +1 -0
  295. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs +70 -0
  296. package/dist/astro/routes/api/admin/transfer/exports/_id_/files/_...path_.mjs.map +1 -0
  297. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.d.mts +8 -0
  298. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.d.mts.map +1 -0
  299. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs +67 -0
  300. package/dist/astro/routes/api/admin/transfer/exports/_id_/index.mjs.map +1 -0
  301. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.d.mts +8 -0
  302. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.d.mts.map +1 -0
  303. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs +70 -0
  304. package/dist/astro/routes/api/admin/transfer/exports/_id_/manifest.mjs.map +1 -0
  305. package/dist/astro/routes/api/admin/transfer/exports/index.d.mts +9 -0
  306. package/dist/astro/routes/api/admin/transfer/exports/index.d.mts.map +1 -0
  307. package/dist/astro/routes/api/admin/transfer/exports/index.mjs +92 -0
  308. package/dist/astro/routes/api/admin/transfer/exports/index.mjs.map +1 -0
  309. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.d.mts +8 -0
  310. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.d.mts.map +1 -0
  311. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs +67 -0
  312. package/dist/astro/routes/api/admin/transfer/imports/_id_/abandon.mjs.map +1 -0
  313. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.d.mts +8 -0
  314. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.d.mts.map +1 -0
  315. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs +71 -0
  316. package/dist/astro/routes/api/admin/transfer/imports/_id_/advance.mjs.map +1 -0
  317. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.d.mts +8 -0
  318. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.d.mts.map +1 -0
  319. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs +79 -0
  320. package/dist/astro/routes/api/admin/transfer/imports/_id_/analyze.mjs.map +1 -0
  321. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.d.mts +8 -0
  322. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.d.mts.map +1 -0
  323. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs +67 -0
  324. package/dist/astro/routes/api/admin/transfer/imports/_id_/cancel.mjs.map +1 -0
  325. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.d.mts +8 -0
  326. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.d.mts.map +1 -0
  327. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs +78 -0
  328. package/dist/astro/routes/api/admin/transfer/imports/_id_/execute.mjs.map +1 -0
  329. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.d.mts +8 -0
  330. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.d.mts.map +1 -0
  331. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs +78 -0
  332. package/dist/astro/routes/api/admin/transfer/imports/_id_/files/_...path_.mjs.map +1 -0
  333. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.d.mts +8 -0
  334. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.d.mts.map +1 -0
  335. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs +67 -0
  336. package/dist/astro/routes/api/admin/transfer/imports/_id_/index.mjs.map +1 -0
  337. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.d.mts +8 -0
  338. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.d.mts.map +1 -0
  339. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs +71 -0
  340. package/dist/astro/routes/api/admin/transfer/imports/_id_/missing.mjs.map +1 -0
  341. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.d.mts +8 -0
  342. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.d.mts.map +1 -0
  343. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs +68 -0
  344. package/dist/astro/routes/api/admin/transfer/imports/_id_/plan.mjs.map +1 -0
  345. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.d.mts +8 -0
  346. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.d.mts.map +1 -0
  347. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs +67 -0
  348. package/dist/astro/routes/api/admin/transfer/imports/_id_/receipt.mjs.map +1 -0
  349. package/dist/astro/routes/api/admin/transfer/imports/index.d.mts +9 -0
  350. package/dist/astro/routes/api/admin/transfer/imports/index.d.mts.map +1 -0
  351. package/dist/astro/routes/api/admin/transfer/imports/index.mjs +100 -0
  352. package/dist/astro/routes/api/admin/transfer/imports/index.mjs.map +1 -0
  353. package/dist/astro/routes/api/admin/users/_id_/disable.d.mts +8 -0
  354. package/dist/astro/routes/api/admin/users/_id_/disable.d.mts.map +1 -0
  355. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +45 -0
  356. package/dist/astro/routes/api/admin/users/_id_/disable.mjs.map +1 -0
  357. package/dist/astro/routes/api/admin/users/_id_/enable.d.mts +8 -0
  358. package/dist/astro/routes/api/admin/users/_id_/enable.d.mts.map +1 -0
  359. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +34 -0
  360. package/dist/astro/routes/api/admin/users/_id_/enable.mjs.map +1 -0
  361. package/dist/astro/routes/api/admin/users/_id_/index.d.mts +9 -0
  362. package/dist/astro/routes/api/admin/users/_id_/index.d.mts.map +1 -0
  363. package/dist/astro/routes/api/admin/users/_id_/index.mjs +117 -0
  364. package/dist/astro/routes/api/admin/users/_id_/index.mjs.map +1 -0
  365. package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts +8 -0
  366. package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts.map +1 -0
  367. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +56 -0
  368. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs.map +1 -0
  369. package/dist/astro/routes/api/admin/users/index.d.mts +8 -0
  370. package/dist/astro/routes/api/admin/users/index.d.mts.map +1 -0
  371. package/dist/astro/routes/api/admin/users/index.mjs +67 -0
  372. package/dist/astro/routes/api/admin/users/index.mjs.map +1 -0
  373. package/dist/astro/routes/api/auth/dev-bypass.d.mts +9 -0
  374. package/dist/astro/routes/api/auth/dev-bypass.d.mts.map +1 -0
  375. package/dist/astro/routes/api/auth/dev-bypass.mjs +83 -0
  376. package/dist/astro/routes/api/auth/dev-bypass.mjs.map +1 -0
  377. package/dist/astro/routes/api/auth/invite/accept.d.mts +8 -0
  378. package/dist/astro/routes/api/auth/invite/accept.d.mts.map +1 -0
  379. package/dist/astro/routes/api/auth/invite/accept.mjs +36 -0
  380. package/dist/astro/routes/api/auth/invite/accept.mjs.map +1 -0
  381. package/dist/astro/routes/api/auth/invite/complete.d.mts +8 -0
  382. package/dist/astro/routes/api/auth/invite/complete.d.mts.map +1 -0
  383. package/dist/astro/routes/api/auth/invite/complete.mjs +70 -0
  384. package/dist/astro/routes/api/auth/invite/complete.mjs.map +1 -0
  385. package/dist/astro/routes/api/auth/invite/index.d.mts +8 -0
  386. package/dist/astro/routes/api/auth/invite/index.d.mts.map +1 -0
  387. package/dist/astro/routes/api/auth/invite/index.mjs +70 -0
  388. package/dist/astro/routes/api/auth/invite/index.mjs.map +1 -0
  389. package/dist/astro/routes/api/auth/invite/register-options.d.mts +8 -0
  390. package/dist/astro/routes/api/auth/invite/register-options.d.mts.map +1 -0
  391. package/dist/astro/routes/api/auth/invite/register-options.mjs +57 -0
  392. package/dist/astro/routes/api/auth/invite/register-options.mjs.map +1 -0
  393. package/dist/astro/routes/api/auth/logout.d.mts +8 -0
  394. package/dist/astro/routes/api/auth/logout.d.mts.map +1 -0
  395. package/dist/astro/routes/api/auth/logout.mjs +29 -0
  396. package/dist/astro/routes/api/auth/logout.mjs.map +1 -0
  397. package/dist/astro/routes/api/auth/magic-link/send.d.mts +8 -0
  398. package/dist/astro/routes/api/auth/magic-link/send.d.mts.map +1 -0
  399. package/dist/astro/routes/api/auth/magic-link/send.mjs +69 -0
  400. package/dist/astro/routes/api/auth/magic-link/send.mjs.map +1 -0
  401. package/dist/astro/routes/api/auth/magic-link/verify.d.mts +9 -0
  402. package/dist/astro/routes/api/auth/magic-link/verify.d.mts.map +1 -0
  403. package/dist/astro/routes/api/auth/magic-link/verify.mjs +59 -0
  404. package/dist/astro/routes/api/auth/magic-link/verify.mjs.map +1 -0
  405. package/dist/astro/routes/api/auth/me.d.mts +14 -0
  406. package/dist/astro/routes/api/auth/me.d.mts.map +1 -0
  407. package/dist/astro/routes/api/auth/me.mjs +71 -0
  408. package/dist/astro/routes/api/auth/me.mjs.map +1 -0
  409. package/dist/astro/routes/api/auth/mode.d.mts +8 -0
  410. package/dist/astro/routes/api/auth/mode.d.mts.map +1 -0
  411. package/dist/astro/routes/api/auth/mode.mjs +34 -0
  412. package/dist/astro/routes/api/auth/mode.mjs.map +1 -0
  413. package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts +8 -0
  414. package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts.map +1 -0
  415. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +149 -0
  416. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs.map +1 -0
  417. package/dist/astro/routes/api/auth/oauth/_provider_.d.mts +8 -0
  418. package/dist/astro/routes/api/auth/oauth/_provider_.d.mts.map +1 -0
  419. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +66 -0
  420. package/dist/astro/routes/api/auth/oauth/_provider_.mjs.map +1 -0
  421. package/dist/astro/routes/api/auth/passkey/_id_.d.mts +15 -0
  422. package/dist/astro/routes/api/auth/passkey/_id_.d.mts.map +1 -0
  423. package/dist/astro/routes/api/auth/passkey/_id_.mjs +75 -0
  424. package/dist/astro/routes/api/auth/passkey/_id_.mjs.map +1 -0
  425. package/dist/astro/routes/api/auth/passkey/index.d.mts +8 -0
  426. package/dist/astro/routes/api/auth/passkey/index.d.mts.map +1 -0
  427. package/dist/astro/routes/api/auth/passkey/index.mjs +30 -0
  428. package/dist/astro/routes/api/auth/passkey/index.mjs.map +1 -0
  429. package/dist/astro/routes/api/auth/passkey/options.d.mts +8 -0
  430. package/dist/astro/routes/api/auth/passkey/options.d.mts.map +1 -0
  431. package/dist/astro/routes/api/auth/passkey/options.mjs +50 -0
  432. package/dist/astro/routes/api/auth/passkey/options.mjs.map +1 -0
  433. package/dist/astro/routes/api/auth/passkey/register/options.d.mts +8 -0
  434. package/dist/astro/routes/api/auth/passkey/register/options.d.mts.map +1 -0
  435. package/dist/astro/routes/api/auth/passkey/register/options.mjs +57 -0
  436. package/dist/astro/routes/api/auth/passkey/register/options.mjs.map +1 -0
  437. package/dist/astro/routes/api/auth/passkey/register/verify.d.mts +8 -0
  438. package/dist/astro/routes/api/auth/passkey/register/verify.d.mts.map +1 -0
  439. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +72 -0
  440. package/dist/astro/routes/api/auth/passkey/register/verify.mjs.map +1 -0
  441. package/dist/astro/routes/api/auth/passkey/verify.d.mts +8 -0
  442. package/dist/astro/routes/api/auth/passkey/verify.d.mts.map +1 -0
  443. package/dist/astro/routes/api/auth/passkey/verify.mjs +63 -0
  444. package/dist/astro/routes/api/auth/passkey/verify.mjs.map +1 -0
  445. package/dist/astro/routes/api/auth/signup/complete.d.mts +8 -0
  446. package/dist/astro/routes/api/auth/signup/complete.d.mts.map +1 -0
  447. package/dist/astro/routes/api/auth/signup/complete.mjs +71 -0
  448. package/dist/astro/routes/api/auth/signup/complete.mjs.map +1 -0
  449. package/dist/astro/routes/api/auth/signup/request.d.mts +8 -0
  450. package/dist/astro/routes/api/auth/signup/request.d.mts.map +1 -0
  451. package/dist/astro/routes/api/auth/signup/request.mjs +57 -0
  452. package/dist/astro/routes/api/auth/signup/request.mjs.map +1 -0
  453. package/dist/astro/routes/api/auth/signup/verify.d.mts +8 -0
  454. package/dist/astro/routes/api/auth/signup/verify.d.mts.map +1 -0
  455. package/dist/astro/routes/api/auth/signup/verify.mjs +37 -0
  456. package/dist/astro/routes/api/auth/signup/verify.mjs.map +1 -0
  457. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +15 -0
  458. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts.map +1 -0
  459. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +60 -0
  460. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs.map +1 -0
  461. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.d.mts +9 -0
  462. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.d.mts.map +1 -0
  463. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +189 -0
  464. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs.map +1 -0
  465. package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts +8 -0
  466. package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts.map +1 -0
  467. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +22 -0
  468. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs.map +1 -0
  469. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts +8 -0
  470. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts.map +1 -0
  471. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +51 -0
  472. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -0
  473. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts +8 -0
  474. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts.map +1 -0
  475. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +32 -0
  476. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs.map +1 -0
  477. package/dist/astro/routes/api/content/_collection_/_id_/lock.d.mts +10 -0
  478. package/dist/astro/routes/api/content/_collection_/_id_/lock.d.mts.map +1 -0
  479. package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs +73 -0
  480. package/dist/astro/routes/api/content/_collection_/_id_/lock.mjs.map +1 -0
  481. package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts +8 -0
  482. package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts.map +1 -0
  483. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +25 -0
  484. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs.map +1 -0
  485. package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.d.mts +8 -0
  486. package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.d.mts.map +1 -0
  487. package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.mjs +38 -0
  488. package/dist/astro/routes/api/content/_collection_/_id_/plugin-extensions/_pluginId_/_kind_/_extensionId_.mjs.map +1 -0
  489. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts +8 -0
  490. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts.map +1 -0
  491. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +135 -0
  492. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs.map +1 -0
  493. package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts +15 -0
  494. package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts.map +1 -0
  495. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +74 -0
  496. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -0
  497. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.d.mts +8 -0
  498. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.d.mts.map +1 -0
  499. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +80 -0
  500. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -0
  501. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.d.mts +8 -0
  502. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.d.mts.map +1 -0
  503. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +75 -0
  504. package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -0
  505. package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts +8 -0
  506. package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts.map +1 -0
  507. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +30 -0
  508. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs.map +1 -0
  509. package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts +8 -0
  510. package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts.map +1 -0
  511. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +24 -0
  512. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs.map +1 -0
  513. package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts +9 -0
  514. package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts.map +1 -0
  515. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +85 -0
  516. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -0
  517. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts +15 -0
  518. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts.map +1 -0
  519. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +133 -0
  520. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -0
  521. package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts +8 -0
  522. package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts.map +1 -0
  523. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +45 -0
  524. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs.map +1 -0
  525. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts +8 -0
  526. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts.map +1 -0
  527. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +58 -0
  528. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -0
  529. package/dist/astro/routes/api/content/_collection_/_id_.d.mts +10 -0
  530. package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -0
  531. package/dist/astro/routes/api/content/_collection_/_id_.mjs +114 -0
  532. package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -0
  533. package/dist/astro/routes/api/content/_collection_/authors.d.mts +8 -0
  534. package/dist/astro/routes/api/content/_collection_/authors.d.mts.map +1 -0
  535. package/dist/astro/routes/api/content/_collection_/authors.mjs +21 -0
  536. package/dist/astro/routes/api/content/_collection_/authors.mjs.map +1 -0
  537. package/dist/astro/routes/api/content/_collection_/index.d.mts +9 -0
  538. package/dist/astro/routes/api/content/_collection_/index.d.mts.map +1 -0
  539. package/dist/astro/routes/api/content/_collection_/index.mjs +77 -0
  540. package/dist/astro/routes/api/content/_collection_/index.mjs.map +1 -0
  541. package/dist/astro/routes/api/content/_collection_/trash.d.mts +8 -0
  542. package/dist/astro/routes/api/content/_collection_/trash.d.mts.map +1 -0
  543. package/dist/astro/routes/api/content/_collection_/trash.mjs +36 -0
  544. package/dist/astro/routes/api/content/_collection_/trash.mjs.map +1 -0
  545. package/dist/astro/routes/api/dashboard.d.mts +8 -0
  546. package/dist/astro/routes/api/dashboard.d.mts.map +1 -0
  547. package/dist/astro/routes/api/dashboard.mjs +37 -0
  548. package/dist/astro/routes/api/dashboard.mjs.map +1 -0
  549. package/dist/astro/routes/api/dev/emails.d.mts +9 -0
  550. package/dist/astro/routes/api/dev/emails.d.mts.map +1 -0
  551. package/dist/astro/routes/api/dev/emails.mjs +22 -0
  552. package/dist/astro/routes/api/dev/emails.mjs.map +1 -0
  553. package/dist/astro/routes/api/health.d.mts +8 -0
  554. package/dist/astro/routes/api/health.d.mts.map +1 -0
  555. package/dist/astro/routes/api/health.mjs +23 -0
  556. package/dist/astro/routes/api/health.mjs.map +1 -0
  557. package/dist/astro/routes/api/import/probe.d.mts +18 -0
  558. package/dist/astro/routes/api/import/probe.d.mts.map +1 -0
  559. package/dist/astro/routes/api/import/probe.mjs +56 -0
  560. package/dist/astro/routes/api/import/probe.mjs.map +1 -0
  561. package/dist/astro/routes/api/import/wordpress/analyze.d.mts +88 -0
  562. package/dist/astro/routes/api/import/wordpress/analyze.d.mts.map +1 -0
  563. package/dist/astro/routes/api/import/wordpress/analyze.mjs +315 -0
  564. package/dist/astro/routes/api/import/wordpress/analyze.mjs.map +1 -0
  565. package/dist/astro/routes/api/import/wordpress/execute.d.mts +66 -0
  566. package/dist/astro/routes/api/import/wordpress/execute.d.mts.map +1 -0
  567. package/dist/astro/routes/api/import/wordpress/execute.mjs +353 -0
  568. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -0
  569. package/dist/astro/routes/api/import/wordpress/media.d.mts +51 -0
  570. package/dist/astro/routes/api/import/wordpress/media.d.mts.map +1 -0
  571. package/dist/astro/routes/api/import/wordpress/media.mjs +241 -0
  572. package/dist/astro/routes/api/import/wordpress/media.mjs.map +1 -0
  573. package/dist/astro/routes/api/import/wordpress/prepare.d.mts +20 -0
  574. package/dist/astro/routes/api/import/wordpress/prepare.d.mts.map +1 -0
  575. package/dist/astro/routes/api/import/wordpress/prepare.mjs +131 -0
  576. package/dist/astro/routes/api/import/wordpress/prepare.mjs.map +1 -0
  577. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts +63 -0
  578. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.d.mts.map +1 -0
  579. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs +149 -0
  580. package/dist/astro/routes/api/import/wordpress/rewrite-url-helpers.mjs.map +1 -0
  581. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +37 -0
  582. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts.map +1 -0
  583. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +179 -0
  584. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -0
  585. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +16 -0
  586. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts.map +1 -0
  587. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +92 -0
  588. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs.map +1 -0
  589. package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts +8 -0
  590. package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts.map +1 -0
  591. package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +29 -0
  592. package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs.map +1 -0
  593. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +60 -0
  594. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts.map +1 -0
  595. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +718 -0
  596. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -0
  597. package/dist/astro/routes/api/manifest.d.mts +8 -0
  598. package/dist/astro/routes/api/manifest.d.mts.map +1 -0
  599. package/dist/astro/routes/api/manifest.mjs +65 -0
  600. package/dist/astro/routes/api/manifest.mjs.map +1 -0
  601. package/dist/astro/routes/api/mcp.d.mts +16 -0
  602. package/dist/astro/routes/api/mcp.d.mts.map +1 -0
  603. package/dist/astro/routes/api/mcp.mjs +2693 -0
  604. package/dist/astro/routes/api/mcp.mjs.map +1 -0
  605. package/dist/astro/routes/api/media/_id_/confirm.d.mts +11 -0
  606. package/dist/astro/routes/api/media/_id_/confirm.d.mts.map +1 -0
  607. package/dist/astro/routes/api/media/_id_/confirm.mjs +178 -0
  608. package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -0
  609. package/dist/astro/routes/api/media/_id_/replace.d.mts +8 -0
  610. package/dist/astro/routes/api/media/_id_/replace.d.mts.map +1 -0
  611. package/dist/astro/routes/api/media/_id_/replace.mjs +99 -0
  612. package/dist/astro/routes/api/media/_id_/replace.mjs.map +1 -0
  613. package/dist/astro/routes/api/media/_id_/upload.d.mts +8 -0
  614. package/dist/astro/routes/api/media/_id_/upload.d.mts.map +1 -0
  615. package/dist/astro/routes/api/media/_id_/upload.mjs +170 -0
  616. package/dist/astro/routes/api/media/_id_/upload.mjs.map +1 -0
  617. package/dist/astro/routes/api/media/_id_/usage.d.mts +8 -0
  618. package/dist/astro/routes/api/media/_id_/usage.d.mts.map +1 -0
  619. package/dist/astro/routes/api/media/_id_/usage.mjs +60 -0
  620. package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -0
  621. package/dist/astro/routes/api/media/_id_.d.mts +23 -0
  622. package/dist/astro/routes/api/media/_id_.d.mts.map +1 -0
  623. package/dist/astro/routes/api/media/_id_.mjs +129 -0
  624. package/dist/astro/routes/api/media/_id_.mjs.map +1 -0
  625. package/dist/astro/routes/api/media/asset/_id_/_filename_.d.mts +8 -0
  626. package/dist/astro/routes/api/media/asset/_id_/_filename_.d.mts.map +1 -0
  627. package/dist/astro/routes/api/media/asset/_id_/_filename_.mjs +54 -0
  628. package/dist/astro/routes/api/media/asset/_id_/_filename_.mjs.map +1 -0
  629. package/dist/astro/routes/api/media/file/_...key_.d.mts +8 -0
  630. package/dist/astro/routes/api/media/file/_...key_.d.mts.map +1 -0
  631. package/dist/astro/routes/api/media/file/_...key_.mjs +83 -0
  632. package/dist/astro/routes/api/media/file/_...key_.mjs.map +1 -0
  633. package/dist/astro/routes/api/media/folders/_id_.d.mts +10 -0
  634. package/dist/astro/routes/api/media/folders/_id_.d.mts.map +1 -0
  635. package/dist/astro/routes/api/media/folders/_id_.mjs +60 -0
  636. package/dist/astro/routes/api/media/folders/_id_.mjs.map +1 -0
  637. package/dist/astro/routes/api/media/folders/index.d.mts +9 -0
  638. package/dist/astro/routes/api/media/folders/index.d.mts.map +1 -0
  639. package/dist/astro/routes/api/media/folders/index.mjs +49 -0
  640. package/dist/astro/routes/api/media/folders/index.mjs.map +1 -0
  641. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts +15 -0
  642. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts.map +1 -0
  643. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +54 -0
  644. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs.map +1 -0
  645. package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts +15 -0
  646. package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts.map +1 -0
  647. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +77 -0
  648. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs.map +1 -0
  649. package/dist/astro/routes/api/media/providers/index.d.mts +11 -0
  650. package/dist/astro/routes/api/media/providers/index.d.mts.map +1 -0
  651. package/dist/astro/routes/api/media/providers/index.mjs +23 -0
  652. package/dist/astro/routes/api/media/providers/index.mjs.map +1 -0
  653. package/dist/astro/routes/api/media/upload-url.d.mts +11 -0
  654. package/dist/astro/routes/api/media/upload-url.d.mts.map +1 -0
  655. package/dist/astro/routes/api/media/upload-url.mjs +106 -0
  656. package/dist/astro/routes/api/media/upload-url.mjs.map +1 -0
  657. package/dist/astro/routes/api/media.d.mts +17 -0
  658. package/dist/astro/routes/api/media.d.mts.map +1 -0
  659. package/dist/astro/routes/api/media.mjs +211 -0
  660. package/dist/astro/routes/api/media.mjs.map +1 -0
  661. package/dist/astro/routes/api/menus/_name_/items/_id_.d.mts +9 -0
  662. package/dist/astro/routes/api/menus/_name_/items/_id_.d.mts.map +1 -0
  663. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +68 -0
  664. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -0
  665. package/dist/astro/routes/api/menus/_name_/items.d.mts +8 -0
  666. package/dist/astro/routes/api/menus/_name_/items.d.mts.map +1 -0
  667. package/dist/astro/routes/api/menus/_name_/items.mjs +48 -0
  668. package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -0
  669. package/dist/astro/routes/api/menus/_name_/reorder.d.mts +8 -0
  670. package/dist/astro/routes/api/menus/_name_/reorder.d.mts.map +1 -0
  671. package/dist/astro/routes/api/menus/_name_/reorder.mjs +48 -0
  672. package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -0
  673. package/dist/astro/routes/api/menus/_name_/translations.d.mts +9 -0
  674. package/dist/astro/routes/api/menus/_name_/translations.d.mts.map +1 -0
  675. package/dist/astro/routes/api/menus/_name_/translations.mjs +79 -0
  676. package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -0
  677. package/dist/astro/routes/api/menus/_name_.d.mts +10 -0
  678. package/dist/astro/routes/api/menus/_name_.d.mts.map +1 -0
  679. package/dist/astro/routes/api/menus/_name_.mjs +80 -0
  680. package/dist/astro/routes/api/menus/_name_.mjs.map +1 -0
  681. package/dist/astro/routes/api/menus/index.d.mts +9 -0
  682. package/dist/astro/routes/api/menus/index.d.mts.map +1 -0
  683. package/dist/astro/routes/api/menus/index.mjs +57 -0
  684. package/dist/astro/routes/api/menus/index.mjs.map +1 -0
  685. package/dist/astro/routes/api/oauth/authorize.d.mts +9 -0
  686. package/dist/astro/routes/api/oauth/authorize.d.mts.map +1 -0
  687. package/dist/astro/routes/api/oauth/authorize.mjs +276 -0
  688. package/dist/astro/routes/api/oauth/authorize.mjs.map +1 -0
  689. package/dist/astro/routes/api/oauth/device/authorize.d.mts +9 -0
  690. package/dist/astro/routes/api/oauth/device/authorize.d.mts.map +1 -0
  691. package/dist/astro/routes/api/oauth/device/authorize.mjs +48 -0
  692. package/dist/astro/routes/api/oauth/device/authorize.mjs.map +1 -0
  693. package/dist/astro/routes/api/oauth/device/code.d.mts +8 -0
  694. package/dist/astro/routes/api/oauth/device/code.d.mts.map +1 -0
  695. package/dist/astro/routes/api/oauth/device/code.mjs +38 -0
  696. package/dist/astro/routes/api/oauth/device/code.mjs.map +1 -0
  697. package/dist/astro/routes/api/oauth/device/token.d.mts +8 -0
  698. package/dist/astro/routes/api/oauth/device/token.d.mts.map +1 -0
  699. package/dist/astro/routes/api/oauth/device/token.mjs +49 -0
  700. package/dist/astro/routes/api/oauth/device/token.mjs.map +1 -0
  701. package/dist/astro/routes/api/oauth/register.d.mts +9 -0
  702. package/dist/astro/routes/api/oauth/register.d.mts.map +1 -0
  703. package/dist/astro/routes/api/oauth/register.mjs +123 -0
  704. package/dist/astro/routes/api/oauth/register.mjs.map +1 -0
  705. package/dist/astro/routes/api/oauth/token/refresh.d.mts +8 -0
  706. package/dist/astro/routes/api/oauth/token/refresh.d.mts.map +1 -0
  707. package/dist/astro/routes/api/oauth/token/refresh.mjs +32 -0
  708. package/dist/astro/routes/api/oauth/token/refresh.mjs.map +1 -0
  709. package/dist/astro/routes/api/oauth/token/revoke.d.mts +8 -0
  710. package/dist/astro/routes/api/oauth/token/revoke.d.mts.map +1 -0
  711. package/dist/astro/routes/api/oauth/token/revoke.mjs +29 -0
  712. package/dist/astro/routes/api/oauth/token/revoke.mjs.map +1 -0
  713. package/dist/astro/routes/api/oauth/token.d.mts +9 -0
  714. package/dist/astro/routes/api/oauth/token.d.mts.map +1 -0
  715. package/dist/astro/routes/api/oauth/token.mjs +143 -0
  716. package/dist/astro/routes/api/oauth/token.mjs.map +1 -0
  717. package/dist/astro/routes/api/openapi.json.d.mts +8 -0
  718. package/dist/astro/routes/api/openapi.json.d.mts.map +1 -0
  719. package/dist/astro/routes/api/openapi.json.mjs +3676 -0
  720. package/dist/astro/routes/api/openapi.json.mjs.map +1 -0
  721. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts +13 -0
  722. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts.map +1 -0
  723. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +44 -0
  724. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs.map +1 -0
  725. package/dist/astro/routes/api/redirects/404s/index.d.mts +10 -0
  726. package/dist/astro/routes/api/redirects/404s/index.d.mts.map +1 -0
  727. package/dist/astro/routes/api/redirects/404s/index.mjs +76 -0
  728. package/dist/astro/routes/api/redirects/404s/index.mjs.map +1 -0
  729. package/dist/astro/routes/api/redirects/404s/summary.d.mts +8 -0
  730. package/dist/astro/routes/api/redirects/404s/summary.d.mts.map +1 -0
  731. package/dist/astro/routes/api/redirects/404s/summary.mjs +48 -0
  732. package/dist/astro/routes/api/redirects/404s/summary.mjs.map +1 -0
  733. package/dist/astro/routes/api/redirects/_id_.d.mts +10 -0
  734. package/dist/astro/routes/api/redirects/_id_.d.mts.map +1 -0
  735. package/dist/astro/routes/api/redirects/_id_.mjs +80 -0
  736. package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -0
  737. package/dist/astro/routes/api/redirects/index.d.mts +9 -0
  738. package/dist/astro/routes/api/redirects/index.d.mts.map +1 -0
  739. package/dist/astro/routes/api/redirects/index.mjs +63 -0
  740. package/dist/astro/routes/api/redirects/index.mjs.map +1 -0
  741. package/dist/astro/routes/api/relations/_id_/index.d.mts +10 -0
  742. package/dist/astro/routes/api/relations/_id_/index.d.mts.map +1 -0
  743. package/dist/astro/routes/api/relations/_id_/index.mjs +94 -0
  744. package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -0
  745. package/dist/astro/routes/api/relations/index.d.mts +9 -0
  746. package/dist/astro/routes/api/relations/index.d.mts.map +1 -0
  747. package/dist/astro/routes/api/relations/index.mjs +78 -0
  748. package/dist/astro/routes/api/relations/index.mjs.map +1 -0
  749. package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts +8 -0
  750. package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts.map +1 -0
  751. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +21 -0
  752. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs.map +1 -0
  753. package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts +8 -0
  754. package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts.map +1 -0
  755. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +48 -0
  756. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs.map +1 -0
  757. package/dist/astro/routes/api/schema/block-types/_slug_/index.d.mts +9 -0
  758. package/dist/astro/routes/api/schema/block-types/_slug_/index.d.mts.map +1 -0
  759. package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs +109 -0
  760. package/dist/astro/routes/api/schema/block-types/_slug_/index.mjs.map +1 -0
  761. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.d.mts +8 -0
  762. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.d.mts.map +1 -0
  763. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs +103 -0
  764. package/dist/astro/routes/api/schema/block-types/_slug_/versions/_version_/activate.mjs.map +1 -0
  765. package/dist/astro/routes/api/schema/block-types/index.d.mts +9 -0
  766. package/dist/astro/routes/api/schema/block-types/index.d.mts.map +1 -0
  767. package/dist/astro/routes/api/schema/block-types/index.mjs +109 -0
  768. package/dist/astro/routes/api/schema/block-types/index.mjs.map +1 -0
  769. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts +10 -0
  770. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts.map +1 -0
  771. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +123 -0
  772. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -0
  773. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts +9 -0
  774. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts.map +1 -0
  775. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +111 -0
  776. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -0
  777. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts +8 -0
  778. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts.map +1 -0
  779. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +102 -0
  780. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -0
  781. package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts +10 -0
  782. package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts.map +1 -0
  783. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +127 -0
  784. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -0
  785. package/dist/astro/routes/api/schema/collections/index.d.mts +9 -0
  786. package/dist/astro/routes/api/schema/collections/index.d.mts.map +1 -0
  787. package/dist/astro/routes/api/schema/collections/index.mjs +111 -0
  788. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -0
  789. package/dist/astro/routes/api/schema/collections/reorder.d.mts +8 -0
  790. package/dist/astro/routes/api/schema/collections/reorder.d.mts.map +1 -0
  791. package/dist/astro/routes/api/schema/collections/reorder.mjs +101 -0
  792. package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -0
  793. package/dist/astro/routes/api/schema/index.d.mts +8 -0
  794. package/dist/astro/routes/api/schema/index.d.mts.map +1 -0
  795. package/dist/astro/routes/api/schema/index.mjs +92 -0
  796. package/dist/astro/routes/api/schema/index.mjs.map +1 -0
  797. package/dist/astro/routes/api/schema/orphans/_slug_.d.mts +8 -0
  798. package/dist/astro/routes/api/schema/orphans/_slug_.d.mts.map +1 -0
  799. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +103 -0
  800. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -0
  801. package/dist/astro/routes/api/schema/orphans/index.d.mts +8 -0
  802. package/dist/astro/routes/api/schema/orphans/index.d.mts.map +1 -0
  803. package/dist/astro/routes/api/schema/orphans/index.mjs +98 -0
  804. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -0
  805. package/dist/astro/routes/api/search/enable.d.mts +17 -0
  806. package/dist/astro/routes/api/search/enable.d.mts.map +1 -0
  807. package/dist/astro/routes/api/search/enable.mjs +71 -0
  808. package/dist/astro/routes/api/search/enable.mjs.map +1 -0
  809. package/dist/astro/routes/api/search/index.d.mts +17 -0
  810. package/dist/astro/routes/api/search/index.d.mts.map +1 -0
  811. package/dist/astro/routes/api/search/index.mjs +66 -0
  812. package/dist/astro/routes/api/search/index.mjs.map +1 -0
  813. package/dist/astro/routes/api/search/rebuild.d.mts +14 -0
  814. package/dist/astro/routes/api/search/rebuild.d.mts.map +1 -0
  815. package/dist/astro/routes/api/search/rebuild.mjs +60 -0
  816. package/dist/astro/routes/api/search/rebuild.mjs.map +1 -0
  817. package/dist/astro/routes/api/search/stats.d.mts +11 -0
  818. package/dist/astro/routes/api/search/stats.d.mts.map +1 -0
  819. package/dist/astro/routes/api/search/stats.mjs +33 -0
  820. package/dist/astro/routes/api/search/stats.mjs.map +1 -0
  821. package/dist/astro/routes/api/search/suggest.d.mts +16 -0
  822. package/dist/astro/routes/api/search/suggest.d.mts.map +1 -0
  823. package/dist/astro/routes/api/search/suggest.mjs +55 -0
  824. package/dist/astro/routes/api/search/suggest.mjs.map +1 -0
  825. package/dist/astro/routes/api/sections/_slug_.d.mts +10 -0
  826. package/dist/astro/routes/api/sections/_slug_.d.mts.map +1 -0
  827. package/dist/astro/routes/api/sections/_slug_.mjs +77 -0
  828. package/dist/astro/routes/api/sections/_slug_.mjs.map +1 -0
  829. package/dist/astro/routes/api/sections/index.d.mts +9 -0
  830. package/dist/astro/routes/api/sections/index.d.mts.map +1 -0
  831. package/dist/astro/routes/api/sections/index.mjs +60 -0
  832. package/dist/astro/routes/api/sections/index.mjs.map +1 -0
  833. package/dist/astro/routes/api/settings/backups/archives/_name_.d.mts +9 -0
  834. package/dist/astro/routes/api/settings/backups/archives/_name_.d.mts.map +1 -0
  835. package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +50 -0
  836. package/dist/astro/routes/api/settings/backups/archives/_name_.mjs.map +1 -0
  837. package/dist/astro/routes/api/settings/backups/archives/index.d.mts +8 -0
  838. package/dist/astro/routes/api/settings/backups/archives/index.d.mts.map +1 -0
  839. package/dist/astro/routes/api/settings/backups/archives/index.mjs +26 -0
  840. package/dist/astro/routes/api/settings/backups/archives/index.mjs.map +1 -0
  841. package/dist/astro/routes/api/settings/backups/export.d.mts +8 -0
  842. package/dist/astro/routes/api/settings/backups/export.d.mts.map +1 -0
  843. package/dist/astro/routes/api/settings/backups/export.mjs +37 -0
  844. package/dist/astro/routes/api/settings/backups/export.mjs.map +1 -0
  845. package/dist/astro/routes/api/settings/backups/index.d.mts +9 -0
  846. package/dist/astro/routes/api/settings/backups/index.d.mts.map +1 -0
  847. package/dist/astro/routes/api/settings/backups/index.mjs +54 -0
  848. package/dist/astro/routes/api/settings/backups/index.mjs.map +1 -0
  849. package/dist/astro/routes/api/settings/email.d.mts +18 -0
  850. package/dist/astro/routes/api/settings/email.d.mts.map +1 -0
  851. package/dist/astro/routes/api/settings/email.mjs +107 -0
  852. package/dist/astro/routes/api/settings/email.mjs.map +1 -0
  853. package/dist/astro/routes/api/settings.d.mts +21 -0
  854. package/dist/astro/routes/api/settings.d.mts.map +1 -0
  855. package/dist/astro/routes/api/settings.mjs +76 -0
  856. package/dist/astro/routes/api/settings.mjs.map +1 -0
  857. package/dist/astro/routes/api/setup/admin-verify.d.mts +8 -0
  858. package/dist/astro/routes/api/setup/admin-verify.d.mts.map +1 -0
  859. package/dist/astro/routes/api/setup/admin-verify.mjs +83 -0
  860. package/dist/astro/routes/api/setup/admin-verify.mjs.map +1 -0
  861. package/dist/astro/routes/api/setup/admin.d.mts +8 -0
  862. package/dist/astro/routes/api/setup/admin.d.mts.map +1 -0
  863. package/dist/astro/routes/api/setup/admin.mjs +83 -0
  864. package/dist/astro/routes/api/setup/admin.mjs.map +1 -0
  865. package/dist/astro/routes/api/setup/dev-bypass.d.mts +9 -0
  866. package/dist/astro/routes/api/setup/dev-bypass.d.mts.map +1 -0
  867. package/dist/astro/routes/api/setup/dev-bypass.mjs +172 -0
  868. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -0
  869. package/dist/astro/routes/api/setup/dev-reset.d.mts +8 -0
  870. package/dist/astro/routes/api/setup/dev-reset.d.mts.map +1 -0
  871. package/dist/astro/routes/api/setup/dev-reset.mjs +27 -0
  872. package/dist/astro/routes/api/setup/dev-reset.mjs.map +1 -0
  873. package/dist/astro/routes/api/setup/index.d.mts +8 -0
  874. package/dist/astro/routes/api/setup/index.d.mts.map +1 -0
  875. package/dist/astro/routes/api/setup/index.mjs +147 -0
  876. package/dist/astro/routes/api/setup/index.mjs.map +1 -0
  877. package/dist/astro/routes/api/setup/status.d.mts +8 -0
  878. package/dist/astro/routes/api/setup/status.d.mts.map +1 -0
  879. package/dist/astro/routes/api/setup/status.mjs +62 -0
  880. package/dist/astro/routes/api/setup/status.mjs.map +1 -0
  881. package/dist/astro/routes/api/snapshot.d.mts +8 -0
  882. package/dist/astro/routes/api/snapshot.d.mts.map +1 -0
  883. package/dist/astro/routes/api/snapshot.mjs +68 -0
  884. package/dist/astro/routes/api/snapshot.mjs.map +1 -0
  885. package/dist/astro/routes/api/taxonomies/_name_/reorder.d.mts +8 -0
  886. package/dist/astro/routes/api/taxonomies/_name_/reorder.d.mts.map +1 -0
  887. package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +57 -0
  888. package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs.map +1 -0
  889. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts +9 -0
  890. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.d.mts.map +1 -0
  891. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +92 -0
  892. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -0
  893. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts +19 -0
  894. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts.map +1 -0
  895. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +103 -0
  896. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -0
  897. package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts +15 -0
  898. package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts.map +1 -0
  899. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +83 -0
  900. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -0
  901. package/dist/astro/routes/api/taxonomies/_name_/translations.d.mts +8 -0
  902. package/dist/astro/routes/api/taxonomies/_name_/translations.d.mts.map +1 -0
  903. package/dist/astro/routes/api/taxonomies/_name_/translations.mjs +55 -0
  904. package/dist/astro/routes/api/taxonomies/_name_/translations.mjs.map +1 -0
  905. package/dist/astro/routes/api/taxonomies/_name_.d.mts +19 -0
  906. package/dist/astro/routes/api/taxonomies/_name_.d.mts.map +1 -0
  907. package/dist/astro/routes/api/taxonomies/_name_.mjs +104 -0
  908. package/dist/astro/routes/api/taxonomies/_name_.mjs.map +1 -0
  909. package/dist/astro/routes/api/taxonomies/bulk-tag.d.mts +8 -0
  910. package/dist/astro/routes/api/taxonomies/bulk-tag.d.mts.map +1 -0
  911. package/dist/astro/routes/api/taxonomies/bulk-tag.mjs +297 -0
  912. package/dist/astro/routes/api/taxonomies/bulk-tag.mjs.map +1 -0
  913. package/dist/astro/routes/api/taxonomies/index.d.mts +15 -0
  914. package/dist/astro/routes/api/taxonomies/index.d.mts.map +1 -0
  915. package/dist/astro/routes/api/taxonomies/index.mjs +75 -0
  916. package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -0
  917. package/dist/astro/routes/api/themes/preview.d.mts +8 -0
  918. package/dist/astro/routes/api/themes/preview.d.mts.map +1 -0
  919. package/dist/astro/routes/api/themes/preview.mjs +52 -0
  920. package/dist/astro/routes/api/themes/preview.mjs.map +1 -0
  921. package/dist/astro/routes/api/typegen.d.mts +18 -0
  922. package/dist/astro/routes/api/typegen.d.mts.map +1 -0
  923. package/dist/astro/routes/api/typegen.mjs +50 -0
  924. package/dist/astro/routes/api/typegen.mjs.map +1 -0
  925. package/dist/astro/routes/api/visual-editing/action-token.d.mts +8 -0
  926. package/dist/astro/routes/api/visual-editing/action-token.d.mts.map +1 -0
  927. package/dist/astro/routes/api/visual-editing/action-token.mjs +27 -0
  928. package/dist/astro/routes/api/visual-editing/action-token.mjs.map +1 -0
  929. package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.d.mts +8 -0
  930. package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.d.mts.map +1 -0
  931. package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.mjs +44 -0
  932. package/dist/astro/routes/api/visual-editing/content/_collection_/_id_/publish.mjs.map +1 -0
  933. package/dist/astro/routes/api/visual-editing/toolbar-labels.d.mts +8 -0
  934. package/dist/astro/routes/api/visual-editing/toolbar-labels.d.mts.map +1 -0
  935. package/dist/astro/routes/api/visual-editing/toolbar-labels.mjs +22 -0
  936. package/dist/astro/routes/api/visual-editing/toolbar-labels.mjs.map +1 -0
  937. package/dist/astro/routes/api/well-known/auth.d.mts +8 -0
  938. package/dist/astro/routes/api/well-known/auth.d.mts.map +1 -0
  939. package/dist/astro/routes/api/well-known/auth.mjs +42 -0
  940. package/dist/astro/routes/api/well-known/auth.mjs.map +1 -0
  941. package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts +8 -0
  942. package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts.map +1 -0
  943. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +33 -0
  944. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs.map +1 -0
  945. package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts +8 -0
  946. package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts.map +1 -0
  947. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +22 -0
  948. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs.map +1 -0
  949. package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts +8 -0
  950. package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts.map +1 -0
  951. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +49 -0
  952. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs.map +1 -0
  953. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts +9 -0
  954. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts.map +1 -0
  955. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +78 -0
  956. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs.map +1 -0
  957. package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts +8 -0
  958. package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts.map +1 -0
  959. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +64 -0
  960. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs.map +1 -0
  961. package/dist/astro/routes/api/widget-areas/_name_.d.mts +9 -0
  962. package/dist/astro/routes/api/widget-areas/_name_.d.mts.map +1 -0
  963. package/dist/astro/routes/api/widget-areas/_name_.mjs +55 -0
  964. package/dist/astro/routes/api/widget-areas/_name_.mjs.map +1 -0
  965. package/dist/astro/routes/api/widget-areas/index.d.mts +9 -0
  966. package/dist/astro/routes/api/widget-areas/index.d.mts.map +1 -0
  967. package/dist/astro/routes/api/widget-areas/index.mjs +74 -0
  968. package/dist/astro/routes/api/widget-areas/index.mjs.map +1 -0
  969. package/dist/astro/routes/api/widget-components.d.mts +8 -0
  970. package/dist/astro/routes/api/widget-components.d.mts.map +1 -0
  971. package/dist/astro/routes/api/widget-components.mjs +20 -0
  972. package/dist/astro/routes/api/widget-components.mjs.map +1 -0
  973. package/dist/astro/routes/robots.txt.d.mts +8 -0
  974. package/dist/astro/routes/robots.txt.d.mts.map +1 -0
  975. package/dist/astro/routes/robots.txt.mjs +65 -0
  976. package/dist/astro/routes/robots.txt.mjs.map +1 -0
  977. package/dist/astro/routes/sitemap-_collection_.xml.d.mts +8 -0
  978. package/dist/astro/routes/sitemap-_collection_.xml.d.mts.map +1 -0
  979. package/dist/astro/routes/sitemap-_collection_.xml.mjs +131 -0
  980. package/dist/astro/routes/sitemap-_collection_.xml.mjs.map +1 -0
  981. package/dist/astro/routes/sitemap.xml.d.mts +8 -0
  982. package/dist/astro/routes/sitemap.xml.d.mts.map +1 -0
  983. package/dist/astro/routes/sitemap.xml.mjs +68 -0
  984. package/dist/astro/routes/sitemap.xml.mjs.map +1 -0
  985. package/dist/astro/types.d.mts +246 -25
  986. package/dist/astro/types.d.mts.map +1 -1
  987. package/dist/audit-BszbE_BP.mjs +127 -0
  988. package/dist/audit-BszbE_BP.mjs.map +1 -0
  989. package/dist/auth/providers/github.d.mts +13 -0
  990. package/dist/auth/providers/github.d.mts.map +1 -0
  991. package/dist/auth/providers/github.mjs +18 -0
  992. package/dist/auth/providers/github.mjs.map +1 -0
  993. package/dist/auth/providers/google.d.mts +13 -0
  994. package/dist/auth/providers/google.d.mts.map +1 -0
  995. package/dist/auth/providers/google.mjs +18 -0
  996. package/dist/auth/providers/google.mjs.map +1 -0
  997. package/dist/authoritative-records-dSvXCfzb.mjs +5172 -0
  998. package/dist/authoritative-records-dSvXCfzb.mjs.map +1 -0
  999. package/dist/authorize-CJtizVbp.mjs +49 -0
  1000. package/dist/authorize-CJtizVbp.mjs.map +1 -0
  1001. package/dist/backup-Cpl8TqRz.mjs +246 -0
  1002. package/dist/backup-Cpl8TqRz.mjs.map +1 -0
  1003. package/dist/base64-DvnNgP7e.mjs +63 -0
  1004. package/dist/base64-DvnNgP7e.mjs.map +1 -0
  1005. package/dist/block-types-DIG_KZwi.mjs +132 -0
  1006. package/dist/block-types-DIG_KZwi.mjs.map +1 -0
  1007. package/dist/block-values-BrTrtA-v.mjs +175 -0
  1008. package/dist/block-values-BrTrtA-v.mjs.map +1 -0
  1009. package/dist/byline-02tu_Uc-.mjs +909 -0
  1010. package/dist/byline-02tu_Uc-.mjs.map +1 -0
  1011. package/dist/byline-fields-DHJs0Mja.mjs +280 -0
  1012. package/dist/byline-fields-DHJs0Mja.mjs.map +1 -0
  1013. package/dist/byline-fields-xdxE9kxZ.mjs +123 -0
  1014. package/dist/byline-fields-xdxE9kxZ.mjs.map +1 -0
  1015. package/dist/byline-registry-dvt4N3xV.mjs +406 -0
  1016. package/dist/byline-registry-dvt4N3xV.mjs.map +1 -0
  1017. package/dist/bylines-CTGTsEAs.mjs +150 -0
  1018. package/dist/bylines-CTGTsEAs.mjs.map +1 -0
  1019. package/dist/bylines-DATJ0B8u.mjs +214 -0
  1020. package/dist/bylines-DATJ0B8u.mjs.map +1 -0
  1021. package/dist/cache-CPanL9IO.mjs +114 -0
  1022. package/dist/cache-CPanL9IO.mjs.map +1 -0
  1023. package/dist/canonical-CAecl1UQ.mjs +174 -0
  1024. package/dist/canonical-CAecl1UQ.mjs.map +1 -0
  1025. package/dist/capture-triggers-CdZfvHtF.mjs +362 -0
  1026. package/dist/capture-triggers-CdZfvHtF.mjs.map +1 -0
  1027. package/dist/challenge-store-CxZxPqaw.mjs +51 -0
  1028. package/dist/challenge-store-CxZxPqaw.mjs.map +1 -0
  1029. package/dist/checksum-DtH6m5uk.mjs +162 -0
  1030. package/dist/checksum-DtH6m5uk.mjs.map +1 -0
  1031. package/dist/chrome-tags-CKELm-bo.mjs +24 -0
  1032. package/dist/chrome-tags-CKELm-bo.mjs.map +1 -0
  1033. package/dist/chunks-DBmkKmBH.mjs +25 -0
  1034. package/dist/chunks-DBmkKmBH.mjs.map +1 -0
  1035. package/dist/cli/index.mjs +3021 -1548
  1036. package/dist/cli/index.mjs.map +1 -1
  1037. package/dist/client/cf-access.d.mts +1 -1
  1038. package/dist/client/index.d.mts +1296 -11
  1039. package/dist/client/index.d.mts.map +1 -1
  1040. package/dist/client/index.mjs +313 -27
  1041. package/dist/client/index.mjs.map +1 -1
  1042. package/dist/collection-deletion-JecE26cS.mjs +436 -0
  1043. package/dist/collection-deletion-JecE26cS.mjs.map +1 -0
  1044. package/dist/collection-deletion-processor-DgCfF3a1.mjs +217 -0
  1045. package/dist/collection-deletion-processor-DgCfF3a1.mjs.map +1 -0
  1046. package/dist/collection-slugs-cache-BNRAPNiu.mjs +85 -0
  1047. package/dist/collection-slugs-cache-BNRAPNiu.mjs.map +1 -0
  1048. package/dist/comment-Cq1UYN8_.mjs +313 -0
  1049. package/dist/comment-Cq1UYN8_.mjs.map +1 -0
  1050. package/dist/comment-reaction-DPeGAfjd.mjs +85 -0
  1051. package/dist/comment-reaction-DPeGAfjd.mjs.map +1 -0
  1052. package/dist/comments-BRtp992B.mjs +99 -0
  1053. package/dist/comments-BRtp992B.mjs.map +1 -0
  1054. package/dist/comments-Bi2j9IoX.mjs +195 -0
  1055. package/dist/comments-Bi2j9IoX.mjs.map +1 -0
  1056. package/dist/components-CQY-Sgm-.mjs +108 -0
  1057. package/dist/components-CQY-Sgm-.mjs.map +1 -0
  1058. package/dist/config-B-uePMLj.d.mts +39 -0
  1059. package/dist/config-B-uePMLj.d.mts.map +1 -0
  1060. package/dist/config-BVX7iYr4.d.mts +6679 -0
  1061. package/dist/config-BVX7iYr4.d.mts.map +1 -0
  1062. package/dist/config-CXPcy2iY.mjs +228 -0
  1063. package/dist/config-CXPcy2iY.mjs.map +1 -0
  1064. package/dist/config-CvmjJcVw.mjs +73 -0
  1065. package/dist/config-CvmjJcVw.mjs.map +1 -0
  1066. package/dist/connection-B9pIasFd.mjs +36 -0
  1067. package/dist/connection-B9pIasFd.mjs.map +1 -0
  1068. package/dist/content-RzEXY3QX.mjs +2020 -0
  1069. package/dist/content-RzEXY3QX.mjs.map +1 -0
  1070. package/dist/content-list-query-DiNwyKtd.d.mts +26 -0
  1071. package/dist/content-list-query-DiNwyKtd.d.mts.map +1 -0
  1072. package/dist/content-policy-Dm32n9C6.mjs +46 -0
  1073. package/dist/content-policy-Dm32n9C6.mjs.map +1 -0
  1074. package/dist/content-repair-B-k5JrVN.mjs +442 -0
  1075. package/dist/content-repair-B-k5JrVN.mjs.map +1 -0
  1076. package/dist/context-CTkYVMZV.mjs +2026 -0
  1077. package/dist/context-CTkYVMZV.mjs.map +1 -0
  1078. package/dist/credits-CAFPFhuk.mjs +110 -0
  1079. package/dist/credits-CAFPFhuk.mjs.map +1 -0
  1080. package/dist/cron-xe5XKqA-.mjs +306 -0
  1081. package/dist/cron-xe5XKqA-.mjs.map +1 -0
  1082. package/dist/dashboard-BoV4pwPP.mjs +151 -0
  1083. package/dist/dashboard-BoV4pwPP.mjs.map +1 -0
  1084. package/dist/database/instrumentation.d.mts +35 -5
  1085. package/dist/database/instrumentation.d.mts.map +1 -1
  1086. package/dist/database/instrumentation.mjs +40 -9
  1087. package/dist/database/instrumentation.mjs.map +1 -1
  1088. package/dist/database/migration-lock.d.mts +37 -0
  1089. package/dist/database/migration-lock.d.mts.map +1 -0
  1090. package/dist/database/migration-lock.mjs +76 -0
  1091. package/dist/database/migration-lock.mjs.map +1 -0
  1092. package/dist/database/pg-migration-lock.d.mts +21 -0
  1093. package/dist/database/pg-migration-lock.d.mts.map +1 -0
  1094. package/dist/database/pg-migration-lock.mjs +42 -0
  1095. package/dist/database/pg-migration-lock.mjs.map +1 -0
  1096. package/dist/datetime-normalization-PeiEdcRY.mjs +187 -0
  1097. package/dist/datetime-normalization-PeiEdcRY.mjs.map +1 -0
  1098. package/dist/db/index.d.mts +4 -4
  1099. package/dist/db/index.mjs +35 -10
  1100. package/dist/db/index.mjs.map +1 -1
  1101. package/dist/db/libsql-migrations.d.mts +11 -0
  1102. package/dist/db/libsql-migrations.d.mts.map +1 -0
  1103. package/dist/db/libsql-migrations.mjs +58 -0
  1104. package/dist/db/libsql-migrations.mjs.map +1 -0
  1105. package/dist/db/libsql.d.mts +1 -1
  1106. package/dist/db/libsql.d.mts.map +1 -1
  1107. package/dist/db/libsql.mjs +7 -2
  1108. package/dist/db/libsql.mjs.map +1 -1
  1109. package/dist/db/postgres-migrations.d.mts +10 -0
  1110. package/dist/db/postgres-migrations.d.mts.map +1 -0
  1111. package/dist/db/postgres-migrations.mjs +48 -0
  1112. package/dist/db/postgres-migrations.mjs.map +1 -0
  1113. package/dist/db/postgres.d.mts +1 -1
  1114. package/dist/db/postgres.d.mts.map +1 -1
  1115. package/dist/db/postgres.mjs +20 -10
  1116. package/dist/db/postgres.mjs.map +1 -1
  1117. package/dist/db/sqlite-migrations.d.mts +10 -0
  1118. package/dist/db/sqlite-migrations.d.mts.map +1 -0
  1119. package/dist/db/sqlite-migrations.mjs +29 -0
  1120. package/dist/db/sqlite-migrations.mjs.map +1 -0
  1121. package/dist/db/sqlite.d.mts +1 -1
  1122. package/dist/db/sqlite.d.mts.map +1 -1
  1123. package/dist/db/sqlite.mjs +9 -4
  1124. package/dist/db/sqlite.mjs.map +1 -1
  1125. package/dist/db-errors-CBD5yMro.mjs +55 -0
  1126. package/dist/db-errors-CBD5yMro.mjs.map +1 -0
  1127. package/dist/default-DaoYyFRS.mjs +81 -0
  1128. package/dist/default-DaoYyFRS.mjs.map +1 -0
  1129. package/dist/deferred-tasks-BYcDx2o_.d.mts +9 -0
  1130. package/dist/deferred-tasks-BYcDx2o_.d.mts.map +1 -0
  1131. package/dist/destination-r2zIAZ2S.mjs +18 -0
  1132. package/dist/destination-r2zIAZ2S.mjs.map +1 -0
  1133. package/dist/dev-typegen-8JlYYFno.mjs +29 -0
  1134. package/dist/dev-typegen-8JlYYFno.mjs.map +1 -0
  1135. package/dist/device-flow-Ma5P5d2e.mjs +521 -0
  1136. package/dist/device-flow-Ma5P5d2e.mjs.map +1 -0
  1137. package/dist/dialect-helpers-7_IqPdh9.mjs +307 -0
  1138. package/dist/dialect-helpers-7_IqPdh9.mjs.map +1 -0
  1139. package/dist/digest-DiYAoZpf.mjs +194 -0
  1140. package/dist/digest-DiYAoZpf.mjs.map +1 -0
  1141. package/dist/direct-executor-FCIRepAU.mjs +104 -0
  1142. package/dist/direct-executor-FCIRepAU.mjs.map +1 -0
  1143. package/dist/dist-Cfu8mMBs.mjs +810 -0
  1144. package/dist/dist-Cfu8mMBs.mjs.map +1 -0
  1145. package/dist/email-console-DmqVF5J_.mjs +50 -0
  1146. package/dist/email-console-DmqVF5J_.mjs.map +1 -0
  1147. package/dist/email-locale-Cc5YSXfJ.mjs +25 -0
  1148. package/dist/email-locale-Cc5YSXfJ.mjs.map +1 -0
  1149. package/dist/emdash-runtime-YPrVnr6x.mjs +4226 -0
  1150. package/dist/emdash-runtime-YPrVnr6x.mjs.map +1 -0
  1151. package/dist/enrich-BDdVNeDK.mjs +194 -0
  1152. package/dist/enrich-BDdVNeDK.mjs.map +1 -0
  1153. package/dist/entry-lock-BtDo1zFm.d.mts +4544 -0
  1154. package/dist/entry-lock-BtDo1zFm.d.mts.map +1 -0
  1155. package/dist/entry-lock-PP1JCXBB.mjs +1180 -0
  1156. package/dist/entry-lock-PP1JCXBB.mjs.map +1 -0
  1157. package/dist/entry-lock-WyppUeRW.mjs +163 -0
  1158. package/dist/entry-lock-WyppUeRW.mjs.map +1 -0
  1159. package/dist/entry-locks-DJAqVweV.mjs +167 -0
  1160. package/dist/entry-locks-DJAqVweV.mjs.map +1 -0
  1161. package/dist/env-types-BaTCgn-y.mjs +38 -0
  1162. package/dist/env-types-BaTCgn-y.mjs.map +1 -0
  1163. package/dist/error-CEdm_AWU.mjs +90 -0
  1164. package/dist/error-CEdm_AWU.mjs.map +1 -0
  1165. package/dist/errors-9P_FDrJ_.mjs +17 -0
  1166. package/dist/errors-9P_FDrJ_.mjs.map +1 -0
  1167. package/dist/errors-CNvATh_7.mjs +469 -0
  1168. package/dist/errors-CNvATh_7.mjs.map +1 -0
  1169. package/dist/errors-CjXd1LgH.mjs +120 -0
  1170. package/dist/errors-CjXd1LgH.mjs.map +1 -0
  1171. package/dist/escape-nJW7dR0s.mjs +9 -0
  1172. package/dist/escape-nJW7dR0s.mjs.map +1 -0
  1173. package/dist/fence-BrnQffdY.mjs +162 -0
  1174. package/dist/fence-BrnQffdY.mjs.map +1 -0
  1175. package/dist/field-defs-cache-DEkFYCDE.mjs +77 -0
  1176. package/dist/field-defs-cache-DEkFYCDE.mjs.map +1 -0
  1177. package/dist/field-map-BfYMstlG.mjs +83 -0
  1178. package/dist/field-map-BfYMstlG.mjs.map +1 -0
  1179. package/dist/focal-point-JX8kcOTQ.mjs +23 -0
  1180. package/dist/focal-point-JX8kcOTQ.mjs.map +1 -0
  1181. package/dist/fts-manager-DU03MxWu.mjs +443 -0
  1182. package/dist/fts-manager-DU03MxWu.mjs.map +1 -0
  1183. package/dist/gc-BO9NqlAe.mjs +75 -0
  1184. package/dist/gc-BO9NqlAe.mjs.map +1 -0
  1185. package/dist/hash-CY4QdeMJ.mjs +37 -0
  1186. package/dist/hash-CY4QdeMJ.mjs.map +1 -0
  1187. package/dist/hook-result-DSRRxu_-.d.mts +31 -0
  1188. package/dist/hook-result-DSRRxu_-.d.mts.map +1 -0
  1189. package/dist/hreflang--av8HanY.d.mts +50 -0
  1190. package/dist/hreflang--av8HanY.d.mts.map +1 -0
  1191. package/dist/hreflang-CNbZjm4g.mjs +105 -0
  1192. package/dist/hreflang-CNbZjm4g.mjs.map +1 -0
  1193. package/dist/http-route-dispatch-16nzAM5m.mjs +339 -0
  1194. package/dist/http-route-dispatch-16nzAM5m.mjs.map +1 -0
  1195. package/dist/identity-DNaOsiip.mjs +35 -0
  1196. package/dist/identity-DNaOsiip.mjs.map +1 -0
  1197. package/dist/import-DUV3Gl6-.mjs +2020 -0
  1198. package/dist/import-DUV3Gl6-.mjs.map +1 -0
  1199. package/dist/index-m-lYQRqs.d.mts +623 -0
  1200. package/dist/index-m-lYQRqs.d.mts.map +1 -0
  1201. package/dist/index.d.mts +27 -11
  1202. package/dist/index.mjs +120 -28
  1203. package/dist/init-lock-4eRRB4Le.mjs +56 -0
  1204. package/dist/init-lock-4eRRB4Le.mjs.map +1 -0
  1205. package/dist/install-finalization-CPM7Gged.mjs +58 -0
  1206. package/dist/install-finalization-CPM7Gged.mjs.map +1 -0
  1207. package/dist/keys-B8g41vwJ.mjs +61 -0
  1208. package/dist/keys-B8g41vwJ.mjs.map +1 -0
  1209. package/dist/kinds-BKu9nb7q.mjs +974 -0
  1210. package/dist/kinds-BKu9nb7q.mjs.map +1 -0
  1211. package/dist/lifecycle-CpebZNAA.mjs +25 -0
  1212. package/dist/lifecycle-CpebZNAA.mjs.map +1 -0
  1213. package/dist/load-dHcR5yh9.mjs +28 -0
  1214. package/dist/load-dHcR5yh9.mjs.map +1 -0
  1215. package/dist/loader-CWb-ja1p.mjs +1197 -0
  1216. package/dist/loader-CWb-ja1p.mjs.map +1 -0
  1217. package/dist/loops-Dn1i16FP.mjs +205 -0
  1218. package/dist/loops-Dn1i16FP.mjs.map +1 -0
  1219. package/dist/manifest-builder-0ZHXBxOL.mjs +189 -0
  1220. package/dist/manifest-builder-0ZHXBxOL.mjs.map +1 -0
  1221. package/dist/manifest-schema-gy37bD_D.mjs +496 -0
  1222. package/dist/manifest-schema-gy37bD_D.mjs.map +1 -0
  1223. package/dist/marketplace-tHWSsCUo.mjs +257 -0
  1224. package/dist/marketplace-tHWSsCUo.mjs.map +1 -0
  1225. package/dist/media/image-endpoint.d.mts +104 -0
  1226. package/dist/media/image-endpoint.d.mts.map +1 -0
  1227. package/dist/media/image-endpoint.mjs +190 -0
  1228. package/dist/media/image-endpoint.mjs.map +1 -0
  1229. package/dist/media/index.d.mts +45 -2
  1230. package/dist/media/index.d.mts.map +1 -1
  1231. package/dist/media/index.mjs +17 -3
  1232. package/dist/media/index.mjs.map +1 -1
  1233. package/dist/media/local-runtime.d.mts +24 -7
  1234. package/dist/media/local-runtime.d.mts.map +1 -1
  1235. package/dist/media/local-runtime.mjs +41 -12
  1236. package/dist/media/local-runtime.mjs.map +1 -1
  1237. package/dist/media-3v7mqAVX.mjs +294 -0
  1238. package/dist/media-3v7mqAVX.mjs.map +1 -0
  1239. package/dist/media-CputjGE1.mjs +373 -0
  1240. package/dist/media-CputjGE1.mjs.map +1 -0
  1241. package/dist/media-D1z_jisb.mjs +408 -0
  1242. package/dist/media-D1z_jisb.mjs.map +1 -0
  1243. package/dist/media-allowlist-D5a4d-RA.mjs +44 -0
  1244. package/dist/media-allowlist-D5a4d-RA.mjs.map +1 -0
  1245. package/dist/media-folders-D2VdVBf6.mjs +210 -0
  1246. package/dist/media-folders-D2VdVBf6.mjs.map +1 -0
  1247. package/dist/media-url-DloW2xrP.mjs +43 -0
  1248. package/dist/media-url-DloW2xrP.mjs.map +1 -0
  1249. package/dist/media-usage-B8q0owWQ.mjs +1629 -0
  1250. package/dist/media-usage-B8q0owWQ.mjs.map +1 -0
  1251. package/dist/media-usage-activation-CQWOOTJi.mjs +78 -0
  1252. package/dist/media-usage-activation-CQWOOTJi.mjs.map +1 -0
  1253. package/dist/media-usage-work-BC0qpkMD.mjs +152 -0
  1254. package/dist/media-usage-work-BC0qpkMD.mjs.map +1 -0
  1255. package/dist/media-usage-work-BlMjwPg8.mjs +586 -0
  1256. package/dist/media-usage-work-BlMjwPg8.mjs.map +1 -0
  1257. package/dist/menus-BQKqf0Up.mjs +92 -0
  1258. package/dist/menus-BQKqf0Up.mjs.map +1 -0
  1259. package/dist/menus-XQdKk-87.mjs +3647 -0
  1260. package/dist/menus-XQdKk-87.mjs.map +1 -0
  1261. package/dist/menus-trvc6_fW.mjs +753 -0
  1262. package/dist/menus-trvc6_fW.mjs.map +1 -0
  1263. package/dist/migrations/index.d.mts +22 -0
  1264. package/dist/migrations/index.d.mts.map +1 -0
  1265. package/dist/migrations/index.mjs +8 -0
  1266. package/dist/mime-IZf-LHIS.mjs +36 -0
  1267. package/dist/mime-IZf-LHIS.mjs.map +1 -0
  1268. package/dist/mode-nh0ppSX5.mjs +23 -0
  1269. package/dist/mode-nh0ppSX5.mjs.map +1 -0
  1270. package/dist/node-sqlite-compat-CDOEcc97.mjs +63 -0
  1271. package/dist/node-sqlite-compat-CDOEcc97.mjs.map +1 -0
  1272. package/dist/normalize-BuWa0lvd.mjs +191 -0
  1273. package/dist/normalize-BuWa0lvd.mjs.map +1 -0
  1274. package/dist/oauth-authorization-BtYQ80uU.mjs +274 -0
  1275. package/dist/oauth-authorization-BtYQ80uU.mjs.map +1 -0
  1276. package/dist/oauth-clients-C1S4NQHh.mjs +266 -0
  1277. package/dist/oauth-clients-C1S4NQHh.mjs.map +1 -0
  1278. package/dist/oauth-state-store-CpGi2FZH.mjs +50 -0
  1279. package/dist/oauth-state-store-CpGi2FZH.mjs.map +1 -0
  1280. package/dist/oauth-user-lookup-BNp1aFAr.mjs +26 -0
  1281. package/dist/oauth-user-lookup-BNp1aFAr.mjs.map +1 -0
  1282. package/dist/object-cache/memory.d.mts +15 -0
  1283. package/dist/object-cache/memory.d.mts.map +1 -0
  1284. package/dist/object-cache/memory.mjs +56 -0
  1285. package/dist/object-cache/memory.mjs.map +1 -0
  1286. package/dist/object-cache-Bo6DGaC9.mjs +586 -0
  1287. package/dist/object-cache-Bo6DGaC9.mjs.map +1 -0
  1288. package/dist/options-DhrI7eMv.mjs +208 -0
  1289. package/dist/options-DhrI7eMv.mjs.map +1 -0
  1290. package/dist/options-Dl_W57-_.d.mts +81 -0
  1291. package/dist/options-Dl_W57-_.d.mts.map +1 -0
  1292. package/dist/ownership-DoeAIuTg.mjs +12 -0
  1293. package/dist/ownership-DoeAIuTg.mjs.map +1 -0
  1294. package/dist/page/index.d.mts +19 -5
  1295. package/dist/page/index.d.mts.map +1 -1
  1296. package/dist/page/index.mjs +32 -7
  1297. package/dist/page/index.mjs.map +1 -1
  1298. package/dist/parse-Gt2l4Sld.mjs +81 -0
  1299. package/dist/parse-Gt2l4Sld.mjs.map +1 -0
  1300. package/dist/parse-QVS0t5oR.d.mts +172 -0
  1301. package/dist/parse-QVS0t5oR.d.mts.map +1 -0
  1302. package/dist/passkey-config-C-MxsV22.mjs +46 -0
  1303. package/dist/passkey-config-C-MxsV22.mjs.map +1 -0
  1304. package/dist/paths-CqFwkjY8.mjs +77 -0
  1305. package/dist/paths-CqFwkjY8.mjs.map +1 -0
  1306. package/dist/patterns-DyZJ67I7.mjs +140 -0
  1307. package/dist/patterns-DyZJ67I7.mjs.map +1 -0
  1308. package/dist/placeholder-Dn7MMdWr.d.mts +306 -0
  1309. package/dist/placeholder-Dn7MMdWr.d.mts.map +1 -0
  1310. package/dist/plan-D8s1n84S.mjs +135 -0
  1311. package/dist/plan-D8s1n84S.mjs.map +1 -0
  1312. package/dist/plugin-test-runtime.d.mts +120 -0
  1313. package/dist/plugin-test-runtime.d.mts.map +1 -0
  1314. package/dist/plugin-test-runtime.mjs +126 -0
  1315. package/dist/plugin-types.d.mts +196 -0
  1316. package/dist/plugin-types.d.mts.map +1 -0
  1317. package/dist/plugin-types.mjs +18 -0
  1318. package/dist/plugin-types.mjs.map +1 -0
  1319. package/dist/plugin-utils.d.mts +36 -16
  1320. package/dist/plugin-utils.d.mts.map +1 -1
  1321. package/dist/plugin-utils.mjs +19 -16
  1322. package/dist/plugin-utils.mjs.map +1 -1
  1323. package/dist/plugins/adapt-sandbox-entry.d.mts +23 -12
  1324. package/dist/plugins/adapt-sandbox-entry.d.mts.map +1 -1
  1325. package/dist/plugins/adapt-sandbox-entry.mjs +124 -28
  1326. package/dist/plugins/adapt-sandbox-entry.mjs.map +1 -1
  1327. package/dist/plugins/host.d.mts +7 -0
  1328. package/dist/plugins/host.mjs +59 -0
  1329. package/dist/plugins/http-wire.d.mts +25 -0
  1330. package/dist/plugins/http-wire.d.mts.map +1 -0
  1331. package/dist/plugins/http-wire.mjs +148 -0
  1332. package/dist/plugins/http-wire.mjs.map +1 -0
  1333. package/dist/plugins/secret-redactor.d.mts +9 -0
  1334. package/dist/plugins/secret-redactor.d.mts.map +1 -0
  1335. package/dist/plugins/secret-redactor.mjs +51 -0
  1336. package/dist/plugins/secret-redactor.mjs.map +1 -0
  1337. package/dist/plugins-BpLkXA1S.mjs +277 -0
  1338. package/dist/plugins-BpLkXA1S.mjs.map +1 -0
  1339. package/dist/policy-C1qpNxrr.mjs +45 -0
  1340. package/dist/policy-C1qpNxrr.mjs.map +1 -0
  1341. package/dist/portable-text-BnRuiR1-.mjs +307 -0
  1342. package/dist/portable-text-BnRuiR1-.mjs.map +1 -0
  1343. package/dist/preview-DU5rwz_m.mjs +107 -0
  1344. package/dist/preview-DU5rwz_m.mjs.map +1 -0
  1345. package/dist/protocol-cEfbPvM6.d.mts +61 -0
  1346. package/dist/protocol-cEfbPvM6.d.mts.map +1 -0
  1347. package/dist/public-submission-x1eaT6Tx.mjs +250 -0
  1348. package/dist/public-submission-x1eaT6Tx.mjs.map +1 -0
  1349. package/dist/public-url-B5a0QAh6.mjs +101 -0
  1350. package/dist/public-url-B5a0QAh6.mjs.map +1 -0
  1351. package/dist/query-DSEkrw_m.mjs +41 -0
  1352. package/dist/query-DSEkrw_m.mjs.map +1 -0
  1353. package/dist/query-dHwqNf85.mjs +1161 -0
  1354. package/dist/query-dHwqNf85.mjs.map +1 -0
  1355. package/dist/rate-limit-BXx3Ecp9.mjs +120 -0
  1356. package/dist/rate-limit-BXx3Ecp9.mjs.map +1 -0
  1357. package/dist/receipt-RG5_pwsj.mjs +43 -0
  1358. package/dist/receipt-RG5_pwsj.mjs.map +1 -0
  1359. package/dist/redirect-BRoLiWQE.mjs +19 -0
  1360. package/dist/redirect-BRoLiWQE.mjs.map +1 -0
  1361. package/dist/redirect-BvFKh8Sz.mjs +416 -0
  1362. package/dist/redirect-BvFKh8Sz.mjs.map +1 -0
  1363. package/dist/redirects-CWQMKYOS.mjs +446 -0
  1364. package/dist/redirects-CWQMKYOS.mjs.map +1 -0
  1365. package/dist/redirects-D4EWeXAo.mjs +148 -0
  1366. package/dist/redirects-D4EWeXAo.mjs.map +1 -0
  1367. package/dist/registry/testing.d.mts +26 -0
  1368. package/dist/registry/testing.d.mts.map +1 -0
  1369. package/dist/registry/testing.mjs +265 -0
  1370. package/dist/registry/testing.mjs.map +1 -0
  1371. package/dist/registry-CtHRqVe-.mjs +6771 -0
  1372. package/dist/registry-CtHRqVe-.mjs.map +1 -0
  1373. package/dist/relations-CVI2nbrn.mjs +776 -0
  1374. package/dist/relations-CVI2nbrn.mjs.map +1 -0
  1375. package/dist/request-cache-C4CIo5ad.mjs +104 -0
  1376. package/dist/request-cache-C4CIo5ad.mjs.map +1 -0
  1377. package/dist/request-context.d.mts +45 -1
  1378. package/dist/request-context.d.mts.map +1 -1
  1379. package/dist/request-context.mjs +17 -3
  1380. package/dist/request-context.mjs.map +1 -1
  1381. package/dist/request-meta-B6blULFY.mjs +141 -0
  1382. package/dist/request-meta-B6blULFY.mjs.map +1 -0
  1383. package/dist/resolve-Cw4rWFJl.mjs +100 -0
  1384. package/dist/resolve-Cw4rWFJl.mjs.map +1 -0
  1385. package/dist/resolve-D-kqyKns.mjs +199 -0
  1386. package/dist/resolve-D-kqyKns.mjs.map +1 -0
  1387. package/dist/revision-CGkQA0e5.mjs +366 -0
  1388. package/dist/revision-CGkQA0e5.mjs.map +1 -0
  1389. package/dist/route-wire-DK600v4u.mjs +197 -0
  1390. package/dist/route-wire-DK600v4u.mjs.map +1 -0
  1391. package/dist/routes-D0u5zK2P.mjs +272 -0
  1392. package/dist/routes-D0u5zK2P.mjs.map +1 -0
  1393. package/dist/runner-CC8LZx97.d.mts +68 -0
  1394. package/dist/runner-CC8LZx97.d.mts.map +1 -0
  1395. package/dist/runner-CLpxmhl8.mjs +6197 -0
  1396. package/dist/runner-CLpxmhl8.mjs.map +1 -0
  1397. package/dist/runtime.d.mts +13 -6
  1398. package/dist/runtime.d.mts.map +1 -1
  1399. package/dist/runtime.mjs +6 -4
  1400. package/dist/runtime.mjs.map +1 -1
  1401. package/dist/schema/project-env-types.d.mts +12 -0
  1402. package/dist/schema/project-env-types.d.mts.map +1 -0
  1403. package/dist/schema/project-env-types.mjs +86 -0
  1404. package/dist/schema/project-env-types.mjs.map +1 -0
  1405. package/dist/schema-BZPj3kwZ.mjs +13 -0
  1406. package/dist/schema-BZPj3kwZ.mjs.map +1 -0
  1407. package/dist/schema-Berj5VQx.mjs +815 -0
  1408. package/dist/schema-Berj5VQx.mjs.map +1 -0
  1409. package/dist/scopes-CxvclshI.mjs +34 -0
  1410. package/dist/scopes-CxvclshI.mjs.map +1 -0
  1411. package/dist/search-CD5MiMdh.mjs +448 -0
  1412. package/dist/search-CD5MiMdh.mjs.map +1 -0
  1413. package/dist/secrets-CIi0nFiR.mjs +341 -0
  1414. package/dist/secrets-CIi0nFiR.mjs.map +1 -0
  1415. package/dist/sections-Do5KdTSQ.mjs +346 -0
  1416. package/dist/sections-Do5KdTSQ.mjs.map +1 -0
  1417. package/dist/seed/index.d.mts +2 -2
  1418. package/dist/seed/index.mjs +47 -14
  1419. package/dist/seo/index.d.mts +15 -2
  1420. package/dist/seo/index.d.mts.map +1 -1
  1421. package/dist/seo/index.mjs +39 -18
  1422. package/dist/seo/index.mjs.map +1 -1
  1423. package/dist/seo-C61bnPuV.mjs +114 -0
  1424. package/dist/seo-C61bnPuV.mjs.map +1 -0
  1425. package/dist/seo-DpYxmGaL.mjs +133 -0
  1426. package/dist/seo-DpYxmGaL.mjs.map +1 -0
  1427. package/dist/service-BFUImckH.mjs +150 -0
  1428. package/dist/service-BFUImckH.mjs.map +1 -0
  1429. package/dist/session-user-DVcHsFD5.mjs +61 -0
  1430. package/dist/session-user-DVcHsFD5.mjs.map +1 -0
  1431. package/dist/settings-B0zQj_Tj.mjs +61 -0
  1432. package/dist/settings-B0zQj_Tj.mjs.map +1 -0
  1433. package/dist/settings-Ckzmx-A1.mjs +51 -0
  1434. package/dist/settings-Ckzmx-A1.mjs.map +1 -0
  1435. package/dist/settings-CnWoEDb0.mjs +439 -0
  1436. package/dist/settings-CnWoEDb0.mjs.map +1 -0
  1437. package/dist/setup-complete-B2_dhZZz.mjs +65 -0
  1438. package/dist/setup-complete-B2_dhZZz.mjs.map +1 -0
  1439. package/dist/setup-nonce-CJV9ftSK.mjs +25 -0
  1440. package/dist/setup-nonce-CJV9ftSK.mjs.map +1 -0
  1441. package/dist/single-flight-cache-B5O2qhO1.mjs +104 -0
  1442. package/dist/single-flight-cache-B5O2qhO1.mjs.map +1 -0
  1443. package/dist/site-settings-AYFvhwQn.mjs +50 -0
  1444. package/dist/site-settings-AYFvhwQn.mjs.map +1 -0
  1445. package/dist/site-url-Ceq_AUK0.mjs +16 -0
  1446. package/dist/site-url-Ceq_AUK0.mjs.map +1 -0
  1447. package/dist/slugify-T5GHH42D.mjs +17 -0
  1448. package/dist/slugify-T5GHH42D.mjs.map +1 -0
  1449. package/dist/snapshot-Dzsn3NZa.mjs +414 -0
  1450. package/dist/snapshot-Dzsn3NZa.mjs.map +1 -0
  1451. package/dist/ssrf-DsmvZB80.mjs +406 -0
  1452. package/dist/ssrf-DsmvZB80.mjs.map +1 -0
  1453. package/dist/ssrf-tA45vIPX.mjs +1 -0
  1454. package/dist/stage-BcuakqfP.mjs +662 -0
  1455. package/dist/stage-BcuakqfP.mjs.map +1 -0
  1456. package/dist/staged-Bw5eHbKS.mjs +686 -0
  1457. package/dist/staged-Bw5eHbKS.mjs.map +1 -0
  1458. package/dist/state-kGdOMQRY.mjs +153 -0
  1459. package/dist/state-kGdOMQRY.mjs.map +1 -0
  1460. package/dist/status-D39Fpy8R.mjs +30 -0
  1461. package/dist/status-D39Fpy8R.mjs.map +1 -0
  1462. package/dist/storage/local.d.mts +2 -1
  1463. package/dist/storage/local.d.mts.map +1 -1
  1464. package/dist/storage/local.mjs +2 -2
  1465. package/dist/storage/local.mjs.map +1 -1
  1466. package/dist/storage/s3.d.mts +2 -1
  1467. package/dist/storage/s3.d.mts.map +1 -1
  1468. package/dist/storage/s3.mjs +4 -3
  1469. package/dist/storage/s3.mjs.map +1 -1
  1470. package/dist/storage-query-CKNIJhjo.d.mts +1614 -0
  1471. package/dist/storage-query-CKNIJhjo.d.mts.map +1 -0
  1472. package/dist/tar-n2OXqKpZ.mjs +449 -0
  1473. package/dist/tar-n2OXqKpZ.mjs.map +1 -0
  1474. package/dist/target-DOFs5oUC.mjs +27 -0
  1475. package/dist/target-DOFs5oUC.mjs.map +1 -0
  1476. package/dist/taxonomies-CMCnItWf.mjs +939 -0
  1477. package/dist/taxonomies-CMCnItWf.mjs.map +1 -0
  1478. package/dist/taxonomies-CvBe3xhM.mjs +697 -0
  1479. package/dist/taxonomies-CvBe3xhM.mjs.map +1 -0
  1480. package/dist/taxonomy-BesdHIwi.mjs +525 -0
  1481. package/dist/taxonomy-BesdHIwi.mjs.map +1 -0
  1482. package/dist/tokens-BIGxi8sP.mjs +171 -0
  1483. package/dist/tokens-BIGxi8sP.mjs.map +1 -0
  1484. package/dist/transaction-BVYIo_yu.mjs +29 -0
  1485. package/dist/transaction-BVYIo_yu.mjs.map +1 -0
  1486. package/dist/transfer-5Ce0QuNS.mjs +8856 -0
  1487. package/dist/transfer-5Ce0QuNS.mjs.map +1 -0
  1488. package/dist/transfer-CzdXsFRx.mjs +166 -0
  1489. package/dist/transfer-CzdXsFRx.mjs.map +1 -0
  1490. package/dist/transfer-download-Dc-ltjZY.mjs +33 -0
  1491. package/dist/transfer-download-Dc-ltjZY.mjs.map +1 -0
  1492. package/dist/transformations-BLzqMnpY.mjs +196 -0
  1493. package/dist/transformations-BLzqMnpY.mjs.map +1 -0
  1494. package/dist/transport-k1fykDBh.d.mts +42 -0
  1495. package/dist/transport-k1fykDBh.d.mts.map +1 -0
  1496. package/dist/transport-umzEbgYO.mjs +136 -0
  1497. package/dist/transport-umzEbgYO.mjs.map +1 -0
  1498. package/dist/trusted-proxy-BqfQFs6a.mjs +51 -0
  1499. package/dist/trusted-proxy-BqfQFs6a.mjs.map +1 -0
  1500. package/dist/turnstile-CvvKLtqE.mjs +53 -0
  1501. package/dist/turnstile-CvvKLtqE.mjs.map +1 -0
  1502. package/dist/types-B8tO_KdV.d.mts +896 -0
  1503. package/dist/types-B8tO_KdV.d.mts.map +1 -0
  1504. package/dist/types-BGmQ0uXs.mjs +201 -0
  1505. package/dist/types-BGmQ0uXs.mjs.map +1 -0
  1506. package/dist/types-BYaPWs_F.d.mts +198 -0
  1507. package/dist/types-BYaPWs_F.d.mts.map +1 -0
  1508. package/dist/types-CLTQ9b_r.d.mts +374 -0
  1509. package/dist/types-CLTQ9b_r.d.mts.map +1 -0
  1510. package/dist/types-CPkQw2T2.d.mts +85 -0
  1511. package/dist/types-CPkQw2T2.d.mts.map +1 -0
  1512. package/dist/types-CQLvuXoZ.d.mts +198 -0
  1513. package/dist/types-CQLvuXoZ.d.mts.map +1 -0
  1514. package/dist/types-CV5xszpF.d.mts +363 -0
  1515. package/dist/types-CV5xszpF.d.mts.map +1 -0
  1516. package/dist/types-CVsmpTcU.mjs +18 -0
  1517. package/dist/types-CVsmpTcU.mjs.map +1 -0
  1518. package/dist/types-CdEMurNh.mjs +77 -0
  1519. package/dist/types-CdEMurNh.mjs.map +1 -0
  1520. package/dist/types-CxwtnuSS.mjs +37 -0
  1521. package/dist/types-CxwtnuSS.mjs.map +1 -0
  1522. package/dist/types-DGw8KMX_.mjs +16 -0
  1523. package/dist/types-DGw8KMX_.mjs.map +1 -0
  1524. package/dist/types-DOfVMPoo.d.mts +125 -0
  1525. package/dist/types-DOfVMPoo.d.mts.map +1 -0
  1526. package/dist/types-Dsco9Y38.d.mts +1720 -0
  1527. package/dist/types-Dsco9Y38.d.mts.map +1 -0
  1528. package/dist/types-LtS0SM4F.d.mts +287 -0
  1529. package/dist/types-LtS0SM4F.d.mts.map +1 -0
  1530. package/dist/types-j6MBDjlZ.mjs +103 -0
  1531. package/dist/types-j6MBDjlZ.mjs.map +1 -0
  1532. package/dist/update-check-B2JKz5cr.mjs +161 -0
  1533. package/dist/update-check-B2JKz5cr.mjs.map +1 -0
  1534. package/dist/upload-attempts-BodUoFBu.mjs +32 -0
  1535. package/dist/upload-attempts-BodUoFBu.mjs.map +1 -0
  1536. package/dist/url-Dn3IStq8.mjs +104 -0
  1537. package/dist/url-Dn3IStq8.mjs.map +1 -0
  1538. package/dist/url-pattern-DGAG6ZP2.mjs +41 -0
  1539. package/dist/url-pattern-DGAG6ZP2.mjs.map +1 -0
  1540. package/dist/user-BOvuF1sQ.mjs +171 -0
  1541. package/dist/user-BOvuF1sQ.mjs.map +1 -0
  1542. package/dist/utils-CoV-PYhg.mjs +439 -0
  1543. package/dist/utils-CoV-PYhg.mjs.map +1 -0
  1544. package/dist/validate-DANX1-Qi.mjs +120 -0
  1545. package/dist/validate-DANX1-Qi.mjs.map +1 -0
  1546. package/dist/validate-DpP1QUiV.d.mts +468 -0
  1547. package/dist/validate-DpP1QUiV.d.mts.map +1 -0
  1548. package/dist/validate-WkjGwBSO.mjs +516 -0
  1549. package/dist/validate-WkjGwBSO.mjs.map +1 -0
  1550. package/dist/validation-DG7Y9H4u.mjs +219 -0
  1551. package/dist/validation-DG7Y9H4u.mjs.map +1 -0
  1552. package/dist/version-BnlfLUa6.mjs +7 -0
  1553. package/dist/version-BnlfLUa6.mjs.map +1 -0
  1554. package/dist/version-BwEGkqkx.mjs +9 -0
  1555. package/dist/version-BwEGkqkx.mjs.map +1 -0
  1556. package/dist/virtual-modules-B6vJW15k.mjs +516 -0
  1557. package/dist/virtual-modules-B6vJW15k.mjs.map +1 -0
  1558. package/dist/widgets-D7I_9xff.mjs +126 -0
  1559. package/dist/widgets-D7I_9xff.mjs.map +1 -0
  1560. package/dist/wxr-taxonomies-Di1w9HDU.d.mts +34 -0
  1561. package/dist/wxr-taxonomies-Di1w9HDU.d.mts.map +1 -0
  1562. package/dist/wxr-taxonomies-m_141EtN.mjs +453 -0
  1563. package/dist/wxr-taxonomies-m_141EtN.mjs.map +1 -0
  1564. package/dist/zod-generator-DnfG5sGQ.mjs +424 -0
  1565. package/dist/zod-generator-DnfG5sGQ.mjs.map +1 -0
  1566. package/locals.d.ts +1 -6
  1567. package/package.json +142 -31
  1568. package/src/after.ts +6 -1
  1569. package/src/api/authorize.ts +27 -1
  1570. package/src/api/email-locale.ts +24 -0
  1571. package/src/api/error.ts +22 -7
  1572. package/src/api/errors.ts +131 -0
  1573. package/src/api/handlers/api-tokens.ts +37 -3
  1574. package/src/api/handlers/backup.ts +318 -0
  1575. package/src/api/handlers/block-types.ts +129 -0
  1576. package/src/api/handlers/bulk-tag.ts +309 -0
  1577. package/src/api/handlers/byline-fields.ts +212 -0
  1578. package/src/api/handlers/bylines.ts +283 -0
  1579. package/src/api/handlers/comment-reactions.ts +165 -0
  1580. package/src/api/handlers/comments.ts +6 -32
  1581. package/src/api/handlers/content.ts +1552 -156
  1582. package/src/api/handlers/dashboard.ts +73 -38
  1583. package/src/api/handlers/device-flow.ts +80 -23
  1584. package/src/api/handlers/entry-lock.ts +206 -0
  1585. package/src/api/handlers/index.ts +90 -0
  1586. package/src/api/handlers/manifest.ts +245 -12
  1587. package/src/api/handlers/marketplace.ts +251 -53
  1588. package/src/api/handlers/media-allowlist.ts +52 -0
  1589. package/src/api/handlers/media-folders.ts +130 -0
  1590. package/src/api/handlers/media-upload.ts +186 -0
  1591. package/src/api/handlers/media-usage-activation.ts +102 -0
  1592. package/src/api/handlers/media-usage-work.ts +188 -0
  1593. package/src/api/handlers/media-usage.ts +418 -0
  1594. package/src/api/handlers/media.ts +207 -16
  1595. package/src/api/handlers/menus.ts +294 -392
  1596. package/src/api/handlers/oauth-authorization.ts +74 -39
  1597. package/src/api/handlers/oauth-clients.ts +1 -1
  1598. package/src/api/handlers/plugin-settings.ts +250 -0
  1599. package/src/api/handlers/plugins.ts +195 -41
  1600. package/src/api/handlers/redirects.ts +225 -131
  1601. package/src/api/handlers/registry.ts +1844 -0
  1602. package/src/api/handlers/relations.ts +960 -0
  1603. package/src/api/handlers/revision.ts +70 -20
  1604. package/src/api/handlers/schema.ts +486 -8
  1605. package/src/api/handlers/seo.ts +68 -5
  1606. package/src/api/handlers/settings.ts +2 -2
  1607. package/src/api/handlers/snapshot.ts +359 -68
  1608. package/src/api/handlers/staged-references.ts +208 -0
  1609. package/src/api/handlers/taxonomies.ts +887 -156
  1610. package/src/api/handlers/transfer.ts +1347 -0
  1611. package/src/api/handlers/update-check.ts +236 -0
  1612. package/src/api/handlers/validate-media-fields.ts +237 -0
  1613. package/src/api/handlers/validate-references.ts +146 -0
  1614. package/src/api/handlers/validation.ts +120 -19
  1615. package/src/api/media-usage-write-fence.ts +43 -0
  1616. package/src/api/openapi/document.ts +1644 -262
  1617. package/src/api/parse.ts +3 -17
  1618. package/src/api/public-url.ts +66 -6
  1619. package/src/api/redirect.ts +9 -1
  1620. package/src/api/schemas/auth.ts +10 -4
  1621. package/src/api/schemas/byline-fields.ts +188 -0
  1622. package/src/api/schemas/bylines.ts +97 -1
  1623. package/src/api/schemas/comments.ts +19 -3
  1624. package/src/api/schemas/common.ts +29 -9
  1625. package/src/api/schemas/content.ts +302 -8
  1626. package/src/api/schemas/entry-lock.ts +57 -0
  1627. package/src/api/schemas/import.ts +69 -14
  1628. package/src/api/schemas/index.ts +4 -0
  1629. package/src/api/schemas/media-usage.ts +341 -0
  1630. package/src/api/schemas/media.ts +186 -5
  1631. package/src/api/schemas/menus.ts +50 -22
  1632. package/src/api/schemas/redirects.ts +17 -5
  1633. package/src/api/schemas/relations.ts +121 -0
  1634. package/src/api/schemas/schema.ts +267 -7
  1635. package/src/api/schemas/search.ts +7 -0
  1636. package/src/api/schemas/sections.ts +3 -3
  1637. package/src/api/schemas/settings.ts +41 -9
  1638. package/src/api/schemas/setup.ts +1 -1
  1639. package/src/api/schemas/taxonomies.ts +134 -10
  1640. package/src/api/schemas/transfer.ts +249 -0
  1641. package/src/api/schemas/users.ts +2 -2
  1642. package/src/api/setup-complete.ts +49 -1
  1643. package/src/api/site-url.ts +16 -6
  1644. package/src/api/transfer-download.ts +36 -0
  1645. package/src/api/types.ts +45 -10
  1646. package/src/astro/dev-typegen.ts +28 -0
  1647. package/src/astro/image-endpoint.ts +84 -0
  1648. package/src/astro/index.ts +6 -0
  1649. package/src/astro/integration/dev-typegen.ts +120 -0
  1650. package/src/astro/integration/index.ts +501 -122
  1651. package/src/astro/integration/route-naming.ts +19 -0
  1652. package/src/astro/integration/routes.ts +367 -16
  1653. package/src/astro/integration/runtime.ts +250 -24
  1654. package/src/astro/integration/shims/use-sync-external-store-with-selector.js +71 -0
  1655. package/src/astro/integration/shims/use-sync-external-store.js +1 -0
  1656. package/src/astro/integration/virtual-modules.ts +213 -7
  1657. package/src/astro/integration/vite-config.ts +261 -31
  1658. package/src/astro/middleware/auth.ts +157 -102
  1659. package/src/astro/middleware/csp.ts +79 -3
  1660. package/src/astro/middleware/media-usage-write-fence.ts +125 -0
  1661. package/src/astro/middleware/redirect.ts +68 -24
  1662. package/src/astro/middleware/request-context.ts +223 -27
  1663. package/src/astro/middleware/scoped-db.ts +183 -0
  1664. package/src/astro/middleware/stream-end-metrics.ts +102 -0
  1665. package/src/astro/middleware.ts +699 -115
  1666. package/src/astro/object-cache/adapters.ts +50 -0
  1667. package/src/astro/prefetch.ts +82 -0
  1668. package/src/astro/public-plugin-api-routes.ts +42 -0
  1669. package/src/astro/routes/PluginRegistry.tsx +5 -2
  1670. package/src/astro/routes/admin.astro +74 -19
  1671. package/src/astro/routes/api/admin/api-tokens/index.ts +6 -3
  1672. package/src/astro/routes/api/admin/byline-fields/[slug]/usage.ts +36 -0
  1673. package/src/astro/routes/api/admin/byline-fields/[slug].ts +92 -0
  1674. package/src/astro/routes/api/admin/byline-fields/index.ts +66 -0
  1675. package/src/astro/routes/api/admin/byline-fields/reorder.ts +39 -0
  1676. package/src/astro/routes/api/admin/bylines/[id]/index.ts +34 -31
  1677. package/src/astro/routes/api/admin/bylines/[id]/translations.ts +102 -0
  1678. package/src/astro/routes/api/admin/bylines/index.ts +25 -11
  1679. package/src/astro/routes/api/admin/comments/[id]/status.ts +23 -60
  1680. package/src/astro/routes/api/admin/comments/index.ts +1 -2
  1681. package/src/astro/routes/api/admin/core-update.ts +34 -0
  1682. package/src/astro/routes/api/admin/hooks/exclusive/index.ts +1 -5
  1683. package/src/astro/routes/api/admin/media-usage/activation.ts +42 -0
  1684. package/src/astro/routes/api/admin/media-usage/collection-deletions/index.ts +22 -0
  1685. package/src/astro/routes/api/admin/media-usage/collection-deletions/retry.ts +22 -0
  1686. package/src/astro/routes/api/admin/media-usage/progress.ts +37 -0
  1687. package/src/astro/routes/api/admin/media-usage/repair.ts +24 -0
  1688. package/src/astro/routes/api/admin/media-usage/work/index.ts +26 -0
  1689. package/src/astro/routes/api/admin/media-usage/work/retry.ts +26 -0
  1690. package/src/astro/routes/api/admin/oauth-clients/[id].ts +1 -1
  1691. package/src/astro/routes/api/admin/oauth-clients/index.ts +1 -1
  1692. package/src/astro/routes/api/admin/plugins/[id]/disable.ts +7 -10
  1693. package/src/astro/routes/api/admin/plugins/[id]/enable.ts +7 -10
  1694. package/src/astro/routes/api/admin/plugins/[id]/index.ts +7 -0
  1695. package/src/astro/routes/api/admin/plugins/[id]/mcp.ts +42 -0
  1696. package/src/astro/routes/api/admin/plugins/[id]/settings.ts +80 -0
  1697. package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +6 -0
  1698. package/src/astro/routes/api/admin/plugins/[id]/update.ts +31 -4
  1699. package/src/astro/routes/api/admin/plugins/index.ts +10 -0
  1700. package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +6 -2
  1701. package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +25 -3
  1702. package/src/astro/routes/api/admin/plugins/registry/[id]/uninstall.ts +57 -0
  1703. package/src/astro/routes/api/admin/plugins/registry/[id]/update.ts +112 -0
  1704. package/src/astro/routes/api/admin/plugins/registry/artifact.ts +538 -0
  1705. package/src/astro/routes/api/admin/plugins/registry/install.ts +134 -0
  1706. package/src/astro/routes/api/admin/plugins/registry/publisher-handle.ts +59 -0
  1707. package/src/astro/routes/api/admin/plugins/registry/verify.ts +61 -0
  1708. package/src/astro/routes/api/admin/plugins/updates.ts +45 -6
  1709. package/src/astro/routes/api/admin/scheduled-policy-rejections/[collection]/[id].ts +34 -0
  1710. package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +6 -2
  1711. package/src/astro/routes/api/admin/themes/marketplace/index.ts +1 -1
  1712. package/src/astro/routes/api/admin/transfer/[...path].ts +143 -0
  1713. package/src/astro/routes/api/admin/transfer/approvals/[id]/approve.ts +35 -0
  1714. package/src/astro/routes/api/admin/transfer/approvals/[id]/deny.ts +35 -0
  1715. package/src/astro/routes/api/admin/transfer/approvals/index.ts +33 -0
  1716. package/src/astro/routes/api/admin/transfer/capabilities.ts +36 -0
  1717. package/src/astro/routes/api/admin/transfer/exports/[id]/advance.ts +34 -0
  1718. package/src/astro/routes/api/admin/transfer/exports/[id]/archive.ts +35 -0
  1719. package/src/astro/routes/api/admin/transfer/exports/[id]/files/[...path].ts +40 -0
  1720. package/src/astro/routes/api/admin/transfer/exports/[id]/index.ts +25 -0
  1721. package/src/astro/routes/api/admin/transfer/exports/[id]/manifest.ts +38 -0
  1722. package/src/astro/routes/api/admin/transfer/exports/index.ts +64 -0
  1723. package/src/astro/routes/api/admin/transfer/imports/[id]/abandon.ts +28 -0
  1724. package/src/astro/routes/api/admin/transfer/imports/[id]/advance.ts +37 -0
  1725. package/src/astro/routes/api/admin/transfer/imports/[id]/analyze.ts +51 -0
  1726. package/src/astro/routes/api/admin/transfer/imports/[id]/cancel.ts +27 -0
  1727. package/src/astro/routes/api/admin/transfer/imports/[id]/execute.ts +48 -0
  1728. package/src/astro/routes/api/admin/transfer/imports/[id]/files/[...path].ts +54 -0
  1729. package/src/astro/routes/api/admin/transfer/imports/[id]/index.ts +25 -0
  1730. package/src/astro/routes/api/admin/transfer/imports/[id]/missing.ts +34 -0
  1731. package/src/astro/routes/api/admin/transfer/imports/[id]/plan.ts +29 -0
  1732. package/src/astro/routes/api/admin/transfer/imports/[id]/receipt.ts +25 -0
  1733. package/src/astro/routes/api/admin/transfer/imports/index.ts +85 -0
  1734. package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +11 -3
  1735. package/src/astro/routes/api/auth/dev-bypass.ts +0 -4
  1736. package/src/astro/routes/api/auth/invite/complete.ts +10 -5
  1737. package/src/astro/routes/api/auth/invite/index.ts +17 -3
  1738. package/src/astro/routes/api/auth/invite/register-options.ts +8 -1
  1739. package/src/astro/routes/api/auth/magic-link/send.ts +11 -3
  1740. package/src/astro/routes/api/auth/magic-link/verify.ts +40 -39
  1741. package/src/astro/routes/api/auth/me.ts +34 -11
  1742. package/src/astro/routes/api/auth/mode.ts +6 -14
  1743. package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +30 -9
  1744. package/src/astro/routes/api/auth/oauth/[provider].ts +24 -7
  1745. package/src/astro/routes/api/auth/passkey/options.ts +2 -21
  1746. package/src/astro/routes/api/auth/passkey/register/verify.ts +6 -1
  1747. package/src/astro/routes/api/auth/passkey/verify.ts +10 -5
  1748. package/src/astro/routes/api/auth/signup/complete.ts +10 -5
  1749. package/src/astro/routes/api/auth/signup/request.ts +2 -2
  1750. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +4 -246
  1751. package/src/astro/routes/api/comments/[collection]/[contentId]/reactions.ts +97 -0
  1752. package/src/astro/routes/api/content/[collection]/[id]/compare.ts +3 -4
  1753. package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +26 -6
  1754. package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +5 -6
  1755. package/src/astro/routes/api/content/[collection]/[id]/lock.ts +133 -0
  1756. package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +3 -4
  1757. package/src/astro/routes/api/content/[collection]/[id]/plugin-extensions/[pluginId]/[kind]/[extensionId].ts +29 -0
  1758. package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +87 -15
  1759. package/src/astro/routes/api/content/[collection]/[id]/publish.ts +58 -8
  1760. package/src/astro/routes/api/content/[collection]/[id]/references/[relation]/children.ts +52 -0
  1761. package/src/astro/routes/api/content/[collection]/[id]/references/[relation]/parents.ts +47 -0
  1762. package/src/astro/routes/api/content/[collection]/[id]/restore.ts +6 -4
  1763. package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +6 -6
  1764. package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +42 -9
  1765. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +103 -38
  1766. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +4 -5
  1767. package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +26 -6
  1768. package/src/astro/routes/api/content/[collection]/[id].ts +62 -18
  1769. package/src/astro/routes/api/content/[collection]/authors.ts +33 -0
  1770. package/src/astro/routes/api/content/[collection]/index.ts +10 -9
  1771. package/src/astro/routes/api/content/[collection]/trash.ts +2 -3
  1772. package/src/astro/routes/api/health.ts +18 -0
  1773. package/src/astro/routes/api/import/wordpress/execute.ts +428 -8
  1774. package/src/astro/routes/api/import/wordpress/media.ts +9 -3
  1775. package/src/astro/routes/api/import/wordpress/prepare.ts +10 -12
  1776. package/src/astro/routes/api/import/wordpress/rewrite-url-helpers.ts +225 -0
  1777. package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +132 -273
  1778. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +798 -46
  1779. package/src/astro/routes/api/manifest.ts +85 -46
  1780. package/src/astro/routes/api/mcp.ts +6 -2
  1781. package/src/astro/routes/api/media/[id]/confirm.ts +169 -11
  1782. package/src/astro/routes/api/media/[id]/replace.ts +114 -0
  1783. package/src/astro/routes/api/media/[id]/upload.ts +262 -0
  1784. package/src/astro/routes/api/media/[id]/usage.ts +30 -0
  1785. package/src/astro/routes/api/media/[id].ts +32 -18
  1786. package/src/astro/routes/api/media/asset/[id]/[filename].ts +50 -0
  1787. package/src/astro/routes/api/media/file/[...key].ts +37 -1
  1788. package/src/astro/routes/api/media/folders/[id].ts +55 -0
  1789. package/src/astro/routes/api/media/folders/index.ts +37 -0
  1790. package/src/astro/routes/api/media/providers/[providerId]/index.ts +12 -3
  1791. package/src/astro/routes/api/media/upload-url.ts +44 -37
  1792. package/src/astro/routes/api/media.ts +115 -33
  1793. package/src/astro/routes/api/menus/[name]/items/[id].ts +74 -0
  1794. package/src/astro/routes/api/menus/[name]/items.ts +12 -60
  1795. package/src/astro/routes/api/menus/[name]/reorder.ts +12 -4
  1796. package/src/astro/routes/api/menus/[name]/translations.ts +85 -0
  1797. package/src/astro/routes/api/menus/[name].ts +25 -11
  1798. package/src/astro/routes/api/menus/index.ts +13 -7
  1799. package/src/astro/routes/api/oauth/authorize.ts +47 -15
  1800. package/src/astro/routes/api/oauth/device/authorize.ts +33 -4
  1801. package/src/astro/routes/api/oauth/register.ts +22 -2
  1802. package/src/astro/routes/api/openapi.json.ts +27 -10
  1803. package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +13 -59
  1804. package/src/astro/routes/api/redirects/404s/index.ts +7 -1
  1805. package/src/astro/routes/api/redirects/404s/summary.ts +3 -1
  1806. package/src/astro/routes/api/redirects/[id].ts +7 -4
  1807. package/src/astro/routes/api/redirects/index.ts +5 -3
  1808. package/src/astro/routes/api/relations/[id]/index.ts +84 -0
  1809. package/src/astro/routes/api/relations/index.ts +56 -0
  1810. package/src/astro/routes/api/revisions/[revisionId]/index.ts +1 -1
  1811. package/src/astro/routes/api/revisions/[revisionId]/restore.ts +17 -1
  1812. package/src/astro/routes/api/schema/block-types/[slug]/index.ts +29 -0
  1813. package/src/astro/routes/api/schema/block-types/[slug]/versions/[version]/activate.ts +31 -0
  1814. package/src/astro/routes/api/schema/block-types/index.ts +29 -0
  1815. package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +9 -13
  1816. package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +2 -8
  1817. package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +1 -2
  1818. package/src/astro/routes/api/schema/collections/[slug]/index.ts +5 -11
  1819. package/src/astro/routes/api/schema/collections/index.ts +4 -4
  1820. package/src/astro/routes/api/schema/collections/reorder.ts +31 -0
  1821. package/src/astro/routes/api/schema/index.ts +19 -19
  1822. package/src/astro/routes/api/schema/orphans/[slug].ts +1 -1
  1823. package/src/astro/routes/api/schema/orphans/index.ts +1 -1
  1824. package/src/astro/routes/api/search/enable.ts +5 -1
  1825. package/src/astro/routes/api/search/index.ts +13 -2
  1826. package/src/astro/routes/api/search/rebuild.ts +6 -1
  1827. package/src/astro/routes/api/sections/[slug].ts +7 -1
  1828. package/src/astro/routes/api/sections/index.ts +5 -1
  1829. package/src/astro/routes/api/settings/backups/archives/[name].ts +78 -0
  1830. package/src/astro/routes/api/settings/backups/archives/index.ts +33 -0
  1831. package/src/astro/routes/api/settings/backups/export.ts +43 -0
  1832. package/src/astro/routes/api/settings/backups/index.ts +76 -0
  1833. package/src/astro/routes/api/settings/email.ts +1 -1
  1834. package/src/astro/routes/api/settings.ts +4 -1
  1835. package/src/astro/routes/api/setup/admin-verify.ts +20 -10
  1836. package/src/astro/routes/api/setup/admin.ts +11 -4
  1837. package/src/astro/routes/api/setup/dev-bypass.ts +26 -10
  1838. package/src/astro/routes/api/setup/index.ts +71 -36
  1839. package/src/astro/routes/api/snapshot.ts +48 -19
  1840. package/src/astro/routes/api/taxonomies/[name]/reorder.ts +44 -0
  1841. package/src/astro/routes/api/taxonomies/[name]/terms/[slug]/translations.ts +92 -0
  1842. package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +28 -23
  1843. package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +19 -15
  1844. package/src/astro/routes/api/taxonomies/[name]/translations.ts +48 -0
  1845. package/src/astro/routes/api/taxonomies/[name].ts +107 -0
  1846. package/src/astro/routes/api/taxonomies/bulk-tag.ts +29 -0
  1847. package/src/astro/routes/api/taxonomies/index.ts +13 -8
  1848. package/src/astro/routes/api/themes/preview.ts +11 -5
  1849. package/src/astro/routes/api/typegen.ts +4 -42
  1850. package/src/astro/routes/api/visual-editing/action-token.ts +36 -0
  1851. package/src/astro/routes/api/visual-editing/content/[collection]/[id]/publish.ts +32 -0
  1852. package/src/astro/routes/api/visual-editing/toolbar-labels.ts +16 -0
  1853. package/src/astro/routes/api/well-known/oauth-authorization-server.ts +4 -1
  1854. package/src/astro/routes/api/well-known/oauth-protected-resource.ts +5 -1
  1855. package/src/astro/routes/api/widget-areas/[name]/reorder.ts +3 -1
  1856. package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +5 -2
  1857. package/src/astro/routes/api/widget-areas/[name]/widgets.ts +3 -1
  1858. package/src/astro/routes/api/widget-areas/[name].ts +3 -1
  1859. package/src/astro/routes/api/widget-areas/index.ts +3 -1
  1860. package/src/astro/routes/sitemap-[collection].xml.ts +133 -14
  1861. package/src/astro/session-user.ts +71 -0
  1862. package/src/astro/types.ts +304 -16
  1863. package/src/auth/allowed-origins.ts +168 -0
  1864. package/src/auth/api-tokens.ts +2 -0
  1865. package/src/auth/challenge-store.ts +3 -1
  1866. package/src/auth/oauth-state-store.ts +3 -0
  1867. package/src/auth/passkey-config.ts +35 -13
  1868. package/src/auth/providers/github-admin.tsx +5 -6
  1869. package/src/auth/providers/google-admin.tsx +5 -6
  1870. package/src/auth/rate-limit.ts +6 -5
  1871. package/src/auth/scopes.ts +14 -9
  1872. package/src/auth/trusted-proxy.ts +1 -1
  1873. package/src/aws-sdk.d.ts +1 -0
  1874. package/src/bylines/credits.ts +149 -0
  1875. package/src/bylines/field-defs-cache.ts +188 -0
  1876. package/src/bylines/index.ts +152 -152
  1877. package/src/cache/chrome-tags.ts +24 -0
  1878. package/src/cleanup.ts +72 -26
  1879. package/src/cli/client-factory.ts +6 -2
  1880. package/src/cli/commands/content.ts +48 -7
  1881. package/src/cli/commands/doctor.ts +219 -7
  1882. package/src/cli/commands/export-seed.ts +1021 -142
  1883. package/src/cli/commands/init.ts +4 -8
  1884. package/src/cli/commands/login.ts +8 -1
  1885. package/src/cli/commands/media.ts +127 -0
  1886. package/src/cli/commands/migrate.ts +641 -0
  1887. package/src/cli/commands/secrets.ts +183 -0
  1888. package/src/cli/commands/seed.ts +9 -3
  1889. package/src/cli/commands/site.ts +556 -0
  1890. package/src/cli/credentials.ts +2 -61
  1891. package/src/cli/index.ts +6 -28
  1892. package/src/cli/site/archive.ts +273 -0
  1893. package/src/cli/site/export.ts +311 -0
  1894. package/src/cli/site/import.ts +815 -0
  1895. package/src/cli/site/shared.ts +241 -0
  1896. package/src/cli/wxr/parser.ts +263 -0
  1897. package/src/client/index.ts +849 -31
  1898. package/src/client/portable-text.ts +41 -0
  1899. package/src/client/transport.ts +23 -9
  1900. package/src/comments/public-submission.ts +254 -0
  1901. package/src/comments/query.ts +78 -7
  1902. package/src/comments/ranking.ts +58 -0
  1903. package/src/comments/service.ts +60 -13
  1904. package/src/comments/turnstile.ts +64 -0
  1905. package/src/components/Block.astro +83 -0
  1906. package/src/components/BlockquoteGroup.astro +34 -0
  1907. package/src/components/Blocks.astro +46 -0
  1908. package/src/components/Break.astro +2 -2
  1909. package/src/components/Columns.astro +3 -1
  1910. package/src/components/CommentForm.astro +13 -6
  1911. package/src/components/Comments.astro +137 -2
  1912. package/src/components/Cover.astro +3 -1
  1913. package/src/components/EmDashBodyEnd.astro +4 -1
  1914. package/src/components/EmDashBodyStart.astro +4 -1
  1915. package/src/components/EmDashHead.astro +113 -25
  1916. package/src/components/EmDashImage.astro +210 -53
  1917. package/src/components/EmDashMedia.astro +3 -3
  1918. package/src/components/Embed.astro +1 -1
  1919. package/src/components/Gallery.astro +166 -29
  1920. package/src/components/Image.astro +158 -40
  1921. package/src/components/InlineEditor.astro +3 -1
  1922. package/src/components/InlinePortableTextEditor.tsx +854 -97
  1923. package/src/components/JsonLdScript.astro +9 -0
  1924. package/src/components/LiveSearch.astro +63 -4
  1925. package/src/components/OrderedList.astro +14 -0
  1926. package/src/components/PortableText.astro +34 -2
  1927. package/src/components/Table.astro +147 -62
  1928. package/src/components/WidgetArea.astro +3 -2
  1929. package/src/components/blocks.ts +44 -0
  1930. package/src/components/code-mark.ts +11 -0
  1931. package/src/components/index.ts +25 -8
  1932. package/src/components/inline-code-block.tsx +474 -0
  1933. package/src/components/live-search-routing.ts +30 -0
  1934. package/src/components/marks/Link.astro +5 -1
  1935. package/src/components/ordered-list.ts +549 -0
  1936. package/src/components/portable-text-blockquote-group.ts +68 -0
  1937. package/src/components/portable-text-text-align.ts +38 -0
  1938. package/src/components/widgets/Archives.astro +7 -41
  1939. package/src/components/widgets/Categories.astro +1 -1
  1940. package/src/components/widgets/Tags.astro +1 -1
  1941. package/src/config/errors.ts +13 -0
  1942. package/src/config/secrets.ts +562 -0
  1943. package/src/content/converters/gallery.ts +101 -0
  1944. package/src/content/converters/image-link.ts +27 -0
  1945. package/src/content/converters/index.ts +3 -0
  1946. package/src/content/converters/mark-safety.ts +121 -0
  1947. package/src/content/converters/numbered-list.ts +148 -0
  1948. package/src/content/converters/portable-text-identity.ts +139 -0
  1949. package/src/content/converters/portable-text-to-prosemirror.ts +400 -90
  1950. package/src/content/converters/prosemirror-to-portable-text.ts +234 -46
  1951. package/src/content/converters/types.ts +80 -0
  1952. package/src/content/known-fields.ts +44 -0
  1953. package/src/content/portable-text-lists.ts +205 -0
  1954. package/src/content-list-query.ts +29 -0
  1955. package/src/database/connection.ts +9 -41
  1956. package/src/database/content-datetime.ts +228 -0
  1957. package/src/database/datetime-storage.ts +452 -0
  1958. package/src/database/dialect-helpers.ts +352 -10
  1959. package/src/database/errors.ts +14 -0
  1960. package/src/database/index.ts +11 -3
  1961. package/src/database/instrumentation.ts +56 -9
  1962. package/src/database/json-recordset.ts +16 -0
  1963. package/src/database/migration-lock.ts +140 -0
  1964. package/src/database/migrations/006_taxonomy_defs.ts +1 -1
  1965. package/src/database/migrations/014_draft_revisions.ts +6 -6
  1966. package/src/database/migrations/016_api_tokens.ts +18 -3
  1967. package/src/database/migrations/017_authorization_codes.ts +14 -4
  1968. package/src/database/migrations/019_i18n.ts +3 -3
  1969. package/src/database/migrations/034_published_at_index.ts +1 -1
  1970. package/src/database/migrations/035_bounded_404_log.ts +37 -31
  1971. package/src/database/migrations/036_i18n_menus_and_taxonomies.ts +655 -0
  1972. package/src/database/migrations/037_credential_algorithm.ts +18 -0
  1973. package/src/database/migrations/038_registry_plugin_state.ts +130 -0
  1974. package/src/database/migrations/039_fix_fts5_triggers.ts +264 -0
  1975. package/src/database/migrations/040_byline_i18n.ts +497 -0
  1976. package/src/database/migrations/041_content_locale_list_index.ts +47 -0
  1977. package/src/database/migrations/042_byline_fields.ts +157 -0
  1978. package/src/database/migrations/043_content_references.ts +121 -0
  1979. package/src/database/migrations/044_comment_reactions.ts +56 -0
  1980. package/src/database/migrations/045_taxonomy_parent_group.ts +68 -0
  1981. package/src/database/migrations/046_media_usage_index.ts +115 -0
  1982. package/src/database/migrations/047_restore_taxonomy_parent_index.ts +29 -0
  1983. package/src/database/migrations/048_restore_content_taxonomies_term_index.ts +32 -0
  1984. package/src/database/migrations/049_taxonomies_name_locale_index.ts +42 -0
  1985. package/src/database/migrations/050_media_usage_index_status.ts +142 -0
  1986. package/src/database/migrations/051_content_taxonomies_denorm.ts +120 -0
  1987. package/src/database/migrations/052_media_usage_read_index.ts +26 -0
  1988. package/src/database/migrations/053_plugin_mcp_tools.ts +21 -0
  1989. package/src/database/migrations/054_media_upload_attempts.ts +41 -0
  1990. package/src/database/migrations/055_content_translation_group_locale_index.ts +67 -0
  1991. package/src/database/migrations/056_taxonomy_term_sort_order.ts +189 -0
  1992. package/src/database/migrations/057_collection_hidden.ts +24 -0
  1993. package/src/database/migrations/058_collection_sort_order.ts +20 -0
  1994. package/src/database/migrations/059_revision_prune_queue.ts +36 -0
  1995. package/src/database/migrations/060_collection_admin_config.ts +16 -0
  1996. package/src/database/migrations/061_media_usage_cleanup.ts +77 -0
  1997. package/src/database/migrations/062_media_usage_cleanup_fence.ts +295 -0
  1998. package/src/database/migrations/063_media_usage_incremental_work.ts +397 -0
  1999. package/src/database/migrations/064_fts_plain_text.ts +253 -0
  2000. package/src/database/migrations/065_media_usage_collection_deletion.ts +85 -0
  2001. package/src/database/migrations/066_media_usage_reconciliation.ts +115 -0
  2002. package/src/database/migrations/067_indexed_content_fields.ts +39 -0
  2003. package/src/database/migrations/068_content_taxonomy_entry_groups.ts +61 -0
  2004. package/src/database/migrations/069_collection_title_date_fields.ts +45 -0
  2005. package/src/database/migrations/070_collection_routable.ts +18 -0
  2006. package/src/database/migrations/071_restore_content_bylines_table.ts +43 -0
  2007. package/src/database/migrations/072_media_folders.ts +72 -0
  2008. package/src/database/migrations/073_media_focal_point.ts +57 -0
  2009. package/src/database/migrations/074_content_deleted_scheduled_index.ts +55 -0
  2010. package/src/database/migrations/075_entry_edit_locks.ts +44 -0
  2011. package/src/database/migrations/076_collection_nav_group.ts +22 -0
  2012. package/src/database/migrations/077_plugin_storage_revisions.ts +89 -0
  2013. package/src/database/migrations/078_menu_item_translation_groups.ts +15 -0
  2014. package/src/database/migrations/079_datetime_normalization.ts +13 -0
  2015. package/src/database/migrations/080_content_translation_locale_unique.ts +88 -0
  2016. package/src/database/migrations/081_redirect_write_guards.ts +260 -0
  2017. package/src/database/migrations/082_taxonomy_translation_locale_unique.ts +49 -0
  2018. package/src/database/migrations/083_block_types.ts +58 -0
  2019. package/src/database/migrations/084_site_transfer.ts +264 -0
  2020. package/src/database/migrations/085_taxonomy_def_groups.ts +155 -0
  2021. package/src/database/migrations/086_relations_structural.ts +197 -0
  2022. package/src/database/migrations/087_reference_field_relations.ts +407 -0
  2023. package/src/database/migrations/088_cron_oneshot_utc.ts +39 -0
  2024. package/src/database/migrations/089_auto_seed_completion.ts +13 -0
  2025. package/src/database/migrations/policy.ts +70 -0
  2026. package/src/database/migrations/runner.ts +416 -43
  2027. package/src/database/pg-migration-lock.ts +69 -0
  2028. package/src/database/reference-backfill.ts +141 -0
  2029. package/src/database/repositories/audit.ts +13 -3
  2030. package/src/database/repositories/byline.ts +1120 -87
  2031. package/src/database/repositories/comment-reaction.ts +132 -0
  2032. package/src/database/repositories/comment.ts +99 -3
  2033. package/src/database/repositories/content.ts +2210 -267
  2034. package/src/database/repositories/entry-locks.ts +257 -0
  2035. package/src/database/repositories/index.ts +21 -0
  2036. package/src/database/repositories/media-folders.ts +115 -0
  2037. package/src/database/repositories/media-usage-work.ts +1132 -0
  2038. package/src/database/repositories/media-usage.ts +4040 -0
  2039. package/src/database/repositories/media.ts +465 -55
  2040. package/src/database/repositories/menu.ts +657 -0
  2041. package/src/database/repositories/options.ts +128 -10
  2042. package/src/database/repositories/plugin-storage.ts +265 -44
  2043. package/src/database/repositories/redirect.ts +296 -79
  2044. package/src/database/repositories/relation.ts +1004 -0
  2045. package/src/database/repositories/revision.ts +225 -31
  2046. package/src/database/repositories/seo.ts +3 -0
  2047. package/src/database/repositories/taxonomy-def.ts +126 -0
  2048. package/src/database/repositories/taxonomy.ts +747 -97
  2049. package/src/database/repositories/types.ts +209 -0
  2050. package/src/database/repositories/user.ts +18 -0
  2051. package/src/database/transaction.ts +12 -0
  2052. package/src/database/types.ts +525 -7
  2053. package/src/database/validate.ts +39 -0
  2054. package/src/datetime-normalization.ts +311 -0
  2055. package/src/db/adapters.ts +105 -5
  2056. package/src/db/index.ts +6 -1
  2057. package/src/db/libsql-migrations.ts +72 -0
  2058. package/src/db/libsql.ts +1 -3
  2059. package/src/db/node-sqlite-compat.ts +105 -0
  2060. package/src/db/postgres-migrations.ts +59 -0
  2061. package/src/db/postgres.ts +28 -2
  2062. package/src/db/sqlite-migrations.ts +37 -0
  2063. package/src/db/sqlite.ts +4 -7
  2064. package/src/deferred-tasks.ts +71 -0
  2065. package/src/emdash-runtime.ts +4558 -909
  2066. package/src/fields/boolean.ts +1 -1
  2067. package/src/fields/datetime.ts +1 -1
  2068. package/src/fields/file.ts +15 -11
  2069. package/src/fields/image.ts +29 -13
  2070. package/src/fields/integer.ts +1 -1
  2071. package/src/fields/json.ts +1 -1
  2072. package/src/fields/multiselect.ts +1 -1
  2073. package/src/fields/number.ts +1 -1
  2074. package/src/fields/portable-text.ts +1 -1
  2075. package/src/fields/richtext.ts +1 -1
  2076. package/src/fields/select.ts +1 -1
  2077. package/src/fields/slug.ts +1 -1
  2078. package/src/fields/text.ts +1 -1
  2079. package/src/fields/textarea.ts +1 -1
  2080. package/src/fields/types.ts +29 -9
  2081. package/src/i18n/config.ts +57 -10
  2082. package/src/i18n/normalize.ts +31 -0
  2083. package/src/i18n/repair-locale-casing.ts +37 -0
  2084. package/src/i18n/resolve.ts +272 -0
  2085. package/src/i18n/taxonomy-locale-diagnostic.ts +47 -0
  2086. package/src/import/comments.ts +159 -0
  2087. package/src/import/index.ts +8 -1
  2088. package/src/import/settings.ts +65 -189
  2089. package/src/import/sources/wordpress-plugin.ts +347 -44
  2090. package/src/import/sources/wxr.ts +20 -3
  2091. package/src/import/ssrf.ts +20 -500
  2092. package/src/import/types.ts +12 -0
  2093. package/src/import/utils.ts +214 -0
  2094. package/src/import/wxr-taxonomies.ts +748 -0
  2095. package/src/index.ts +274 -20
  2096. package/src/loader.ts +1257 -152
  2097. package/src/mcp/server.ts +2065 -272
  2098. package/src/mcp/transfer.ts +569 -0
  2099. package/src/media/enrich.ts +78 -0
  2100. package/src/media/focal-point.ts +37 -0
  2101. package/src/media/image-endpoint.ts +206 -0
  2102. package/src/media/index.ts +1 -0
  2103. package/src/media/local-runtime.ts +49 -15
  2104. package/src/media/local.ts +1 -1
  2105. package/src/media/mime.ts +76 -0
  2106. package/src/media/normalize.ts +82 -9
  2107. package/src/media/placeholder.ts +29 -9
  2108. package/src/media/responsive.ts +148 -0
  2109. package/src/media/types.ts +24 -0
  2110. package/src/media/upload-attempts.ts +38 -0
  2111. package/src/media/url.ts +15 -0
  2112. package/src/media/usage/activation.ts +762 -0
  2113. package/src/media/usage/capture-triggers.ts +559 -0
  2114. package/src/media/usage/cleanup.ts +306 -0
  2115. package/src/media/usage/collection-deletion-processor.ts +360 -0
  2116. package/src/media/usage/collection-deletion.ts +846 -0
  2117. package/src/media/usage/content-fields.ts +220 -0
  2118. package/src/media/usage/content-refresh.ts +1000 -0
  2119. package/src/media/usage/content-repair.ts +802 -0
  2120. package/src/media/usage/content-snapshots.ts +516 -0
  2121. package/src/media/usage/extractor.ts +427 -0
  2122. package/src/media/usage/gc.ts +50 -0
  2123. package/src/media/usage/maintenance-engine.ts +166 -0
  2124. package/src/media/usage/projection-fingerprint.ts +143 -0
  2125. package/src/media/usage/reconciliation-processor.ts +449 -0
  2126. package/src/media/usage/reconciliation.ts +1200 -0
  2127. package/src/media/usage/schema-invalidation.ts +72 -0
  2128. package/src/media/usage/site-settings.ts +52 -0
  2129. package/src/media/usage/source-key.ts +26 -0
  2130. package/src/media/usage/types.ts +50 -0
  2131. package/src/media/usage/work-processor.ts +489 -0
  2132. package/src/menus/index.ts +408 -198
  2133. package/src/menus/types.ts +15 -1
  2134. package/src/migrations/config-loader.ts +210 -0
  2135. package/src/migrations/direct-executor.ts +179 -0
  2136. package/src/migrations/identity.ts +46 -0
  2137. package/src/migrations/index.ts +20 -0
  2138. package/src/migrations/integration-metadata.ts +67 -0
  2139. package/src/migrations/manifest-builder.ts +55 -0
  2140. package/src/migrations/manifest-writer.ts +63 -0
  2141. package/src/migrations/manifest.ts +197 -0
  2142. package/src/migrations/protocol.ts +69 -0
  2143. package/src/migrations/target.ts +35 -0
  2144. package/src/object-cache/codec.ts +73 -0
  2145. package/src/object-cache/index.ts +852 -0
  2146. package/src/object-cache/memory.ts +91 -0
  2147. package/src/object-cache/types.ts +125 -0
  2148. package/src/page/absolute-url.ts +146 -0
  2149. package/src/page/jsonld.ts +10 -2
  2150. package/src/page/metadata.ts +50 -3
  2151. package/src/page/seo-contributions.ts +94 -6
  2152. package/src/page/seo-panel.ts +47 -0
  2153. package/src/page/site-identity.ts +58 -0
  2154. package/src/plugin-test-runtime.ts +18 -0
  2155. package/src/plugin-types.ts +410 -0
  2156. package/src/plugin-utils.ts +31 -6
  2157. package/src/plugins/adapt-sandbox-entry.ts +249 -56
  2158. package/src/plugins/byline-access.ts +158 -0
  2159. package/src/plugins/conditional-storage.ts +30 -0
  2160. package/src/plugins/content-access.ts +170 -0
  2161. package/src/plugins/content-policy.ts +74 -0
  2162. package/src/plugins/context.ts +1160 -251
  2163. package/src/plugins/cron.ts +69 -19
  2164. package/src/plugins/define-plugin.ts +129 -86
  2165. package/src/plugins/editor-draft.ts +257 -0
  2166. package/src/plugins/email-console.ts +3 -1
  2167. package/src/plugins/email.ts +16 -0
  2168. package/src/plugins/hooks.ts +330 -57
  2169. package/src/plugins/host.ts +30 -0
  2170. package/src/plugins/http-route-dispatch.ts +389 -0
  2171. package/src/plugins/http-wire.ts +180 -0
  2172. package/src/plugins/index.ts +148 -12
  2173. package/src/plugins/install-finalization.ts +77 -0
  2174. package/src/plugins/lifecycle.ts +47 -0
  2175. package/src/plugins/manager.ts +40 -2
  2176. package/src/plugins/manifest-schema.ts +452 -49
  2177. package/src/plugins/marketplace.ts +110 -42
  2178. package/src/plugins/media.ts +166 -0
  2179. package/src/plugins/request-meta.ts +12 -2
  2180. package/src/plugins/route-error.ts +57 -0
  2181. package/src/plugins/route-wire.ts +304 -0
  2182. package/src/plugins/routes.ts +183 -62
  2183. package/src/plugins/sandbox/hook-result.ts +52 -0
  2184. package/src/plugins/sandbox/index.ts +25 -1
  2185. package/src/plugins/sandbox/noop.ts +13 -5
  2186. package/src/plugins/sandbox/proxy.ts +130 -0
  2187. package/src/plugins/sandbox/runner-options.ts +16 -0
  2188. package/src/plugins/sandbox/types.ts +218 -9
  2189. package/src/plugins/save-rejection.ts +20 -0
  2190. package/src/plugins/scheduler/node.ts +9 -2
  2191. package/src/plugins/secret-redactor.ts +65 -0
  2192. package/src/plugins/settings.ts +303 -0
  2193. package/src/plugins/state.ts +137 -39
  2194. package/src/plugins/storage-indexes.ts +50 -11
  2195. package/src/plugins/storage-query.ts +111 -32
  2196. package/src/plugins/storage-update.ts +96 -0
  2197. package/src/plugins/types.ts +1014 -152
  2198. package/src/preview/urls.ts +23 -3
  2199. package/src/query.ts +1188 -85
  2200. package/src/redirects/cache.ts +113 -23
  2201. package/src/redirects/destination.ts +20 -0
  2202. package/src/redirects/loops.ts +10 -6
  2203. package/src/redirects/patterns.ts +12 -30
  2204. package/src/redirects/status.ts +27 -0
  2205. package/src/references/field-map.ts +115 -0
  2206. package/src/references/resolve.ts +160 -0
  2207. package/src/references/staged.ts +157 -0
  2208. package/src/references/types.ts +16 -0
  2209. package/src/registry/artifact-checksum.ts +15 -0
  2210. package/src/registry/artifact-fetch.ts +317 -0
  2211. package/src/registry/artifact-verification.ts +85 -0
  2212. package/src/registry/authoritative-records.ts +206 -0
  2213. package/src/registry/config.ts +461 -0
  2214. package/src/registry/plugin-id.ts +116 -0
  2215. package/src/registry/publisher-handle.ts +273 -0
  2216. package/src/registry/record-labels.ts +28 -0
  2217. package/src/registry/testing.ts +145 -0
  2218. package/src/registry/types.ts +126 -0
  2219. package/src/request-cache.ts +31 -4
  2220. package/src/request-context.ts +62 -3
  2221. package/src/scheduled-publish.ts +225 -0
  2222. package/src/scheduler-health.ts +46 -0
  2223. package/src/schema/block-type-contract.ts +478 -0
  2224. package/src/schema/block-type-registry.ts +689 -0
  2225. package/src/schema/block-types.ts +110 -0
  2226. package/src/schema/block-values.ts +293 -0
  2227. package/src/schema/byline-registry.ts +671 -0
  2228. package/src/schema/collection-slugs-cache.ts +157 -0
  2229. package/src/schema/env-types.ts +37 -0
  2230. package/src/schema/index.ts +29 -0
  2231. package/src/schema/project-env-types.ts +41 -0
  2232. package/src/schema/query.ts +11 -4
  2233. package/src/schema/registry.ts +1837 -264
  2234. package/src/schema/types.ts +326 -5
  2235. package/src/schema/url-pattern.ts +43 -0
  2236. package/src/schema/zod-generator.ts +357 -34
  2237. package/src/search/fts-manager.ts +256 -39
  2238. package/src/search/index.ts +2 -0
  2239. package/src/search/match.ts +50 -0
  2240. package/src/search/query.ts +155 -18
  2241. package/src/search/types.ts +18 -0
  2242. package/src/security/ssrf.ts +549 -0
  2243. package/src/seed/apply.ts +1547 -274
  2244. package/src/seed/ownership.ts +15 -0
  2245. package/src/seed/types.ts +145 -11
  2246. package/src/seed/validate.ts +415 -26
  2247. package/src/seo/hreflang.ts +196 -0
  2248. package/src/seo/index.ts +28 -32
  2249. package/src/seo/media-url.ts +58 -0
  2250. package/src/settings/index.ts +206 -27
  2251. package/src/settings/types.ts +42 -1
  2252. package/src/storage/local.ts +2 -1
  2253. package/src/storage/s3.ts +6 -4
  2254. package/src/storage/types.ts +8 -0
  2255. package/src/taxonomies/index.ts +686 -302
  2256. package/src/taxonomies/term-counts.ts +175 -0
  2257. package/src/taxonomies/types.ts +10 -0
  2258. package/src/transfer/analyze/index.ts +45 -0
  2259. package/src/transfer/analyze/issues.ts +55 -0
  2260. package/src/transfer/analyze/plan.ts +327 -0
  2261. package/src/transfer/analyze/read.ts +134 -0
  2262. package/src/transfer/analyze/step.ts +551 -0
  2263. package/src/transfer/analyze/target.ts +269 -0
  2264. package/src/transfer/analyze/unique-keys.ts +219 -0
  2265. package/src/transfer/analyze/validate.ts +1550 -0
  2266. package/src/transfer/analyze/values.ts +341 -0
  2267. package/src/transfer/analyze/write-rules.ts +204 -0
  2268. package/src/transfer/audit.ts +38 -0
  2269. package/src/transfer/auth.ts +25 -0
  2270. package/src/transfer/container/tar.ts +242 -0
  2271. package/src/transfer/domain.ts +248 -0
  2272. package/src/transfer/errors.ts +134 -0
  2273. package/src/transfer/export/exporter.ts +1067 -0
  2274. package/src/transfer/export/fence.ts +84 -0
  2275. package/src/transfer/export/media.ts +165 -0
  2276. package/src/transfer/export/readers.ts +1168 -0
  2277. package/src/transfer/export/verify.ts +677 -0
  2278. package/src/transfer/fence.ts +193 -0
  2279. package/src/transfer/format/canonical.ts +151 -0
  2280. package/src/transfer/format/column-codec.ts +275 -0
  2281. package/src/transfer/format/columns.ts +727 -0
  2282. package/src/transfer/format/digest.ts +287 -0
  2283. package/src/transfer/format/features.ts +91 -0
  2284. package/src/transfer/format/issues.ts +39 -0
  2285. package/src/transfer/format/kinds.ts +952 -0
  2286. package/src/transfer/format/limits.ts +87 -0
  2287. package/src/transfer/format/manifest.ts +297 -0
  2288. package/src/transfer/format/media-refs.ts +716 -0
  2289. package/src/transfer/format/paths.ts +73 -0
  2290. package/src/transfer/format/plan.ts +162 -0
  2291. package/src/transfer/format/receipt.ts +43 -0
  2292. package/src/transfer/format/records.ts +127 -0
  2293. package/src/transfer/format/settings.ts +94 -0
  2294. package/src/transfer/format/transformations.ts +260 -0
  2295. package/src/transfer/format/version.ts +9 -0
  2296. package/src/transfer/gc.ts +103 -0
  2297. package/src/transfer/import/advance.ts +522 -0
  2298. package/src/transfer/import/context.ts +288 -0
  2299. package/src/transfer/import/entries.ts +186 -0
  2300. package/src/transfer/import/ids.ts +40 -0
  2301. package/src/transfer/import/index.ts +15 -0
  2302. package/src/transfer/import/media.ts +141 -0
  2303. package/src/transfer/import/rebuild.ts +300 -0
  2304. package/src/transfer/import/rows.ts +114 -0
  2305. package/src/transfer/import/scaffold.ts +221 -0
  2306. package/src/transfer/import/sql.ts +134 -0
  2307. package/src/transfer/import/stages.ts +329 -0
  2308. package/src/transfer/import/writers.ts +370 -0
  2309. package/src/transfer/index.ts +472 -0
  2310. package/src/transfer/ops/approvals.ts +359 -0
  2311. package/src/transfer/ops/budget.ts +82 -0
  2312. package/src/transfer/ops/collation.ts +21 -0
  2313. package/src/transfer/ops/identity-map.ts +142 -0
  2314. package/src/transfer/ops/media-blobs.ts +135 -0
  2315. package/src/transfer/ops/operations.ts +842 -0
  2316. package/src/transfer/ops/package-index.ts +159 -0
  2317. package/src/transfer/ops/staged-files.ts +231 -0
  2318. package/src/transfer/ops/states.ts +265 -0
  2319. package/src/transfer/ops/time.ts +54 -0
  2320. package/src/transfer/schema-importer.ts +34 -0
  2321. package/src/transfer/site-id.ts +30 -0
  2322. package/src/transfer/staging/assembler.ts +217 -0
  2323. package/src/transfer/staging/keys.ts +94 -0
  2324. package/src/transfer/staging/package.ts +229 -0
  2325. package/src/transfer/staging/stage.ts +231 -0
  2326. package/src/ui-comments.ts +19 -0
  2327. package/src/ui.ts +26 -3
  2328. package/src/utils/base64.ts +7 -2
  2329. package/src/utils/db-errors.ts +26 -0
  2330. package/src/utils/hash.ts +14 -3
  2331. package/src/utils/init-lock.ts +143 -0
  2332. package/src/utils/single-flight-cache.ts +194 -0
  2333. package/src/utils/slugify.ts +1 -29
  2334. package/src/utils/url.ts +58 -3
  2335. package/src/virtual-modules.d.ts +84 -0
  2336. package/src/visual-editing/action-token.ts +31 -0
  2337. package/src/visual-editing/editable.ts +41 -35
  2338. package/src/visual-editing/toolbar-bootstrap.ts +145 -0
  2339. package/src/visual-editing/toolbar.ts +273 -48
  2340. package/src/widgets/archives.ts +68 -0
  2341. package/src/widgets/index.ts +83 -54
  2342. package/dist/adapters-BKSf3T9R.d.mts +0 -121
  2343. package/dist/adapters-BKSf3T9R.d.mts.map +0 -1
  2344. package/dist/apply-x0eMK1lX.mjs +0 -1528
  2345. package/dist/apply-x0eMK1lX.mjs.map +0 -1
  2346. package/dist/base64-MBPo9ozB.mjs +0 -59
  2347. package/dist/base64-MBPo9ozB.mjs.map +0 -1
  2348. package/dist/byline-Chbr2GoP.mjs +0 -220
  2349. package/dist/byline-Chbr2GoP.mjs.map +0 -1
  2350. package/dist/bylines-CRNsVG88.mjs +0 -157
  2351. package/dist/bylines-CRNsVG88.mjs.map +0 -1
  2352. package/dist/cache-BkKBuIvS.mjs +0 -56
  2353. package/dist/cache-BkKBuIvS.mjs.map +0 -1
  2354. package/dist/chunk-ClPoSABd.mjs +0 -21
  2355. package/dist/chunks-HGz06Soa.mjs +0 -19
  2356. package/dist/chunks-HGz06Soa.mjs.map +0 -1
  2357. package/dist/config-BXwuX8Bx.mjs +0 -47
  2358. package/dist/config-BXwuX8Bx.mjs.map +0 -1
  2359. package/dist/connection-2igzM-AT.mjs +0 -57
  2360. package/dist/connection-2igzM-AT.mjs.map +0 -1
  2361. package/dist/content-BcQPYxdV.mjs +0 -878
  2362. package/dist/content-BcQPYxdV.mjs.map +0 -1
  2363. package/dist/db-errors-l1Qh2RPR.mjs +0 -41
  2364. package/dist/db-errors-l1Qh2RPR.mjs.map +0 -1
  2365. package/dist/default-DCVqE5ib.mjs +0 -81
  2366. package/dist/default-DCVqE5ib.mjs.map +0 -1
  2367. package/dist/dialect-helpers-DhTzaUxP.mjs +0 -93
  2368. package/dist/dialect-helpers-DhTzaUxP.mjs.map +0 -1
  2369. package/dist/error-zG5T1UGA.mjs +0 -27
  2370. package/dist/error-zG5T1UGA.mjs.map +0 -1
  2371. package/dist/index-DIb-CzNx.d.mts +0 -4955
  2372. package/dist/index-DIb-CzNx.d.mts.map +0 -1
  2373. package/dist/load-CyEoextb.mjs +0 -28
  2374. package/dist/load-CyEoextb.mjs.map +0 -1
  2375. package/dist/loader-CndGj8kM.mjs +0 -457
  2376. package/dist/loader-CndGj8kM.mjs.map +0 -1
  2377. package/dist/manifest-schema-DH9xhc6t.mjs +0 -199
  2378. package/dist/manifest-schema-DH9xhc6t.mjs.map +0 -1
  2379. package/dist/media-D8FbNsl0.mjs +0 -197
  2380. package/dist/media-D8FbNsl0.mjs.map +0 -1
  2381. package/dist/mode-BnAOqItE.mjs +0 -23
  2382. package/dist/mode-BnAOqItE.mjs.map +0 -1
  2383. package/dist/patterns-CrCYkMBb.mjs +0 -93
  2384. package/dist/patterns-CrCYkMBb.mjs.map +0 -1
  2385. package/dist/placeholder-C-fk5hYI.mjs +0 -268
  2386. package/dist/placeholder-C-fk5hYI.mjs.map +0 -1
  2387. package/dist/placeholder-D29tWZ7o.d.mts +0 -284
  2388. package/dist/placeholder-D29tWZ7o.d.mts.map +0 -1
  2389. package/dist/query-fqEdLFms.mjs +0 -558
  2390. package/dist/query-fqEdLFms.mjs.map +0 -1
  2391. package/dist/redirect-D_pshWdf.mjs +0 -302
  2392. package/dist/redirect-D_pshWdf.mjs.map +0 -1
  2393. package/dist/registry-C3Mr0ODu.mjs +0 -902
  2394. package/dist/registry-C3Mr0ODu.mjs.map +0 -1
  2395. package/dist/request-cache-Ci7f5pBb.mjs +0 -79
  2396. package/dist/request-cache-Ci7f5pBb.mjs.map +0 -1
  2397. package/dist/runner-OURCaApa.d.mts +0 -34
  2398. package/dist/runner-OURCaApa.d.mts.map +0 -1
  2399. package/dist/runner-tQ7BJ4T7.mjs +0 -1619
  2400. package/dist/runner-tQ7BJ4T7.mjs.map +0 -1
  2401. package/dist/search-BoZYFuUk.mjs +0 -9637
  2402. package/dist/search-BoZYFuUk.mjs.map +0 -1
  2403. package/dist/taxonomies-B4IAshV8.mjs +0 -308
  2404. package/dist/taxonomies-B4IAshV8.mjs.map +0 -1
  2405. package/dist/tokens-D9vnZqYS.mjs +0 -171
  2406. package/dist/tokens-D9vnZqYS.mjs.map +0 -1
  2407. package/dist/transaction-Cn2rjY78.mjs +0 -28
  2408. package/dist/transaction-Cn2rjY78.mjs.map +0 -1
  2409. package/dist/transport-C9ugt2Nr.mjs +0 -418
  2410. package/dist/transport-C9ugt2Nr.mjs.map +0 -1
  2411. package/dist/transport-CUnEL3Vs.d.mts +0 -42
  2412. package/dist/transport-CUnEL3Vs.d.mts.map +0 -1
  2413. package/dist/types-BIgulNsW.mjs +0 -68
  2414. package/dist/types-BIgulNsW.mjs.map +0 -1
  2415. package/dist/types-Bm1dn-q3.mjs +0 -83
  2416. package/dist/types-Bm1dn-q3.mjs.map +0 -1
  2417. package/dist/types-BmPPSUEx.d.mts +0 -243
  2418. package/dist/types-BmPPSUEx.d.mts.map +0 -1
  2419. package/dist/types-BrA0xf5I.d.mts +0 -126
  2420. package/dist/types-BrA0xf5I.d.mts.map +0 -1
  2421. package/dist/types-CS8FIX7L.d.mts +0 -435
  2422. package/dist/types-CS8FIX7L.d.mts.map +0 -1
  2423. package/dist/types-CgqmmMJB.mjs +0 -16
  2424. package/dist/types-CgqmmMJB.mjs.map +0 -1
  2425. package/dist/types-DIMwPFub.d.mts +0 -192
  2426. package/dist/types-DIMwPFub.d.mts.map +0 -1
  2427. package/dist/types-i36XcA_X.d.mts +0 -1252
  2428. package/dist/types-i36XcA_X.d.mts.map +0 -1
  2429. package/dist/validate-CxVsLehf.mjs +0 -328
  2430. package/dist/validate-CxVsLehf.mjs.map +0 -1
  2431. package/dist/validate-DHxmpFJt.d.mts +0 -331
  2432. package/dist/validate-DHxmpFJt.d.mts.map +0 -1
  2433. package/dist/validate-VPnKoIzW.mjs +0 -97
  2434. package/dist/validate-VPnKoIzW.mjs.map +0 -1
  2435. package/dist/validation-C-ZpN2GI.mjs +0 -144
  2436. package/dist/validation-C-ZpN2GI.mjs.map +0 -1
  2437. package/dist/version-DJrV1K0M.mjs +0 -7
  2438. package/dist/version-DJrV1K0M.mjs.map +0 -1
  2439. package/dist/zod-generator-CpwccCIv.mjs +0 -132
  2440. package/dist/zod-generator-CpwccCIv.mjs.map +0 -1
  2441. package/src/cli/commands/auth.ts +0 -46
  2442. package/src/cli/commands/bundle-utils.ts +0 -273
  2443. package/src/cli/commands/bundle.ts +0 -626
  2444. package/src/cli/commands/dev.ts +0 -191
  2445. package/src/cli/commands/plugin-init.ts +0 -291
  2446. package/src/cli/commands/plugin-validate.ts +0 -31
  2447. package/src/cli/commands/plugin.ts +0 -33
  2448. package/src/cli/commands/publish.ts +0 -697
  2449. package/src/plugins/scheduler/piggyback.ts +0 -71
@@ -1,1829 +1,450 @@
1
- import { getRequestContext, runWithContext } from "../request-context.mjs";
2
- import { createRecorder, flushRecorder, isInstrumentationEnabled, kyselyLogOption } from "../database/instrumentation.mjs";
3
- import "../connection-2igzM-AT.mjs";
4
- import { t as validateIdentifier } from "../validate-VPnKoIzW.mjs";
5
- import { a as isSqlite } from "../dialect-helpers-DhTzaUxP.mjs";
6
- import { r as runMigrations } from "../runner-tQ7BJ4T7.mjs";
7
- import { At as handleContentSchedule, B as EmailPipeline, Ct as handleContentGet, Dt as handleContentPermanentDelete, Et as handleContentListTrashed, Ft as validateRev, G as extractRequestMeta, H as createHookPipeline, J as definePlugin, K as sanitizeHeadersForSandbox, L as PluginRouteRegistry, Mt as handleContentUnpublish, Nt as handleContentUnschedule, Ot as handleContentPublish, Pt as handleContentUpdate, R as DEV_CONSOLE_EMAIL_PLUGIN_ID, St as handleContentDuplicate, Tt as handleContentList, U as resolveExclusiveHooks, W as CronExecutor, Z as after, _t as handleContentCountScheduled, at as PluginStateRepository, bt as handleContentDelete, ct as handleMediaDelete, dt as handleMediaUpdate, ft as handleRevisionGet, gt as handleContentCompare, jt as handleContentTranslations, kt as handleContentRestore, lt as handleMediaGet, mt as handleRevisionRestore, nt as loadBundleFromR2, pt as handleRevisionList, q as getTrustedProxyHeaders, st as handleMediaCreate, ut as handleMediaList, vt as handleContentCountTrashed, wt as handleContentGetIncludingTrashed, xt as handleContentDiscardDraft, yt as handleContentCreate, z as devConsoleEmailDeliver } from "../search-BoZYFuUk.mjs";
8
- import { r as RevisionRepository } from "../content-BcQPYxdV.mjs";
9
- import "../base64-MBPo9ozB.mjs";
10
- import "../types-BIgulNsW.mjs";
11
- import { t as MediaRepository } from "../media-D8FbNsl0.mjs";
12
- import { p as OptionsRepository } from "../apply-x0eMK1lX.mjs";
13
- import "../redirect-D_pshWdf.mjs";
14
- import "../byline-Chbr2GoP.mjs";
15
- import { n as normalizeMediaValue } from "../placeholder-C-fk5hYI.mjs";
16
- import { i as setI18nConfig } from "../config-BXwuX8Bx.mjs";
17
- import { r as hashString } from "../zod-generator-CpwccCIv.mjs";
18
- import { i as FTSManager, n as SchemaRegistry } from "../registry-C3Mr0ODu.mjs";
19
- import { n as getDb } from "../loader-CndGj8kM.mjs";
20
- import "../request-cache-Ci7f5pBb.mjs";
21
- import "../taxonomies-B4IAshV8.mjs";
22
- import { r as normalizeManifestRoute } from "../manifest-schema-DH9xhc6t.mjs";
23
- import "../error-zG5T1UGA.mjs";
24
- import { a as invalidateUrlPatternCache } from "../query-fqEdLFms.mjs";
25
- import "../tokens-D9vnZqYS.mjs";
26
- import "../bylines-CRNsVG88.mjs";
27
- import "../load-CyEoextb.mjs";
28
- import "../index.mjs";
29
- import { n as VERSION, t as COMMIT } from "../version-DJrV1K0M.mjs";
30
- import { t as getAuthMode } from "../mode-BnAOqItE.mjs";
31
- import { Kysely, sql } from "kysely";
1
+ import "../runner-CLpxmhl8.mjs";
2
+ import { n as isMissingTableError } from "../db-errors-CBD5yMro.mjs";
3
+ import "../dialect-helpers-7_IqPdh9.mjs";
4
+ import { c as setI18nConfig } from "../config-CvmjJcVw.mjs";
5
+ import "../datetime-normalization-PeiEdcRY.mjs";
6
+ import { j as EmDashConfigurationError, t as getMenu } from "../menus-XQdKk-87.mjs";
7
+ import { n as createDeferredTaskTracker, t as after } from "../after-PcEvMY_6.mjs";
8
+ import { createRequestMetrics, getRequestContext, runWithContext } from "../request-context.mjs";
9
+ import "../options-DhrI7eMv.mjs";
10
+ import "../base64-DvnNgP7e.mjs";
11
+ import { n as initWithLock, t as createInitLock } from "../init-lock-4eRRB4Le.mjs";
12
+ import "../secrets-CIi0nFiR.mjs";
13
+ import "../content-RzEXY3QX.mjs";
14
+ import { s as getLastContentWriteAt } from "../object-cache-Bo6DGaC9.mjs";
15
+ import "../slugify-T5GHH42D.mjs";
16
+ import { i as setRequestCacheEntry, r as requestCached } from "../request-cache-C4CIo5ad.mjs";
17
+ import "../url-Dn3IStq8.mjs";
18
+ import "../types-j6MBDjlZ.mjs";
19
+ import "../revision-CGkQA0e5.mjs";
20
+ import "../media-CputjGE1.mjs";
21
+ import "../user-BOvuF1sQ.mjs";
22
+ import "../taxonomy-BesdHIwi.mjs";
23
+ import "../comment-Cq1UYN8_.mjs";
24
+ import "../audit-BszbE_BP.mjs";
25
+ import "../context-CTkYVMZV.mjs";
26
+ import "../menus-trvc6_fW.mjs";
27
+ import "../resolve-D-kqyKns.mjs";
28
+ import "../redirect-BvFKh8Sz.mjs";
29
+ import "../byline-registry-dvt4N3xV.mjs";
30
+ import "../field-defs-cache-DEkFYCDE.mjs";
31
+ import "../byline-02tu_Uc-.mjs";
32
+ import "../staged-Bw5eHbKS.mjs";
33
+ import "../dist-Cfu8mMBs.mjs";
34
+ import "../enrich-BDdVNeDK.mjs";
35
+ import "../entry-locks-DJAqVweV.mjs";
36
+ import "../seo-DpYxmGaL.mjs";
37
+ import "../cache-CPanL9IO.mjs";
38
+ import "../fts-manager-DU03MxWu.mjs";
39
+ import { s as getDb } from "../loader-CWb-ja1p.mjs";
40
+ import { createRecorder, flushRecorder, isInstrumentationEnabled } from "../database/instrumentation.mjs";
41
+ import "../collection-slugs-cache-BNRAPNiu.mjs";
42
+ import { a as getTaxonomyDefs, o as getTaxonomyTerms } from "../taxonomies-CvBe3xhM.mjs";
43
+ import "../api-BJFwdTiG.mjs";
44
+ import "../capture-triggers-CdZfvHtF.mjs";
45
+ import "../activation-DDuqAat2.mjs";
46
+ import "../collection-deletion-JecE26cS.mjs";
47
+ import "../registry-CtHRqVe-.mjs";
48
+ import "../hash-CY4QdeMJ.mjs";
49
+ import "../zod-generator-DnfG5sGQ.mjs";
50
+ import "../errors-CjXd1LgH.mjs";
51
+ import "../canonical-CAecl1UQ.mjs";
52
+ import "../digest-DiYAoZpf.mjs";
53
+ import "../block-values-BrTrtA-v.mjs";
54
+ import "../query-DSEkrw_m.mjs";
55
+ import "../schema-BZPj3kwZ.mjs";
56
+ import "../relations-CVI2nbrn.mjs";
57
+ import "../dashboard-BoV4pwPP.mjs";
58
+ import "../config-CXPcy2iY.mjs";
59
+ import "../errors-CNvATh_7.mjs";
60
+ import "../update-check-B2JKz5cr.mjs";
61
+ import "../media-3v7mqAVX.mjs";
62
+ import "../media-folders-D2VdVBf6.mjs";
63
+ import "../media-usage-work-BlMjwPg8.mjs";
64
+ import "../content-repair-B-k5JrVN.mjs";
65
+ import "../collection-deletion-processor-DgCfF3a1.mjs";
66
+ import "../media-usage-B8q0owWQ.mjs";
67
+ import "../settings-B0zQj_Tj.mjs";
68
+ import "../site-settings-AYFvhwQn.mjs";
69
+ import "../media-usage-activation-CQWOOTJi.mjs";
70
+ import "../media-usage-work-BC0qpkMD.mjs";
71
+ import "../schema-Berj5VQx.mjs";
72
+ import "../block-types-DIG_KZwi.mjs";
73
+ import "../seo-C61bnPuV.mjs";
74
+ import { i as getSiteSettings } from "../settings-CnWoEDb0.mjs";
75
+ import "../sections-Do5KdTSQ.mjs";
76
+ import "../settings-Ckzmx-A1.mjs";
77
+ import "../taxonomies-CMCnItWf.mjs";
78
+ import "../manifest-schema-gy37bD_D.mjs";
79
+ import "../marketplace-tHWSsCUo.mjs";
80
+ import "../types-CxwtnuSS.mjs";
81
+ import { t as EmDashStorageError } from "../types-DGw8KMX_.mjs";
82
+ import "../artifact-fetch-CWxyELVI.mjs";
83
+ import "../ssrf-DsmvZB80.mjs";
84
+ import "../authoritative-records-dSvXCfzb.mjs";
85
+ import { t as apiError } from "../error-CEdm_AWU.mjs";
86
+ import "../parse-Gt2l4Sld.mjs";
87
+ import "../redirects-D4EWeXAo.mjs";
88
+ import "../entry-lock-PP1JCXBB.mjs";
89
+ import "../media-D1z_jisb.mjs";
90
+ import "../comments-BRtp992B.mjs";
91
+ import "../byline-fields-DHJs0Mja.mjs";
92
+ import "../menus-BQKqf0Up.mjs";
93
+ import "../status-D39Fpy8R.mjs";
94
+ import { o as createPublicMediaUrlResolver } from "../apply-BNvvsD51.mjs";
95
+ import { o as invalidateUrlPatternCache } from "../query-dHwqNf85.mjs";
96
+ import "../import-DUV3Gl6-.mjs";
97
+ import "../redirects-CWQMKYOS.mjs";
98
+ import "../ssrf-tA45vIPX.mjs";
99
+ import "../credits-CAFPFhuk.mjs";
100
+ import "../cron-xe5XKqA-.mjs";
101
+ import "../email-console-DmqVF5J_.mjs";
102
+ import "../fence-BrnQffdY.mjs";
103
+ import "../route-wire-DK600v4u.mjs";
104
+ import "../routes-D0u5zK2P.mjs";
105
+ import "../utils-CoV-PYhg.mjs";
106
+ import "../tokens-BIGxi8sP.mjs";
107
+ import "../preview-DU5rwz_m.mjs";
108
+ import "../hreflang-CNbZjm4g.mjs";
109
+ import "../comment-reaction-DPeGAfjd.mjs";
110
+ import "../bylines-CTGTsEAs.mjs";
111
+ import { r as getWidgetAreas } from "../widgets-D7I_9xff.mjs";
112
+ import "../validate-WkjGwBSO.mjs";
113
+ import "../load-dHcR5yh9.mjs";
114
+ import "../search-CD5MiMdh.mjs";
115
+ import { i as resolveRuntimeMigrationMode, t as PendingMigrationsError } from "../policy-C1qpNxrr.mjs";
116
+ import { n as EmDashRuntime, t as DB_INIT_DEADLINE_MS } from "../emdash-runtime-YPrVnr6x.mjs";
117
+ import "../site-url-Ceq_AUK0.mjs";
118
+ import "../public-submission-x1eaT6Tx.mjs";
119
+ import "../ownership-DoeAIuTg.mjs";
120
+ import "../snapshot-Dzsn3NZa.mjs";
121
+ import "../backup-Cpl8TqRz.mjs";
122
+ import "../comments-Bi2j9IoX.mjs";
123
+ import "../rate-limit-BXx3Ecp9.mjs";
124
+ import "../service-BFUImckH.mjs";
125
+ import "../lifecycle-CpebZNAA.mjs";
126
+ import { n as resolveSessionUser } from "../session-user-DVcHsFD5.mjs";
32
127
  import { defineMiddleware } from "astro:middleware";
128
+ import { buildTime } from "virtual:emdash/build";
33
129
  import virtualConfig from "virtual:emdash/config";
34
- import { createDialect, createRequestScopedDb } from "virtual:emdash/dialect";
130
+ import { createCoalescingDialect, createDialect, createRequestScopedDb } from "virtual:emdash/dialect";
35
131
  import { mediaProviders } from "virtual:emdash/media-providers";
36
132
  import { plugins } from "virtual:emdash/plugins";
37
- import { createSandboxRunner, sandboxEnabled } from "virtual:emdash/sandbox-runner";
133
+ import * as virtualSandboxRunnerModule from "virtual:emdash/sandbox-runner";
38
134
  import { sandboxedPlugins } from "virtual:emdash/sandboxed-plugins";
135
+ import { createScheduler } from "virtual:emdash/scheduler";
39
136
  import { createStorage } from "virtual:emdash/storage";
40
- import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
41
137
 
42
- //#region src/auth/challenge-store.ts
138
+ //#region src/astro/middleware/scoped-db.ts
43
139
  /**
44
- * Clean up expired challenges.
45
- * Should be called periodically (e.g., on startup, or via cron).
140
+ * Request-scoped database lifecycle helpers.
141
+ *
142
+ * Extracted from middleware.ts so they can be unit-tested without pulling in
143
+ * the virtual:emdash/* module graph. The middleware imports these to settle a
144
+ * request-scoped db adapter's lifecycle around the response.
145
+ */
146
+ /**
147
+ * Astro attaches AstroCookies to outgoing responses via a well-known global
148
+ * symbol. Cloning a Response (`new Response(body, init)`) drops non-header
149
+ * metadata, so any helper that wraps the response must explicitly forward this
150
+ * symbol or `cookies.set()` calls will be silently dropped. `Symbol.for`
151
+ * returns the same registry symbol everywhere, so this matches the copy in
152
+ * middleware.ts.
153
+ */
154
+ const ASTRO_COOKIES_SYMBOL = Symbol.for("astro.cookies");
155
+ /**
156
+ * Whether the request ended authenticated, for the db adapter's `commit()`.
157
+ * `isAuthenticated` is captured before the route runs, so it misses
158
+ * login/signup/invite requests that create the Astro session mid-request;
159
+ * `session.set()` writes the `astro-session` cookie into the jar synchronously,
160
+ * so scanning the outgoing cookies detects them. Only outgoing cookies count —
161
+ * a stale `astro-session` cookie arriving on an anonymous render must not
162
+ * qualify, or its replica-read bookmark would overwrite a fresher one from an
163
+ * earlier authenticated write.
46
164
  */
47
- async function cleanupExpiredChallenges(db) {
48
- const now = (/* @__PURE__ */ new Date()).toISOString();
49
- const result = await db.deleteFrom("auth_challenges").where("expires_at", "<", now).executeTakeFirst();
50
- return Number(result.numDeletedRows ?? 0);
165
+ function requestEndedAuthenticated(isAuthenticated, cookies) {
166
+ if (isAuthenticated) return true;
167
+ for (const header of cookies.headers()) if (header.startsWith("astro-session=")) return true;
168
+ return false;
169
+ }
170
+ /** Hold the real adapter close behind both response and deferred-task completion. */
171
+ function coordinateScopedDbLifecycle(scoped) {
172
+ if (!scoped.close) return { lifecycle: scoped };
173
+ const close = scoped.close;
174
+ const deferredTasks = createDeferredTaskTracker(() => {
175
+ try {
176
+ close();
177
+ } catch (error) {
178
+ console.error("[emdash] request-scoped db close failed:", error);
179
+ }
180
+ });
181
+ return {
182
+ closed: deferredTasks.settled,
183
+ deferredTasks,
184
+ lifecycle: {
185
+ commit: scoped.commit,
186
+ close: deferredTasks.settle
187
+ }
188
+ };
51
189
  }
52
-
53
- //#endregion
54
- //#region src/cleanup.ts
55
190
  /**
56
- * System cleanup
191
+ * Run a request-scoped db's `close()` once the response body has finished
192
+ * streaming. Astro streams HTML and components issue DB queries during that
193
+ * stream, so a connection-backed adapter (e.g. Postgres over Hyperdrive) must
194
+ * not be torn down until the body is flushed. Bodyless responses (redirects,
195
+ * 304s, errors) close immediately. A guard makes close idempotent and a stream
196
+ * `cancel` (client disconnect) still triggers it so connections never leak.
57
197
  *
58
- * Runs periodic maintenance tasks that prevent unbounded accumulation of
59
- * expired or stale data. Called from cron scheduler ticks and (for latency-
60
- * sensitive subsystems) inline during relevant requests.
61
- *
62
- * Each subsystem cleanup is independent and non-fatal -- if one fails, the
63
- * rest still run. Failures are logged but never surface to callers.
198
+ * No-op for adapters without a `close` (D1): the response passes through.
64
199
  */
65
- /** Max revisions to keep per entry during periodic pruning */
66
- const REVISION_KEEP_COUNT = 50;
67
- /** Only prune entries that exceed this threshold */
68
- const REVISION_PRUNE_THRESHOLD = REVISION_KEEP_COUNT;
200
+ function wrapResponseForScopedClose(response, close) {
201
+ let closed = false;
202
+ const runClose = () => {
203
+ if (closed) return;
204
+ closed = true;
205
+ try {
206
+ close();
207
+ } catch (error) {
208
+ console.error("[emdash] request-scoped db close failed:", error);
209
+ }
210
+ };
211
+ if (!response.body) {
212
+ runClose();
213
+ return response;
214
+ }
215
+ const transform = new TransformStream({
216
+ flush: runClose,
217
+ cancel: runClose
218
+ });
219
+ const wrapped = new Response(response.body.pipeThrough(transform), response);
220
+ const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL);
221
+ if (astroCookies !== void 0) Reflect.set(wrapped, ASTRO_COOKIES_SYMBOL, astroCookies);
222
+ wrapped.headers.delete("Content-Length");
223
+ return wrapped;
224
+ }
69
225
  /**
70
- * Run all system cleanup tasks.
226
+ * Run the request body under a request-scoped db, then settle its lifecycle:
227
+ * `commit()` runs before the response is returned (so per-request state like a
228
+ * D1 bookmark cookie is persisted in the headers, even if render throws), while
229
+ * `close()` (if any) is deferred to lifecycle settlement so a
230
+ * connection-backed adapter isn't torn down mid-render or mid-task. On error
231
+ * the lifecycle is settled before rethrowing so it never leaks.
71
232
  *
72
- * Safe to call frequently -- each task is a single DELETE with a WHERE clause,
73
- * so repeated calls with nothing to clean are cheap (no-op queries).
74
- *
75
- * @param db - The database instance
76
- * @param storage - Optional storage backend for deleting orphaned files.
77
- * When omitted, pending upload DB rows are still deleted but the
78
- * corresponding files in object storage are not removed.
233
+ * On the error path both `commit()` and `close()` are defended: a throw from
234
+ * either is logged and swallowed so it can't replace the propagating render
235
+ * error (which is the one the caller needs to see). On the success path
236
+ * `commit()` is guarded too — if it throws, the connection is closed before the
237
+ * failure is surfaced, so it never leaks. For the current adapters `commit()`
238
+ * is a no-op (Hyperdrive) or a cookie write (D1, no `close`) and `close()` is
239
+ * fire-and-forget, so these guards only matter for a future connection-backed
240
+ * adapter with throwing teardown, but the helper is generic and must not leak
241
+ * or mask.
79
242
  */
80
- async function runSystemCleanup(db, storage) {
81
- const result = {
82
- challenges: -1,
83
- expiredTokens: -1,
84
- pendingUploads: -1,
85
- pendingUploadFiles: -1,
86
- revisionsPruned: -1
87
- };
88
- try {
89
- result.challenges = await cleanupExpiredChallenges(db);
90
- } catch (error) {
91
- console.error("[cleanup] Failed to clean expired challenges:", error);
92
- }
243
+ async function finishScoped(scoped, run) {
244
+ let response;
93
245
  try {
94
- await createKyselyAdapter(db).deleteExpiredTokens();
95
- result.expiredTokens = 0;
246
+ response = await run();
96
247
  } catch (error) {
97
- console.error("[cleanup] Failed to clean expired tokens:", error);
248
+ commitSafely(scoped.commit);
249
+ closeSafely(scoped.close);
250
+ throw error;
98
251
  }
99
252
  try {
100
- const orphanedKeys = await new MediaRepository(db).cleanupPendingUploads();
101
- result.pendingUploads = orphanedKeys.length;
102
- if (storage && orphanedKeys.length > 0) {
103
- let filesDeleted = 0;
104
- for (const key of orphanedKeys) try {
105
- await storage.delete(key);
106
- filesDeleted++;
107
- } catch (error) {
108
- console.error(`[cleanup] Failed to delete storage file ${key}:`, error);
109
- }
110
- result.pendingUploadFiles = filesDeleted;
111
- } else result.pendingUploadFiles = 0;
253
+ scoped.commit();
112
254
  } catch (error) {
113
- console.error("[cleanup] Failed to clean pending uploads:", error);
255
+ closeSafely(scoped.close);
256
+ throw error;
114
257
  }
258
+ return scoped.close ? wrapResponseForScopedClose(response, scoped.close) : response;
259
+ }
260
+ /**
261
+ * Run commit() swallowing any error. Used where an exception is already
262
+ * propagating (or about to be thrown) and a commit failure must neither mask it
263
+ * nor skip the subsequent close().
264
+ */
265
+ function commitSafely(commit) {
115
266
  try {
116
- result.revisionsPruned = await pruneExcessiveRevisions(db);
267
+ commit();
117
268
  } catch (error) {
118
- console.error("[cleanup] Failed to prune revisions:", error);
269
+ console.error("[emdash] request-scoped db commit failed during error handling:", error);
119
270
  }
120
- return result;
121
271
  }
122
272
  /**
123
- * Find entries with more than REVISION_PRUNE_THRESHOLD revisions and prune
124
- * them down to REVISION_KEEP_COUNT.
273
+ * Run close() swallowing any error. Used on the error/commit-failure paths
274
+ * where another exception is the one the caller must see; a throwing teardown
275
+ * must not replace it.
125
276
  */
126
- async function pruneExcessiveRevisions(db) {
127
- const entries = await sql`
128
- SELECT collection, entry_id
129
- FROM revisions
130
- GROUP BY collection, entry_id
131
- HAVING COUNT(*) > ${REVISION_PRUNE_THRESHOLD}
132
- `.execute(db);
133
- if (entries.rows.length === 0) return 0;
134
- const revisionRepo = new RevisionRepository(db);
135
- let totalPruned = 0;
136
- for (const row of entries.rows) try {
137
- const pruned = await revisionRepo.pruneOldRevisions(row.collection, row.entry_id, REVISION_KEEP_COUNT);
138
- totalPruned += pruned;
277
+ function closeSafely(close) {
278
+ if (!close) return;
279
+ try {
280
+ close();
139
281
  } catch (error) {
140
- console.error(`[cleanup] Failed to prune revisions for ${row.collection}/${row.entry_id}:`, error);
282
+ console.error("[emdash] request-scoped db close failed during error handling:", error);
141
283
  }
142
- return totalPruned;
143
284
  }
144
285
 
145
286
  //#endregion
146
- //#region src/comments/moderator.ts
147
- /** Plugin ID for the built-in default comment moderator */
148
- const DEFAULT_COMMENT_MODERATOR_PLUGIN_ID = "emdash-default-comment-moderator";
287
+ //#region src/astro/middleware/stream-end-metrics.ts
149
288
  /**
150
- * The comment:moderate handler for the built-in default moderator.
289
+ * Stream-end metrics
290
+ *
291
+ * Server-Timing db.* counters are snapshotted when middleware's next()
292
+ * returns — but at that point only the response *headers* are final.
293
+ * Astro streams the body afterwards, and components rendered during
294
+ * streaming issue further DB queries that the headers can never report.
295
+ *
296
+ * This module wraps the response body in an identity TransformStream and
297
+ * snapshots the request metrics in flush(), i.e. when the body actually
298
+ * finishes streaming. The metrics object lives on the request context
299
+ * (AsyncLocalStorage) and is mutated in-place by the Kysely log hook, so
300
+ * a reference captured before wrapping observes every post-header query.
301
+ * The snapshot is emitted as prefixed NDJSON on stdout (same transport as
302
+ * [emdash-query-log] — console.log works in both Node and workerd).
303
+ *
304
+ * Gated on isInstrumentationEnabled() (EMDASH_QUERY_LOG=1): zero overhead
305
+ * in normal production traffic.
151
306
  */
152
- async function defaultCommentModerate(event, _ctx) {
153
- const { comment, collectionSettings, priorApprovedCount } = event;
154
- if (collectionSettings.commentsAutoApproveUsers && comment.authorUserId) return {
155
- status: "approved",
156
- reason: "Authenticated CMS user"
157
- };
158
- if (collectionSettings.commentsModeration === "none") return {
159
- status: "approved",
160
- reason: "Moderation disabled"
161
- };
162
- if (collectionSettings.commentsModeration === "first_time" && priorApprovedCount > 0) return {
163
- status: "approved",
164
- reason: "Returning commenter"
165
- };
166
- return {
167
- status: "pending",
168
- reason: "Held for review"
169
- };
307
+ const STREAM_END_PREFIX = "[emdash-stream-end]";
308
+ /**
309
+ * Wrap a response body so the FINAL request metrics are emitted when the
310
+ * body finishes streaming. Returns the response unchanged when
311
+ * instrumentation is disabled, the body is null, or no request metrics
312
+ * are attached (e.g. outside the middleware's ALS context).
313
+ */
314
+ function wrapBodyForStreamMetrics(response) {
315
+ if (!isInstrumentationEnabled()) return response;
316
+ if (!response.body) return response;
317
+ const ctx = getRequestContext();
318
+ const metrics = ctx?.metrics;
319
+ if (!metrics) return response;
320
+ const recorder = ctx?.queryRecorder;
321
+ if (recorder) recorder.deferredFlush = true;
322
+ const transform = new TransformStream({ flush() {
323
+ const snapshot = {
324
+ route: recorder?.route,
325
+ method: recorder?.method,
326
+ phase: recorder?.phase,
327
+ totalMs: performance.now() - metrics.start,
328
+ dbCount: metrics.dbCount,
329
+ dbTotalMs: metrics.dbTotalMs,
330
+ dbFirstOffset: metrics.dbFirstOffset,
331
+ dbLastOffset: metrics.dbLastOffset,
332
+ cacheHits: metrics.cacheHits,
333
+ cacheMisses: metrics.cacheMisses
334
+ };
335
+ console.log(`${STREAM_END_PREFIX} ${JSON.stringify(snapshot)}`);
336
+ if (recorder) flushRecorder(recorder);
337
+ } });
338
+ const wrapped = new Response(response.body.pipeThrough(transform), response);
339
+ const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL);
340
+ if (astroCookies !== void 0) Reflect.set(wrapped, ASTRO_COOKIES_SYMBOL, astroCookies);
341
+ wrapped.headers.delete("Content-Length");
342
+ return wrapped;
170
343
  }
171
344
 
172
345
  //#endregion
173
- //#region src/plugins/scheduler/node.ts
174
- /** Minimum polling interval (ms) — prevents tight loops if next_run_at is in the past */
175
- const MIN_INTERVAL_MS = 1e3;
176
- /** Maximum polling interval (ms) — wake up periodically to check for stale locks */
177
- const MAX_INTERVAL_MS = 300 * 1e3;
178
- var NodeCronScheduler = class {
179
- timer = null;
180
- running = false;
181
- systemCleanup = null;
182
- constructor(executor) {
183
- this.executor = executor;
184
- }
185
- setSystemCleanup(fn) {
186
- this.systemCleanup = fn;
187
- }
188
- start() {
189
- this.running = true;
190
- this.arm();
191
- }
192
- stop() {
193
- this.running = false;
194
- if (this.timer) {
195
- clearTimeout(this.timer);
196
- this.timer = null;
197
- }
198
- }
199
- reschedule() {
200
- if (!this.running) return;
201
- if (this.timer) {
202
- clearTimeout(this.timer);
203
- this.timer = null;
204
- }
205
- this.arm();
206
- }
207
- arm() {
208
- if (!this.running) return;
209
- this.executor.getNextDueTime().then((nextDue) => {
210
- if (!this.running) return void 0;
211
- let delayMs;
212
- if (nextDue) {
213
- const dueAt = new Date(nextDue).getTime();
214
- delayMs = Math.max(dueAt - Date.now(), MIN_INTERVAL_MS);
215
- delayMs = Math.min(delayMs, MAX_INTERVAL_MS);
216
- } else delayMs = MAX_INTERVAL_MS;
217
- this.timer = setTimeout(() => {
218
- if (!this.running) return;
219
- this.executeTick();
220
- }, delayMs);
221
- if (this.timer && typeof this.timer === "object" && "unref" in this.timer) this.timer.unref();
222
- }).catch((error) => {
223
- console.error("[cron:node] Failed to get next due time:", error);
224
- if (this.running) {
225
- this.timer = setTimeout(() => this.arm(), MAX_INTERVAL_MS);
226
- if (this.timer && typeof this.timer === "object" && "unref" in this.timer) this.timer.unref();
227
- }
228
- });
229
- }
230
- executeTick() {
231
- if (!this.running) return;
232
- const tasks = [this.executor.tick(), this.executor.recoverStaleLocks()];
233
- if (this.systemCleanup) tasks.push(this.systemCleanup());
234
- Promise.allSettled(tasks).then((results) => {
235
- for (const r of results) if (r.status === "rejected") console.error("[cron:node] Tick task failed:", r.reason);
236
- }).finally(() => {
237
- if (this.running) this.arm();
238
- });
239
- }
240
- };
241
-
242
- //#endregion
243
- //#region src/plugins/scheduler/piggyback.ts
244
- /** Minimum interval between tick attempts (ms) */
245
- const DEBOUNCE_MS = 60 * 1e3;
246
- var PiggybackScheduler = class {
247
- lastTickAt = 0;
248
- running = false;
249
- systemCleanup = null;
250
- constructor(executor) {
251
- this.executor = executor;
252
- }
253
- setSystemCleanup(fn) {
254
- this.systemCleanup = fn;
255
- }
256
- start() {
257
- this.running = true;
258
- }
259
- stop() {
260
- this.running = false;
261
- }
262
- /**
263
- * No-op for piggyback — tick happens on next request.
264
- */
265
- reschedule() {}
266
- /**
267
- * Call this from middleware on each request.
268
- * Debounced: only actually ticks if enough time has passed.
269
- */
270
- onRequest() {
271
- if (!this.running) return;
272
- const now = Date.now();
273
- if (now - this.lastTickAt < DEBOUNCE_MS) return;
274
- this.lastTickAt = now;
275
- const tasks = [this.executor.tick(), this.executor.recoverStaleLocks()];
276
- if (this.systemCleanup) tasks.push(this.systemCleanup());
277
- Promise.allSettled(tasks).then((results) => {
278
- for (const r of results) if (r.status === "rejected") console.error("[cron:piggyback] Tick task failed:", r.reason);
279
- });
280
- }
281
- };
282
-
283
- //#endregion
284
- //#region src/emdash-runtime.ts
285
- const LEADING_SLASH_PATTERN = /^\//;
346
+ //#region src/astro/prefetch.ts
286
347
  /**
287
- * Parse a JSON column expected to contain an array of strings.
348
+ * Eager, transparent prefetch of site-global "chrome" data.
349
+ *
350
+ * On a public page render, the shared layout pulls the same site-global data on
351
+ * every request -- menus, widget areas, taxonomy term lists, site settings --
352
+ * but each is awaited inside a separately-rendered Astro component, so they
353
+ * execute as serial DB round trips. This fires them all CONCURRENTLY at the
354
+ * very start of the request, before `next()`:
355
+ *
356
+ * - On remote backends (D1, Durable Objects) the round trips overlap instead
357
+ * of serializing, collapsing ~N sequential RTTs into ~1 wall-clock RTT. On
358
+ * a coalescing backend they additionally batch into a single round trip.
359
+ * - The results land in the per-request `requestCached` store under the exact
360
+ * keys the layout helpers use, so when the components render they hit a warm
361
+ * (in-flight or resolved) cache entry instead of issuing their own query.
288
362
  *
289
- * Throws on malformed JSON rather than returning []; callers are responsible
290
- * for deciding how to handle/log the error. Empty string / null inputs return
291
- * [] (they represent "no value"). Non-string array entries are filtered out.
363
+ * Nothing here changes what templates call -- it warms the real helpers, so the
364
+ * cache keys and value shapes are guaranteed identical. The caller gates this to
365
+ * the public-page path on a request-scoped (remote) backend; it is a no-op-ish
366
+ * waste on synchronous local SQLite, so don't call it there.
367
+ *
368
+ * Fire-and-forget: never awaited by middleware, never throws (a prefetch failure
369
+ * must not affect the request -- the helpers will simply run on demand).
292
370
  */
293
- function parseStringArray(raw) {
294
- if (!raw) return [];
295
- const parsed = JSON.parse(raw);
296
- if (!Array.isArray(parsed)) return [];
297
- return parsed.filter((v) => typeof v === "string");
371
+ /** Warm widget areas: one bulk load, primed under each per-area cache key. */
372
+ async function prefetchWidgetAreas() {
373
+ const areas = await requestCached("widget-areas", getWidgetAreas);
374
+ for (const area of areas) setRequestCacheEntry(`widget-area:${area.name}`, area);
298
375
  }
299
- const VALID_METADATA_KINDS = new Set([
300
- "meta",
301
- "property",
302
- "link",
303
- "jsonld"
304
- ]);
305
- /** Security-critical allowlist for link rel values from sandboxed plugins */
306
- const VALID_LINK_REL = new Set([
307
- "canonical",
308
- "alternate",
309
- "author",
310
- "license",
311
- "nlweb",
312
- "site.standard.document"
313
- ]);
314
376
  /**
315
- * Runtime validation for sandboxed plugin metadata contributions.
316
- * Sandboxed plugins return `unknown` across the RPC boundary — we must
317
- * verify the shape before passing to the metadata collector.
377
+ * Warm every taxonomy's term list via the real helper (primes per-name keys).
378
+ * Counts are left out: they cost an aggregate over the whole assignment pivot
379
+ * per taxonomy, and only a consumer that renders one can say it's needed. A
380
+ * consumer that does asks for it and reuses the term list warmed here.
318
381
  */
319
- function isValidMetadataContribution(c) {
320
- if (!c || typeof c !== "object" || !("kind" in c)) return false;
321
- const obj = c;
322
- if (typeof obj.kind !== "string" || !VALID_METADATA_KINDS.has(obj.kind)) return false;
323
- switch (obj.kind) {
324
- case "meta": return typeof obj.name === "string" && typeof obj.content === "string";
325
- case "property": return typeof obj.property === "string" && typeof obj.content === "string";
326
- case "link": return typeof obj.href === "string" && typeof obj.rel === "string" && VALID_LINK_REL.has(obj.rel);
327
- case "jsonld": return obj.graph != null && typeof obj.graph === "object";
328
- default: return false;
329
- }
382
+ async function prefetchTaxonomyTerms() {
383
+ const defs = await getTaxonomyDefs();
384
+ await Promise.allSettled(defs.map((def) => getTaxonomyTerms(def.name, { includeCounts: false })));
330
385
  }
331
- /**
332
- * Map schema field types to editor field kinds
333
- */
334
- const FIELD_TYPE_TO_KIND = {
335
- string: "string",
336
- slug: "string",
337
- url: "url",
338
- text: "richText",
339
- number: "number",
340
- integer: "number",
341
- boolean: "boolean",
342
- datetime: "datetime",
343
- select: "select",
344
- multiSelect: "multiSelect",
345
- portableText: "portableText",
346
- image: "image",
347
- file: "file",
348
- reference: "reference",
349
- json: "json",
350
- repeater: "repeater"
351
- };
352
- /**
353
- * Convert a ContentItem to Record<string, unknown> for hook consumption.
354
- * Hooks receive the full item as a flat record.
355
- */
356
- function contentItemToRecord(item) {
357
- return { ...item };
386
+ /** Warm every menu via the real helper (primes `menu:${name}:${locale}`). */
387
+ async function prefetchMenus() {
388
+ const rows = await (await getDb()).selectFrom("_emdash_menus").select("name").distinct().execute();
389
+ const names = [...new Set(rows.map((r) => r.name))];
390
+ await Promise.allSettled(names.map((name) => getMenu(name)));
358
391
  }
359
- const dbCache = /* @__PURE__ */ new Map();
360
- let dbInitPromise = null;
361
- const storageCache = /* @__PURE__ */ new Map();
362
- const sandboxedPluginCache = /* @__PURE__ */ new Map();
363
- const marketplacePluginKeys = /* @__PURE__ */ new Set();
364
- /** Manifest metadata for marketplace plugins: pluginId -> manifest admin config */
365
- const marketplaceManifestCache = /* @__PURE__ */ new Map();
366
- /** Route metadata for sandboxed plugins: pluginId -> routeName -> RouteMeta */
367
- const sandboxedRouteMetaCache = /* @__PURE__ */ new Map();
368
- let sandboxRunner = null;
369
392
  /**
370
- * EmDashRuntime - singleton per worker
393
+ * Concurrently warm the site-global layout data for the current request.
394
+ * Safe to call only inside the request ALS frame that owns the (remote)
395
+ * request-scoped db. Never throws.
371
396
  */
372
- var EmDashRuntime = class EmDashRuntime {
373
- /**
374
- * The singleton database instance (worker-lifetime cached).
375
- * Use the `db` getter instead — it checks the request context first
376
- * for per-request overrides (D1 read replica sessions, DO multi-site).
377
- */
378
- _db;
379
- storage;
380
- configuredPlugins;
381
- sandboxedPlugins;
382
- sandboxedPluginEntries;
383
- schemaRegistry;
384
- _hooks;
385
- config;
386
- mediaProviders;
387
- mediaProviderEntries;
388
- cronExecutor;
389
- email;
390
- cronScheduler;
391
- enabledPlugins;
392
- pluginStates;
393
- _cachedManifest = null;
394
- _manifestPromise = null;
395
- _manifestCacheKey;
396
- /**
397
- * Set to true after FTS indexes have been verified for this worker
398
- * lifetime so we don't re-scan on every admin request. See
399
- * ensureSearchHealthy().
400
- */
401
- _searchHealthChecked = false;
402
- _searchHealthPromise = null;
403
- /** Current hook pipeline. Use the `hooks` getter for external access. */
404
- get hooks() {
405
- return this._hooks;
406
- }
407
- /** All plugins eligible for the hook pipeline (includes built-in plugins).
408
- * Stored so we can rebuild the pipeline when plugins are enabled/disabled. */
409
- allPipelinePlugins;
410
- /** Factory options for the hook pipeline context factory */
411
- pipelineFactoryOptions;
412
- /** Dependencies needed for exclusive hook resolution */
413
- runtimeDeps;
414
- /** Mutable ref for the cron invokeCronHook closure to read the current pipeline */
415
- pipelineRef;
416
- /**
417
- * Get the database instance for the current request.
418
- *
419
- * Checks the ALS-based request context first — middleware sets a
420
- * per-request Kysely instance there for D1 read replica sessions
421
- * or DO preview databases. Falls back to the singleton instance.
422
- */
423
- get db() {
424
- const ctx = getRequestContext();
425
- if (ctx?.db) return ctx.db;
426
- return this._db;
427
- }
428
- constructor(parts) {
429
- this._db = parts.db;
430
- this.storage = parts.storage;
431
- this.configuredPlugins = parts.configuredPlugins;
432
- this.sandboxedPlugins = parts.sandboxedPlugins;
433
- this.sandboxedPluginEntries = parts.sandboxedPluginEntries;
434
- this.schemaRegistry = new SchemaRegistry(parts.db);
435
- this._hooks = parts.hooks;
436
- this.enabledPlugins = parts.enabledPlugins;
437
- this.pluginStates = parts.pluginStates;
438
- this.config = parts.config;
439
- this.mediaProviders = parts.mediaProviders;
440
- this.mediaProviderEntries = parts.mediaProviderEntries;
441
- this.cronExecutor = parts.cronExecutor;
442
- this.cronScheduler = parts.cronScheduler;
443
- this.email = parts.emailPipeline;
444
- this.allPipelinePlugins = parts.allPipelinePlugins;
445
- this.pipelineFactoryOptions = parts.pipelineFactoryOptions;
446
- this.runtimeDeps = parts.runtimeDeps;
447
- this.pipelineRef = parts.pipelineRef;
448
- this._manifestCacheKey = parts.manifestCacheKey;
449
- }
450
- /**
451
- * Get the sandbox runner instance (for marketplace install/update)
452
- */
453
- getSandboxRunner() {
454
- return sandboxRunner;
455
- }
456
- /**
457
- * Tick the cron system from request context (piggyback mode).
458
- * Call this from middleware on each request to ensure cron tasks
459
- * execute even when no dedicated scheduler is available.
460
- */
461
- tickCron() {
462
- if (this.cronScheduler instanceof PiggybackScheduler) this.cronScheduler.onRequest();
463
- }
464
- /**
465
- * Stop the cron scheduler gracefully.
466
- * Call during worker shutdown or hot-reload.
467
- */
468
- async stopCron() {
469
- if (this.cronScheduler) await this.cronScheduler.stop();
470
- }
471
- /**
472
- * Update in-memory plugin status and rebuild the hook pipeline.
473
- *
474
- * Rebuilding the pipeline ensures disabled plugins' hooks stop firing
475
- * and re-enabled plugins' hooks start firing again without a restart.
476
- * Exclusive hook selections are re-resolved after each rebuild.
477
- */
478
- async setPluginStatus(pluginId, status) {
479
- this.pluginStates.set(pluginId, status);
480
- if (status === "active") {
481
- this.enabledPlugins.add(pluginId);
482
- await this.rebuildHookPipeline();
483
- await this._hooks.runPluginActivate(pluginId);
484
- } else {
485
- await this._hooks.runPluginDeactivate(pluginId);
486
- this.enabledPlugins.delete(pluginId);
487
- await this.rebuildHookPipeline();
488
- }
489
- this.invalidateManifest();
490
- }
491
- /**
492
- * Rebuild the hook pipeline from the current set of enabled plugins.
493
- *
494
- * Filters `allPipelinePlugins` to only those in `enabledPlugins`,
495
- * creates a fresh HookPipeline, re-resolves exclusive hook selections,
496
- * and re-wires the context factory so existing references (cron
497
- * callbacks, email pipeline) use the new pipeline.
498
- */
499
- async rebuildHookPipeline() {
500
- const newPipeline = createHookPipeline(this.allPipelinePlugins.filter((p) => this.enabledPlugins.has(p.id)), this.pipelineFactoryOptions);
501
- await EmDashRuntime.resolveExclusiveHooks(newPipeline, this.db, this.runtimeDeps);
502
- if (this.email) newPipeline.setContextFactory({
503
- db: this.db,
504
- emailPipeline: this.email
505
- });
506
- if (this.cronScheduler) {
507
- const scheduler = this.cronScheduler;
508
- newPipeline.setContextFactory({ cronReschedule: () => scheduler.reschedule() });
509
- }
510
- if (this.email) this.email.setPipeline(newPipeline);
511
- this.pipelineRef.current = newPipeline;
512
- this._hooks = newPipeline;
513
- }
514
- /**
515
- * Synchronize marketplace plugin runtime state with DB + storage.
516
- *
517
- * Ensures install/update/uninstall changes take effect immediately in the
518
- * current worker: loads newly active plugins and removes uninstalled ones.
519
- */
520
- async syncMarketplacePlugins() {
521
- if (!this.config.marketplace || !this.storage) return;
522
- if (!sandboxRunner || !sandboxRunner.isAvailable()) return;
523
- try {
524
- const marketplaceStates = await new PluginStateRepository(this.db).getMarketplacePlugins();
525
- const desired = /* @__PURE__ */ new Map();
526
- for (const state of marketplaceStates) {
527
- this.pluginStates.set(state.pluginId, state.status);
528
- if (state.status === "active") this.enabledPlugins.add(state.pluginId);
529
- else this.enabledPlugins.delete(state.pluginId);
530
- if (state.status !== "active") continue;
531
- desired.set(state.pluginId, state.marketplaceVersion ?? state.version);
532
- }
533
- const keysToRemove = [];
534
- for (const key of marketplacePluginKeys) {
535
- const [pluginId] = key.split(":");
536
- if (!pluginId) continue;
537
- const desiredVersion = desired.get(pluginId);
538
- if (desiredVersion && key === `${pluginId}:${desiredVersion}`) continue;
539
- keysToRemove.push(key);
540
- }
541
- for (const key of keysToRemove) {
542
- const [pluginId] = key.split(":");
543
- if (!pluginId) continue;
544
- if (!desired.get(pluginId)) {
545
- this.pluginStates.delete(pluginId);
546
- this.enabledPlugins.delete(pluginId);
547
- }
548
- const existing = sandboxedPluginCache.get(key);
549
- if (existing) try {
550
- await existing.terminate();
551
- } catch (error) {
552
- console.warn(`EmDash: Failed to terminate sandboxed plugin ${key}:`, error);
553
- }
554
- sandboxedPluginCache.delete(key);
555
- this.sandboxedPlugins.delete(key);
556
- marketplacePluginKeys.delete(key);
557
- if (pluginId) {
558
- sandboxedRouteMetaCache.delete(pluginId);
559
- marketplaceManifestCache.delete(pluginId);
560
- }
561
- }
562
- for (const [pluginId, version] of desired) {
563
- const key = `${pluginId}:${version}`;
564
- if (sandboxedPluginCache.has(key)) {
565
- marketplacePluginKeys.add(key);
566
- continue;
567
- }
568
- const bundle = await loadBundleFromR2(this.storage, pluginId, version);
569
- if (!bundle) {
570
- console.warn(`EmDash: Marketplace plugin ${pluginId}@${version} not found in R2`);
571
- continue;
572
- }
573
- const loaded = await sandboxRunner.load(bundle.manifest, bundle.backendCode);
574
- sandboxedPluginCache.set(key, loaded);
575
- this.sandboxedPlugins.set(key, loaded);
576
- marketplacePluginKeys.add(key);
577
- marketplaceManifestCache.set(pluginId, {
578
- id: bundle.manifest.id,
579
- version: bundle.manifest.version,
580
- admin: bundle.manifest.admin
581
- });
582
- if (bundle.manifest.routes.length > 0) {
583
- const routeMetaMap = /* @__PURE__ */ new Map();
584
- for (const entry of bundle.manifest.routes) {
585
- const normalized = normalizeManifestRoute(entry);
586
- routeMetaMap.set(normalized.name, { public: normalized.public === true });
587
- }
588
- sandboxedRouteMetaCache.set(pluginId, routeMetaMap);
589
- } else sandboxedRouteMetaCache.delete(pluginId);
590
- }
591
- } catch (error) {
592
- console.error("EmDash: Failed to sync marketplace plugins:", error);
593
- }
594
- }
595
- /**
596
- * Create and initialize the runtime
597
- */
598
- static async create(deps, timings) {
599
- const phase = async (name, desc, fn) => {
600
- if (!timings) return fn();
601
- const t0 = performance.now();
602
- try {
603
- return await fn();
604
- } finally {
605
- timings.push({
606
- name,
607
- dur: performance.now() - t0,
608
- desc
609
- });
610
- }
611
- };
612
- const db = await phase("rt.db", "DB init + migrations", () => EmDashRuntime.getDatabase(deps));
613
- const storage = EmDashRuntime.getStorage(deps);
614
- let pluginStates = /* @__PURE__ */ new Map();
615
- await phase("rt.plugins", "Plugin states", async () => {
616
- try {
617
- const states = await db.selectFrom("_plugin_state").select(["plugin_id", "status"]).execute();
618
- pluginStates = new Map(states.map((s) => [s.plugin_id, s.status]));
619
- } catch {}
620
- });
621
- const enabledPlugins = /* @__PURE__ */ new Set();
622
- for (const plugin of deps.plugins) {
623
- const status = pluginStates.get(plugin.id);
624
- if (status === void 0 || status === "active") enabledPlugins.add(plugin.id);
625
- }
626
- let siteInfo;
627
- await phase("rt.site", "Site info options", async () => {
628
- try {
629
- const siteOpts = await new OptionsRepository(db).getMany([
630
- "emdash:site_title",
631
- "emdash:site_url",
632
- "emdash:locale"
633
- ]);
634
- siteInfo = {
635
- siteName: siteOpts.get("emdash:site_title") ?? void 0,
636
- siteUrl: siteOpts.get("emdash:site_url") ?? void 0,
637
- locale: siteOpts.get("emdash:locale") ?? void 0
638
- };
639
- } catch {}
640
- });
641
- const allPipelinePlugins = [...deps.plugins];
642
- if (import.meta.env.DEV) try {
643
- const devConsolePlugin = definePlugin({
644
- id: DEV_CONSOLE_EMAIL_PLUGIN_ID,
645
- version: "0.0.0",
646
- capabilities: ["email:provide"],
647
- hooks: { "email:deliver": {
648
- exclusive: true,
649
- handler: devConsoleEmailDeliver
650
- } }
651
- });
652
- allPipelinePlugins.push(devConsolePlugin);
653
- enabledPlugins.add(devConsolePlugin.id);
654
- } catch (error) {
655
- console.warn("[email] Failed to register dev console email provider:", error);
656
- }
657
- try {
658
- const defaultModeratorPlugin = definePlugin({
659
- id: DEFAULT_COMMENT_MODERATOR_PLUGIN_ID,
660
- version: "0.0.0",
661
- capabilities: ["read:users"],
662
- hooks: { "comment:moderate": {
663
- exclusive: true,
664
- handler: defaultCommentModerate
665
- } }
666
- });
667
- allPipelinePlugins.push(defaultModeratorPlugin);
668
- enabledPlugins.add(defaultModeratorPlugin.id);
669
- } catch (error) {
670
- console.warn("[comments] Failed to register default moderator:", error);
671
- }
672
- const enabledPluginList = allPipelinePlugins.filter((p) => enabledPlugins.has(p.id));
673
- const pipelineFactoryOptions = {
674
- db,
675
- storage: storage ?? void 0,
676
- siteInfo
677
- };
678
- const pipeline = createHookPipeline(enabledPluginList, pipelineFactoryOptions);
679
- const sandboxedPlugins = await phase("rt.sandbox", "Sandboxed plugins", () => EmDashRuntime.loadSandboxedPlugins(deps, db));
680
- if (deps.config.marketplace && storage) await phase("rt.market", "Marketplace plugins", () => EmDashRuntime.loadMarketplacePlugins(db, storage, deps, sandboxedPlugins));
681
- const mediaProviders = /* @__PURE__ */ new Map();
682
- const mediaProviderEntries = deps.mediaProviderEntries ?? [];
683
- const providerContext = {
684
- db,
685
- storage
686
- };
687
- for (const entry of mediaProviderEntries) try {
688
- const provider = entry.createProvider(providerContext);
689
- mediaProviders.set(entry.id, provider);
690
- } catch (error) {
691
- console.warn(`Failed to initialize media provider "${entry.id}":`, error);
692
- }
693
- await phase("rt.hooks", "Exclusive hook resolution", () => EmDashRuntime.resolveExclusiveHooks(pipeline, db, deps));
694
- const emailPipeline = new EmailPipeline(pipeline);
695
- if (sandboxRunner) sandboxRunner.setEmailSend((message, pluginId) => emailPipeline.send(message, pluginId));
696
- const pipelineRef = { current: pipeline };
697
- const invokeCronHook = async (pluginId, event) => {
698
- const result = await pipelineRef.current.invokeCronHook(pluginId, event);
699
- if (!result.success && result.error) throw result.error;
700
- };
701
- pipeline.setContextFactory({
702
- db,
703
- emailPipeline
704
- });
705
- let cronExecutor = null;
706
- let cronScheduler = null;
707
- await phase("rt.cron", "Cron init (recovery deferred post-response)", async () => {
708
- try {
709
- cronExecutor = new CronExecutor(db, invokeCronHook);
710
- const executorForRecovery = cronExecutor;
711
- after(async () => {
712
- try {
713
- const recovered = await executorForRecovery.recoverStaleLocks();
714
- if (recovered > 0) console.log(`[cron] Recovered ${recovered} stale task lock(s)`);
715
- } catch (error) {
716
- console.error("[cron] Failed to recover stale task locks:", error);
717
- }
718
- });
719
- if (typeof globalThis.navigator !== "undefined" && globalThis.navigator.userAgent === "Cloudflare-Workers") cronScheduler = new PiggybackScheduler(cronExecutor);
720
- else cronScheduler = new NodeCronScheduler(cronExecutor);
721
- cronScheduler.setSystemCleanup(async () => {
722
- try {
723
- await runSystemCleanup(db, storage ?? void 0);
724
- } catch (error) {
725
- console.error("[cleanup] System cleanup failed:", error);
726
- }
727
- });
728
- pipeline.setContextFactory({ cronReschedule: () => cronScheduler?.reschedule() });
729
- await cronScheduler.start();
730
- } catch (error) {
731
- console.warn("[cron] Failed to initialize cron system:", error);
732
- }
733
- });
734
- const manifestCacheKey = await hashString([
735
- COMMIT,
736
- ...deps.plugins.map((p) => `${p.id}@${p.version ?? ""}`).toSorted(),
737
- ...deps.sandboxedPluginEntries.map((e) => `${e.id}@${e.version}`).toSorted(),
738
- virtualConfig?.i18n?.defaultLocale ?? "",
739
- (virtualConfig?.i18n?.locales ?? []).toSorted().join(",")
740
- ].join("|"));
741
- return new EmDashRuntime({
742
- db,
743
- storage,
744
- configuredPlugins: deps.plugins,
745
- sandboxedPlugins,
746
- sandboxedPluginEntries: deps.sandboxedPluginEntries,
747
- hooks: pipeline,
748
- enabledPlugins,
749
- pluginStates,
750
- config: deps.config,
751
- mediaProviders,
752
- mediaProviderEntries,
753
- cronExecutor,
754
- cronScheduler,
755
- emailPipeline,
756
- allPipelinePlugins,
757
- pipelineFactoryOptions,
758
- runtimeDeps: deps,
759
- pipelineRef,
760
- manifestCacheKey
761
- });
762
- }
763
- /**
764
- * Get a media provider by ID
765
- */
766
- getMediaProvider(providerId) {
767
- return this.mediaProviders.get(providerId);
768
- }
769
- /**
770
- * Get all media provider entries (for admin UI)
771
- */
772
- getMediaProviderList() {
773
- return this.mediaProviderEntries.map((e) => ({
774
- id: e.id,
775
- name: e.name,
776
- icon: e.icon,
777
- capabilities: e.capabilities
778
- }));
779
- }
780
- /**
781
- * Get or create database instance
782
- */
783
- static async getDatabase(deps) {
784
- const ctx = getRequestContext();
785
- if (ctx?.dbIsIsolated && ctx.db) return ctx.db;
786
- const dbConfig = deps.config.database;
787
- if (!dbConfig) try {
788
- return await getDb();
789
- } catch {
790
- throw new Error("EmDash database not configured. Either configure database in astro.config.mjs or use emdashLoader in live.config.ts");
791
- }
792
- const cacheKey = dbConfig.entrypoint;
793
- const cached = dbCache.get(cacheKey);
794
- if (cached) return cached;
795
- if (dbInitPromise) return dbInitPromise;
796
- dbInitPromise = (async () => {
797
- const db = new Kysely({
798
- dialect: deps.createDialect(dbConfig.config),
799
- log: kyselyLogOption()
800
- });
801
- const { applied } = await runMigrations(db);
802
- if (applied.length > 0) try {
803
- await new OptionsRepository(db).delete("emdash:manifest_cache");
804
- } catch {}
805
- try {
806
- const [collectionCount, setupOption] = await Promise.all([db.selectFrom("_emdash_collections").select((eb) => eb.fn.countAll().as("count")).executeTakeFirstOrThrow(), db.selectFrom("options").select("value").where("name", "=", "emdash:setup_complete").executeTakeFirst()]);
807
- const setupDone = (() => {
808
- try {
809
- return setupOption && JSON.parse(setupOption.value) === true;
810
- } catch {
811
- return false;
812
- }
813
- })();
814
- if (collectionCount.count === 0 && !setupDone) {
815
- const { applySeed } = await import("../apply-x0eMK1lX.mjs").then((n) => n.n);
816
- const { loadSeed } = await import("../load-CyEoextb.mjs").then((n) => n.r);
817
- const { validateSeed } = await import("../validate-CxVsLehf.mjs").then((n) => n.n);
818
- const seed = await loadSeed();
819
- if (validateSeed(seed).valid) {
820
- await applySeed(db, seed, { onConflict: "skip" });
821
- console.log("Auto-seeded default collections");
822
- }
823
- }
824
- } catch {}
825
- dbCache.set(cacheKey, db);
826
- return db;
827
- })();
828
- try {
829
- return await dbInitPromise;
830
- } finally {
831
- dbInitPromise = null;
832
- }
833
- }
834
- /**
835
- * Get or create storage instance
836
- */
837
- static getStorage(deps) {
838
- const storageConfig = deps.config.storage;
839
- if (!storageConfig || !deps.createStorage) return null;
840
- const cacheKey = storageConfig.entrypoint;
841
- const cached = storageCache.get(cacheKey);
842
- if (cached) return cached;
843
- const storage = deps.createStorage(storageConfig.config);
844
- storageCache.set(cacheKey, storage);
845
- return storage;
846
- }
847
- /**
848
- * Load sandboxed plugins using SandboxRunner
849
- */
850
- static async loadSandboxedPlugins(deps, db) {
851
- if (sandboxedPluginCache.size > 0) return sandboxedPluginCache;
852
- if (!deps.sandboxEnabled || deps.sandboxedPluginEntries.length === 0) return sandboxedPluginCache;
853
- if (!sandboxRunner && deps.createSandboxRunner) sandboxRunner = deps.createSandboxRunner({ db });
854
- if (!sandboxRunner) return sandboxedPluginCache;
855
- if (!sandboxRunner.isAvailable()) {
856
- console.debug("EmDash: Sandbox runner not available (missing bindings), skipping sandbox");
857
- return sandboxedPluginCache;
858
- }
859
- for (const entry of deps.sandboxedPluginEntries) {
860
- const pluginKey = `${entry.id}:${entry.version}`;
861
- if (sandboxedPluginCache.has(pluginKey)) continue;
862
- try {
863
- const manifest = {
864
- id: entry.id,
865
- version: entry.version,
866
- capabilities: entry.capabilities ?? [],
867
- allowedHosts: entry.allowedHosts ?? [],
868
- storage: entry.storage ?? {},
869
- hooks: [],
870
- routes: [],
871
- admin: {}
872
- };
873
- const plugin = await sandboxRunner.load(manifest, entry.code);
874
- sandboxedPluginCache.set(pluginKey, plugin);
875
- console.log(`EmDash: Loaded sandboxed plugin ${pluginKey} with capabilities: [${manifest.capabilities.join(", ")}]`);
876
- } catch (error) {
877
- console.error(`EmDash: Failed to load sandboxed plugin ${entry.id}:`, error);
878
- }
879
- }
880
- return sandboxedPluginCache;
881
- }
882
- /**
883
- * Cold-start: load marketplace-installed plugins from site-local R2 storage
884
- *
885
- * Queries _plugin_state for source='marketplace' rows, fetches each bundle
886
- * from R2, and loads via SandboxRunner.
887
- */
888
- static async loadMarketplacePlugins(db, storage, deps, cache) {
889
- if (!sandboxRunner && deps.createSandboxRunner) sandboxRunner = deps.createSandboxRunner({ db });
890
- if (!sandboxRunner || !sandboxRunner.isAvailable()) return;
891
- try {
892
- const marketplacePlugins = await new PluginStateRepository(db).getMarketplacePlugins();
893
- for (const plugin of marketplacePlugins) {
894
- if (plugin.status !== "active") continue;
895
- const version = plugin.marketplaceVersion ?? plugin.version;
896
- const pluginKey = `${plugin.pluginId}:${version}`;
897
- if (cache.has(pluginKey)) continue;
898
- try {
899
- const bundle = await loadBundleFromR2(storage, plugin.pluginId, version);
900
- if (!bundle) {
901
- console.warn(`EmDash: Marketplace plugin ${plugin.pluginId}@${version} not found in R2`);
902
- continue;
903
- }
904
- const loaded = await sandboxRunner.load(bundle.manifest, bundle.backendCode);
905
- cache.set(pluginKey, loaded);
906
- marketplacePluginKeys.add(pluginKey);
907
- marketplaceManifestCache.set(plugin.pluginId, {
908
- id: bundle.manifest.id,
909
- version: bundle.manifest.version,
910
- admin: bundle.manifest.admin
911
- });
912
- if (bundle.manifest.routes.length > 0) {
913
- const routeMeta = /* @__PURE__ */ new Map();
914
- for (const entry of bundle.manifest.routes) {
915
- const normalized = normalizeManifestRoute(entry);
916
- routeMeta.set(normalized.name, { public: normalized.public === true });
917
- }
918
- sandboxedRouteMetaCache.set(plugin.pluginId, routeMeta);
919
- }
920
- console.log(`EmDash: Loaded marketplace plugin ${pluginKey} with capabilities: [${bundle.manifest.capabilities.join(", ")}]`);
921
- } catch (error) {
922
- console.error(`EmDash: Failed to load marketplace plugin ${plugin.pluginId}:`, error);
923
- }
924
- }
925
- } catch {}
926
- }
927
- /**
928
- * Resolve exclusive hook selections on startup.
929
- *
930
- * Delegates to the shared resolveExclusiveHooks() in hooks.ts.
931
- * The runtime version considers all pipeline providers as "active" since
932
- * the pipeline was already built from only active/enabled plugins.
933
- */
934
- static async resolveExclusiveHooks(pipeline, db, deps) {
935
- if (pipeline.getRegisteredExclusiveHooks().length === 0) return;
936
- let optionsRepo;
937
- try {
938
- optionsRepo = new OptionsRepository(db);
939
- } catch {
940
- return;
941
- }
942
- const preferredHints = /* @__PURE__ */ new Map();
943
- for (const entry of deps.sandboxedPluginEntries) if (entry.preferred && entry.preferred.length > 0) preferredHints.set(entry.id, entry.preferred);
944
- await resolveExclusiveHooks({
945
- pipeline,
946
- isActive: () => true,
947
- getOption: (key) => optionsRepo.get(key),
948
- setOption: (key, value) => optionsRepo.set(key, value),
949
- deleteOption: async (key) => {
950
- await optionsRepo.delete(key);
951
- },
952
- preferredHints
953
- });
954
- }
955
- /**
956
- * Get the manifest, using an in-memory cache with a DB-persisted
957
- * fallback for cold starts. Avoids N+1 schema registry queries
958
- * on every request.
959
- *
960
- * Cache is invalidated by invalidateManifest(), called from schema
961
- * API routes, MCP server, plugin toggle, and taxonomy def changes.
962
- */
963
- async getManifest() {
964
- if (getRequestContext()?.dbIsIsolated) return this._buildManifest();
965
- if (this._cachedManifest) return this._cachedManifest;
966
- try {
967
- const cached = await new OptionsRepository(this.db).get("emdash:manifest_cache");
968
- if (cached && cached.key === this._manifestCacheKey && cached.manifest) {
969
- this._cachedManifest = cached.manifest;
970
- return cached.manifest;
971
- }
972
- } catch {}
973
- if (!this._manifestPromise) {
974
- let manifestPromise;
975
- const isCurrentLoad = () => this._manifestPromise === manifestPromise;
976
- manifestPromise = this._loadManifest(isCurrentLoad);
977
- this._manifestPromise = manifestPromise;
978
- }
979
- return this._manifestPromise;
980
- }
981
- async _loadManifest(isCurrentLoad) {
982
- try {
983
- const manifest = await this._buildManifest();
984
- if (isCurrentLoad()) {
985
- this._cachedManifest = manifest;
986
- try {
987
- await new OptionsRepository(this.db).set("emdash:manifest_cache", {
988
- key: this._manifestCacheKey,
989
- manifest
990
- });
991
- } catch {}
992
- }
993
- return manifest;
994
- } finally {
995
- if (isCurrentLoad()) this._manifestPromise = null;
996
- }
997
- }
998
- /**
999
- * Build the manifest from database (N+1 collection queries).
1000
- */
1001
- async _buildManifest() {
1002
- const manifestCollections = {};
1003
- try {
1004
- const registry = new SchemaRegistry(this.db);
1005
- const dbCollections = await registry.listCollections();
1006
- for (const collection of dbCollections) {
1007
- const collectionWithFields = await registry.getCollectionWithFields(collection.slug);
1008
- const fields = {};
1009
- if (collectionWithFields?.fields) for (const field of collectionWithFields.fields) {
1010
- const entry = {
1011
- kind: FIELD_TYPE_TO_KIND[field.type] ?? "string",
1012
- label: field.label,
1013
- required: field.required
1014
- };
1015
- if (field.widget) entry.widget = field.widget;
1016
- if (field.options) entry.options = field.options;
1017
- if (field.validation?.options) entry.options = field.validation.options.map((v) => ({
1018
- value: v,
1019
- label: v.charAt(0).toUpperCase() + v.slice(1)
1020
- }));
1021
- if (field.type === "repeater" && field.validation) entry.validation = field.validation;
1022
- fields[field.slug] = entry;
1023
- }
1024
- manifestCollections[collection.slug] = {
1025
- label: collection.label,
1026
- labelSingular: collection.labelSingular || collection.label,
1027
- supports: collection.supports || [],
1028
- hasSeo: collection.hasSeo,
1029
- urlPattern: collection.urlPattern,
1030
- fields
1031
- };
1032
- }
1033
- } catch (error) {
1034
- console.debug("EmDash: Could not load database collections:", error);
1035
- }
1036
- const manifestPlugins = {};
1037
- for (const plugin of this.configuredPlugins) {
1038
- const status = this.pluginStates.get(plugin.id);
1039
- const enabled = status === void 0 || status === "active";
1040
- const hasAdminEntry = !!plugin.admin?.entry;
1041
- const hasAdminPages = (plugin.admin?.pages?.length ?? 0) > 0;
1042
- const hasWidgets = (plugin.admin?.widgets?.length ?? 0) > 0;
1043
- let adminMode = "none";
1044
- if (hasAdminEntry) adminMode = "react";
1045
- else if (hasAdminPages || hasWidgets) adminMode = "blocks";
1046
- manifestPlugins[plugin.id] = {
1047
- version: plugin.version,
1048
- enabled,
1049
- adminMode,
1050
- adminPages: plugin.admin?.pages ?? [],
1051
- dashboardWidgets: plugin.admin?.widgets ?? [],
1052
- portableTextBlocks: plugin.admin?.portableTextBlocks,
1053
- fieldWidgets: plugin.admin?.fieldWidgets
1054
- };
1055
- }
1056
- for (const entry of this.sandboxedPluginEntries) {
1057
- const status = this.pluginStates.get(entry.id);
1058
- const enabled = status === void 0 || status === "active";
1059
- const hasAdminPages = (entry.adminPages?.length ?? 0) > 0;
1060
- const hasWidgets = (entry.adminWidgets?.length ?? 0) > 0;
1061
- manifestPlugins[entry.id] = {
1062
- version: entry.version,
1063
- enabled,
1064
- sandboxed: true,
1065
- adminMode: hasAdminPages || hasWidgets ? "blocks" : "none",
1066
- adminPages: entry.adminPages ?? [],
1067
- dashboardWidgets: entry.adminWidgets ?? []
1068
- };
1069
- }
1070
- for (const [pluginId, meta] of marketplaceManifestCache) {
1071
- if (manifestPlugins[pluginId]) continue;
1072
- const enabled = this.pluginStates.get(pluginId) === "active";
1073
- const pages = meta.admin?.pages;
1074
- const widgets = meta.admin?.widgets;
1075
- const hasAdminPages = (pages?.length ?? 0) > 0;
1076
- const hasWidgets = (widgets?.length ?? 0) > 0;
1077
- manifestPlugins[pluginId] = {
1078
- version: meta.version,
1079
- enabled,
1080
- sandboxed: true,
1081
- adminMode: hasAdminPages || hasWidgets ? "blocks" : "none",
1082
- adminPages: pages ?? [],
1083
- dashboardWidgets: widgets ?? []
1084
- };
1085
- }
1086
- let manifestTaxonomies = [];
1087
- try {
1088
- manifestTaxonomies = (await this.db.selectFrom("_emdash_taxonomy_defs").selectAll().orderBy("name").execute()).map((row) => ({
1089
- name: row.name,
1090
- label: row.label,
1091
- labelSingular: row.label_singular ?? void 0,
1092
- hierarchical: row.hierarchical === 1,
1093
- collections: parseStringArray(row.collections).toSorted()
1094
- }));
1095
- } catch (error) {
1096
- console.debug("EmDash: Could not load taxonomy definitions:", error);
1097
- }
1098
- const manifestHash = await hashString(JSON.stringify(manifestCollections) + JSON.stringify(manifestPlugins) + JSON.stringify(manifestTaxonomies));
1099
- const authMode = getAuthMode(this.config);
1100
- const authModeValue = authMode.type === "external" ? authMode.providerType : "passkey";
1101
- const i18nConfig = virtualConfig?.i18n;
1102
- const i18n = i18nConfig && i18nConfig.locales && i18nConfig.locales.length > 1 ? {
1103
- defaultLocale: i18nConfig.defaultLocale,
1104
- locales: i18nConfig.locales
1105
- } : void 0;
1106
- return {
1107
- version: VERSION,
1108
- commit: COMMIT,
1109
- hash: manifestHash,
1110
- collections: manifestCollections,
1111
- plugins: manifestPlugins,
1112
- taxonomies: manifestTaxonomies,
1113
- authMode: authModeValue,
1114
- i18n,
1115
- marketplace: !!this.config.marketplace
1116
- };
1117
- }
1118
- /**
1119
- * Invalidate cached data derived from the manifest/schema.
1120
- * Called when collections, fields, plugins, or taxonomy defs change.
1121
- */
1122
- invalidateManifest() {
1123
- this._cachedManifest = null;
1124
- this._manifestPromise = null;
1125
- invalidateUrlPatternCache();
1126
- try {
1127
- new OptionsRepository(this.db).delete("emdash:manifest_cache").catch((error) => {
1128
- console.error("Failed to delete persisted manifest cache", error);
1129
- });
1130
- } catch (error) {
1131
- console.error("Failed to initialize manifest cache invalidation", error);
1132
- }
1133
- }
1134
- /**
1135
- * Verify and repair FTS indexes on demand. Runs at most once per worker
1136
- * lifetime.
1137
- *
1138
- * Originally called from `EmDashRuntime.create()`, but on a busy D1 link
1139
- * (e.g. SIN replica ~80-150ms per query) it added ~1.5s to every cold
1140
- * start for a modest-sized site — more than every other init phase
1141
- * combined. Anonymous public reads never touch the search write path,
1142
- * so the cost isn't paid back for the vast majority of requests.
1143
- *
1144
- * Instead, search endpoints call this lazily: the first request that
1145
- * actually needs the index pays the verify cost (usually fast — no
1146
- * rebuild needed), everyone else runs cold-free.
1147
- *
1148
- * Uses the runtime's singleton database (`this._db`) rather than the
1149
- * request-scoped DB. Verify reads only, but `rebuildIndex` writes, and
1150
- * a GET search request on D1 carries a `first-unconstrained` session
1151
- * that's free to route at a read replica — unsafe for writes. The
1152
- * singleton always goes through the default binding, which the D1
1153
- * adapter will promote to `first-primary` for write statements.
1154
- *
1155
- * Safe to call concurrently: repeated callers share the same in-flight
1156
- * promise. Errors are swallowed internally so callers don't need to
1157
- * defend against FTS not existing yet (pre-setup).
1158
- */
1159
- async ensureSearchHealthy() {
1160
- if (this._searchHealthChecked) return;
1161
- if (this._searchHealthPromise) return this._searchHealthPromise;
1162
- if (!isSqlite(this._db)) {
1163
- this._searchHealthChecked = true;
1164
- return;
1165
- }
1166
- this._searchHealthPromise = (async () => {
1167
- try {
1168
- const repaired = await new FTSManager(this._db).verifyAndRepairAll();
1169
- if (repaired > 0) console.log(`Repaired ${repaired} corrupted FTS index(es)`);
1170
- } catch {} finally {
1171
- this._searchHealthChecked = true;
1172
- this._searchHealthPromise = null;
1173
- }
1174
- })();
1175
- return this._searchHealthPromise;
1176
- }
1177
- async handleContentList(collection, params) {
1178
- return handleContentList(this.db, collection, params);
1179
- }
1180
- async handleContentGet(collection, id, locale) {
1181
- const result = await handleContentGet(this.db, collection, id, locale);
1182
- return this.hydrateDraftData(result);
1183
- }
1184
- async handleContentGetIncludingTrashed(collection, id, locale) {
1185
- const result = await handleContentGetIncludingTrashed(this.db, collection, id, locale);
1186
- return this.hydrateDraftData(result);
1187
- }
1188
- /**
1189
- * If the response item has a `draftRevisionId`, replace `item.data` with
1190
- * the draft revision's data and expose the original published values as
1191
- * `liveData`. This makes the content_get / content_update round-trip
1192
- * intuitive — read returns the latest content the caller has saved
1193
- * (their pending draft), with the previously-published values still
1194
- * accessible for compare-style flows.
1195
- *
1196
- * No-op when no draft exists or the response is an error.
1197
- */
1198
- async hydrateDraftData(result) {
1199
- if (!result || typeof result !== "object") return result;
1200
- const r = result;
1201
- if (!r.success || !r.data?.item) return result;
1202
- const item = r.data.item;
1203
- const draftRevisionId = typeof item.draftRevisionId === "string" ? item.draftRevisionId : null;
1204
- if (!draftRevisionId) return result;
1205
- try {
1206
- const revision = await new RevisionRepository(this.db).findById(draftRevisionId);
1207
- if (!revision) return result;
1208
- const liveData = item.data && typeof item.data === "object" ? item.data : {};
1209
- const revisionData = {};
1210
- for (const [key, value] of Object.entries(revision.data)) if (!key.startsWith("_")) revisionData[key] = value;
1211
- const mergedData = {
1212
- ...liveData,
1213
- ...revisionData
1214
- };
1215
- return {
1216
- ...result,
1217
- data: {
1218
- ...r.data,
1219
- item: {
1220
- ...item,
1221
- data: mergedData,
1222
- liveData
1223
- }
1224
- }
1225
- };
1226
- } catch (error) {
1227
- console.error("[emdash] draft hydration failed:", error);
1228
- return result;
1229
- }
1230
- }
1231
- async handleContentCreate(collection, body) {
1232
- let processedData = body.data;
1233
- if (this.hooks.hasHooks("content:beforeSave")) processedData = (await this.hooks.runContentBeforeSave(body.data, collection, true)).content;
1234
- processedData = await this.runSandboxedBeforeSave(processedData, collection, true);
1235
- processedData = await this.normalizeMediaFields(collection, processedData);
1236
- const { validateContentData } = await import("../validation-C-ZpN2GI.mjs");
1237
- const validation = await validateContentData(this.db, collection, processedData, { partial: false });
1238
- if (!validation.ok) return {
1239
- success: false,
1240
- error: validation.error
1241
- };
1242
- const result = await handleContentCreate(this.db, collection, {
1243
- ...body,
1244
- data: processedData,
1245
- authorId: body.authorId,
1246
- bylines: body.bylines
1247
- });
1248
- if (result.success && result.data) this.runAfterSaveHooks(contentItemToRecord(result.data.item), collection, true);
1249
- return result;
1250
- }
1251
- async handleContentUpdate(collection, id, body) {
1252
- const { ContentRepository } = await import("../content-BcQPYxdV.mjs").then((n) => n.n);
1253
- const repo = new ContentRepository(this.db);
1254
- const resolvedItem = await repo.findByIdOrSlug(collection, id);
1255
- const resolvedId = resolvedItem?.id ?? id;
1256
- if (body._rev) {
1257
- if (!resolvedItem) return {
1258
- success: false,
1259
- error: {
1260
- code: "NOT_FOUND",
1261
- message: `Content item not found: ${id}`
1262
- }
1263
- };
1264
- const revCheck = validateRev(body._rev, resolvedItem);
1265
- if (!revCheck.valid) return {
1266
- success: false,
1267
- error: {
1268
- code: "CONFLICT",
1269
- message: revCheck.message
1270
- }
1271
- };
1272
- }
1273
- const { _rev: _discardedRev, ...bodyWithoutRev } = body;
1274
- let processedData = bodyWithoutRev.data;
1275
- if (bodyWithoutRev.data) {
1276
- if (this.hooks.hasHooks("content:beforeSave")) processedData = (await this.hooks.runContentBeforeSave(bodyWithoutRev.data, collection, false)).content;
1277
- processedData = await this.runSandboxedBeforeSave(processedData, collection, false);
1278
- processedData = await this.normalizeMediaFields(collection, processedData);
1279
- const { validateContentData } = await import("../validation-C-ZpN2GI.mjs");
1280
- const validation = await validateContentData(this.db, collection, processedData, { partial: true });
1281
- if (!validation.ok) return {
1282
- success: false,
1283
- error: validation.error
1284
- };
1285
- }
1286
- let usesDraftRevisions = false;
1287
- if (processedData) try {
1288
- if ((await this.schemaRegistry.getCollectionWithFields(collection))?.supports?.includes("revisions")) {
1289
- usesDraftRevisions = true;
1290
- const revisionRepo = new RevisionRepository(this.db);
1291
- const existing = await repo.findById(collection, resolvedId);
1292
- if (existing) {
1293
- let baseData;
1294
- if (existing.draftRevisionId) baseData = (await revisionRepo.findById(existing.draftRevisionId))?.data ?? existing.data;
1295
- else baseData = existing.data;
1296
- const mergedData = {
1297
- ...baseData,
1298
- ...processedData
1299
- };
1300
- if (bodyWithoutRev.slug !== void 0) mergedData._slug = bodyWithoutRev.slug;
1301
- if (bodyWithoutRev.skipRevision && existing.draftRevisionId) await revisionRepo.updateData(existing.draftRevisionId, mergedData);
1302
- else {
1303
- const revision = await revisionRepo.create({
1304
- collection,
1305
- entryId: resolvedId,
1306
- data: mergedData,
1307
- authorId: bodyWithoutRev.authorId ?? void 0
1308
- });
1309
- validateIdentifier(collection, "collection");
1310
- const tableName = `ec_${collection}`;
1311
- await sql`
1312
- UPDATE ${sql.ref(tableName)}
1313
- SET draft_revision_id = ${revision.id},
1314
- updated_at = ${(/* @__PURE__ */ new Date()).toISOString()}
1315
- WHERE id = ${resolvedId}
1316
- `.execute(this.db);
1317
- revisionRepo.pruneOldRevisions(collection, resolvedId, 50).catch(() => {});
1318
- }
1319
- }
1320
- }
1321
- } catch {}
1322
- const result = await handleContentUpdate(this.db, collection, resolvedId, {
1323
- ...bodyWithoutRev,
1324
- data: usesDraftRevisions ? void 0 : processedData,
1325
- slug: usesDraftRevisions ? void 0 : bodyWithoutRev.slug,
1326
- authorId: bodyWithoutRev.authorId,
1327
- bylines: bodyWithoutRev.bylines
1328
- });
1329
- const hydrated = await this.hydrateDraftData(result);
1330
- if (hydrated.success && hydrated.data) this.runAfterSaveHooks(contentItemToRecord(hydrated.data.item), collection, false);
1331
- return hydrated;
1332
- }
1333
- async handleContentDelete(collection, id) {
1334
- if (this.hooks.hasHooks("content:beforeDelete")) {
1335
- const { allowed } = await this.hooks.runContentBeforeDelete(id, collection);
1336
- if (!allowed) return {
1337
- success: false,
1338
- error: {
1339
- code: "DELETE_BLOCKED",
1340
- message: "Delete blocked by plugin hook"
1341
- }
1342
- };
1343
- }
1344
- if (!await this.runSandboxedBeforeDelete(id, collection)) return {
1345
- success: false,
1346
- error: {
1347
- code: "DELETE_BLOCKED",
1348
- message: "Delete blocked by sandboxed plugin hook"
1349
- }
1350
- };
1351
- const result = await handleContentDelete(this.db, collection, id);
1352
- if (result.success) this.runAfterDeleteHooks(id, collection, false);
1353
- return result;
1354
- }
1355
- async handleContentListTrashed(collection, params = {}) {
1356
- return handleContentListTrashed(this.db, collection, params);
1357
- }
1358
- async handleContentRestore(collection, id) {
1359
- return handleContentRestore(this.db, collection, id);
1360
- }
1361
- async handleContentPermanentDelete(collection, id) {
1362
- const result = await handleContentPermanentDelete(this.db, collection, id);
1363
- if (result.success) this.runAfterDeleteHooks(id, collection, true);
1364
- return result;
1365
- }
1366
- async handleContentCountTrashed(collection) {
1367
- return handleContentCountTrashed(this.db, collection);
1368
- }
1369
- async handleContentDuplicate(collection, id, authorId) {
1370
- return handleContentDuplicate(this.db, collection, id, authorId);
1371
- }
1372
- async handleContentPublish(collection, id) {
1373
- const result = await handleContentPublish(this.db, collection, id);
1374
- if (result.success && result.data) this.runAfterPublishHooks(contentItemToRecord(result.data.item), collection);
1375
- return result;
1376
- }
1377
- async handleContentUnpublish(collection, id) {
1378
- const result = await handleContentUnpublish(this.db, collection, id);
1379
- if (result.success && result.data) this.runAfterUnpublishHooks(contentItemToRecord(result.data.item), collection);
1380
- return result;
1381
- }
1382
- async handleContentSchedule(collection, id, scheduledAt) {
1383
- return handleContentSchedule(this.db, collection, id, scheduledAt);
1384
- }
1385
- async handleContentUnschedule(collection, id) {
1386
- return handleContentUnschedule(this.db, collection, id);
1387
- }
1388
- async handleContentCountScheduled(collection) {
1389
- return handleContentCountScheduled(this.db, collection);
1390
- }
1391
- async handleContentDiscardDraft(collection, id) {
1392
- return handleContentDiscardDraft(this.db, collection, id);
1393
- }
1394
- async handleContentCompare(collection, id) {
1395
- return handleContentCompare(this.db, collection, id);
1396
- }
1397
- async handleContentTranslations(collection, id) {
1398
- return handleContentTranslations(this.db, collection, id);
1399
- }
1400
- async handleMediaList(params) {
1401
- return handleMediaList(this.db, params);
1402
- }
1403
- async handleMediaGet(id) {
1404
- return handleMediaGet(this.db, id);
1405
- }
1406
- async handleMediaCreate(input) {
1407
- let processedInput = input;
1408
- if (this.hooks.hasHooks("media:beforeUpload")) {
1409
- const hookResult = await this.hooks.runMediaBeforeUpload({
1410
- name: input.filename,
1411
- type: input.mimeType,
1412
- size: input.size || 0
1413
- });
1414
- processedInput = {
1415
- ...input,
1416
- filename: hookResult.file.name,
1417
- mimeType: hookResult.file.type,
1418
- size: hookResult.file.size
1419
- };
1420
- }
1421
- const result = await handleMediaCreate(this.db, processedInput);
1422
- if (result.success && this.hooks.hasHooks("media:afterUpload")) {
1423
- const item = result.data.item;
1424
- const mediaItem = {
1425
- id: item.id,
1426
- filename: item.filename,
1427
- mimeType: item.mimeType,
1428
- size: item.size,
1429
- url: `/media/${item.id}/${item.filename}`,
1430
- createdAt: item.createdAt
1431
- };
1432
- this.hooks.runMediaAfterUpload(mediaItem).catch((err) => console.error("EmDash afterUpload hook error:", err));
1433
- }
1434
- return result;
1435
- }
1436
- async handleMediaUpdate(id, input) {
1437
- return handleMediaUpdate(this.db, id, input);
1438
- }
1439
- async handleMediaDelete(id) {
1440
- return handleMediaDelete(this.db, id);
1441
- }
1442
- async handleRevisionList(collection, entryId, params = {}) {
1443
- return handleRevisionList(this.db, collection, entryId, params);
1444
- }
1445
- async handleRevisionGet(revisionId) {
1446
- return handleRevisionGet(this.db, revisionId);
1447
- }
1448
- async handleRevisionRestore(revisionId, callerUserId) {
1449
- const revisionRepo = new RevisionRepository(this.db);
1450
- const revision = await revisionRepo.findById(revisionId);
1451
- if (!revision) return {
1452
- success: false,
1453
- error: {
1454
- code: "NOT_FOUND",
1455
- message: `Revision not found: ${revisionId}`
1456
- }
1457
- };
1458
- if (!((await this.schemaRegistry.getCollectionWithFields(revision.collection))?.supports?.includes("revisions") ?? false)) {
1459
- const result = await handleRevisionRestore(this.db, revisionId, callerUserId);
1460
- return this.hydrateDraftData(result);
1461
- }
1462
- try {
1463
- const newDraft = await revisionRepo.create({
1464
- collection: revision.collection,
1465
- entryId: revision.entryId,
1466
- data: revision.data,
1467
- authorId: callerUserId
1468
- });
1469
- validateIdentifier(revision.collection, "collection");
1470
- const tableName = `ec_${revision.collection}`;
1471
- await sql`
1472
- UPDATE ${sql.ref(tableName)}
1473
- SET draft_revision_id = ${newDraft.id},
1474
- updated_at = ${(/* @__PURE__ */ new Date()).toISOString()}
1475
- WHERE id = ${revision.entryId}
1476
- `.execute(this.db);
1477
- revisionRepo.pruneOldRevisions(revision.collection, revision.entryId, 50).catch(() => {});
1478
- const refetched = await handleContentGet(this.db, revision.collection, revision.entryId);
1479
- return this.hydrateDraftData(refetched);
1480
- } catch (error) {
1481
- console.error("[emdash] revision restore failed:", error);
1482
- return {
1483
- success: false,
1484
- error: {
1485
- code: "REVISION_RESTORE_ERROR",
1486
- message: "Failed to restore revision"
1487
- }
1488
- };
1489
- }
1490
- }
1491
- /**
1492
- * Get route metadata for a plugin route without invoking the handler.
1493
- * Used by the catch-all route to decide auth before dispatch.
1494
- * Returns null if the plugin or route doesn't exist.
1495
- */
1496
- getPluginRouteMeta(pluginId, path) {
1497
- if (!this.isPluginEnabled(pluginId)) return null;
1498
- const routeKey = path.replace(LEADING_SLASH_PATTERN, "");
1499
- const trustedPlugin = this.configuredPlugins.find((p) => p.id === pluginId);
1500
- if (trustedPlugin) {
1501
- const route = trustedPlugin.routes[routeKey];
1502
- if (!route) return null;
1503
- return { public: route.public === true };
1504
- }
1505
- const meta = sandboxedRouteMetaCache.get(pluginId);
1506
- if (meta) {
1507
- const routeMeta = meta.get(routeKey);
1508
- if (routeMeta) return routeMeta;
1509
- }
1510
- if (routeKey === "admin") {
1511
- const manifestMeta = marketplaceManifestCache.get(pluginId);
1512
- if (manifestMeta?.admin?.pages?.length || manifestMeta?.admin?.widgets?.length) return { public: false };
1513
- const entry = this.sandboxedPluginEntries.find((e) => e.id === pluginId);
1514
- if (entry?.adminPages?.length || entry?.adminWidgets?.length) return { public: false };
1515
- }
1516
- if (this.findSandboxedPlugin(pluginId)) return { public: false };
1517
- return null;
1518
- }
1519
- async handlePluginApiRoute(pluginId, _method, path, request) {
1520
- if (!this.isPluginEnabled(pluginId)) return {
1521
- success: false,
1522
- error: {
1523
- code: "NOT_FOUND",
1524
- message: `Plugin not enabled: ${pluginId}`
1525
- }
1526
- };
1527
- const trustedPlugin = this.configuredPlugins.find((p) => p.id === pluginId);
1528
- if (trustedPlugin && this.enabledPlugins.has(trustedPlugin.id)) {
1529
- const routeRegistry = new PluginRouteRegistry({
1530
- db: this.db,
1531
- emailPipeline: this.email ?? void 0,
1532
- trustedProxyHeaders: getTrustedProxyHeaders(this.config)
1533
- });
1534
- routeRegistry.register(trustedPlugin);
1535
- const routeKey = path.replace(LEADING_SLASH_PATTERN, "");
1536
- let body = void 0;
1537
- try {
1538
- body = await request.json();
1539
- } catch {}
1540
- return routeRegistry.invoke(pluginId, routeKey, {
1541
- request,
1542
- body
1543
- });
1544
- }
1545
- const sandboxedPlugin = this.findSandboxedPlugin(pluginId);
1546
- if (sandboxedPlugin) return this.handleSandboxedRoute(sandboxedPlugin, path, request);
1547
- return {
1548
- success: false,
1549
- error: {
1550
- code: "NOT_FOUND",
1551
- message: `Plugin not found: ${pluginId}`
1552
- }
1553
- };
1554
- }
1555
- findSandboxedPlugin(pluginId) {
1556
- for (const [key, plugin] of this.sandboxedPlugins) if (key.startsWith(pluginId + ":")) return plugin;
1557
- }
1558
- /**
1559
- * Normalize image/file fields in content data.
1560
- * Fills missing dimensions, storageKey, mimeType, and filename from providers.
1561
- */
1562
- async normalizeMediaFields(collection, data) {
1563
- let collectionInfo;
1564
- try {
1565
- collectionInfo = await this.schemaRegistry.getCollectionWithFields(collection);
1566
- } catch {
1567
- return data;
1568
- }
1569
- if (!collectionInfo?.fields) return data;
1570
- const imageFields = collectionInfo.fields.filter((f) => f.type === "image" || f.type === "file");
1571
- if (imageFields.length === 0) return data;
1572
- const getProvider = (id) => this.getMediaProvider(id);
1573
- const result = { ...data };
1574
- for (const field of imageFields) {
1575
- const value = result[field.slug];
1576
- if (value == null) continue;
1577
- try {
1578
- const normalized = await normalizeMediaValue(value, getProvider);
1579
- if (normalized) result[field.slug] = normalized;
1580
- } catch {}
1581
- }
1582
- return result;
1583
- }
1584
- async runSandboxedBeforeSave(content, collection, isNew) {
1585
- let result = content;
1586
- for (const [pluginKey, plugin] of this.sandboxedPlugins) {
1587
- const [id] = pluginKey.split(":");
1588
- if (!id || !this.isPluginEnabled(id)) continue;
1589
- try {
1590
- const hookResult = await plugin.invokeHook("content:beforeSave", {
1591
- content: result,
1592
- collection,
1593
- isNew
1594
- });
1595
- if (hookResult && typeof hookResult === "object" && !Array.isArray(hookResult)) {
1596
- const record = {};
1597
- for (const [k, v] of Object.entries(hookResult)) record[k] = v;
1598
- result = record;
1599
- }
1600
- } catch (error) {
1601
- console.error(`EmDash: Sandboxed plugin ${id} beforeSave hook error:`, error);
1602
- }
1603
- }
1604
- return result;
1605
- }
1606
- async runSandboxedBeforeDelete(id, collection) {
1607
- for (const [pluginKey, plugin] of this.sandboxedPlugins) {
1608
- const [pluginId] = pluginKey.split(":");
1609
- if (!pluginId || !this.isPluginEnabled(pluginId)) continue;
1610
- try {
1611
- if (await plugin.invokeHook("content:beforeDelete", {
1612
- id,
1613
- collection
1614
- }) === false) return false;
1615
- } catch (error) {
1616
- console.error(`EmDash: Sandboxed plugin ${pluginId} beforeDelete hook error:`, error);
1617
- }
1618
- }
1619
- return true;
1620
- }
1621
- runAfterSaveHooks(content, collection, isNew) {
1622
- after(async () => {
1623
- if (this.hooks.hasHooks("content:afterSave")) try {
1624
- await this.hooks.runContentAfterSave(content, collection, isNew);
1625
- } catch (err) {
1626
- console.error("EmDash afterSave hook error:", err);
1627
- }
1628
- const tasks = [];
1629
- for (const [pluginKey, plugin] of this.sandboxedPlugins) {
1630
- const [id] = pluginKey.split(":");
1631
- if (!id || !this.isPluginEnabled(id)) continue;
1632
- tasks.push((async () => {
1633
- try {
1634
- await plugin.invokeHook("content:afterSave", {
1635
- content,
1636
- collection,
1637
- isNew
1638
- });
1639
- } catch (err) {
1640
- console.error(`EmDash: Sandboxed plugin ${id} afterSave error:`, err);
1641
- }
1642
- })());
1643
- }
1644
- await Promise.allSettled(tasks);
1645
- });
1646
- }
1647
- runAfterDeleteHooks(id, collection, permanent) {
1648
- if (this.hooks.hasHooks("content:afterDelete")) this.hooks.runContentAfterDelete(id, collection, permanent).catch((err) => console.error("EmDash afterDelete hook error:", err));
1649
- for (const [pluginKey, plugin] of this.sandboxedPlugins) {
1650
- const [pluginId] = pluginKey.split(":");
1651
- if (!pluginId || !this.isPluginEnabled(pluginId)) continue;
1652
- plugin.invokeHook("content:afterDelete", {
1653
- id,
1654
- collection,
1655
- permanent
1656
- }).catch((err) => console.error(`EmDash: Sandboxed plugin ${pluginId} afterDelete error:`, err));
1657
- }
1658
- }
1659
- runAfterPublishHooks(content, collection) {
1660
- after(async () => {
1661
- if (this.hooks.hasHooks("content:afterPublish")) try {
1662
- await this.hooks.runContentAfterPublish(content, collection);
1663
- } catch (err) {
1664
- console.error("EmDash afterPublish hook error:", err);
1665
- }
1666
- const tasks = [];
1667
- for (const [pluginKey, plugin] of this.sandboxedPlugins) {
1668
- const [pluginId] = pluginKey.split(":");
1669
- if (!pluginId || !this.isPluginEnabled(pluginId)) continue;
1670
- tasks.push((async () => {
1671
- try {
1672
- await plugin.invokeHook("content:afterPublish", {
1673
- content,
1674
- collection
1675
- });
1676
- } catch (err) {
1677
- console.error(`EmDash: Sandboxed plugin ${pluginId} afterPublish error:`, err);
1678
- }
1679
- })());
1680
- }
1681
- await Promise.allSettled(tasks);
1682
- });
1683
- }
1684
- runAfterUnpublishHooks(content, collection) {
1685
- if (this.hooks.hasHooks("content:afterUnpublish")) this.hooks.runContentAfterUnpublish(content, collection).catch((err) => console.error("EmDash afterUnpublish hook error:", err));
1686
- for (const [pluginKey, plugin] of this.sandboxedPlugins) {
1687
- const [pluginId] = pluginKey.split(":");
1688
- if (!pluginId || !this.isPluginEnabled(pluginId)) continue;
1689
- plugin.invokeHook("content:afterUnpublish", {
1690
- content,
1691
- collection
1692
- }).catch((err) => console.error(`EmDash: Sandboxed plugin ${pluginId} afterUnpublish error:`, err));
1693
- }
1694
- }
1695
- async handleSandboxedRoute(plugin, path, request) {
1696
- const routeName = path.replace(LEADING_SLASH_PATTERN, "");
1697
- let body = void 0;
1698
- try {
1699
- body = await request.json();
1700
- } catch {}
1701
- try {
1702
- const headers = sanitizeHeadersForSandbox(request.headers);
1703
- const meta = extractRequestMeta(request, this.config);
1704
- return {
1705
- success: true,
1706
- data: await plugin.invokeRoute(routeName, body, {
1707
- url: request.url,
1708
- method: request.method,
1709
- headers,
1710
- meta
1711
- })
1712
- };
1713
- } catch (error) {
1714
- console.error(`EmDash: Sandboxed plugin route error:`, error);
1715
- return {
1716
- success: false,
1717
- error: {
1718
- code: "ROUTE_ERROR",
1719
- message: error instanceof Error ? error.message : String(error)
1720
- }
1721
- };
1722
- }
1723
- }
1724
- /**
1725
- * Cache for page contributions. Uses a WeakMap keyed on the PublicPageContext
1726
- * object so results are collected once per page context per request, even when
1727
- * multiple render components (EmDashHead, EmDashBodyStart, EmDashBodyEnd)
1728
- * request contributions from the same page.
1729
- */
1730
- pageContributionCache = /* @__PURE__ */ new WeakMap();
1731
- /**
1732
- * Collect all page contributions (metadata + fragments) in a single pass.
1733
- * Results are cached by page context object identity.
1734
- */
1735
- async collectPageContributions(page) {
1736
- const cached = this.pageContributionCache.get(page);
1737
- if (cached) return cached;
1738
- const promise = this.doCollectPageContributions(page);
1739
- this.pageContributionCache.set(page, promise);
1740
- return promise;
1741
- }
1742
- async doCollectPageContributions(page) {
1743
- const metadata = [];
1744
- const fragments = [];
1745
- if (this.hooks.hasHooks("page:metadata")) {
1746
- const results = await this.hooks.runPageMetadata({ page });
1747
- for (const r of results) metadata.push(...r.contributions);
1748
- }
1749
- if (this.hooks.hasHooks("page:fragments")) {
1750
- const results = await this.hooks.runPageFragments({ page });
1751
- for (const r of results) fragments.push(...r.contributions);
1752
- }
1753
- for (const [pluginKey, plugin] of this.sandboxedPlugins) {
1754
- const [id] = pluginKey.split(":");
1755
- if (!id || !this.isPluginEnabled(id)) continue;
1756
- try {
1757
- const result = await plugin.invokeHook("page:metadata", { page });
1758
- if (result != null) {
1759
- const items = Array.isArray(result) ? result : [result];
1760
- for (const item of items) if (isValidMetadataContribution(item)) metadata.push(item);
1761
- }
1762
- } catch (error) {
1763
- console.error(`EmDash: Sandboxed plugin ${id} page:metadata error:`, error);
1764
- }
1765
- }
1766
- return {
1767
- metadata,
1768
- fragments
1769
- };
1770
- }
1771
- /**
1772
- * Collect page metadata contributions from trusted and sandboxed plugins.
1773
- * Delegates to the single-pass collector and returns the metadata portion.
1774
- */
1775
- async collectPageMetadata(page) {
1776
- const { metadata } = await this.collectPageContributions(page);
1777
- return metadata;
1778
- }
1779
- /**
1780
- * Collect page fragment contributions from trusted plugins only.
1781
- * Delegates to the single-pass collector and returns the fragments portion.
1782
- */
1783
- async collectPageFragments(page) {
1784
- const { fragments } = await this.collectPageContributions(page);
1785
- return fragments;
1786
- }
1787
- isPluginEnabled(pluginId) {
1788
- const status = this.pluginStates.get(pluginId);
1789
- return status === void 0 || status === "active";
397
+ async function prefetchLayoutData() {
398
+ try {
399
+ await Promise.allSettled([
400
+ getSiteSettings(),
401
+ prefetchMenus(),
402
+ prefetchWidgetAreas(),
403
+ prefetchTaxonomyTerms()
404
+ ]);
405
+ } catch (error) {
406
+ console.error("[emdash] layout prefetch failed (non-fatal):", error);
1790
407
  }
1791
- };
408
+ }
1792
409
 
1793
410
  //#endregion
1794
- //#region src/media/url.ts
1795
- /**
1796
- * Resolve the public URL for a locally stored media key. Returns an empty
1797
- * string when no key is given. When a storage adapter is supplied, defers to
1798
- * `storage.getPublicUrl()`; otherwise returns the internal proxy route.
1799
- */
1800
- function resolvePublicMediaUrl(storage, storageKey) {
1801
- if (!storageKey) return "";
1802
- if (storage) return storage.getPublicUrl(storageKey);
1803
- return `/_emdash/api/media/file/${storageKey}`;
411
+ //#region src/astro/public-plugin-api-routes.ts
412
+ function pluginRouteNotFound() {
413
+ return {
414
+ success: false,
415
+ error: {
416
+ code: "NOT_FOUND",
417
+ message: "Plugin route not found"
418
+ }
419
+ };
1804
420
  }
1805
- /**
1806
- * Build the `getPublicMediaUrl` closure attached to `Astro.locals.emdash`.
1807
- * Shared by the anonymous fast path and the full-runtime path in middleware.
1808
- *
1809
- * @internal
1810
- */
1811
- function createPublicMediaUrlResolver(storage) {
1812
- return (key) => resolvePublicMediaUrl(storage, key);
421
+ function createPublicPluginApiRouteHandler(runtime) {
422
+ return async (pluginId, method, path, request) => {
423
+ if (runtime.getPluginRouteMeta(pluginId, path)?.public !== true) return pluginRouteNotFound();
424
+ return runtime.handlePluginApiRoute(pluginId, method, path, request);
425
+ };
1813
426
  }
1814
427
 
1815
428
  //#endregion
1816
429
  //#region src/astro/middleware.ts
1817
430
  /**
1818
- * EmDash middleware
1819
- *
1820
- * Thin wrapper that initializes EmDashRuntime and attaches it to locals.
1821
- * All heavy lifting happens in EmDashRuntime.
431
+ * Runtime init lock reclaim deadline. Must be strictly larger than the db
432
+ * init deadline: this lock wraps EmDashRuntime.create() → getDatabase() →
433
+ * the db init lock, and equal deadlines would let this outer lock reclaim
434
+ * (spawning a second cron scheduler and sandbox runner) while the inner db
435
+ * init is legitimately still working through a contended migration.
1822
436
  */
1823
- let runtimeInstance = null;
1824
- let runtimeInitializing = false;
1825
- /** Whether i18n config has been initialized from the virtual module */
1826
- let i18nInitialized = false;
437
+ const RUNTIME_INIT_DEADLINE_MS = DB_INIT_DEADLINE_MS + 15e3;
438
+ /**
439
+ * Throttle for the anonymous-path runtime-init failure log. While a site is
440
+ * stuck (e.g. a failing migration in its backoff window, #1744) every
441
+ * anonymous request lands in that catch; one line per interval per isolate
442
+ * keeps the failure visible without flooding logs on a busy site. Plain
443
+ * module state (not globalThis): a duplicated SSR chunk just means an extra
444
+ * log line, which is harmless.
445
+ */
446
+ const RUNTIME_INIT_ERROR_LOG_INTERVAL_MS = 3e4;
447
+ let lastRuntimeInitErrorLogAt = 0;
1827
448
  /**
1828
449
  * Whether we've verified the database has been set up.
1829
450
  * On a fresh deployment the first request may hit a public page, bypassing
@@ -1831,8 +452,43 @@ let i18nInitialized = false;
1831
452
  * would query an empty database and crash. Once verified (or once the runtime
1832
453
  * has initialized via an admin/API request), this stays true for the worker's
1833
454
  * lifetime.
455
+ *
456
+ * Stored on globalThis behind a Symbol key so the flag is a true singleton
457
+ * even when the bundler duplicates this module across SSR chunks (same
458
+ * pattern as request-cache.ts). A plain module-scoped `let` becomes multiple
459
+ * independent variables, which would make the setup probe re-run far more
460
+ * often than intended — and every re-run is another chance for a transient
461
+ * DB error to be misread as "fresh install" and bounce visitors to setup.
1834
462
  */
1835
- let setupVerified = false;
463
+ const SETUP_VERIFIED_KEY = Symbol.for("emdash:setup-verified");
464
+ const setupFlagStore = globalThis;
465
+ function isSetupVerified() {
466
+ return setupFlagStore[SETUP_VERIFIED_KEY] === true;
467
+ }
468
+ function markSetupVerified() {
469
+ setupFlagStore[SETUP_VERIFIED_KEY] = true;
470
+ }
471
+ /**
472
+ * The runtime singleton and its init lock live on globalThis behind a
473
+ * Symbol — same reasoning as SETUP_VERIFIED_KEY above: the bundler can
474
+ * duplicate this module across SSR chunks, and a duplicated instance/lock
475
+ * would mean multiple runtimes (each with its own cron scheduler) per
476
+ * isolate, initializing and reclaiming independently.
477
+ */
478
+ const RUNTIME_HOLDER_KEY = Symbol.for("emdash:runtime-holder");
479
+ function getRuntimeHolder() {
480
+ let holder = setupFlagStore[RUNTIME_HOLDER_KEY];
481
+ if (!holder) {
482
+ holder = {
483
+ instance: null,
484
+ lock: createInitLock()
485
+ };
486
+ setupFlagStore[RUNTIME_HOLDER_KEY] = holder;
487
+ }
488
+ return holder;
489
+ }
490
+ /** Whether i18n config has been initialized from the virtual module */
491
+ let i18nInitialized = false;
1836
492
  /**
1837
493
  * Get EmDash configuration from virtual module
1838
494
  */
@@ -1857,15 +513,20 @@ function getPlugins() {
1857
513
  /**
1858
514
  * Build runtime dependencies from virtual modules
1859
515
  */
1860
- function buildDependencies(config) {
516
+ function buildDependencies(config, migrationMode) {
517
+ const sandboxModule = virtualSandboxRunnerModule;
1861
518
  return {
1862
519
  config,
520
+ migrationMode,
1863
521
  plugins: getPlugins(),
1864
522
  createDialect,
523
+ createCoalescingDialect,
1865
524
  createStorage,
1866
- sandboxEnabled,
525
+ createScheduler,
526
+ sandboxEnabled: sandboxModule.sandboxEnabled,
527
+ sandboxBypassed: sandboxModule.sandboxBypassed ?? false,
1867
528
  sandboxedPluginEntries: sandboxedPlugins || [],
1868
- createSandboxRunner,
529
+ createSandboxRunner: sandboxModule.createSandboxRunner,
1869
530
  mediaProviderEntries: mediaProviders || []
1870
531
  };
1871
532
  }
@@ -1877,29 +538,202 @@ function buildDependencies(config) {
1877
538
  * cached instance) push nothing — callers should treat an empty array
1878
539
  * as "warm, nothing to report".
1879
540
  */
1880
- async function getRuntime(config, initTimings) {
1881
- if (runtimeInstance) return runtimeInstance;
1882
- if (runtimeInitializing) {
1883
- await new Promise((resolve) => setTimeout(resolve, 50));
1884
- return getRuntime(config, initTimings);
1885
- }
1886
- runtimeInitializing = true;
1887
- try {
1888
- const deps = buildDependencies(config);
541
+ async function getRuntime(config, migrationMode, initTimings) {
542
+ const holder = getRuntimeHolder();
543
+ return initWithLock(holder.lock, () => holder.instance, async (isCurrentClaim) => {
544
+ const deps = buildDependencies(config, migrationMode);
1889
545
  const runtime = await EmDashRuntime.create(deps, initTimings);
1890
- runtimeInstance = runtime;
546
+ if (isCurrentClaim()) holder.instance = runtime;
547
+ else runtime.stopCron().catch((error) => {
548
+ console.error("[emdash] failed to stop superseded runtime's cron:", error);
549
+ });
1891
550
  return runtime;
551
+ }, {
552
+ deadlineMs: RUNTIME_INIT_DEADLINE_MS,
553
+ anchor: (promise) => after(() => promise)
554
+ });
555
+ }
556
+ /**
557
+ * Run scheduled maintenance (cron tasks, scheduled publishing, system cleanup)
558
+ * outside any request. Resolves the runtime from the build-time virtual config
559
+ * and the cached singleton — the same instance request handlers use.
560
+ *
561
+ * Wired into a platform heartbeat that is not a request: the Cloudflare Worker's
562
+ * `scheduled()` handler (Cron Trigger) calls this. On Node the runtime's own
563
+ * timer-based scheduler already drives the same work, so this isn't needed there.
564
+ *
565
+ * Returns the content promoted by the publishing sweep so the caller can purge
566
+ * edge-cache tags for it. `onPublished` (optional) is awaited after each
567
+ * collection's batch so the caller can invalidate edge-cache tags incrementally
568
+ * rather than only after the whole sweep.
569
+ */
570
+ async function runScheduledTasks(options = {}) {
571
+ const config = getConfig();
572
+ if (!config) return { published: [] };
573
+ return runOutsideRequest(config, (runtime) => runtime.runScheduledTasks(options));
574
+ }
575
+ /**
576
+ * Run a callback against the EmDash runtime outside any HTTP request — from a
577
+ * Cloudflare Queue consumer, a `scheduled()` handler, or any other
578
+ * platform-event handler that has no request and therefore no `locals.emdash`.
579
+ *
580
+ * Resolves the same cached runtime singleton request handlers use, so hooks,
581
+ * plugin state, and storage all behave exactly as they do during a request.
582
+ * A typical queue consumer finishes a job by calling back into a plugin route:
583
+ *
584
+ * ```ts
585
+ * import { withEmDashRuntime } from "emdash/middleware";
586
+ *
587
+ * async function queue(batch: MessageBatch) {
588
+ * await withEmDashRuntime(async (runtime) => {
589
+ * for (const message of batch.messages) {
590
+ * await runtime.handlePluginApiRoute(
591
+ * "my-plugin",
592
+ * "POST",
593
+ * "/finishJob",
594
+ * new Request("https://internal/", {
595
+ * method: "POST",
596
+ * body: JSON.stringify(message.body),
597
+ * }),
598
+ * );
599
+ * }
600
+ * });
601
+ * }
602
+ * ```
603
+ *
604
+ * Server-only and fully trusted: the callback gets the raw runtime with no
605
+ * auth or CSRF checks, same trust level as plugin cron. Never expose it to
606
+ * user input without validating that input yourself.
607
+ *
608
+ * Throws when EmDash is not configured (no `emdash()` Astro integration).
609
+ */
610
+ async function withEmDashRuntime(run) {
611
+ const config = getConfig();
612
+ if (!config) throw new Error("EmDash is not configured — withEmDashRuntime() requires the emdash() Astro integration.");
613
+ return runOutsideRequest(config, async (runtime) => run(runtime));
614
+ }
615
+ /**
616
+ * Shared plumbing for request-free entry points (`runScheduledTasks`,
617
+ * `withEmDashRuntime`): resolve the runtime singleton, then run the callback
618
+ * under an event-scoped db when the adapter needs one.
619
+ *
620
+ * Connection-backed adapters (e.g. Postgres over Hyperdrive) cannot reuse
621
+ * the per-isolate singleton from a platform event: its socket belongs to the
622
+ * request that opened it, and workerd rejects cross-event I/O. Open an
623
+ * event-scoped connection and run the callback under it in ALS — the
624
+ * runtime's db getter, the cron executor, and plugin contexts all resolve
625
+ * the connection from ALS — then close it when required. Stateless adapters
626
+ * that need primary routing can return a close-less scope; adapters with no
627
+ * event scoping return null and keep using the singleton.
628
+ */
629
+ async function runOutsideRequest(config, fn) {
630
+ const migrationMode = resolveConfiguredMigrationMode(config);
631
+ if (getRequestContext()) return runOutsideRequestWithRuntime(config, await getRuntime(config, migrationMode), fn);
632
+ const deferredTasks = createDeferredTaskTracker(() => {});
633
+ return runWithContext({
634
+ editMode: false,
635
+ metrics: createRequestMetrics(performance.now()),
636
+ deferredTasks
637
+ }, async () => {
638
+ return runOutsideRequestWithRuntime(config, await (async () => {
639
+ try {
640
+ return await getRuntime(config, migrationMode);
641
+ } finally {
642
+ deferredTasks.settle();
643
+ await deferredTasks.settled;
644
+ }
645
+ })(), fn);
646
+ });
647
+ }
648
+ async function runOutsideRequestWithRuntime(config, runtime, fn) {
649
+ const scoped = createRequestScopedDb$1({
650
+ config: config.database?.config,
651
+ isAuthenticated: false,
652
+ isWrite: true,
653
+ canUseCachedBinding: false,
654
+ cookies: NOOP_COOKIE_JAR,
655
+ url: CRON_EVENT_URL
656
+ });
657
+ if (!scoped) return fn(runtime);
658
+ const { closed, deferredTasks, lifecycle } = coordinateScopedDbLifecycle(scoped);
659
+ const parent = getRequestContext();
660
+ const ctx = parent ? {
661
+ ...parent,
662
+ db: scoped.db,
663
+ deferredTasks
664
+ } : {
665
+ editMode: false,
666
+ db: scoped.db,
667
+ metrics: createRequestMetrics(performance.now()),
668
+ deferredTasks
669
+ };
670
+ try {
671
+ return await runWithContext(ctx, () => fn(runtime));
1892
672
  } finally {
1893
- runtimeInitializing = false;
673
+ try {
674
+ lifecycle.commit();
675
+ } catch (error) {
676
+ console.error("[emdash] event-scoped db commit failed:", error);
677
+ }
678
+ try {
679
+ lifecycle.close?.();
680
+ } catch (error) {
681
+ console.error("[emdash] event-scoped db close failed:", error);
682
+ }
683
+ await closed;
1894
684
  }
1895
685
  }
1896
686
  /**
1897
- * Astro attaches AstroCookies to outgoing responses via a well-known global
1898
- * symbol. Cloning a Response (`new Response(body, init)`) drops non-header
1899
- * metadata, so any middleware that wraps the response must explicitly forward
1900
- * this symbol or `cookies.set()` calls will be silently dropped.
687
+ * A cookie jar that reads nothing and writes nothing, for request-scoped db
688
+ * adapters invoked outside an HTTP request (the Cron Trigger sweep). Connection
689
+ * adapters like Hyperdrive ignore cookies entirely; the D1 session adapter
690
+ * reads/writes a bookmark cookie, but cron never reaches that path (it has no
691
+ * `close()`), so the no-ops are never observed.
1901
692
  */
1902
- const ASTRO_COOKIES_SYMBOL = Symbol.for("astro.cookies");
693
+ const NOOP_COOKIE_JAR = {
694
+ get: () => void 0,
695
+ set: () => {}
696
+ };
697
+ /**
698
+ * Synthetic URL for the cron sweep's request-scoped db opts. Only the D1
699
+ * session adapter inspects `url` (for cookie `secure`), and cron doesn't take
700
+ * that path, so the value is never used — it exists to satisfy the contract.
701
+ */
702
+ const CRON_EVENT_URL = new URL("https://cron.emdash.internal/");
703
+ function resolveConfiguredMigrationMode(config) {
704
+ const processOverride = typeof process !== "undefined" && process.env ? process.env.EMDASH_MIGRATIONS_MODE : void 0;
705
+ const importMetaOverride = import.meta.env.EMDASH_MIGRATIONS_MODE;
706
+ return resolveRuntimeMigrationMode(config.migrations, {
707
+ dev: import.meta.env.DEV,
708
+ override: processOverride ?? importMetaOverride
709
+ });
710
+ }
711
+ function pendingMigrationsResponse(error) {
712
+ console.error("[emdash] database migrations are pending:", error.pending.join(", "));
713
+ return migrationRequiredResponse();
714
+ }
715
+ function migrationRequiredResponse() {
716
+ return new Response("Database migrations are required. Apply the deployment migration manifest and retry.", {
717
+ status: 503,
718
+ headers: { "Retry-After": "60" }
719
+ });
720
+ }
721
+ function unmigratedDatabaseResponse() {
722
+ return new Response("<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"robots\" content=\"noindex\"><title>Site unavailable</title></head><body><p>This site's database has not been migrated yet. <a href=\"/_emdash/admin/setup\">Set up EmDash</a></p></body></html>", {
723
+ status: 503,
724
+ headers: {
725
+ "Content-Type": "text/html; charset=utf-8",
726
+ "Cache-Control": "no-store",
727
+ "Retry-After": "60"
728
+ }
729
+ });
730
+ }
731
+ function runtimeConfigurationErrorResponse(error, pathname) {
732
+ if (!pathname.startsWith("/_emdash/api/")) return null;
733
+ if (error instanceof EmDashConfigurationError) return apiError(error.code, error.message, 500);
734
+ if (error instanceof EmDashStorageError && error.code === "BINDING_NOT_FOUND") return apiError(error.code, error.message, 500);
735
+ return null;
736
+ }
1903
737
  /**
1904
738
  * Baseline security headers applied to all responses.
1905
739
  * Admin routes get additional headers (strict CSP) from auth middleware.
@@ -1908,9 +742,9 @@ function finalizeResponse(response, serverTimings) {
1908
742
  const res = new Response(response.body, response);
1909
743
  const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL);
1910
744
  if (astroCookies !== void 0) Reflect.set(res, ASTRO_COOKIES_SYMBOL, astroCookies);
1911
- res.headers.set("X-Content-Type-Options", "nosniff");
1912
- res.headers.set("Referrer-Policy", "strict-origin-when-cross-origin");
1913
- res.headers.set("Permissions-Policy", "camera=(), microphone=(), geolocation=(), payment=()");
745
+ if (!res.headers.has("X-Content-Type-Options")) res.headers.set("X-Content-Type-Options", "nosniff");
746
+ if (!res.headers.has("Referrer-Policy")) res.headers.set("Referrer-Policy", "strict-origin-when-cross-origin");
747
+ if (!res.headers.has("Permissions-Policy")) res.headers.set("Permissions-Policy", "camera=(), microphone=(), geolocation=(), payment=()");
1914
748
  if (!res.headers.has("Content-Security-Policy")) res.headers.set("X-Frame-Options", "SAMEORIGIN");
1915
749
  if (serverTimings && serverTimings.length > 0) res.headers.set("Server-Timing", serverTimings.map((t) => {
1916
750
  const dur = Math.round(t.dur);
@@ -1918,6 +752,54 @@ function finalizeResponse(response, serverTimings) {
1918
752
  }).join(", "));
1919
753
  return res;
1920
754
  }
755
+ /**
756
+ * Append always-on counters (db.*, cache.*) to the Server-Timing list.
757
+ *
758
+ * dur values for `count`, `hit`, `miss` are integer counts — Server-Timing
759
+ * spec only models milliseconds, but browsers show whatever number is given,
760
+ * which is the convention most projects use for non-time samples.
761
+ */
762
+ function pushMetricsTimings(timings, metrics) {
763
+ if (metrics.dbCount > 0) {
764
+ timings.push({
765
+ name: "db.total",
766
+ dur: metrics.dbTotalMs,
767
+ desc: "DB total"
768
+ });
769
+ timings.push({
770
+ name: "db.count",
771
+ dur: metrics.dbCount,
772
+ desc: "Query count"
773
+ });
774
+ if (metrics.dbFirstOffset !== null) timings.push({
775
+ name: "db.first",
776
+ dur: metrics.dbFirstOffset,
777
+ desc: "First query at"
778
+ });
779
+ if (metrics.dbLastOffset !== null) timings.push({
780
+ name: "db.last",
781
+ dur: metrics.dbLastOffset,
782
+ desc: "Last query at"
783
+ });
784
+ }
785
+ if (metrics.rpcCount > 0) timings.push({
786
+ name: "rpc.count",
787
+ dur: metrics.rpcCount,
788
+ desc: "DB round trips"
789
+ });
790
+ if (metrics.cacheHits + metrics.cacheMisses > 0) {
791
+ timings.push({
792
+ name: "cache.hit",
793
+ dur: metrics.cacheHits,
794
+ desc: "Cache hits"
795
+ });
796
+ timings.push({
797
+ name: "cache.miss",
798
+ dur: metrics.cacheMisses,
799
+ desc: "Cache misses"
800
+ });
801
+ }
802
+ }
1921
803
  /** Public routes that require the runtime (sitemap, robots.txt, etc.) */
1922
804
  const PUBLIC_RUNTIME_ROUTES = new Set(["/sitemap.xml", "/robots.txt"]);
1923
805
  const SITEMAP_COLLECTION_RE = /^\/sitemap-[a-z][a-z0-9_]*\.xml$/;
@@ -1931,32 +813,74 @@ function createRequestScopedDb$1(opts) {
1931
813
  if (typeof createRequestScopedDb !== "function") return null;
1932
814
  return createRequestScopedDb(opts);
1933
815
  }
816
+ const buildDate = buildTime ? new Date(buildTime) : null;
817
+ /**
818
+ * Fold the build timestamp into the route cache validator.
819
+ *
820
+ * `CacheHint.lastModified` describes the content, but the response also depends
821
+ * on the build: `/_astro/*` names are content-hashed, and a deployment only
822
+ * serves its own. Without the build dimension a code-only deploy answers a
823
+ * returning visitor's conditional request with 304, leaving them on HTML whose
824
+ * assets 404.
825
+ *
826
+ * Prerendered pages are served by the host's static layer, which manages its
827
+ * own validators — only on-demand responses need the build dimension.
828
+ *
829
+ * Only forward moves are covered. `Last-Modified` expresses newer, not
830
+ * different, so after a rollback the earlier build still answers a conditional
831
+ * request with 304 and the browser stays on the newer build's HTML.
832
+ *
833
+ * Must run before next(): Astro keeps the later of two dates, so a route's own
834
+ * hint still wins when content is newer, and a route that opts out with
835
+ * `Astro.cache.set(false)` stays opted out — calling set() afterwards would
836
+ * clear that opt-out.
837
+ */
838
+ function applyBuildValidator(context) {
839
+ if (context.isPrerendered || !buildDate || !context.cache?.enabled) return;
840
+ context.cache.set({ lastModified: buildDate });
841
+ }
1934
842
  const onRequest = defineMiddleware(async (context, next) => {
1935
843
  const { request, locals, cookies } = context;
1936
844
  const url = context.url;
1937
845
  if (!url.pathname.startsWith("/_emdash") && virtualConfig?.authProviders) {
1938
846
  if (virtualConfig.authProviders.some((p) => p.routes?.some((r) => r.pattern && url.pathname === r.pattern))) return finalizeResponse(await next());
1939
847
  }
848
+ applyBuildValidator(context);
1940
849
  const queryRecorder = isInstrumentationEnabled() ? createRecorder(url.pathname, request.method, request.headers.get("x-perf-phase") ?? "default") : void 0;
850
+ const metrics = createRequestMetrics(performance.now());
1941
851
  const run = async () => {
852
+ const config = getConfig();
853
+ const migrationMode = config ? resolveConfiguredMigrationMode(config) : "auto";
1942
854
  const isEmDashRoute = url.pathname.startsWith("/_emdash");
1943
855
  const isPublicRuntimeRoute = PUBLIC_RUNTIME_ROUTES.has(url.pathname) || SITEMAP_COLLECTION_RE.test(url.pathname);
1944
856
  const hasEditCookie = cookies.get("emdash-edit-mode")?.value === "true";
1945
857
  const hasPreviewToken = url.searchParams.has("_preview");
1946
858
  const playgroundDb = locals.__playgroundDb;
1947
- const sessionUser = context.isPrerendered ? null : await context.session?.get("user");
859
+ const hasSessionCookie = cookies.get("astro-session") !== void 0;
860
+ const sessionUser = context.isPrerendered || !hasSessionCookie ? null : await resolveSessionUser(context.session);
861
+ const hasBearerAuth = (request.headers.get("authorization") ?? "").toLowerCase().startsWith("bearer ");
862
+ const isWrite = request.method !== "GET" && request.method !== "HEAD";
863
+ const isAuthenticated = !!sessionUser || hasBearerAuth;
864
+ const endedAuthenticated = () => requestEndedAuthenticated(isAuthenticated, cookies);
865
+ const canUseCachedBinding = !isAuthenticated && !isWrite && !playgroundDb && !isEmDashRoute && !hasEditCookie && !hasPreviewToken;
1948
866
  if (!isEmDashRoute && !isPublicRuntimeRoute && !hasEditCookie && !hasPreviewToken) {
1949
867
  if (!sessionUser && !playgroundDb) {
1950
868
  const timings = [];
1951
869
  const mwStart = performance.now();
1952
- if (!setupVerified) {
870
+ let unmigrated = false;
871
+ let probeFailed = false;
872
+ if (migrationMode === "auto" && !isSetupVerified() && !context.isPrerendered) {
1953
873
  const t0 = performance.now();
1954
874
  try {
1955
- const { getDb } = await import("../loader-CndGj8kM.mjs").then((n) => n.r);
875
+ const { getDb } = await import("../loader-CWb-ja1p.mjs").then((n) => n.l);
1956
876
  await (await getDb()).selectFrom("_emdash_migrations").selectAll().limit(1).execute();
1957
- setupVerified = true;
1958
- } catch {
1959
- return context.redirect("/_emdash/admin/setup");
877
+ markSetupVerified();
878
+ } catch (error) {
879
+ if (isMissingTableError(error)) unmigrated = true;
880
+ else {
881
+ probeFailed = !getRuntimeHolder().instance;
882
+ console.error("Setup probe failed (non-fatal):", error);
883
+ }
1960
884
  }
1961
885
  timings.push({
1962
886
  name: "setup",
@@ -1964,19 +888,30 @@ const onRequest = defineMiddleware(async (context, next) => {
1964
888
  desc: "Setup probe"
1965
889
  });
1966
890
  }
1967
- const config = getConfig();
1968
- if (config) {
891
+ if (config && !probeFailed) {
1969
892
  const initSubTimings = [];
1970
893
  const t0 = performance.now();
1971
894
  try {
1972
- const runtime = await getRuntime(config, initSubTimings);
1973
- setupVerified = true;
895
+ const runtime = await getRuntime(config, migrationMode, initSubTimings);
896
+ markSetupVerified();
1974
897
  locals.emdash = {
898
+ handlePublicPluginApiRoute: createPublicPluginApiRouteHandler(runtime),
1975
899
  collectPageMetadata: runtime.collectPageMetadata.bind(runtime),
1976
900
  collectPageFragments: runtime.collectPageFragments.bind(runtime),
1977
- getPublicMediaUrl: createPublicMediaUrlResolver(runtime.storage)
901
+ getPublicMediaUrl: createPublicMediaUrlResolver(runtime.storage),
902
+ storage: runtime.storage
1978
903
  };
1979
- } catch {}
904
+ } catch (error) {
905
+ if (error instanceof PendingMigrationsError) return pendingMigrationsResponse(error);
906
+ if (migrationMode === "manual" && isMissingTableError(error)) {
907
+ console.error("[emdash] database schema is unavailable in manual migration mode:", error);
908
+ return migrationRequiredResponse();
909
+ }
910
+ if (Date.now() - lastRuntimeInitErrorLogAt >= RUNTIME_INIT_ERROR_LOG_INTERVAL_MS) {
911
+ lastRuntimeInitErrorLogAt = Date.now();
912
+ console.error("[emdash] runtime init failed (page renders without CMS data):", error);
913
+ }
914
+ }
1980
915
  timings.push({
1981
916
  name: "rt",
1982
917
  dur: performance.now() - t0,
@@ -1984,12 +919,17 @@ const onRequest = defineMiddleware(async (context, next) => {
1984
919
  });
1985
920
  for (const sub of initSubTimings) timings.push(sub);
1986
921
  }
922
+ if (unmigrated && !locals.emdash) return finalizeResponse(unmigratedDatabaseResponse(), timings);
923
+ const lastContentWriteAt = canUseCachedBinding && config?.database?.needsLastContentWriteAt ? await getLastContentWriteAt() : void 0;
1987
924
  const anonScoped = createRequestScopedDb$1({
1988
925
  config: config?.database?.config,
1989
- isAuthenticated: false,
1990
- isWrite: request.method !== "GET" && request.method !== "HEAD",
926
+ isAuthenticated,
927
+ endedAuthenticated,
928
+ isWrite,
929
+ canUseCachedBinding,
1991
930
  cookies,
1992
- url
931
+ url,
932
+ lastContentWriteAt
1993
933
  });
1994
934
  const runAnon = async () => {
1995
935
  const t0 = performance.now();
@@ -2004,26 +944,31 @@ const onRequest = defineMiddleware(async (context, next) => {
2004
944
  dur: performance.now() - mwStart,
2005
945
  desc: "Total middleware"
2006
946
  });
2007
- return finalizeResponse(response, timings);
947
+ pushMetricsTimings(timings, metrics);
948
+ return wrapBodyForStreamMetrics(finalizeResponse(response, timings));
2008
949
  };
2009
950
  if (anonScoped) {
951
+ const { deferredTasks, lifecycle } = coordinateScopedDbLifecycle(anonScoped);
2010
952
  const parent = getRequestContext();
2011
- return runWithContext(parent ? {
953
+ const ctx = parent ? {
2012
954
  ...parent,
2013
- db: anonScoped.db
955
+ db: anonScoped.db,
956
+ deferredTasks
2014
957
  } : {
2015
958
  editMode: false,
2016
- db: anonScoped.db
2017
- }, async () => {
2018
- const response = await runAnon();
2019
- anonScoped.commit();
2020
- return response;
959
+ db: anonScoped.db,
960
+ metrics,
961
+ deferredTasks
962
+ };
963
+ const acceptsHtml = (request.headers.get("accept") ?? "").split(",", 1)[0].trim().startsWith("text/html");
964
+ return runWithContext(ctx, async () => {
965
+ if (acceptsHtml) after(() => prefetchLayoutData());
966
+ return finishScoped(lifecycle, runAnon);
2021
967
  });
2022
968
  }
2023
969
  return runAnon();
2024
970
  }
2025
971
  }
2026
- const config = getConfig();
2027
972
  if (!config) {
2028
973
  console.error("EmDash: No configuration found");
2029
974
  return finalizeResponse(await next());
@@ -2034,25 +979,18 @@ const onRequest = defineMiddleware(async (context, next) => {
2034
979
  try {
2035
980
  const initSubTimings = [];
2036
981
  let t0 = performance.now();
2037
- const runtime = await getRuntime(config, initSubTimings);
982
+ const runtime = await getRuntime(config, migrationMode, initSubTimings);
2038
983
  timings.push({
2039
984
  name: "rt",
2040
985
  dur: performance.now() - t0,
2041
986
  desc: "Runtime init"
2042
987
  });
2043
988
  for (const sub of initSubTimings) timings.push(sub);
2044
- setupVerified = true;
2045
- t0 = performance.now();
2046
- const manifest = await runtime.getManifest();
2047
- timings.push({
2048
- name: "manifest",
2049
- dur: performance.now() - t0,
2050
- desc: "Manifest"
2051
- });
2052
- locals.emdashManifest = manifest;
989
+ markSetupVerified();
2053
990
  locals.emdash = {
2054
991
  handleContentList: runtime.handleContentList.bind(runtime),
2055
992
  handleContentGet: runtime.handleContentGet.bind(runtime),
993
+ handleContentAuthors: runtime.handleContentAuthors.bind(runtime),
2056
994
  handleContentCreate: runtime.handleContentCreate.bind(runtime),
2057
995
  handleContentUpdate: runtime.handleContentUpdate.bind(runtime),
2058
996
  handleContentDelete: runtime.handleContentDelete.bind(runtime),
@@ -2072,40 +1010,73 @@ const onRequest = defineMiddleware(async (context, next) => {
2072
1010
  handleContentTranslations: runtime.handleContentTranslations.bind(runtime),
2073
1011
  handleMediaList: runtime.handleMediaList.bind(runtime),
2074
1012
  handleMediaGet: runtime.handleMediaGet.bind(runtime),
1013
+ handleMediaUpload: runtime.handleMediaUpload.bind(runtime),
2075
1014
  handleMediaCreate: runtime.handleMediaCreate.bind(runtime),
1015
+ handleMediaRegisterUpload: runtime.handleMediaRegisterUpload.bind(runtime),
2076
1016
  handleMediaUpdate: runtime.handleMediaUpdate.bind(runtime),
1017
+ ...runtime.handleMediaReplaceMetadata ? { handleMediaReplaceMetadata: runtime.handleMediaReplaceMetadata.bind(runtime) } : {},
2077
1018
  handleMediaDelete: runtime.handleMediaDelete.bind(runtime),
1019
+ ...runtime.handleCommentModerate ? { handleCommentModerate: runtime.handleCommentModerate.bind(runtime) } : {},
2078
1020
  handleRevisionList: runtime.handleRevisionList.bind(runtime),
2079
1021
  handleRevisionGet: runtime.handleRevisionGet.bind(runtime),
2080
1022
  handleRevisionRestore: runtime.handleRevisionRestore.bind(runtime),
2081
1023
  handlePluginApiRoute: runtime.handlePluginApiRoute.bind(runtime),
1024
+ getPluginEditorExtension: runtime.getPluginEditorExtension.bind(runtime),
1025
+ getPluginEditorDraftSchema: runtime.getPluginEditorDraftSchema.bind(runtime),
1026
+ handlePublicPluginApiRoute: createPublicPluginApiRouteHandler(runtime),
2082
1027
  getPluginRouteMeta: runtime.getPluginRouteMeta.bind(runtime),
1028
+ getPluginMcpTools: runtime.getPluginMcpTools.bind(runtime),
1029
+ getEnabledPluginMcpTools: runtime.getEnabledPluginMcpTools.bind(runtime),
1030
+ serializePluginMcpConsent: runtime.serializePluginMcpConsent.bind(runtime),
1031
+ handlePluginMcpTool: runtime.handlePluginMcpTool.bind(runtime),
1032
+ handlePluginMcpDenied: runtime.handlePluginMcpDenied.bind(runtime),
2083
1033
  getMediaProvider: runtime.getMediaProvider.bind(runtime),
2084
1034
  getMediaProviderList: runtime.getMediaProviderList.bind(runtime),
2085
1035
  collectPageMetadata: runtime.collectPageMetadata.bind(runtime),
2086
1036
  collectPageFragments: runtime.collectPageFragments.bind(runtime),
2087
1037
  ensureSearchHealthy: runtime.ensureSearchHealthy.bind(runtime),
2088
1038
  storage: runtime.storage,
2089
- db: runtime.db,
1039
+ get db() {
1040
+ return runtime.db;
1041
+ },
2090
1042
  getPublicMediaUrl: createPublicMediaUrlResolver(runtime.storage),
2091
1043
  hooks: runtime.hooks,
2092
1044
  email: runtime.email,
2093
1045
  configuredPlugins: runtime.configuredPlugins,
1046
+ sandboxedPluginEntries: runtime.sandboxedPluginEntries,
2094
1047
  config,
2095
- invalidateManifest: runtime.invalidateManifest.bind(runtime),
1048
+ getManifest: runtime.getManifest.bind(runtime),
1049
+ invalidateUrlPatternCache,
2096
1050
  getSandboxRunner: runtime.getSandboxRunner.bind(runtime),
1051
+ isSandboxBypassed: runtime.isSandboxBypassed.bind(runtime),
2097
1052
  syncMarketplacePlugins: runtime.syncMarketplacePlugins.bind(runtime),
1053
+ syncRegistryPlugins: runtime.syncRegistryPlugins.bind(runtime),
1054
+ runPluginInstallLifecycle: runtime.runPluginInstallLifecycle.bind(runtime),
1055
+ runPluginActivateLifecycle: runtime.runPluginActivateLifecycle.bind(runtime),
1056
+ runPluginUninstallLifecycle: runtime.runPluginUninstallLifecycle.bind(runtime),
1057
+ getRuntimePluginSettingsSchema: runtime.getRuntimePluginSettingsSchema.bind(runtime),
2098
1058
  setPluginStatus: runtime.setPluginStatus.bind(runtime)
2099
1059
  };
2100
1060
  } catch (error) {
1061
+ if (error instanceof PendingMigrationsError) return pendingMigrationsResponse(error);
1062
+ if (migrationMode === "manual" && isMissingTableError(error)) {
1063
+ console.error("[emdash] database schema is unavailable in manual migration mode:", error);
1064
+ return migrationRequiredResponse();
1065
+ }
2101
1066
  console.error("EmDash middleware error:", error);
1067
+ const configurationError = runtimeConfigurationErrorResponse(error, url.pathname);
1068
+ if (configurationError) return configurationError;
2102
1069
  }
1070
+ const lastContentWriteAt = canUseCachedBinding && config?.database?.needsLastContentWriteAt ? await getLastContentWriteAt() : void 0;
2103
1071
  const scoped = createRequestScopedDb$1({
2104
1072
  config: config?.database?.config,
2105
- isAuthenticated: !!sessionUser,
2106
- isWrite: request.method !== "GET" && request.method !== "HEAD",
1073
+ isAuthenticated,
1074
+ endedAuthenticated,
1075
+ isWrite,
1076
+ canUseCachedBinding,
2107
1077
  cookies: context.cookies,
2108
- url
1078
+ url,
1079
+ lastContentWriteAt
2109
1080
  });
2110
1081
  const renderAndFinalize = async () => {
2111
1082
  const t0 = performance.now();
@@ -2120,21 +1091,22 @@ const onRequest = defineMiddleware(async (context, next) => {
2120
1091
  dur: performance.now() - mwStart,
2121
1092
  desc: "Total middleware"
2122
1093
  });
2123
- return finalizeResponse(response, timings);
1094
+ pushMetricsTimings(timings, metrics);
1095
+ return wrapBodyForStreamMetrics(finalizeResponse(response, timings));
2124
1096
  };
2125
1097
  if (scoped) {
1098
+ const { deferredTasks, lifecycle } = coordinateScopedDbLifecycle(scoped);
2126
1099
  const parent = getRequestContext();
2127
1100
  return runWithContext(parent ? {
2128
1101
  ...parent,
2129
- db: scoped.db
1102
+ db: scoped.db,
1103
+ deferredTasks
2130
1104
  } : {
2131
1105
  editMode: false,
2132
- db: scoped.db
2133
- }, async () => {
2134
- const response = await renderAndFinalize();
2135
- scoped.commit();
2136
- return response;
2137
- });
1106
+ db: scoped.db,
1107
+ metrics,
1108
+ deferredTasks
1109
+ }, () => finishScoped(lifecycle, renderAndFinalize));
2138
1110
  }
2139
1111
  return renderAndFinalize();
2140
1112
  };
@@ -2149,22 +1121,23 @@ const onRequest = defineMiddleware(async (context, next) => {
2149
1121
  } : {
2150
1122
  editMode,
2151
1123
  db: playgroundDb,
2152
- dbIsIsolated: true
1124
+ dbIsIsolated: true,
1125
+ metrics
2153
1126
  }, doInit);
2154
1127
  }
2155
1128
  return doInit();
2156
1129
  };
2157
- if (queryRecorder) try {
1130
+ try {
2158
1131
  return await runWithContext({
2159
1132
  editMode: false,
2160
- queryRecorder
1133
+ queryRecorder,
1134
+ metrics
2161
1135
  }, run);
2162
1136
  } finally {
2163
- flushRecorder(queryRecorder);
1137
+ if (queryRecorder && !queryRecorder.deferredFlush) flushRecorder(queryRecorder);
2164
1138
  }
2165
- return run();
2166
1139
  });
2167
1140
 
2168
1141
  //#endregion
2169
- export { onRequest as default, onRequest };
1142
+ export { onRequest as default, onRequest, runScheduledTasks, withEmDashRuntime };
2170
1143
  //# sourceMappingURL=middleware.mjs.map