emdash 0.22.0 → 0.23.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 (507) hide show
  1. package/dist/{adapters-hUy8vOB-.d.mts → adapters-DAAjOID4.d.mts} +1 -1
  2. package/dist/{adapters-hUy8vOB-.d.mts.map → adapters-DAAjOID4.d.mts.map} +1 -1
  3. package/dist/{allowed-origins-DjlhyfNN.mjs → allowed-origins-D5FxMUo8.mjs} +2 -2
  4. package/dist/{allowed-origins-DjlhyfNN.mjs.map → allowed-origins-D5FxMUo8.mjs.map} +1 -1
  5. package/dist/api/route-utils.d.mts +3 -3
  6. package/dist/api/route-utils.mjs +11 -11
  7. package/dist/api/schemas/index.d.mts +1 -1
  8. package/dist/api/schemas/index.mjs +3 -3
  9. package/dist/{api-BDuM4bEy.mjs → api-BQ_yKRdG.mjs} +12 -12
  10. package/dist/{api-BDuM4bEy.mjs.map → api-BQ_yKRdG.mjs.map} +1 -1
  11. package/dist/{api-tokens-ViYKeIp9.mjs → api-tokens-D6ppjIVi.mjs} +2 -2
  12. package/dist/{api-tokens-ViYKeIp9.mjs.map → api-tokens-D6ppjIVi.mjs.map} +1 -1
  13. package/dist/{apply-wDqQoxX4.mjs → apply-CWRyxIoO.mjs} +12 -12
  14. package/dist/{apply-wDqQoxX4.mjs.map → apply-CWRyxIoO.mjs.map} +1 -1
  15. package/dist/astro/index.d.mts +11 -11
  16. package/dist/astro/index.mjs +12 -6
  17. package/dist/astro/index.mjs.map +1 -1
  18. package/dist/astro/middleware/auth.d.mts +9 -9
  19. package/dist/astro/middleware/auth.mjs +6 -6
  20. package/dist/astro/middleware/redirect.mjs +3 -3
  21. package/dist/astro/middleware/request-context.d.mts.map +1 -1
  22. package/dist/astro/middleware/request-context.mjs +5 -3
  23. package/dist/astro/middleware/request-context.mjs.map +1 -1
  24. package/dist/astro/middleware/setup.mjs +1 -1
  25. package/dist/astro/middleware.d.mts +1 -1
  26. package/dist/astro/middleware.d.mts.map +1 -1
  27. package/dist/astro/middleware.mjs +349 -128
  28. package/dist/astro/middleware.mjs.map +1 -1
  29. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
  30. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
  31. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +3 -3
  32. package/dist/astro/routes/api/admin/api-tokens/index.mjs +4 -4
  33. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +3 -3
  34. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +7 -7
  35. package/dist/astro/routes/api/admin/byline-fields/index.mjs +7 -7
  36. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +7 -7
  37. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +12 -11
  38. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
  39. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +12 -11
  40. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -1
  41. package/dist/astro/routes/api/admin/bylines/index.mjs +12 -11
  42. package/dist/astro/routes/api/admin/bylines/index.mjs.map +1 -1
  43. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +9 -9
  44. package/dist/astro/routes/api/admin/comments/_id_.mjs +3 -3
  45. package/dist/astro/routes/api/admin/comments/bulk.mjs +7 -7
  46. package/dist/astro/routes/api/admin/comments/counts.mjs +3 -3
  47. package/dist/astro/routes/api/admin/comments/index.mjs +7 -7
  48. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +3 -3
  49. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +2 -2
  50. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +3 -3
  51. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +3 -3
  52. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +27 -26
  53. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
  54. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +27 -26
  55. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
  56. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +26 -25
  57. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
  58. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +26 -25
  59. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
  60. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +26 -25
  61. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
  62. package/dist/astro/routes/api/admin/plugins/index.mjs +26 -25
  63. package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
  64. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
  65. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +26 -25
  66. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
  67. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +26 -25
  68. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
  69. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +26 -25
  70. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
  71. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +26 -25
  72. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
  73. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +27 -26
  74. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
  75. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +26 -25
  76. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
  77. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +27 -26
  78. package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
  79. package/dist/astro/routes/api/admin/plugins/updates.mjs +26 -25
  80. package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
  81. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +26 -25
  82. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
  83. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
  84. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +26 -25
  85. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
  86. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
  87. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
  88. package/dist/astro/routes/api/admin/users/_id_/index.mjs +5 -5
  89. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
  90. package/dist/astro/routes/api/admin/users/index.mjs +5 -5
  91. package/dist/astro/routes/api/auth/dev-bypass.mjs +3 -3
  92. package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
  93. package/dist/astro/routes/api/auth/invite/complete.mjs +9 -9
  94. package/dist/astro/routes/api/auth/invite/index.mjs +6 -6
  95. package/dist/astro/routes/api/auth/invite/register-options.mjs +8 -8
  96. package/dist/astro/routes/api/auth/logout.mjs +2 -2
  97. package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
  98. package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
  99. package/dist/astro/routes/api/auth/me.mjs +5 -5
  100. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  101. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
  102. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
  103. package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
  104. package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
  105. package/dist/astro/routes/api/auth/passkey/options.mjs +10 -10
  106. package/dist/astro/routes/api/auth/passkey/register/options.mjs +8 -8
  107. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +9 -9
  108. package/dist/astro/routes/api/auth/passkey/verify.mjs +9 -9
  109. package/dist/astro/routes/api/auth/signup/complete.mjs +9 -9
  110. package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
  111. package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
  112. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +10 -10
  113. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +9 -9
  114. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
  115. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +2 -2
  116. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +2 -2
  117. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +2 -2
  118. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +9 -9
  119. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +6 -6
  120. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +2 -2
  121. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
  122. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +6 -6
  123. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +9 -9
  124. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
  125. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +2 -2
  126. package/dist/astro/routes/api/content/_collection_/_id_.mjs +6 -6
  127. package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
  128. package/dist/astro/routes/api/content/_collection_/index.mjs +6 -6
  129. package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
  130. package/dist/astro/routes/api/dashboard.mjs +3 -3
  131. package/dist/astro/routes/api/dev/emails.mjs +2 -2
  132. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  133. package/dist/astro/routes/api/import/probe.mjs +10 -10
  134. package/dist/astro/routes/api/import/wordpress/analyze.mjs +2 -2
  135. package/dist/astro/routes/api/import/wordpress/execute.d.mts +9 -9
  136. package/dist/astro/routes/api/import/wordpress/execute.mjs +8 -7
  137. package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
  138. package/dist/astro/routes/api/import/wordpress/media.mjs +8 -8
  139. package/dist/astro/routes/api/import/wordpress/prepare.mjs +8 -8
  140. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +8 -8
  141. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  142. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +10 -10
  143. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +1 -1
  144. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +12 -11
  145. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
  146. package/dist/astro/routes/api/manifest.mjs +3 -3
  147. package/dist/astro/routes/api/mcp.mjs +29 -29
  148. package/dist/astro/routes/api/media/_id_/confirm.mjs +6 -6
  149. package/dist/astro/routes/api/media/_id_.mjs +6 -6
  150. package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
  151. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
  152. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
  153. package/dist/astro/routes/api/media/providers/index.mjs +2 -2
  154. package/dist/astro/routes/api/media/upload-url.mjs +8 -8
  155. package/dist/astro/routes/api/media.mjs +10 -10
  156. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +6 -6
  157. package/dist/astro/routes/api/menus/_name_/items.mjs +6 -6
  158. package/dist/astro/routes/api/menus/_name_/reorder.mjs +6 -6
  159. package/dist/astro/routes/api/menus/_name_/translations.mjs +6 -6
  160. package/dist/astro/routes/api/menus/_name_.mjs +6 -6
  161. package/dist/astro/routes/api/menus/index.mjs +6 -6
  162. package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
  163. package/dist/astro/routes/api/oauth/device/authorize.mjs +5 -5
  164. package/dist/astro/routes/api/oauth/device/code.mjs +8 -8
  165. package/dist/astro/routes/api/oauth/device/token.mjs +7 -7
  166. package/dist/astro/routes/api/oauth/register.mjs +2 -2
  167. package/dist/astro/routes/api/oauth/token/refresh.mjs +5 -5
  168. package/dist/astro/routes/api/oauth/token/revoke.mjs +5 -5
  169. package/dist/astro/routes/api/oauth/token.mjs +5 -5
  170. package/dist/astro/routes/api/openapi.json.mjs +3 -3
  171. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
  172. package/dist/astro/routes/api/redirects/404s/index.mjs +7 -7
  173. package/dist/astro/routes/api/redirects/404s/summary.mjs +7 -7
  174. package/dist/astro/routes/api/redirects/_id_.mjs +8 -8
  175. package/dist/astro/routes/api/redirects/index.mjs +8 -8
  176. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
  177. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
  178. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +26 -25
  179. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
  180. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +26 -25
  181. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
  182. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +26 -25
  183. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
  184. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +26 -25
  185. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
  186. package/dist/astro/routes/api/schema/collections/index.mjs +26 -25
  187. package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
  188. package/dist/astro/routes/api/schema/index.mjs +7 -6
  189. package/dist/astro/routes/api/schema/index.mjs.map +1 -1
  190. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +26 -25
  191. package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
  192. package/dist/astro/routes/api/schema/orphans/index.mjs +26 -25
  193. package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
  194. package/dist/astro/routes/api/search/enable.mjs +9 -9
  195. package/dist/astro/routes/api/search/index.mjs +8 -8
  196. package/dist/astro/routes/api/search/rebuild.mjs +9 -9
  197. package/dist/astro/routes/api/search/stats.mjs +5 -5
  198. package/dist/astro/routes/api/search/suggest.mjs +8 -8
  199. package/dist/astro/routes/api/sections/_slug_.mjs +8 -8
  200. package/dist/astro/routes/api/sections/index.mjs +8 -8
  201. package/dist/astro/routes/api/settings/email.mjs +3 -3
  202. package/dist/astro/routes/api/settings.mjs +9 -9
  203. package/dist/astro/routes/api/setup/admin-verify.mjs +10 -10
  204. package/dist/astro/routes/api/setup/admin.mjs +9 -9
  205. package/dist/astro/routes/api/setup/dev-bypass.mjs +17 -16
  206. package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
  207. package/dist/astro/routes/api/setup/dev-reset.mjs +1 -1
  208. package/dist/astro/routes/api/setup/index.mjs +18 -17
  209. package/dist/astro/routes/api/setup/index.mjs.map +1 -1
  210. package/dist/astro/routes/api/setup/status.mjs +3 -3
  211. package/dist/astro/routes/api/snapshot.mjs +5 -5
  212. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +10 -10
  213. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +10 -10
  214. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +10 -10
  215. package/dist/astro/routes/api/taxonomies/index.mjs +10 -10
  216. package/dist/astro/routes/api/themes/preview.mjs +4 -4
  217. package/dist/astro/routes/api/typegen.mjs +4 -4
  218. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  219. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
  220. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
  221. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +6 -6
  222. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +8 -8
  223. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +8 -8
  224. package/dist/astro/routes/api/widget-areas/_name_.mjs +4 -4
  225. package/dist/astro/routes/api/widget-areas/index.mjs +8 -8
  226. package/dist/astro/routes/api/widget-components.mjs +2 -2
  227. package/dist/astro/routes/robots.txt.mjs +3 -3
  228. package/dist/astro/routes/sitemap-_collection_.xml.mjs +6 -6
  229. package/dist/astro/routes/sitemap.xml.mjs +4 -4
  230. package/dist/astro/types.d.mts +12 -12
  231. package/dist/auth/providers/github.d.mts +1 -1
  232. package/dist/auth/providers/google.d.mts +1 -1
  233. package/dist/{authorize-C0EYoUeV.mjs → authorize-Cse0k7B0.mjs} +2 -2
  234. package/dist/{authorize-C0EYoUeV.mjs.map → authorize-Cse0k7B0.mjs.map} +1 -1
  235. package/dist/{byline-CC0WS4Gu.mjs → byline-DVo-liaP.mjs} +15 -73
  236. package/dist/byline-DVo-liaP.mjs.map +1 -0
  237. package/dist/{byline-fields-53i9Et0x.mjs → byline-fields-B-KXkg5R.mjs} +2 -2
  238. package/dist/{byline-fields-53i9Et0x.mjs.map → byline-fields-B-KXkg5R.mjs.map} +1 -1
  239. package/dist/{byline-fields-DNp0HNKc.mjs → byline-fields-DaMKzkhO.mjs} +1 -1
  240. package/dist/{byline-fields-DNp0HNKc.mjs.map → byline-fields-DaMKzkhO.mjs.map} +1 -1
  241. package/dist/{byline-fields-jy07PZJM.d.mts → byline-fields-RFPkDLRw.d.mts} +21 -1
  242. package/dist/byline-fields-RFPkDLRw.d.mts.map +1 -0
  243. package/dist/{bylines-CCO1CYnH.mjs → bylines-f5ppBpD5.mjs} +6 -6
  244. package/dist/{bylines-CCO1CYnH.mjs.map → bylines-f5ppBpD5.mjs.map} +1 -1
  245. package/dist/{bylines-DGekMGGm.mjs → bylines-pIKgc_TL.mjs} +2 -2
  246. package/dist/{bylines-DGekMGGm.mjs.map → bylines-pIKgc_TL.mjs.map} +1 -1
  247. package/dist/{cache-pXTpun6s.mjs → cache-Q6V4U-Xz.mjs} +1 -1
  248. package/dist/{cache-pXTpun6s.mjs.map → cache-Q6V4U-Xz.mjs.map} +1 -1
  249. package/dist/{challenge-store-C6E_kWTs.mjs → challenge-store-LhiqMccz.mjs} +1 -1
  250. package/dist/{challenge-store-C6E_kWTs.mjs.map → challenge-store-LhiqMccz.mjs.map} +1 -1
  251. package/dist/cli/index.mjs +16 -15
  252. package/dist/cli/index.mjs.map +1 -1
  253. package/dist/client/cf-access.d.mts +1 -1
  254. package/dist/client/index.d.mts +1 -1
  255. package/dist/client/index.mjs +2 -2
  256. package/dist/{comment-reaction-B6AdcpXw.mjs → comment-reaction-Dyb-AutY.mjs} +1 -1
  257. package/dist/{comment-reaction-B6AdcpXw.mjs.map → comment-reaction-Dyb-AutY.mjs.map} +1 -1
  258. package/dist/{comments-CtPkT2tp.mjs → comments-Cczx7AvD.mjs} +1 -1
  259. package/dist/{comments-CtPkT2tp.mjs.map → comments-Cczx7AvD.mjs.map} +1 -1
  260. package/dist/{components-D6ZnrzbB.mjs → components-CYt4uVK9.mjs} +1 -1
  261. package/dist/{components-D6ZnrzbB.mjs.map → components-CYt4uVK9.mjs.map} +1 -1
  262. package/dist/{context-f1__jpzF.mjs → context-B1W8soLv.mjs} +58 -20
  263. package/dist/context-B1W8soLv.mjs.map +1 -0
  264. package/dist/{cron-CQPxBjYs.mjs → cron-C5LVoNmP.mjs} +14 -2
  265. package/dist/cron-C5LVoNmP.mjs.map +1 -0
  266. package/dist/{dashboard-BOESNcwE.mjs → dashboard-CYjpQZ6-.mjs} +1 -1
  267. package/dist/{dashboard-BOESNcwE.mjs.map → dashboard-CYjpQZ6-.mjs.map} +1 -1
  268. package/dist/db/index.d.mts +3 -3
  269. package/dist/db/libsql.d.mts +1 -1
  270. package/dist/db/postgres.d.mts +1 -1
  271. package/dist/db/sqlite.d.mts +1 -1
  272. package/dist/{db-errors-CrC5w3Jz.mjs → db-errors-UXB1CK42.mjs} +1 -1
  273. package/dist/{db-errors-CrC5w3Jz.mjs.map → db-errors-UXB1CK42.mjs.map} +1 -1
  274. package/dist/{default-CpBEPn6a.mjs → default-CeRG-Ot4.mjs} +1 -1
  275. package/dist/{default-CpBEPn6a.mjs.map → default-CeRG-Ot4.mjs.map} +1 -1
  276. package/dist/{device-flow-Bn-qiDrw.mjs → device-flow-DENDCQ9F.mjs} +4 -4
  277. package/dist/{device-flow-Bn-qiDrw.mjs.map → device-flow-DENDCQ9F.mjs.map} +1 -1
  278. package/dist/{email-console-B9VS6eN4.mjs → email-console-DJP32ucW.mjs} +1 -1
  279. package/dist/{email-console-B9VS6eN4.mjs.map → email-console-DJP32ucW.mjs.map} +1 -1
  280. package/dist/{error-BQ1pxs0L.mjs → error-Bl6kZgtt.mjs} +1 -1
  281. package/dist/{error-BQ1pxs0L.mjs.map → error-Bl6kZgtt.mjs.map} +1 -1
  282. package/dist/{escape-BtbJWyaW.mjs → escape-Bjio4ZsM.mjs} +1 -1
  283. package/dist/{escape-BtbJWyaW.mjs.map → escape-Bjio4ZsM.mjs.map} +1 -1
  284. package/dist/field-defs-cache-ztrdzUGb.mjs +77 -0
  285. package/dist/field-defs-cache-ztrdzUGb.mjs.map +1 -0
  286. package/dist/{fts-manager-DtiWqwNJ.mjs → fts-manager-CQuHt-vS.mjs} +1 -1
  287. package/dist/{fts-manager-DtiWqwNJ.mjs.map → fts-manager-CQuHt-vS.mjs.map} +1 -1
  288. package/dist/{hash-BowcuPwv.mjs → hash-DrvzIXcz.mjs} +1 -1
  289. package/dist/{hash-BowcuPwv.mjs.map → hash-DrvzIXcz.mjs.map} +1 -1
  290. package/dist/{import-DqSGOlmR.mjs → import-Bb1T9WJS.mjs} +3 -3
  291. package/dist/{import-DqSGOlmR.mjs.map → import-Bb1T9WJS.mjs.map} +1 -1
  292. package/dist/{index-C2dLNT6S.d.mts → index-BaIj5hIq.d.mts} +39 -17
  293. package/dist/index-BaIj5hIq.d.mts.map +1 -0
  294. package/dist/{index-ZDEwR7qW.d.mts → index-qbL02uhs.d.mts} +3 -3
  295. package/dist/{index-ZDEwR7qW.d.mts.map → index-qbL02uhs.d.mts.map} +1 -1
  296. package/dist/index.d.mts +17 -17
  297. package/dist/index.mjs +46 -45
  298. package/dist/{load-Dtoo7KcJ.mjs → load-BNo-ER8C.mjs} +1 -1
  299. package/dist/{load-Dtoo7KcJ.mjs.map → load-BNo-ER8C.mjs.map} +1 -1
  300. package/dist/{loader-C8Z48Uof.mjs → loader-Dn74CG1b.mjs} +68 -9
  301. package/dist/loader-Dn74CG1b.mjs.map +1 -0
  302. package/dist/{manifest-schema-DDSbwkAL.mjs → manifest-schema-BWKnQYQF.mjs} +1 -1
  303. package/dist/{manifest-schema-DDSbwkAL.mjs.map → manifest-schema-BWKnQYQF.mjs.map} +1 -1
  304. package/dist/media/image-endpoint.mjs +1 -1
  305. package/dist/media/index.d.mts +1 -1
  306. package/dist/media/index.mjs +2 -2
  307. package/dist/media/local-runtime.d.mts +19 -11
  308. package/dist/media/local-runtime.d.mts.map +1 -1
  309. package/dist/media/local-runtime.mjs +9 -7
  310. package/dist/media/local-runtime.mjs.map +1 -1
  311. package/dist/{media-allowlist-DunzrKFM.mjs → media-allowlist-B77I5_bw.mjs} +2 -2
  312. package/dist/{media-allowlist-DunzrKFM.mjs.map → media-allowlist-B77I5_bw.mjs.map} +1 -1
  313. package/dist/{media-url-S22B6aPr.mjs → media-url-O4rm9-SQ.mjs} +1 -1
  314. package/dist/{media-url-S22B6aPr.mjs.map → media-url-O4rm9-SQ.mjs.map} +1 -1
  315. package/dist/{menus-DOs1MQJg.mjs → menus-DS8VTZgo.mjs} +56 -13
  316. package/dist/menus-DS8VTZgo.mjs.map +1 -0
  317. package/dist/{mime-DYpsOAny.mjs → mime-BTzvzJ8M.mjs} +1 -1
  318. package/dist/{mime-DYpsOAny.mjs.map → mime-BTzvzJ8M.mjs.map} +1 -1
  319. package/dist/{mode-CFh8Dw8G.mjs → mode-BB0F8xTC.mjs} +1 -1
  320. package/dist/{mode-CFh8Dw8G.mjs.map → mode-BB0F8xTC.mjs.map} +1 -1
  321. package/dist/{normalize-Uam4_Vkr.mjs → normalize-ClbNIenm.mjs} +1 -1
  322. package/dist/{normalize-Uam4_Vkr.mjs.map → normalize-ClbNIenm.mjs.map} +1 -1
  323. package/dist/{oauth-authorization-BN-t83Uy.mjs → oauth-authorization-CsvzIp_F.mjs} +4 -4
  324. package/dist/{oauth-authorization-BN-t83Uy.mjs.map → oauth-authorization-CsvzIp_F.mjs.map} +1 -1
  325. package/dist/{oauth-clients-R6I_V0qz.mjs → oauth-clients-C9SYwEbZ.mjs} +1 -1
  326. package/dist/{oauth-clients-R6I_V0qz.mjs.map → oauth-clients-C9SYwEbZ.mjs.map} +1 -1
  327. package/dist/{oauth-state-store-Csoc6kkR.mjs → oauth-state-store---zrApfB.mjs} +1 -1
  328. package/dist/{oauth-state-store-Csoc6kkR.mjs.map → oauth-state-store---zrApfB.mjs.map} +1 -1
  329. package/dist/{oauth-user-lookup-d7VYjTpx.mjs → oauth-user-lookup-SHsWRlG9.mjs} +1 -1
  330. package/dist/{oauth-user-lookup-d7VYjTpx.mjs.map → oauth-user-lookup-SHsWRlG9.mjs.map} +1 -1
  331. package/dist/object-cache/memory.d.mts +1 -1
  332. package/dist/{options-DFFpvNJU.d.mts → options-CqECG0gM.d.mts} +3 -3
  333. package/dist/{options-DFFpvNJU.d.mts.map → options-CqECG0gM.d.mts.map} +1 -1
  334. package/dist/page/index.d.mts +2 -2
  335. package/dist/{parse-qrHlnzTy.mjs → parse-C9hpjUyY.mjs} +2 -2
  336. package/dist/{parse-qrHlnzTy.mjs.map → parse-C9hpjUyY.mjs.map} +1 -1
  337. package/dist/{passkey-config-BJTbcnI5.mjs → passkey-config-C0YfSBko.mjs} +1 -1
  338. package/dist/{passkey-config-BJTbcnI5.mjs.map → passkey-config-C0YfSBko.mjs.map} +1 -1
  339. package/dist/{placeholder-CIDCpyEY.mjs → placeholder-B0s2mWu5.mjs} +1 -1
  340. package/dist/{placeholder-CIDCpyEY.mjs.map → placeholder-B0s2mWu5.mjs.map} +1 -1
  341. package/dist/{placeholder-CirPauNG.d.mts → placeholder-QoI4gEzP.d.mts} +1 -1
  342. package/dist/{placeholder-CirPauNG.d.mts.map → placeholder-QoI4gEzP.d.mts.map} +1 -1
  343. package/dist/plugin-types.d.mts +1 -1
  344. package/dist/plugin-utils.d.mts +9 -9
  345. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
  346. package/dist/plugins/adapt-sandbox-entry.mjs +2 -2
  347. package/dist/{portable-text-BIFhrU6T.mjs → portable-text-BICg8bTk.mjs} +1 -1
  348. package/dist/{portable-text-BIFhrU6T.mjs.map → portable-text-BICg8bTk.mjs.map} +1 -1
  349. package/dist/{preview-IDye9SPQ.mjs → preview-DKGCt2_p.mjs} +2 -2
  350. package/dist/{preview-IDye9SPQ.mjs.map → preview-DKGCt2_p.mjs.map} +1 -1
  351. package/dist/{public-url-8lFyQ8ZF.mjs → public-url-CTVqgMmg.mjs} +1 -1
  352. package/dist/{public-url-8lFyQ8ZF.mjs.map → public-url-CTVqgMmg.mjs.map} +1 -1
  353. package/dist/{query-B1RVFUNM.mjs → query-DgUHZLWB.mjs} +79 -8
  354. package/dist/query-DgUHZLWB.mjs.map +1 -0
  355. package/dist/{rate-limit-DfNAqIWW.mjs → rate-limit-BuQ5d4X_.mjs} +2 -2
  356. package/dist/{rate-limit-DfNAqIWW.mjs.map → rate-limit-BuQ5d4X_.mjs.map} +1 -1
  357. package/dist/{redirect-B4wuX2A5.mjs → redirect-CS-PHtNh.mjs} +1 -1
  358. package/dist/{redirect-B4wuX2A5.mjs.map → redirect-CS-PHtNh.mjs.map} +1 -1
  359. package/dist/{redirects-CT_vb3NV.mjs → redirects-BZ8Mxn8H.mjs} +2 -2
  360. package/dist/{redirects-CT_vb3NV.mjs.map → redirects-BZ8Mxn8H.mjs.map} +1 -1
  361. package/dist/{redirects-DUvXgzCX.mjs → redirects-x9eFPeyi.mjs} +4 -2
  362. package/dist/redirects-x9eFPeyi.mjs.map +1 -0
  363. package/dist/{registry-CjK96fHD.mjs → registry-CK1SS6pi.mjs} +2 -2
  364. package/dist/{registry-CjK96fHD.mjs.map → registry-CK1SS6pi.mjs.map} +1 -1
  365. package/dist/{request-meta-ei3ATilC.mjs → request-meta-CmS1tDFf.mjs} +2 -2
  366. package/dist/{request-meta-ei3ATilC.mjs.map → request-meta-CmS1tDFf.mjs.map} +1 -1
  367. package/dist/{resolve-CpbBglV0.mjs → resolve-C7I0qiR0.mjs} +1 -1
  368. package/dist/{resolve-CpbBglV0.mjs.map → resolve-C7I0qiR0.mjs.map} +1 -1
  369. package/dist/{runner-jdXtFEd3.d.mts → runner-CEtq-6Sm.d.mts} +2 -2
  370. package/dist/{runner-jdXtFEd3.d.mts.map → runner-CEtq-6Sm.d.mts.map} +1 -1
  371. package/dist/runtime.d.mts +10 -10
  372. package/dist/runtime.mjs +1 -1
  373. package/dist/{schema-5z2Jfnbm.mjs → schema-CbFRFoM7.mjs} +3 -3
  374. package/dist/{schema-5z2Jfnbm.mjs.map → schema-CbFRFoM7.mjs.map} +1 -1
  375. package/dist/{search-D9FkoM-k.mjs → search-C-waE_YW.mjs} +3 -3
  376. package/dist/{search-D9FkoM-k.mjs.map → search-C-waE_YW.mjs.map} +1 -1
  377. package/dist/{secrets-BUE5UQys.mjs → secrets-BSf9pRRY.mjs} +2 -2
  378. package/dist/{secrets-BUE5UQys.mjs.map → secrets-BSf9pRRY.mjs.map} +1 -1
  379. package/dist/{sections-DWYZo6HK.mjs → sections-osX9U-YJ.mjs} +2 -2
  380. package/dist/{sections-DWYZo6HK.mjs.map → sections-osX9U-YJ.mjs.map} +1 -1
  381. package/dist/seed/index.d.mts +2 -2
  382. package/dist/seed/index.mjs +12 -11
  383. package/dist/seo/index.d.mts +1 -1
  384. package/dist/seo/index.mjs +1 -1
  385. package/dist/{seo-Cu47j3mJ.mjs → seo-4FovMwNS.mjs} +1 -1
  386. package/dist/{seo-Cu47j3mJ.mjs.map → seo-4FovMwNS.mjs.map} +1 -1
  387. package/dist/{seo-DRnqnstF.mjs → seo-DCEF-AVr.mjs} +1 -1
  388. package/dist/{seo-DRnqnstF.mjs.map → seo-DCEF-AVr.mjs.map} +1 -1
  389. package/dist/{service-DTmtqCnw.mjs → service-jby1RRmU.mjs} +2 -2
  390. package/dist/{service-DTmtqCnw.mjs.map → service-jby1RRmU.mjs.map} +1 -1
  391. package/dist/{session-user-DmtPMNa1.mjs → session-user-B8aLtKAH.mjs} +1 -1
  392. package/dist/{session-user-DmtPMNa1.mjs.map → session-user-B8aLtKAH.mjs.map} +1 -1
  393. package/dist/{settings-DUrVDN0c.mjs → settings-4bRT2NIf.mjs} +2 -2
  394. package/dist/{settings-DUrVDN0c.mjs.map → settings-4bRT2NIf.mjs.map} +1 -1
  395. package/dist/{settings-yaxu9mU-.mjs → settings-t-H2jPuJ.mjs} +3 -3
  396. package/dist/{settings-yaxu9mU-.mjs.map → settings-t-H2jPuJ.mjs.map} +1 -1
  397. package/dist/{setup-complete-BWFHzgvZ.mjs → setup-complete-gEiySUc-.mjs} +1 -1
  398. package/dist/{setup-complete-BWFHzgvZ.mjs.map → setup-complete-gEiySUc-.mjs.map} +1 -1
  399. package/dist/{setup-nonce-DFWG-J5c.mjs → setup-nonce-DzS50zme.mjs} +1 -1
  400. package/dist/{setup-nonce-DFWG-J5c.mjs.map → setup-nonce-DzS50zme.mjs.map} +1 -1
  401. package/dist/{single-flight-cache-B5p5cNOL.mjs → single-flight-cache-Cdfkic3t.mjs} +1 -1
  402. package/dist/{single-flight-cache-B5p5cNOL.mjs.map → single-flight-cache-Cdfkic3t.mjs.map} +1 -1
  403. package/dist/{site-url-BOTPgmeM.mjs → site-url-BLebyON8.mjs} +1 -1
  404. package/dist/{site-url-BOTPgmeM.mjs.map → site-url-BLebyON8.mjs.map} +1 -1
  405. package/dist/{ssrf-B0VeRLrp.mjs → ssrf-BRKb343l.mjs} +1 -1
  406. package/dist/{ssrf-B0VeRLrp.mjs.map → ssrf-BRKb343l.mjs.map} +1 -1
  407. package/dist/{status-CB2basWJ.mjs → status-vUK0SA17.mjs} +1 -1
  408. package/dist/{status-CB2basWJ.mjs.map → status-vUK0SA17.mjs.map} +1 -1
  409. package/dist/storage/local.d.mts +1 -1
  410. package/dist/storage/local.mjs +1 -1
  411. package/dist/storage/s3.d.mts +1 -1
  412. package/dist/storage/s3.mjs +1 -1
  413. package/dist/{taxonomies-CJmkEpdS.mjs → taxonomies-BBB8O-CU.mjs} +2 -2
  414. package/dist/{taxonomies-CJmkEpdS.mjs.map → taxonomies-BBB8O-CU.mjs.map} +1 -1
  415. package/dist/{taxonomies-Be9B1jEj.mjs → taxonomies-Dxrc_szG.mjs} +26 -6
  416. package/dist/{taxonomies-Be9B1jEj.mjs.map → taxonomies-Dxrc_szG.mjs.map} +1 -1
  417. package/dist/{tokens-BvrJvIB6.mjs → tokens-LeuXF9gG.mjs} +1 -1
  418. package/dist/{tokens-BvrJvIB6.mjs.map → tokens-LeuXF9gG.mjs.map} +1 -1
  419. package/dist/{transport-k7YjfmEn.d.mts → transport-BZ-03aFT.d.mts} +1 -1
  420. package/dist/{transport-k7YjfmEn.d.mts.map → transport-BZ-03aFT.d.mts.map} +1 -1
  421. package/dist/{transport-B4rXnSTf.mjs → transport-_2nBz7e9.mjs} +1 -1
  422. package/dist/{transport-B4rXnSTf.mjs.map → transport-_2nBz7e9.mjs.map} +1 -1
  423. package/dist/{trusted-proxy-DY1_UqHr.mjs → trusted-proxy-DZY5WCn2.mjs} +1 -1
  424. package/dist/{trusted-proxy-DY1_UqHr.mjs.map → trusted-proxy-DZY5WCn2.mjs.map} +1 -1
  425. package/dist/{types-Czg1S3gB.d.mts → types-B-gIxFCE.d.mts} +1 -1
  426. package/dist/{types-Czg1S3gB.d.mts.map → types-B-gIxFCE.d.mts.map} +1 -1
  427. package/dist/{types-DXLVzV2w.d.mts → types-BG8_XTLj.d.mts} +1 -1
  428. package/dist/{types-DXLVzV2w.d.mts.map → types-BG8_XTLj.d.mts.map} +1 -1
  429. package/dist/{types-CWGYDYqF.d.mts → types-BWh2MjmA.d.mts} +15 -2
  430. package/dist/types-BWh2MjmA.d.mts.map +1 -0
  431. package/dist/{types-CgvhU-hF.d.mts → types-BWqGVhFn.d.mts} +1 -1
  432. package/dist/{types-CgvhU-hF.d.mts.map → types-BWqGVhFn.d.mts.map} +1 -1
  433. package/dist/{types-DYF2_Vf4.mjs → types-CQAugunJ.mjs} +1 -1
  434. package/dist/{types-DYF2_Vf4.mjs.map → types-CQAugunJ.mjs.map} +1 -1
  435. package/dist/{types-DPCpkzvS.d.mts → types-CTLJYMhN.d.mts} +1 -1
  436. package/dist/{types-DPCpkzvS.d.mts.map → types-CTLJYMhN.d.mts.map} +1 -1
  437. package/dist/{types-CmivgZbp.d.mts → types-CUsXGRVj.d.mts} +1 -1
  438. package/dist/{types-CmivgZbp.d.mts.map → types-CUsXGRVj.d.mts.map} +1 -1
  439. package/dist/types-DXOIbece.mjs.map +1 -1
  440. package/dist/{types-CKNXt63n.d.mts → types-DrYMm9s5.d.mts} +1 -1
  441. package/dist/{types-CKNXt63n.d.mts.map → types-DrYMm9s5.d.mts.map} +1 -1
  442. package/dist/{types-CIKX2HO5.d.mts → types-TTx8uP7V.d.mts} +2 -2
  443. package/dist/{types-CIKX2HO5.d.mts.map → types-TTx8uP7V.d.mts.map} +1 -1
  444. package/dist/{types-DCNNfeCv.d.mts → types-fS7-VTdR.d.mts} +1 -1
  445. package/dist/{types-DCNNfeCv.d.mts.map → types-fS7-VTdR.d.mts.map} +1 -1
  446. package/dist/{utils-LbHcSRTj.mjs → utils-B7A57fm9.mjs} +1 -1
  447. package/dist/{utils-LbHcSRTj.mjs.map → utils-B7A57fm9.mjs.map} +1 -1
  448. package/dist/{validate-Bwl64sxv.mjs → validate-0Utjspbs.mjs} +1 -1
  449. package/dist/{validate-Bwl64sxv.mjs.map → validate-0Utjspbs.mjs.map} +1 -1
  450. package/dist/{validate-CE2M0nvx.d.mts → validate-DOFrIb-c.d.mts} +5 -5
  451. package/dist/{validate-CE2M0nvx.d.mts.map → validate-DOFrIb-c.d.mts.map} +1 -1
  452. package/dist/{validation-C_yOvFaO.mjs → validation-D9EnzH1T.mjs} +5 -5
  453. package/dist/{validation-C_yOvFaO.mjs.map → validation-D9EnzH1T.mjs.map} +1 -1
  454. package/dist/version-BgVM_1MU.mjs +7 -0
  455. package/dist/{version-RnYXYjzD.mjs.map → version-BgVM_1MU.mjs.map} +1 -1
  456. package/dist/{widgets-8GONuRHo.mjs → widgets-BSTzPUYa.mjs} +3 -3
  457. package/dist/{widgets-8GONuRHo.mjs.map → widgets-BSTzPUYa.mjs.map} +1 -1
  458. package/dist/{zod-generator-D481JjzD.mjs → zod-generator-ElVQOav7.mjs} +50 -14
  459. package/dist/zod-generator-ElVQOav7.mjs.map +1 -0
  460. package/package.json +8 -7
  461. package/src/api/schemas/bylines.ts +8 -0
  462. package/src/astro/integration/virtual-modules.ts +8 -0
  463. package/src/astro/integration/vite-config.ts +9 -1
  464. package/src/astro/middleware/request-context.ts +6 -1
  465. package/src/astro/middleware/scoped-db.ts +131 -0
  466. package/src/astro/middleware/stream-end-metrics.ts +4 -8
  467. package/src/astro/middleware.ts +90 -28
  468. package/src/astro/routes/admin.astro +5 -1
  469. package/src/astro/routes/api/schema/index.ts +9 -3
  470. package/src/cli/commands/export-seed.ts +10 -7
  471. package/src/components/Block.astro +71 -0
  472. package/src/components/EmDashMedia.astro +1 -2
  473. package/src/components/Image.astro +36 -2
  474. package/src/components/InlinePortableTextEditor.tsx +10 -2
  475. package/src/components/index.ts +5 -0
  476. package/src/components/portable-text-text-align.ts +38 -0
  477. package/src/content/converters/portable-text-to-prosemirror.ts +5 -1
  478. package/src/content/converters/prosemirror-to-portable-text.ts +8 -0
  479. package/src/content/converters/types.ts +1 -0
  480. package/src/database/repositories/byline.ts +14 -0
  481. package/src/database/repositories/types.ts +13 -0
  482. package/src/emdash-runtime.ts +226 -71
  483. package/src/loader.ts +97 -5
  484. package/src/media/local-runtime.ts +18 -5
  485. package/src/plugins/context.ts +94 -22
  486. package/src/plugins/cron.ts +18 -2
  487. package/src/plugins/routes.ts +40 -1
  488. package/src/query.ts +108 -1
  489. package/src/schema/zod-generator.ts +53 -8
  490. package/src/taxonomies/index.ts +26 -0
  491. package/src/ui.ts +5 -0
  492. package/src/virtual-modules.d.ts +13 -0
  493. package/dist/byline-CC0WS4Gu.mjs.map +0 -1
  494. package/dist/byline-fields-jy07PZJM.d.mts.map +0 -1
  495. package/dist/context-f1__jpzF.mjs.map +0 -1
  496. package/dist/cron-CQPxBjYs.mjs.map +0 -1
  497. package/dist/index-C2dLNT6S.d.mts.map +0 -1
  498. package/dist/loader-C8Z48Uof.mjs.map +0 -1
  499. package/dist/menus-DOs1MQJg.mjs.map +0 -1
  500. package/dist/query-B1RVFUNM.mjs.map +0 -1
  501. package/dist/redirects-DUvXgzCX.mjs.map +0 -1
  502. package/dist/types-CWGYDYqF.d.mts.map +0 -1
  503. package/dist/version-RnYXYjzD.mjs +0 -7
  504. package/dist/zod-generator-D481JjzD.mjs.map +0 -1
  505. /package/dist/{api-tokens-BVH-H8Z9.mjs → api-tokens-B4BQybOp.mjs} +0 -0
  506. /package/dist/{ssrf-Cz1e2QPn.mjs → ssrf-CcX9zvMK.mjs} +0 -0
  507. /package/dist/{types-Bfr2Pj6z.mjs → types-BvbeGEtr.mjs} +0 -0
@@ -2,7 +2,7 @@ import { i as runMigrations, t as MIGRATION_RACE_WAIT_MS } from "../runner-DYYnW
2
2
  import { t as validateIdentifier } from "../validate-VPnKoIzW.mjs";
3
3
  import { o as isSqlite } from "../dialect-helpers-DRI5pyY3.mjs";
4
4
  import { i as setI18nConfig } from "../config-CVssduLe.mjs";
5
- import { _ as resolveExclusiveHooks, g as createHookPipeline, m as EmailPipeline, p as PluginRouteRegistry, t as getMenu, v as definePlugin } from "../menus-DOs1MQJg.mjs";
5
+ import { _ as resolveExclusiveHooks, g as createHookPipeline, m as EmailPipeline, p as PluginRouteRegistry, t as getMenu, v as definePlugin } from "../menus-DS8VTZgo.mjs";
6
6
  import { t as after } from "../after-B1IIdH3Y.mjs";
7
7
  import { createRequestMetrics, getRequestContext, runWithContext } from "../request-context.mjs";
8
8
  import "../object-cache-SEb2IM4Z.mjs";
@@ -14,68 +14,69 @@ import "../user-Db-Rti_z.mjs";
14
14
  import "../taxonomy-B2HQuVf5.mjs";
15
15
  import "../comment-80UyJJUR.mjs";
16
16
  import { t as OptionsRepository } from "../options-DTTML-Tx.mjs";
17
- import "../context-f1__jpzF.mjs";
17
+ import "../context-B1W8soLv.mjs";
18
18
  import "../menus-CYs0WZoL.mjs";
19
19
  import "../redirect-Bifv_yHv.mjs";
20
20
  import { i as setRequestCacheEntry, r as requestCached } from "../request-cache-KCNHp_RJ.mjs";
21
21
  import "../byline-registry-BOjqDOim.mjs";
22
22
  import { n as initWithLock, t as createInitLock } from "../init-lock-6b309ZrF.mjs";
23
- import "../byline-CC0WS4Gu.mjs";
24
- import { n as normalizeMediaValue } from "../normalize-Uam4_Vkr.mjs";
25
- import "../placeholder-CIDCpyEY.mjs";
26
- import "../seo-Cu47j3mJ.mjs";
27
- import { n as isMissingTableError } from "../db-errors-CrC5w3Jz.mjs";
28
- import { $ as handleContentGet, B as handleMediaUpdate, G as handleContentAuthors, H as handleRevisionList, I as handleMediaCreate, J as handleContentCountTrashed, K as handleContentCompare, L as handleMediaDelete, Q as handleContentDuplicate, R as handleMediaGet, S as PluginStateRepository, U as handleRevisionRestore, V as handleRevisionGet, X as handleContentDelete, Y as handleContentCreate, Z as handleContentDiscardDraft, _ as loadBundleFromR2, at as handleContentRestore, ct as handleContentUnpublish, dt as validateRev, et as handleContentGetIncludingTrashed, it as handleContentPublish, lt as handleContentUnschedule, nt as handleContentListTrashed, ot as handleContentSchedule, q as handleContentCountScheduled, rt as handleContentPermanentDelete, s as normalizeRegistryConfig, st as handleContentTranslations, tt as handleContentList, ut as handleContentUpdate, z as handleMediaList } from "../api-BDuM4bEy.mjs";
29
- import "../dashboard-BOESNcwE.mjs";
30
- import { n as hashString } from "../hash-BowcuPwv.mjs";
31
- import { t as FTSManager } from "../fts-manager-DtiWqwNJ.mjs";
32
- import { n as SchemaRegistry } from "../registry-CjK96fHD.mjs";
23
+ import "../field-defs-cache-ztrdzUGb.mjs";
24
+ import "../byline-DVo-liaP.mjs";
25
+ import { n as normalizeMediaValue } from "../normalize-ClbNIenm.mjs";
26
+ import "../placeholder-B0s2mWu5.mjs";
27
+ import "../seo-4FovMwNS.mjs";
28
+ import { n as isMissingTableError } from "../db-errors-UXB1CK42.mjs";
29
+ import { $ as handleContentGet, B as handleMediaUpdate, G as handleContentAuthors, H as handleRevisionList, I as handleMediaCreate, J as handleContentCountTrashed, K as handleContentCompare, L as handleMediaDelete, Q as handleContentDuplicate, R as handleMediaGet, S as PluginStateRepository, U as handleRevisionRestore, V as handleRevisionGet, X as handleContentDelete, Y as handleContentCreate, Z as handleContentDiscardDraft, _ as loadBundleFromR2, at as handleContentRestore, ct as handleContentUnpublish, dt as validateRev, et as handleContentGetIncludingTrashed, it as handleContentPublish, lt as handleContentUnschedule, nt as handleContentListTrashed, ot as handleContentSchedule, q as handleContentCountScheduled, rt as handleContentPermanentDelete, s as normalizeRegistryConfig, st as handleContentTranslations, tt as handleContentList, ut as handleContentUpdate, z as handleMediaList } from "../api-BQ_yKRdG.mjs";
30
+ import "../dashboard-CYjpQZ6-.mjs";
31
+ import { n as hashString } from "../hash-DrvzIXcz.mjs";
32
+ import { t as FTSManager } from "../fts-manager-CQuHt-vS.mjs";
33
+ import { n as SchemaRegistry } from "../registry-CK1SS6pi.mjs";
33
34
  import { createRecorder, flushRecorder, isInstrumentationEnabled, kyselyLogOption } from "../database/instrumentation.mjs";
34
- import { r as getDb } from "../loader-C8Z48Uof.mjs";
35
- import "../schema-5z2Jfnbm.mjs";
36
- import "../zod-generator-D481JjzD.mjs";
37
- import "../seo-DRnqnstF.mjs";
38
- import "../sections-DWYZo6HK.mjs";
39
- import { r as singleFlightCached, t as createSingleFlightCache } from "../single-flight-cache-B5p5cNOL.mjs";
40
- import { i as getSiteSettings, o as invalidateSiteSettingsCache } from "../settings-yaxu9mU-.mjs";
41
- import "../settings-DUrVDN0c.mjs";
42
- import "../resolve-CpbBglV0.mjs";
43
- import { a as getTaxonomyDefs, o as getTaxonomyTerms } from "../taxonomies-Be9B1jEj.mjs";
44
- import "../taxonomies-CJmkEpdS.mjs";
45
- import { r as normalizeManifestRoute } from "../manifest-schema-DDSbwkAL.mjs";
46
- import "../types-Bfr2Pj6z.mjs";
47
- import "../ssrf-B0VeRLrp.mjs";
48
- import "../error-BQ1pxs0L.mjs";
49
- import "../parse-qrHlnzTy.mjs";
50
- import "../redirects-DUvXgzCX.mjs";
51
- import "../byline-fields-53i9Et0x.mjs";
52
- import "../status-CB2basWJ.mjs";
53
- import { a as invalidateUrlPatternCache } from "../query-B1RVFUNM.mjs";
54
- import "../import-DqSGOlmR.mjs";
55
- import { t as getTrustedProxyHeaders } from "../trusted-proxy-DY1_UqHr.mjs";
56
- import { n as sanitizeHeadersForSandbox, t as extractRequestMeta } from "../request-meta-ei3ATilC.mjs";
57
- import "../ssrf-Cz1e2QPn.mjs";
58
- import { n as CronExecutor } from "../cron-CQPxBjYs.mjs";
59
- import { r as devConsoleEmailDeliver, t as DEV_CONSOLE_EMAIL_PLUGIN_ID } from "../email-console-B9VS6eN4.mjs";
60
- import "../utils-LbHcSRTj.mjs";
61
- import "../tokens-BvrJvIB6.mjs";
62
- import "../preview-IDye9SPQ.mjs";
63
- import "../comment-reaction-B6AdcpXw.mjs";
64
- import "../bylines-CCO1CYnH.mjs";
65
- import { n as getWidgetAreas } from "../widgets-8GONuRHo.mjs";
66
- import "../apply-wDqQoxX4.mjs";
67
- import "../load-Dtoo7KcJ.mjs";
68
- import "../search-D9FkoM-k.mjs";
35
+ import { a as getDb } from "../loader-Dn74CG1b.mjs";
36
+ import "../schema-CbFRFoM7.mjs";
37
+ import "../zod-generator-ElVQOav7.mjs";
38
+ import "../seo-DCEF-AVr.mjs";
39
+ import "../sections-osX9U-YJ.mjs";
40
+ import { r as singleFlightCached, t as createSingleFlightCache } from "../single-flight-cache-Cdfkic3t.mjs";
41
+ import { i as getSiteSettings, o as invalidateSiteSettingsCache } from "../settings-t-H2jPuJ.mjs";
42
+ import "../settings-4bRT2NIf.mjs";
43
+ import "../resolve-C7I0qiR0.mjs";
44
+ import { a as getTaxonomyDefs, o as getTaxonomyTerms } from "../taxonomies-Dxrc_szG.mjs";
45
+ import "../taxonomies-BBB8O-CU.mjs";
46
+ import { r as normalizeManifestRoute } from "../manifest-schema-BWKnQYQF.mjs";
47
+ import "../types-BvbeGEtr.mjs";
48
+ import "../ssrf-BRKb343l.mjs";
49
+ import "../error-Bl6kZgtt.mjs";
50
+ import "../parse-C9hpjUyY.mjs";
51
+ import "../redirects-x9eFPeyi.mjs";
52
+ import "../byline-fields-B-KXkg5R.mjs";
53
+ import "../status-vUK0SA17.mjs";
54
+ import { a as invalidateUrlPatternCache } from "../query-DgUHZLWB.mjs";
55
+ import "../import-Bb1T9WJS.mjs";
56
+ import { t as getTrustedProxyHeaders } from "../trusted-proxy-DZY5WCn2.mjs";
57
+ import { n as sanitizeHeadersForSandbox, t as extractRequestMeta } from "../request-meta-CmS1tDFf.mjs";
58
+ import "../ssrf-CcX9zvMK.mjs";
59
+ import { n as CronExecutor } from "../cron-C5LVoNmP.mjs";
60
+ import { r as devConsoleEmailDeliver, t as DEV_CONSOLE_EMAIL_PLUGIN_ID } from "../email-console-DJP32ucW.mjs";
61
+ import "../utils-B7A57fm9.mjs";
62
+ import "../tokens-LeuXF9gG.mjs";
63
+ import "../preview-DKGCt2_p.mjs";
64
+ import "../comment-reaction-Dyb-AutY.mjs";
65
+ import "../bylines-f5ppBpD5.mjs";
66
+ import { n as getWidgetAreas } from "../widgets-BSTzPUYa.mjs";
67
+ import "../apply-CWRyxIoO.mjs";
68
+ import "../load-BNo-ER8C.mjs";
69
+ import "../search-C-waE_YW.mjs";
69
70
  import "../index.mjs";
70
- import { n as VERSION, t as COMMIT } from "../version-RnYXYjzD.mjs";
71
- import { t as getAuthMode } from "../mode-CFh8Dw8G.mjs";
72
- import { t as cleanupExpiredChallenges } from "../challenge-store-C6E_kWTs.mjs";
73
- import { a as validateEncryptionKeyAtStartup } from "../secrets-BUE5UQys.mjs";
74
- import { t as resolveSessionUser } from "../session-user-DmtPMNa1.mjs";
71
+ import { n as VERSION, t as COMMIT } from "../version-BgVM_1MU.mjs";
72
+ import { t as getAuthMode } from "../mode-BB0F8xTC.mjs";
73
+ import { t as cleanupExpiredChallenges } from "../challenge-store-LhiqMccz.mjs";
74
+ import { a as validateEncryptionKeyAtStartup } from "../secrets-BSf9pRRY.mjs";
75
+ import { t as resolveSessionUser } from "../session-user-B8aLtKAH.mjs";
75
76
  import { Kysely, sql } from "kysely";
76
77
  import { defineMiddleware } from "astro:middleware";
77
78
  import virtualConfig from "virtual:emdash/config";
78
- import { createDialect, createRequestScopedDb } from "virtual:emdash/dialect";
79
+ import { createCoalescingDialect, createDialect, createRequestScopedDb } from "virtual:emdash/dialect";
79
80
  import { mediaProviders } from "virtual:emdash/media-providers";
80
81
  import { plugins } from "virtual:emdash/plugins";
81
82
  import * as virtualSandboxRunnerModule from "virtual:emdash/sandbox-runner";
@@ -373,6 +374,25 @@ function getDbHolder() {
373
374
  }
374
375
  return holder;
375
376
  }
377
+ /**
378
+ * Auto-seed runs at most once per isolate per database. Its lock + "done" set
379
+ * live on globalThis (same bundler-duplication reasoning as the db cache) so a
380
+ * reclaimed-and-rerun `create()` can't seed a second time concurrently. The
381
+ * lock polls rather than sharing a promise, so it is safe to await across a
382
+ * cancelled owner in workerd.
383
+ */
384
+ const SEED_HOLDER_KEY = Symbol.for("emdash:seed-state");
385
+ function getSeedHolder() {
386
+ let holder = globalSymbolStore[SEED_HOLDER_KEY];
387
+ if (!holder) {
388
+ holder = {
389
+ done: /* @__PURE__ */ new Set(),
390
+ lock: createInitLock()
391
+ };
392
+ globalSymbolStore[SEED_HOLDER_KEY] = holder;
393
+ }
394
+ return holder;
395
+ }
376
396
  const storageCache = /* @__PURE__ */ new Map();
377
397
  const sandboxedPluginCache = /* @__PURE__ */ new Map();
378
398
  /**
@@ -406,7 +426,20 @@ var EmDashRuntime = class EmDashRuntime {
406
426
  configuredPlugins;
407
427
  sandboxedPlugins;
408
428
  sandboxedPluginEntries;
409
- schemaRegistry;
429
+ /**
430
+ * Schema registry bound to the current request/event-scoped connection.
431
+ * Built per access (SchemaRegistry just wraps a db) against `this.db`, the
432
+ * ALS-aware getter — never a captured snapshot of the singleton. On a
433
+ * connection-backed adapter (Postgres over Hyperdrive) a captured singleton
434
+ * would query a socket opened by an earlier event and trip workerd's
435
+ * cross-request I/O guard; the catch in handlers like handleContentUpdate
436
+ * would then silently treat a revision-enabled collection as non-revisioned
437
+ * and write draft edits to live columns. Same reasoning as the per-call
438
+ * registry in _buildManifest().
439
+ */
440
+ get schemaRegistry() {
441
+ return new SchemaRegistry(this.db);
442
+ }
410
443
  _hooks;
411
444
  config;
412
445
  mediaProviders;
@@ -454,7 +487,6 @@ var EmDashRuntime = class EmDashRuntime {
454
487
  this.configuredPlugins = parts.configuredPlugins;
455
488
  this.sandboxedPlugins = parts.sandboxedPlugins;
456
489
  this.sandboxedPluginEntries = parts.sandboxedPluginEntries;
457
- this.schemaRegistry = new SchemaRegistry(parts.db);
458
490
  this._hooks = parts.hooks;
459
491
  this.enabledPlugins = parts.enabledPlugins;
460
492
  this.pluginStates = parts.pluginStates;
@@ -571,10 +603,7 @@ var EmDashRuntime = class EmDashRuntime {
571
603
  async rebuildHookPipeline() {
572
604
  const newPipeline = createHookPipeline(this.allPipelinePlugins.filter((p) => this.enabledPlugins.has(p.id)), this.pipelineFactoryOptions);
573
605
  await EmDashRuntime.resolveExclusiveHooks(newPipeline, this.db, this.runtimeDeps);
574
- if (this.email) newPipeline.setContextFactory({
575
- db: this.db,
576
- emailPipeline: this.email
577
- });
606
+ if (this.email) newPipeline.setContextFactory({ emailPipeline: this.email });
578
607
  if (this.cronScheduler) {
579
608
  const scheduler = this.cronScheduler;
580
609
  newPipeline.setContextFactory({ cronReschedule: () => scheduler.reschedule() });
@@ -824,29 +853,100 @@ var EmDashRuntime = class EmDashRuntime {
824
853
  }
825
854
  };
826
855
  const db = await phase("rt.db", "DB init + migrations", () => EmDashRuntime.getDatabase(deps));
856
+ const resolveDb = () => {
857
+ return getRequestContext()?.db ?? db;
858
+ };
827
859
  await phase("rt.secrets", "Validate encryption key", () => validateEncryptionKeyAtStartup());
828
860
  const storage = EmDashRuntime.getStorage(deps);
829
861
  let pluginStates = /* @__PURE__ */ new Map();
830
862
  let siteInfo;
831
- await Promise.all([phase("rt.plugins", "Plugin states", async () => {
863
+ let seedGate = {
864
+ collectionCount: 1,
865
+ setupDone: true
866
+ };
867
+ const reqCtx = getRequestContext();
868
+ const ownsConfiguredDb = !!deps.config.database && !(reqCtx?.dbIsIsolated && reqCtx.db);
869
+ let readDb = db;
870
+ let readDbDisposable;
871
+ if (ownsConfiguredDb && deps.createCoalescingDialect && deps.config.database) try {
872
+ const dialect = deps.createCoalescingDialect(deps.config.database.config);
873
+ if (dialect) {
874
+ readDb = new Kysely({
875
+ dialect,
876
+ log: kyselyLogOption()
877
+ });
878
+ readDbDisposable = readDb;
879
+ }
880
+ } catch {
881
+ readDb = db;
882
+ }
883
+ const optionsRepo = new OptionsRepository(readDb);
884
+ const readSiteInfo = async () => {
885
+ const siteOpts = await optionsRepo.getMany([
886
+ "emdash:site_title",
887
+ "emdash:site_url",
888
+ "emdash:locale"
889
+ ]);
890
+ return {
891
+ siteName: siteOpts.get("emdash:site_title") ?? void 0,
892
+ siteUrl: siteOpts.get("emdash:site_url") ?? void 0,
893
+ locale: siteOpts.get("emdash:locale") ?? void 0
894
+ };
895
+ };
896
+ const coldStartReads = [phase("rt.plugins", "Plugin states", async () => {
832
897
  try {
833
- const states = await db.selectFrom("_plugin_state").select(["plugin_id", "status"]).execute();
898
+ const states = await readDb.selectFrom("_plugin_state").select(["plugin_id", "status"]).execute();
834
899
  pluginStates = new Map(states.map((s) => [s.plugin_id, s.status]));
835
900
  } catch {}
836
901
  }), phase("rt.site", "Site info options", async () => {
837
902
  try {
838
- const siteOpts = await new OptionsRepository(db).getMany([
839
- "emdash:site_title",
840
- "emdash:site_url",
841
- "emdash:locale"
842
- ]);
843
- siteInfo = {
844
- siteName: siteOpts.get("emdash:site_title") ?? void 0,
845
- siteUrl: siteOpts.get("emdash:site_url") ?? void 0,
846
- locale: siteOpts.get("emdash:locale") ?? void 0
903
+ siteInfo = await readSiteInfo();
904
+ } catch {}
905
+ })];
906
+ if (ownsConfiguredDb) coldStartReads.push(phase("rt.seedcheck", "Auto-seed gate", async () => {
907
+ try {
908
+ const [collectionCount, setupOption] = await Promise.all([readDb.selectFrom("_emdash_collections").select((eb) => eb.fn.countAll().as("count")).executeTakeFirstOrThrow(), readDb.selectFrom("options").select("value").where("name", "=", "emdash:setup_complete").executeTakeFirst()]);
909
+ const setupDone = (() => {
910
+ try {
911
+ return !!setupOption && JSON.parse(setupOption.value) === true;
912
+ } catch {
913
+ return false;
914
+ }
915
+ })();
916
+ seedGate = {
917
+ collectionCount: collectionCount.count,
918
+ setupDone
847
919
  };
848
920
  } catch {}
849
- })]);
921
+ }));
922
+ await Promise.all(coldStartReads);
923
+ if (seedGate.collectionCount === 0 && !seedGate.setupDone) {
924
+ const seedKey = deps.config.database?.entrypoint ?? "default";
925
+ const seedHolder = getSeedHolder();
926
+ try {
927
+ await initWithLock(seedHolder.lock, () => seedHolder.done.has(seedKey) ? true : void 0, async () => {
928
+ const { applySeed } = await import("../apply-CWRyxIoO.mjs").then((n) => n.n);
929
+ const { loadSeed } = await import("../load-BNo-ER8C.mjs").then((n) => n.r);
930
+ const { validateSeed } = await import("../validate-0Utjspbs.mjs").then((n) => n.n);
931
+ const seed = await loadSeed();
932
+ if (validateSeed(seed).valid) {
933
+ await applySeed(db, seed, { onConflict: "skip" });
934
+ console.log("Auto-seeded default collections");
935
+ }
936
+ seedHolder.done.add(seedKey);
937
+ return true;
938
+ }, {
939
+ deadlineMs: DB_INIT_DEADLINE_MS,
940
+ anchor: (promise) => after(() => promise)
941
+ });
942
+ try {
943
+ siteInfo = await readSiteInfo();
944
+ } catch {}
945
+ } catch {}
946
+ }
947
+ if (readDbDisposable) try {
948
+ await readDbDisposable.destroy();
949
+ } catch {}
850
950
  const enabledPlugins = /* @__PURE__ */ new Set();
851
951
  for (const plugin of deps.plugins) {
852
952
  const status = pluginStates.get(plugin.id);
@@ -907,6 +1007,7 @@ var EmDashRuntime = class EmDashRuntime {
907
1007
  const enabledPluginList = allPipelinePlugins.filter((p) => enabledPlugins.has(p.id));
908
1008
  const pipelineFactoryOptions = {
909
1009
  db,
1010
+ getDb: resolveDb,
910
1011
  storage: storage ?? void 0,
911
1012
  siteInfo
912
1013
  };
@@ -920,7 +1021,8 @@ var EmDashRuntime = class EmDashRuntime {
920
1021
  const mediaProviderEntries = deps.mediaProviderEntries ?? [];
921
1022
  const providerContext = {
922
1023
  db,
923
- storage
1024
+ storage,
1025
+ getDb: resolveDb
924
1026
  };
925
1027
  for (const entry of mediaProviderEntries) try {
926
1028
  const provider = entry.createProvider(providerContext);
@@ -936,16 +1038,13 @@ var EmDashRuntime = class EmDashRuntime {
936
1038
  const result = await pipelineRef.current.invokeCronHook(pluginId, event);
937
1039
  if (!result.success && result.error) throw result.error;
938
1040
  };
939
- pipeline.setContextFactory({
940
- db,
941
- emailPipeline
942
- });
1041
+ pipeline.setContextFactory({ emailPipeline });
943
1042
  let cronExecutor = null;
944
1043
  let cronScheduler = null;
945
1044
  const runtimeRef = { current: null };
946
1045
  await phase("rt.cron", "Cron init (recovery deferred post-response)", async () => {
947
1046
  try {
948
- cronExecutor = new CronExecutor(db, invokeCronHook);
1047
+ cronExecutor = new CronExecutor(resolveDb, invokeCronHook);
949
1048
  const executorForRecovery = cronExecutor;
950
1049
  after(async () => {
951
1050
  try {
@@ -1038,26 +1137,6 @@ var EmDashRuntime = class EmDashRuntime {
1038
1137
  log: kyselyLogOption()
1039
1138
  });
1040
1139
  await runMigrations(db);
1041
- try {
1042
- 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()]);
1043
- const setupDone = (() => {
1044
- try {
1045
- return setupOption && JSON.parse(setupOption.value) === true;
1046
- } catch {
1047
- return false;
1048
- }
1049
- })();
1050
- if (collectionCount.count === 0 && !setupDone) {
1051
- const { applySeed } = await import("../apply-wDqQoxX4.mjs").then((n) => n.n);
1052
- const { loadSeed } = await import("../load-Dtoo7KcJ.mjs").then((n) => n.r);
1053
- const { validateSeed } = await import("../validate-Bwl64sxv.mjs").then((n) => n.n);
1054
- const seed = await loadSeed();
1055
- if (validateSeed(seed).valid) {
1056
- await applySeed(db, seed, { onConflict: "skip" });
1057
- console.log("Auto-seeded default collections");
1058
- }
1059
- }
1060
- } catch {}
1061
1140
  if (isCurrentClaim()) holder.cache.set(cacheKey, db);
1062
1141
  return db;
1063
1142
  }, {
@@ -1584,7 +1663,7 @@ var EmDashRuntime = class EmDashRuntime {
1584
1663
  if (this.hooks.hasHooks("content:beforeSave")) processedData = (await this.hooks.runContentBeforeSave(body.data, collection, true)).content;
1585
1664
  processedData = await this.runSandboxedBeforeSave(processedData, collection, true);
1586
1665
  processedData = await this.normalizeMediaFields(collection, processedData);
1587
- const { validateContentData } = await import("../validation-C_yOvFaO.mjs");
1666
+ const { validateContentData } = await import("../validation-D9EnzH1T.mjs");
1588
1667
  const validation = await validateContentData(this.db, collection, processedData, { partial: false });
1589
1668
  if (!validation.ok) return {
1590
1669
  success: false,
@@ -1627,7 +1706,7 @@ var EmDashRuntime = class EmDashRuntime {
1627
1706
  if (this.hooks.hasHooks("content:beforeSave")) processedData = (await this.hooks.runContentBeforeSave(bodyWithoutRev.data, collection, false)).content;
1628
1707
  processedData = await this.runSandboxedBeforeSave(processedData, collection, false);
1629
1708
  processedData = await this.normalizeMediaFields(collection, processedData);
1630
- const { validateContentData } = await import("../validation-C_yOvFaO.mjs");
1709
+ const { validateContentData } = await import("../validation-D9EnzH1T.mjs");
1631
1710
  const validation = await validateContentData(this.db, collection, processedData, { partial: true });
1632
1711
  if (!validation.ok) return {
1633
1712
  success: false,
@@ -1883,6 +1962,7 @@ var EmDashRuntime = class EmDashRuntime {
1883
1962
  if (trustedPlugin && this.enabledPlugins.has(trustedPlugin.id)) {
1884
1963
  const routeRegistry = new PluginRouteRegistry({
1885
1964
  db: this.db,
1965
+ storage: this.storage ?? void 0,
1886
1966
  emailPipeline: this.email ?? void 0,
1887
1967
  trustedProxyHeaders: getTrustedProxyHeaders(this.config)
1888
1968
  });
@@ -2167,6 +2247,120 @@ function createPublicMediaUrlResolver(storage) {
2167
2247
  return (key) => resolvePublicMediaUrl(storage, key);
2168
2248
  }
2169
2249
 
2250
+ //#endregion
2251
+ //#region src/astro/middleware/scoped-db.ts
2252
+ /**
2253
+ * Request-scoped database lifecycle helpers.
2254
+ *
2255
+ * Extracted from middleware.ts so they can be unit-tested without pulling in
2256
+ * the virtual:emdash/* module graph. The middleware imports these to settle a
2257
+ * request-scoped db adapter's lifecycle around the response.
2258
+ */
2259
+ /**
2260
+ * Astro attaches AstroCookies to outgoing responses via a well-known global
2261
+ * symbol. Cloning a Response (`new Response(body, init)`) drops non-header
2262
+ * metadata, so any helper that wraps the response must explicitly forward this
2263
+ * symbol or `cookies.set()` calls will be silently dropped. `Symbol.for`
2264
+ * returns the same registry symbol everywhere, so this matches the copy in
2265
+ * middleware.ts.
2266
+ */
2267
+ const ASTRO_COOKIES_SYMBOL = Symbol.for("astro.cookies");
2268
+ /**
2269
+ * Run a request-scoped db's `close()` once the response body has finished
2270
+ * streaming. Astro streams HTML and components issue DB queries during that
2271
+ * stream, so a connection-backed adapter (e.g. Postgres over Hyperdrive) must
2272
+ * not be torn down until the body is flushed. Bodyless responses (redirects,
2273
+ * 304s, errors) close immediately. A guard makes close idempotent and a stream
2274
+ * `cancel` (client disconnect) still triggers it so connections never leak.
2275
+ *
2276
+ * No-op for adapters without a `close` (D1): the response passes through.
2277
+ */
2278
+ function wrapResponseForScopedClose(response, close) {
2279
+ let closed = false;
2280
+ const runClose = () => {
2281
+ if (closed) return;
2282
+ closed = true;
2283
+ try {
2284
+ close();
2285
+ } catch (error) {
2286
+ console.error("[emdash] request-scoped db close failed:", error);
2287
+ }
2288
+ };
2289
+ if (!response.body) {
2290
+ runClose();
2291
+ return response;
2292
+ }
2293
+ const transform = new TransformStream({
2294
+ flush: runClose,
2295
+ cancel: runClose
2296
+ });
2297
+ const wrapped = new Response(response.body.pipeThrough(transform), response);
2298
+ const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL);
2299
+ if (astroCookies !== void 0) Reflect.set(wrapped, ASTRO_COOKIES_SYMBOL, astroCookies);
2300
+ wrapped.headers.delete("Content-Length");
2301
+ return wrapped;
2302
+ }
2303
+ /**
2304
+ * Run the request body under a request-scoped db, then settle its lifecycle:
2305
+ * `commit()` runs before the response is returned (so per-request state like a
2306
+ * D1 bookmark cookie is persisted in the headers, even if render throws), while
2307
+ * `close()` (if any) is deferred to stream-end so a connection-backed adapter
2308
+ * isn't torn down mid-render. On error the connection is closed immediately
2309
+ * before rethrowing so it never leaks.
2310
+ *
2311
+ * On the error path both `commit()` and `close()` are defended: a throw from
2312
+ * either is logged and swallowed so it can't replace the propagating render
2313
+ * error (which is the one the caller needs to see). On the success path
2314
+ * `commit()` is guarded too — if it throws, the connection is closed before the
2315
+ * failure is surfaced, so it never leaks. For the current adapters `commit()`
2316
+ * is a no-op (Hyperdrive) or a cookie write (D1, no `close`) and `close()` is
2317
+ * fire-and-forget, so these guards only matter for a future connection-backed
2318
+ * adapter with throwing teardown, but the helper is generic and must not leak
2319
+ * or mask.
2320
+ */
2321
+ async function finishScoped(scoped, run) {
2322
+ let response;
2323
+ try {
2324
+ response = await run();
2325
+ } catch (error) {
2326
+ commitSafely(scoped.commit);
2327
+ closeSafely(scoped.close);
2328
+ throw error;
2329
+ }
2330
+ try {
2331
+ scoped.commit();
2332
+ } catch (error) {
2333
+ closeSafely(scoped.close);
2334
+ throw error;
2335
+ }
2336
+ return scoped.close ? wrapResponseForScopedClose(response, scoped.close) : response;
2337
+ }
2338
+ /**
2339
+ * Run commit() swallowing any error. Used where an exception is already
2340
+ * propagating (or about to be thrown) and a commit failure must neither mask it
2341
+ * nor skip the subsequent close().
2342
+ */
2343
+ function commitSafely(commit) {
2344
+ try {
2345
+ commit();
2346
+ } catch (error) {
2347
+ console.error("[emdash] request-scoped db commit failed during error handling:", error);
2348
+ }
2349
+ }
2350
+ /**
2351
+ * Run close() swallowing any error. Used on the error/commit-failure paths
2352
+ * where another exception is the one the caller must see; a throwing teardown
2353
+ * must not replace it.
2354
+ */
2355
+ function closeSafely(close) {
2356
+ if (!close) return;
2357
+ try {
2358
+ close();
2359
+ } catch (error) {
2360
+ console.error("[emdash] request-scoped db close failed during error handling:", error);
2361
+ }
2362
+ }
2363
+
2170
2364
  //#endregion
2171
2365
  //#region src/astro/middleware/stream-end-metrics.ts
2172
2366
  /**
@@ -2190,13 +2384,6 @@ function createPublicMediaUrlResolver(storage) {
2190
2384
  */
2191
2385
  const STREAM_END_PREFIX = "[emdash-stream-end]";
2192
2386
  /**
2193
- * Astro attaches AstroCookies to outgoing responses via a well-known global
2194
- * symbol. Constructing a new Response drops non-header metadata, so the
2195
- * symbol must be forwarded explicitly or `cookies.set()` calls are silently
2196
- * dropped. Same pattern as finalizeResponse in ../middleware.ts.
2197
- */
2198
- const ASTRO_COOKIES_SYMBOL$1 = Symbol.for("astro.cookies");
2199
- /**
2200
2387
  * Wrap a response body so the FINAL request metrics are emitted when the
2201
2388
  * body finishes streaming. Returns the response unchanged when
2202
2389
  * instrumentation is disabled, the body is null, or no request metrics
@@ -2227,8 +2414,8 @@ function wrapBodyForStreamMetrics(response) {
2227
2414
  if (recorder) flushRecorder(recorder);
2228
2415
  } });
2229
2416
  const wrapped = new Response(response.body.pipeThrough(transform), response);
2230
- const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL$1);
2231
- if (astroCookies !== void 0) Reflect.set(wrapped, ASTRO_COOKIES_SYMBOL$1, astroCookies);
2417
+ const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL);
2418
+ if (astroCookies !== void 0) Reflect.set(wrapped, ASTRO_COOKIES_SYMBOL, astroCookies);
2232
2419
  wrapped.headers.delete("Content-Length");
2233
2420
  return wrapped;
2234
2421
  }
@@ -2401,6 +2588,7 @@ function buildDependencies(config) {
2401
2588
  config,
2402
2589
  plugins: getPlugins(),
2403
2590
  createDialect,
2591
+ createCoalescingDialect,
2404
2592
  createStorage,
2405
2593
  createScheduler,
2406
2594
  sandboxEnabled: sandboxModule.sandboxEnabled,
@@ -2450,15 +2638,56 @@ async function getRuntime(config, initTimings) {
2450
2638
  async function runScheduledTasks(options = {}) {
2451
2639
  const config = getConfig();
2452
2640
  if (!config) return { published: [] };
2453
- return (await getRuntime(config)).runScheduledTasks(options);
2641
+ const runtime = await getRuntime(config);
2642
+ const scoped = createRequestScopedDb$1({
2643
+ config: config.database?.config,
2644
+ isAuthenticated: false,
2645
+ isWrite: true,
2646
+ cookies: NOOP_COOKIE_JAR,
2647
+ url: CRON_EVENT_URL
2648
+ });
2649
+ if (!scoped?.close) return runtime.runScheduledTasks(options);
2650
+ const parent = getRequestContext();
2651
+ const ctx = parent ? {
2652
+ ...parent,
2653
+ db: scoped.db
2654
+ } : {
2655
+ editMode: false,
2656
+ db: scoped.db,
2657
+ metrics: createRequestMetrics(performance.now())
2658
+ };
2659
+ try {
2660
+ return await runWithContext(ctx, () => runtime.runScheduledTasks(options));
2661
+ } finally {
2662
+ try {
2663
+ scoped.commit();
2664
+ } catch (error) {
2665
+ console.error("[scheduled] request-scoped db commit failed:", error);
2666
+ }
2667
+ try {
2668
+ scoped.close();
2669
+ } catch (error) {
2670
+ console.error("[scheduled] request-scoped db close failed:", error);
2671
+ }
2672
+ }
2454
2673
  }
2455
2674
  /**
2456
- * Astro attaches AstroCookies to outgoing responses via a well-known global
2457
- * symbol. Cloning a Response (`new Response(body, init)`) drops non-header
2458
- * metadata, so any middleware that wraps the response must explicitly forward
2459
- * this symbol or `cookies.set()` calls will be silently dropped.
2675
+ * A cookie jar that reads nothing and writes nothing, for request-scoped db
2676
+ * adapters invoked outside an HTTP request (the Cron Trigger sweep). Connection
2677
+ * adapters like Hyperdrive ignore cookies entirely; the D1 session adapter
2678
+ * reads/writes a bookmark cookie, but cron never reaches that path (it has no
2679
+ * `close()`), so the no-ops are never observed.
2460
2680
  */
2461
- const ASTRO_COOKIES_SYMBOL = Symbol.for("astro.cookies");
2681
+ const NOOP_COOKIE_JAR = {
2682
+ get: () => void 0,
2683
+ set: () => {}
2684
+ };
2685
+ /**
2686
+ * Synthetic URL for the cron sweep's request-scoped db opts. Only the D1
2687
+ * session adapter inspects `url` (for cookie `secure`), and cron doesn't take
2688
+ * that path, so the value is never used — it exists to satisfy the contract.
2689
+ */
2690
+ const CRON_EVENT_URL = new URL("https://cron.emdash.internal/");
2462
2691
  /**
2463
2692
  * Baseline security headers applied to all responses.
2464
2693
  * Admin routes get additional headers (strict CSP) from auth middleware.
@@ -2561,7 +2790,7 @@ const onRequest = defineMiddleware(async (context, next) => {
2561
2790
  if (!isSetupVerified() && !context.isPrerendered) {
2562
2791
  const t0 = performance.now();
2563
2792
  try {
2564
- const { getDb } = await import("../loader-C8Z48Uof.mjs").then((n) => n.i);
2793
+ const { getDb } = await import("../loader-Dn74CG1b.mjs").then((n) => n.o);
2565
2794
  await (await getDb()).selectFrom("_emdash_migrations").selectAll().limit(1).execute();
2566
2795
  markSetupVerified();
2567
2796
  } catch (error) {
@@ -2632,11 +2861,7 @@ const onRequest = defineMiddleware(async (context, next) => {
2632
2861
  const acceptsHtml = (request.headers.get("accept") ?? "").split(",", 1)[0].trim().startsWith("text/html");
2633
2862
  return runWithContext(ctx, async () => {
2634
2863
  if (acceptsHtml) after(() => prefetchLayoutData());
2635
- try {
2636
- return await runAnon();
2637
- } finally {
2638
- anonScoped.commit();
2639
- }
2864
+ return finishScoped(anonScoped, runAnon);
2640
2865
  });
2641
2866
  }
2642
2867
  return runAnon();
@@ -2698,7 +2923,9 @@ const onRequest = defineMiddleware(async (context, next) => {
2698
2923
  collectPageFragments: runtime.collectPageFragments.bind(runtime),
2699
2924
  ensureSearchHealthy: runtime.ensureSearchHealthy.bind(runtime),
2700
2925
  storage: runtime.storage,
2701
- db: runtime.db,
2926
+ get db() {
2927
+ return runtime.db;
2928
+ },
2702
2929
  getPublicMediaUrl: createPublicMediaUrlResolver(runtime.storage),
2703
2930
  hooks: runtime.hooks,
2704
2931
  email: runtime.email,
@@ -2747,13 +2974,7 @@ const onRequest = defineMiddleware(async (context, next) => {
2747
2974
  editMode: false,
2748
2975
  db: scoped.db,
2749
2976
  metrics
2750
- }, async () => {
2751
- try {
2752
- return await renderAndFinalize();
2753
- } finally {
2754
- scoped.commit();
2755
- }
2756
- });
2977
+ }, () => finishScoped(scoped, renderAndFinalize));
2757
2978
  }
2758
2979
  return renderAndFinalize();
2759
2980
  };