dineway 0.1.47 → 0.1.48

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 (289) hide show
  1. package/README.md +57 -54
  2. package/dist/{activity-events-CNk3clTT.mjs → activity-events-C9u37D5z.mjs} +1 -1
  3. package/dist/api/route-utils.d.mts +8 -22
  4. package/dist/api/route-utils.mjs +8 -8
  5. package/dist/api/schemas/index.d.mts +2 -2
  6. package/dist/api/schemas/index.mjs +3 -3
  7. package/dist/{api-ePsOhL3q.mjs → api-Eiy8_zVZ.mjs} +63 -16
  8. package/dist/{apply-BpRBCqUt.mjs → apply-CX3no7XE.mjs} +54 -48
  9. package/dist/astro/index.d.mts +8 -8
  10. package/dist/astro/index.mjs +67 -25
  11. package/dist/astro/middleware/auth.d.mts +7 -7
  12. package/dist/astro/middleware/auth.mjs +1 -1
  13. package/dist/astro/middleware/redirect.mjs +4 -4
  14. package/dist/astro/middleware/request-context.mjs +2 -2
  15. package/dist/astro/middleware/seed.d.mts +1 -1
  16. package/dist/astro/middleware/seed.mjs +2 -2
  17. package/dist/astro/middleware/setup.mjs +1 -1
  18. package/dist/astro/middleware.d.mts +2 -1
  19. package/dist/astro/middleware.mjs +362 -143
  20. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +2 -2
  21. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +2 -2
  22. package/dist/astro/routes/api/admin/api-tokens/index.mjs +1 -1
  23. package/dist/astro/routes/api/admin/briefing.mjs +14 -14
  24. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +2 -2
  25. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +4 -4
  26. package/dist/astro/routes/api/admin/byline-fields/index.mjs +4 -4
  27. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +4 -4
  28. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +9 -9
  29. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +9 -9
  30. package/dist/astro/routes/api/admin/bylines/index.mjs +9 -9
  31. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +8 -8
  32. package/dist/astro/routes/api/admin/comments/_id_.mjs +3 -3
  33. package/dist/astro/routes/api/admin/comments/bulk.mjs +5 -5
  34. package/dist/astro/routes/api/admin/comments/counts.mjs +3 -3
  35. package/dist/astro/routes/api/admin/comments/index.mjs +5 -5
  36. package/dist/astro/routes/api/admin/context/_id_/history.mjs +20 -20
  37. package/dist/astro/routes/api/admin/context/_id_/index.mjs +20 -20
  38. package/dist/astro/routes/api/admin/context/_id_/review.mjs +23 -23
  39. package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +23 -23
  40. package/dist/astro/routes/api/admin/context/diff.mjs +22 -22
  41. package/dist/astro/routes/api/admin/context/index.mjs +23 -23
  42. package/dist/astro/routes/api/admin/context/stale.mjs +22 -22
  43. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +21 -21
  44. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +23 -23
  45. package/dist/astro/routes/api/admin/hitl-requests/index.mjs +23 -23
  46. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +20 -20
  47. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +1 -1
  48. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +2 -2
  49. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +2 -2
  50. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +40 -40
  51. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +40 -40
  52. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +35 -35
  53. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +40 -40
  54. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +40 -40
  55. package/dist/astro/routes/api/admin/plugins/index.mjs +35 -35
  56. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +35 -35
  57. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +40 -40
  58. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +35 -35
  59. package/dist/astro/routes/api/admin/plugins/updates.mjs +35 -35
  60. package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +3 -3
  61. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +22 -22
  62. package/dist/astro/routes/api/admin/review-requests/index.mjs +5 -5
  63. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +35 -35
  64. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +35 -35
  65. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
  66. package/dist/astro/routes/api/admin/users/_id_/index.mjs +3 -3
  67. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
  68. package/dist/astro/routes/api/admin/users/index.mjs +2 -2
  69. package/dist/astro/routes/api/auth/dev-bypass.mjs +1 -1
  70. package/dist/astro/routes/api/auth/invite/complete.mjs +5 -5
  71. package/dist/astro/routes/api/auth/invite/index.mjs +4 -4
  72. package/dist/astro/routes/api/auth/invite/register-options.mjs +4 -4
  73. package/dist/astro/routes/api/auth/magic-link/send.mjs +4 -4
  74. package/dist/astro/routes/api/auth/me.mjs +5 -5
  75. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  76. package/dist/astro/routes/api/auth/passkey/_id_.mjs +2 -2
  77. package/dist/astro/routes/api/auth/passkey/options.mjs +4 -4
  78. package/dist/astro/routes/api/auth/passkey/register/options.mjs +4 -4
  79. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +5 -5
  80. package/dist/astro/routes/api/auth/passkey/verify.mjs +5 -5
  81. package/dist/astro/routes/api/auth/setup-token/index.mjs +2 -2
  82. package/dist/astro/routes/api/auth/signup/complete.mjs +5 -5
  83. package/dist/astro/routes/api/auth/signup/request.mjs +4 -4
  84. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +9 -9
  85. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +6 -5
  86. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
  87. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
  88. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +4 -4
  89. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +8 -7
  90. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
  91. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +11 -9
  92. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +8 -8
  93. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +6 -5
  94. package/dist/astro/routes/api/content/_collection_/_id_.mjs +8 -7
  95. package/dist/astro/routes/api/content/_collection_/authors.d.mts +7 -0
  96. package/dist/astro/routes/api/content/_collection_/authors.mjs +16 -0
  97. package/dist/astro/routes/api/content/_collection_/index.mjs +5 -5
  98. package/dist/astro/routes/api/content/_collection_/trash.mjs +2 -2
  99. package/dist/astro/routes/api/dashboard.mjs +6 -6
  100. package/dist/astro/routes/api/health.mjs +1 -1
  101. package/dist/astro/routes/api/import/probe.d.mts +2 -2
  102. package/dist/astro/routes/api/import/probe.mjs +2 -2
  103. package/dist/astro/routes/api/import/wordpress/analyze.mjs +3 -3
  104. package/dist/astro/routes/api/import/wordpress/execute.mjs +23 -23
  105. package/dist/astro/routes/api/import/wordpress/media.mjs +4 -4
  106. package/dist/astro/routes/api/import/wordpress/prepare.mjs +26 -26
  107. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +24 -24
  108. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +4 -4
  109. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +24 -24
  110. package/dist/astro/routes/api/manifest.mjs +3 -3
  111. package/dist/astro/routes/api/mcp.mjs +46 -46
  112. package/dist/astro/routes/api/media/_id_/confirm.mjs +4 -4
  113. package/dist/astro/routes/api/media/_id_.mjs +2 -2
  114. package/dist/astro/routes/api/media/upload-url.mjs +4 -4
  115. package/dist/astro/routes/api/media.mjs +4 -4
  116. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +23 -23
  117. package/dist/astro/routes/api/menus/_name_/items.mjs +23 -23
  118. package/dist/astro/routes/api/menus/_name_/reorder.mjs +23 -23
  119. package/dist/astro/routes/api/menus/_name_/translations.mjs +23 -23
  120. package/dist/astro/routes/api/menus/_name_.mjs +23 -23
  121. package/dist/astro/routes/api/menus/index.mjs +23 -23
  122. package/dist/astro/routes/api/oauth/authorize.mjs +3 -3
  123. package/dist/astro/routes/api/oauth/device/authorize.mjs +2 -2
  124. package/dist/astro/routes/api/oauth/device/code.mjs +2 -2
  125. package/dist/astro/routes/api/oauth/device/token.mjs +2 -2
  126. package/dist/astro/routes/api/oauth/register.mjs +2 -2
  127. package/dist/astro/routes/api/oauth/token/refresh.mjs +2 -2
  128. package/dist/astro/routes/api/oauth/token/revoke.mjs +2 -2
  129. package/dist/astro/routes/api/oauth/token.mjs +3 -3
  130. package/dist/astro/routes/api/openapi.json.mjs +16 -2
  131. package/dist/astro/routes/api/redirects/404s/index.mjs +6 -6
  132. package/dist/astro/routes/api/redirects/404s/summary.mjs +6 -6
  133. package/dist/astro/routes/api/redirects/_id_.mjs +24 -24
  134. package/dist/astro/routes/api/redirects/index.mjs +24 -24
  135. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +36 -36
  136. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +36 -36
  137. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +36 -36
  138. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +36 -36
  139. package/dist/astro/routes/api/schema/collections/index.mjs +36 -36
  140. package/dist/astro/routes/api/schema/index.mjs +3 -3
  141. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +35 -35
  142. package/dist/astro/routes/api/schema/orphans/index.mjs +35 -35
  143. package/dist/astro/routes/api/search/enable.mjs +6 -6
  144. package/dist/astro/routes/api/search/index.mjs +6 -6
  145. package/dist/astro/routes/api/search/rebuild.mjs +6 -6
  146. package/dist/astro/routes/api/search/stats.mjs +4 -4
  147. package/dist/astro/routes/api/search/suggest.mjs +6 -6
  148. package/dist/astro/routes/api/sections/_slug_.mjs +23 -23
  149. package/dist/astro/routes/api/sections/index.mjs +23 -23
  150. package/dist/astro/routes/api/settings/email.mjs +1 -1
  151. package/dist/astro/routes/api/settings.mjs +23 -23
  152. package/dist/astro/routes/api/setup/admin-verify.mjs +6 -6
  153. package/dist/astro/routes/api/setup/admin.mjs +4 -4
  154. package/dist/astro/routes/api/setup/dev-bypass.mjs +17 -17
  155. package/dist/astro/routes/api/setup/dev-reset.mjs +1 -1
  156. package/dist/astro/routes/api/setup/index.mjs +20 -20
  157. package/dist/astro/routes/api/setup/status.mjs +2 -2
  158. package/dist/astro/routes/api/snapshot.mjs +2 -2
  159. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +25 -25
  160. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +25 -25
  161. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +25 -25
  162. package/dist/astro/routes/api/taxonomies/index.mjs +25 -25
  163. package/dist/astro/routes/api/themes/preview.mjs +2 -2
  164. package/dist/astro/routes/api/typegen.mjs +3 -3
  165. package/dist/astro/routes/api/well-known/auth.mjs +3 -3
  166. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +1 -1
  167. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +1 -1
  168. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +22 -22
  169. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +23 -23
  170. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +23 -23
  171. package/dist/astro/routes/api/widget-areas/_name_.mjs +21 -21
  172. package/dist/astro/routes/api/widget-areas/index.mjs +23 -23
  173. package/dist/astro/routes/robots.txt.mjs +45 -22
  174. package/dist/astro/routes/sitemap-_collection_.xml.mjs +6 -6
  175. package/dist/astro/routes/sitemap.xml.mjs +6 -6
  176. package/dist/astro/session-driver.d.mts +1 -1
  177. package/dist/astro/session-driver.mjs +2 -2
  178. package/dist/astro/types.d.mts +15 -8
  179. package/dist/{audit-DuRbTm8L.mjs → audit-D1cbG7xH.mjs} +1 -1
  180. package/dist/{briefing-C4fJSVYW.mjs → briefing-CObXGOGz.mjs} +1 -1
  181. package/dist/{briefing-BFEWeJtR.mjs → briefing-gKWiGLt1.mjs} +6 -6
  182. package/dist/{byline-CXQcMsBu.mjs → byline-1ntDwv8c.mjs} +5 -5
  183. package/dist/{byline-fields-D7TJ_oHF.mjs → byline-fields-B-ZkoVft.mjs} +2 -2
  184. package/dist/{byline-fields-Cuo-JI3B.d.mts → byline-fields-BX7rWKNU.d.mts} +54 -30
  185. package/dist/{byline-fields-Dc7L6Yry.mjs → byline-fields-C9_iaPaM.mjs} +1 -1
  186. package/dist/{byline-registry-CL8BxPPp.mjs → byline-registry-CUSvkasJ.mjs} +2 -2
  187. package/dist/{bylines-BgriNlW7.mjs → bylines-DtxChhN_.mjs} +38 -4
  188. package/dist/{bylines-D2vqm1aZ.mjs → bylines-bC15ZqAv.mjs} +2 -2
  189. package/dist/{cache-GRK71jOU.mjs → cache-DbKyr60Q.mjs} +2 -2
  190. package/dist/{chunks-DgEw12Bc.mjs → chunks-C5zp2xir.mjs} +1 -1
  191. package/dist/cli/index.mjs +42 -31
  192. package/dist/client/external-auth-headers.d.mts +1 -1
  193. package/dist/client/index.d.mts +1 -1
  194. package/dist/{comment-ogMaF1gk.mjs → comment-CXDOQ93N.mjs} +1 -1
  195. package/dist/{comments-CTSOKrZq.mjs → comments-hK-rdzJ9.mjs} +1 -1
  196. package/dist/{content-BfyjOiMi.mjs → content-QaryevFO.mjs} +103 -40
  197. package/dist/{context-ZMHhwzkG.mjs → context-CoYb_fvK.mjs} +7 -7
  198. package/dist/{context-CdsYb1m8.mjs → context-DBL1ib4v.mjs} +2 -2
  199. package/dist/{context-route-helpers-YLWx2N1j.mjs → context-route-helpers-CYQVmbIm.mjs} +1 -1
  200. package/dist/{dashboard-D0gWuzNp.mjs → dashboard-DNlqsknJ.mjs} +4 -4
  201. package/dist/db/index.d.mts +2 -2
  202. package/dist/db/index.mjs +1 -1
  203. package/dist/{default-BHauvIdG.mjs → default-B6iaLvP7.mjs} +4 -2
  204. package/dist/{device-flow-B3_FEoMI.mjs → device-flow-DygsFPGL.mjs} +3 -3
  205. package/dist/{fts-manager-EHY2Kes9.mjs → fts-manager-CIZlScg5.mjs} +1 -1
  206. package/dist/{hitl-requests-B1Zqgut6.mjs → hitl-requests-CGQwOEiq.mjs} +2 -2
  207. package/dist/{hitl-route-helpers-CjpWUMuw.mjs → hitl-route-helpers-GSDLNPpN.mjs} +3 -3
  208. package/dist/{index-DJVaYiUV.d.mts → index-CwRuZ-u8.d.mts} +1 -1
  209. package/dist/index.d.mts +10 -10
  210. package/dist/index.mjs +51 -51
  211. package/dist/{jsonld-AcPnCEGD.d.mts → jsonld-DZ67souc.d.mts} +1 -1
  212. package/dist/{load-BdbvtoDb.mjs → load-xE01Jm0V.mjs} +1 -1
  213. package/dist/{loader-Y0QvC_QO.mjs → loader-tg63WSY2.mjs} +138 -36
  214. package/dist/media/index.mjs +1 -1
  215. package/dist/media/local-runtime.d.mts +7 -7
  216. package/dist/media/local-runtime.mjs +2 -2
  217. package/dist/{media-DhBwiCYR.mjs → media-DUAjMfvR.mjs} +1 -1
  218. package/dist/{menus-fqqzXyHd.mjs → menus-DU1eZqw_.mjs} +13 -8
  219. package/dist/{menus-BzGQpw9d.mjs → menus-WpFRMXjz.mjs} +2 -2
  220. package/dist/{normalize-O-hi3a27.mjs → normalize-DUnoXAa9.mjs} +1 -1
  221. package/dist/{oauth-authorization-DsF81vki.mjs → oauth-authorization-D-1p52Je.mjs} +3 -3
  222. package/dist/{oauth-clients-Du-V0fEm.mjs → oauth-clients-CzeMGyUU.mjs} +1 -1
  223. package/dist/page/index.d.mts +2 -2
  224. package/dist/plugin-utils.d.mts +7 -7
  225. package/dist/plugins/adapt-sandbox-entry.d.mts +7 -7
  226. package/dist/{plugins-BQ5Joz6v.mjs → plugins-C57YQi4l.mjs} +195 -5
  227. package/dist/public-url-B5HaoGzj.d.mts +18 -0
  228. package/dist/{query-CSx0EdSW.mjs → query-BYc3oruA.mjs} +29 -18
  229. package/dist/{query-BJuUydtD.mjs → query-DKEwzobh.mjs} +3 -3
  230. package/dist/{redirect-BqFMj67n.mjs → redirect-C2zXRj3c.mjs} +2 -2
  231. package/dist/{redirects-CJwHl_YG.mjs → redirects-YZo_znWG.mjs} +4 -4
  232. package/dist/{redirects-q_cToaHv.mjs → redirects-ocRJmQHP.mjs} +23 -3
  233. package/dist/{registry-Cq3QRBW2.mjs → registry-CTkbIDB9.mjs} +38 -6
  234. package/dist/{review-requests-GYqjl2jO.mjs → review-requests-C0un5kdV.mjs} +1 -1
  235. package/dist/{review-requests-tPw8_pAO.mjs → review-requests-gGMyYYhy.mjs} +1 -1
  236. package/dist/{runner-DTfG5v0G.mjs → runner-B-tbV751.mjs} +233 -193
  237. package/dist/{runner-Cnz4dl0f.d.mts → runner-D4FL9usy.d.mts} +1 -1
  238. package/dist/{runtime-Cd-kjPfN.d.mts → runtime-DEWQpZ-4.d.mts} +154 -22
  239. package/dist/runtime.d.mts +8 -8
  240. package/dist/runtime.mjs +2 -2
  241. package/dist/schema-B6zyB-Xn.mjs +8 -0
  242. package/dist/{search-BAiFLz81.mjs → search-axGQ1KY3.mjs} +3 -3
  243. package/dist/{secrets-CPoFLJjm.mjs → secrets-062Izo8i.mjs} +1 -1
  244. package/dist/{sections-DsuIrFDC.mjs → sections-OLKgXL10.mjs} +2 -2
  245. package/dist/seed/index.d.mts +2 -2
  246. package/dist/seed/index.mjs +17 -17
  247. package/dist/seo/index.d.mts +1 -1
  248. package/dist/{seo-uMFBaR8G.mjs → seo-Cd45Po8L.mjs} +1 -1
  249. package/dist/{service-CifrxCru.mjs → service-Bwad8s5h.mjs} +1 -1
  250. package/dist/{settings-BYGdocdj.mjs → settings-lAHjaUit.mjs} +2 -2
  251. package/dist/{settings-DNRQuX3d.mjs → settings-yLjz_I4T.mjs} +4 -4
  252. package/dist/{setup-complete-4EiBS1E5.mjs → setup-complete--PradA4R.mjs} +1 -1
  253. package/dist/{site-activity-6x1JccoR.mjs → site-activity-D7Xyropw.mjs} +1 -1
  254. package/dist/{site-context-c1ZFa_OF.mjs → site-context-DaN9Z91j.mjs} +13 -13
  255. package/dist/{site-url-C-cu8Ff2.mjs → site-url-DpGZo9Z6.mjs} +1 -1
  256. package/dist/{taxonomies-faQVeMgj.mjs → taxonomies-CNOGeC-3.mjs} +9 -7
  257. package/dist/{taxonomies-CQFmkP5u.mjs → taxonomies-uXVEoQso.mjs} +3 -3
  258. package/dist/{taxonomy-BnH-6VsX.mjs → taxonomy-CBmkmMuU.mjs} +2 -2
  259. package/dist/{types-DEAQG87T.d.mts → types-CwawBUTa.d.mts} +1 -1
  260. package/dist/{types-B7_vSiPD.d.mts → types-DRIKLmJI.d.mts} +14 -2
  261. package/dist/{types-UGmU5sWx.d.mts → types-DSPGWjxO.d.mts} +1 -1
  262. package/dist/{types-Ck7-WoUD.mjs → types-DfuD0Afl.mjs} +9 -2
  263. package/dist/{types-DYKtk8f1.d.mts → types-eu5UDgHN.d.mts} +22 -0
  264. package/dist/ui/server-runtime.d.mts +58 -10
  265. package/dist/ui/server-runtime.mjs +97 -15
  266. package/dist/{user-CqZwN21P.mjs → user-DtNmjNYt.mjs} +15 -1
  267. package/dist/{validate-CK4a1sIF.mjs → validate-7SYRbz2f.mjs} +5 -2
  268. package/dist/{validate-BJuG-ISL.d.mts → validate-BMs11tan.d.mts} +10 -2
  269. package/dist/version-xlzMSXF2.mjs +6 -0
  270. package/dist/{widgets-CdDvF4fV.mjs → widgets-DR8EHuRO.mjs} +1 -1
  271. package/dist/{wordpress-slugs-B6Gw9q3Q.mjs → wordpress-slugs-Dvhxh4cl.mjs} +1 -1
  272. package/dist/{zod-generator-D1ROBNuC.mjs → zod-generator-BS9-umbk.mjs} +3 -2
  273. package/package.json +5 -5
  274. package/src/components/DinewayImage.astro +23 -5
  275. package/src/components/Image.astro +19 -3
  276. package/dist/schema-DmHMWnSA.mjs +0 -8
  277. package/dist/version-Cb1tZ6s_.mjs +0 -6
  278. /package/dist/{allowed-origins-QirBXiDj.mjs → allowed-origins-DhipQNLb.mjs} +0 -0
  279. /package/dist/{challenge-store-DFxX0_15.mjs → challenge-store-CRSz-Xim.mjs} +0 -0
  280. /package/dist/{entity-aliases-uOrKvlPg.mjs → entity-aliases-Egjmqc7I.mjs} +0 -0
  281. /package/dist/{experimental-workflows-CSMffP6q.mjs → experimental-workflows-Dh4DUoD_.mjs} +0 -0
  282. /package/dist/{mode-CZqCF9dZ.mjs → mode-CpyEz8pe.mjs} +0 -0
  283. /package/dist/{options-BF11H_FD.mjs → options-BvJoSSJR.mjs} +0 -0
  284. /package/dist/{patterns-D9iDO3j8.mjs → patterns-r-0n824Y.mjs} +0 -0
  285. /package/dist/{provider-loader-B5PMjpN7.d.mts → provider-loader-9it4vd6L.d.mts} +0 -0
  286. /package/dist/{request-cache-w5cj5itT.mjs → request-cache-CYMbwZc6.mjs} +0 -0
  287. /package/dist/{transaction-D0FOsb3X.mjs → transaction-CShMWIej.mjs} +0 -0
  288. /package/dist/{transport-DidKKxvW.d.mts → transport-BnsNxh2l.d.mts} +0 -0
  289. /package/dist/{types-DbZhHtqS.mjs → types-BO8TGjS8.mjs} +0 -0
@@ -1,60 +1,60 @@
1
- import { i as runMigrations } from "../runner-DTfG5v0G.mjs";
1
+ import { i as runMigrations } from "../runner-B-tbV751.mjs";
2
2
  import "../connection-CiJWiWya.mjs";
3
3
  import { t as validateIdentifier } from "../validate-VPnKoIzW.mjs";
4
4
  import { s as isSqlite } from "../dialect-helpers-fk43GbDb.mjs";
5
5
  import { i as setI18nConfig } from "../config-CVssduLe.mjs";
6
- import { d as EmailPipeline, g as after, h as definePlugin, m as resolveExclusiveHooks, p as createHookPipeline, u as PluginRouteRegistry } from "../plugins-BQ5Joz6v.mjs";
7
- import { r as RevisionRepository } from "../content-BfyjOiMi.mjs";
6
+ import { d as EmailPipeline, g as after, h as definePlugin, m as resolveExclusiveHooks, p as createHookPipeline, u as PluginRouteRegistry } from "../plugins-C57YQi4l.mjs";
7
+ import { r as RevisionRepository, t as ContentRepository } from "../content-QaryevFO.mjs";
8
8
  import "../base64-C1Q9yr0B.mjs";
9
- import "../types-Ck7-WoUD.mjs";
10
- import { t as MediaRepository } from "../media-DhBwiCYR.mjs";
11
- import "../user-CqZwN21P.mjs";
12
- import "../taxonomy-BnH-6VsX.mjs";
13
- import "../comment-ogMaF1gk.mjs";
14
- import { t as OptionsRepository } from "../options-BF11H_FD.mjs";
15
- import "../audit-DuRbTm8L.mjs";
16
- import "../site-activity-6x1JccoR.mjs";
17
- import "../review-requests-tPw8_pAO.mjs";
18
- import "../entity-aliases-uOrKvlPg.mjs";
19
- import "../context-ZMHhwzkG.mjs";
20
- import "../menus-BzGQpw9d.mjs";
21
- import "../redirect-BqFMj67n.mjs";
9
+ import "../types-DfuD0Afl.mjs";
10
+ import { t as MediaRepository } from "../media-DUAjMfvR.mjs";
11
+ import "../user-DtNmjNYt.mjs";
12
+ import "../taxonomy-CBmkmMuU.mjs";
13
+ import "../comment-CXDOQ93N.mjs";
14
+ import { t as OptionsRepository } from "../options-BvJoSSJR.mjs";
15
+ import "../audit-D1cbG7xH.mjs";
16
+ import "../site-activity-D7Xyropw.mjs";
17
+ import "../review-requests-gGMyYYhy.mjs";
18
+ import "../entity-aliases-Egjmqc7I.mjs";
19
+ import "../context-CoYb_fvK.mjs";
20
+ import "../menus-WpFRMXjz.mjs";
21
+ import "../redirect-C2zXRj3c.mjs";
22
22
  import { createRequestMetrics, getRequestContext, runWithContext } from "../request-context.mjs";
23
- import { r as requestCached } from "../request-cache-w5cj5itT.mjs";
24
- import "../byline-registry-CL8BxPPp.mjs";
25
- import "../byline-CXQcMsBu.mjs";
26
- import { t as normalizeMediaValue } from "../normalize-O-hi3a27.mjs";
23
+ import { r as requestCached } from "../request-cache-CYMbwZc6.mjs";
24
+ import "../byline-registry-CUSvkasJ.mjs";
25
+ import "../byline-1ntDwv8c.mjs";
26
+ import { n as normalizeMediaValue } from "../normalize-DUnoXAa9.mjs";
27
27
  import "../placeholder-BDo81Is5.mjs";
28
- import "../seo-uMFBaR8G.mjs";
29
- import { $ as validateRev, A as handleRevisionGet, B as handleContentDuplicate, D as handleMediaGet, E as handleMediaDelete, F as handleContentCountScheduled, G as handleContentPermanentDelete, H as handleContentGetIncludingTrashed, I as handleContentCountTrashed, J as handleContentSchedule, K as handleContentPublish, L as handleContentCreate, M as handleRevisionRestore, O as handleMediaList, P as handleContentCompare, Q as handleContentUpdate, R as handleContentDelete, T as handleMediaCreate, U as handleContentList, V as handleContentGet, W as handleContentListTrashed, X as handleContentUnpublish, Y as handleContentTranslations, Z as handleContentUnschedule, d as createPluginBundleStore, j as handleRevisionList, k as handleMediaUpdate, q as handleContentRestore, z as handleContentDiscardDraft } from "../api-ePsOhL3q.mjs";
30
- import "../dashboard-D0gWuzNp.mjs";
31
- import { u as PluginStateRepository } from "../briefing-BFEWeJtR.mjs";
28
+ import "../seo-Cd45Po8L.mjs";
29
+ import { $ as handleContentUpdate, A as handleRevisionGet, B as handleContentDiscardDraft, D as handleMediaGet, E as handleMediaDelete, F as handleContentCompare, G as handleContentListTrashed, H as handleContentGet, I as handleContentCountScheduled, J as handleContentRestore, K as handleContentPermanentDelete, L as handleContentCountTrashed, M as handleRevisionRestore, O as handleMediaList, P as handleContentAuthors, Q as handleContentUnschedule, R as handleContentCreate, T as handleMediaCreate, U as handleContentGetIncludingTrashed, V as handleContentDuplicate, W as handleContentList, X as handleContentTranslations, Y as handleContentSchedule, Z as handleContentUnpublish, d as createPluginBundleStore, et as validateRev, j as handleRevisionList, k as handleMediaUpdate, q as handleContentPublish, z as handleContentDelete } from "../api-Eiy8_zVZ.mjs";
30
+ import "../dashboard-DNlqsknJ.mjs";
31
+ import { u as PluginStateRepository } from "../briefing-gKWiGLt1.mjs";
32
32
  import "../context-types-DQh_XKkn.mjs";
33
- import { t as FTSManager } from "../fts-manager-EHY2Kes9.mjs";
34
- import { n as SchemaRegistry } from "../registry-Cq3QRBW2.mjs";
33
+ import { t as FTSManager } from "../fts-manager-CIZlScg5.mjs";
34
+ import { n as SchemaRegistry } from "../registry-CTkbIDB9.mjs";
35
35
  import { createRecorder, flushRecorder, formatServerTimingHeader, isInstrumentationEnabled, isServerTimingEnabled, kyselyLogOption } from "../database/instrumentation.mjs";
36
- import { a as isMissingTableError, r as getDb } from "../loader-Y0QvC_QO.mjs";
37
- import { c as createPublicMediaUrlResolver } from "../settings-DNRQuX3d.mjs";
38
- import "../briefing-C4fJSVYW.mjs";
39
- import "../review-requests-GYqjl2jO.mjs";
36
+ import { a as isMissingTableError, r as getDb } from "../loader-tg63WSY2.mjs";
37
+ import { c as createPublicMediaUrlResolver } from "../settings-yLjz_I4T.mjs";
38
+ import "../briefing-CObXGOGz.mjs";
39
+ import "../review-requests-C0un5kdV.mjs";
40
40
  import { n as hashString } from "../hash-BPmX6P8I.mjs";
41
- import { n as VERSION, t as COMMIT } from "../version-Cb1tZ6s_.mjs";
42
- import "../query-BJuUydtD.mjs";
43
- import "../zod-generator-D1ROBNuC.mjs";
44
- import "../schema-DmHMWnSA.mjs";
41
+ import { n as VERSION, t as COMMIT } from "../version-xlzMSXF2.mjs";
42
+ import "../query-DKEwzobh.mjs";
43
+ import "../zod-generator-BS9-umbk.mjs";
44
+ import "../schema-B6zyB-Xn.mjs";
45
45
  import "../seo-5lJOtB5J.mjs";
46
- import "../bylines-D2vqm1aZ.mjs";
47
- import "../byline-fields-Dc7L6Yry.mjs";
48
- import "../sections-DsuIrFDC.mjs";
49
- import "../settings-BYGdocdj.mjs";
46
+ import "../bylines-bC15ZqAv.mjs";
47
+ import "../byline-fields-C9_iaPaM.mjs";
48
+ import "../sections-OLKgXL10.mjs";
49
+ import "../settings-lAHjaUit.mjs";
50
50
  import "../resolve-DTuDyYKs.mjs";
51
- import "../taxonomies-faQVeMgj.mjs";
52
- import "../taxonomies-CQFmkP5u.mjs";
51
+ import "../taxonomies-CNOGeC-3.mjs";
52
+ import "../taxonomies-uXVEoQso.mjs";
53
53
  import { r as normalizeManifestRoute } from "../manifest-schema-qh2P7RDX.mjs";
54
54
  import "../parse-CneSgl7-.mjs";
55
- import "../redirects-q_cToaHv.mjs";
56
- import "../byline-fields-D7TJ_oHF.mjs";
57
- import { a as invalidateUrlPatternCache } from "../query-CSx0EdSW.mjs";
55
+ import "../redirects-ocRJmQHP.mjs";
56
+ import "../byline-fields-B-ZkoVft.mjs";
57
+ import { a as invalidateUrlPatternCache } from "../query-BYc3oruA.mjs";
58
58
  import "../preview-D5rvDhRt.mjs";
59
59
  import "../parser-DxfsARXL.mjs";
60
60
  import { t as getTrustedProxyHeaders } from "../trusted-proxy-BgIIcbsN.mjs";
@@ -65,17 +65,17 @@ import { r as devConsoleEmailDeliver, t as DEV_CONSOLE_EMAIL_PLUGIN_ID } from ".
65
65
  import "../import-CvHY6sf5.mjs";
66
66
  import "../utils-wv-zvC-Y.mjs";
67
67
  import "../tokens-CjSgb0AC.mjs";
68
- import "../menus-fqqzXyHd.mjs";
69
- import "../bylines-BgriNlW7.mjs";
70
- import "../widgets-CdDvF4fV.mjs";
71
- import "../apply-BpRBCqUt.mjs";
72
- import "../load-BdbvtoDb.mjs";
73
- import "../search-BAiFLz81.mjs";
68
+ import "../menus-DU1eZqw_.mjs";
69
+ import "../bylines-DtxChhN_.mjs";
70
+ import "../widgets-DR8EHuRO.mjs";
71
+ import "../apply-CX3no7XE.mjs";
72
+ import "../load-xE01Jm0V.mjs";
73
+ import "../search-axGQ1KY3.mjs";
74
74
  import "../index.mjs";
75
- import { t as getAuthMode } from "../mode-CZqCF9dZ.mjs";
76
- import { i as experimentalSiteContextWorkflowsEnabled } from "../experimental-workflows-CSMffP6q.mjs";
77
- import { t as cleanupExpiredChallenges } from "../challenge-store-DFxX0_15.mjs";
78
- import { a as validateEncryptionKeyAtStartup } from "../secrets-CPoFLJjm.mjs";
75
+ import { t as getAuthMode } from "../mode-CpyEz8pe.mjs";
76
+ import { i as experimentalSiteContextWorkflowsEnabled } from "../experimental-workflows-Dh4DUoD_.mjs";
77
+ import { t as cleanupExpiredChallenges } from "../challenge-store-CRSz-Xim.mjs";
78
+ import { a as validateEncryptionKeyAtStartup } from "../secrets-062Izo8i.mjs";
79
79
  import { Kysely, sql } from "kysely";
80
80
  import { defineMiddleware } from "astro:middleware";
81
81
  import virtualConfig from "virtual:dineway/config";
@@ -224,8 +224,8 @@ function createSandboxRunnerRuntimeOptions(input) {
224
224
  //#region src/plugins/scheduler/node.ts
225
225
  /** Minimum polling interval (ms) — prevents tight loops if next_run_at is in the past */
226
226
  const MIN_INTERVAL_MS = 1e3;
227
- /** Maximum polling interval (ms) — wake up periodically to check for stale locks */
228
- const MAX_INTERVAL_MS = 300 * 1e3;
227
+ /** Maximum polling interval (ms) — bounds scheduled publishing latency */
228
+ const MAX_INTERVAL_MS = 60 * 1e3;
229
229
  var NodeCronScheduler = class {
230
230
  timer = null;
231
231
  running = false;
@@ -342,6 +342,92 @@ function shouldUsePiggybackScheduler(createTimer = () => globalThis.setTimeout((
342
342
  return !hasUnref(handle);
343
343
  }
344
344
 
345
+ //#endregion
346
+ //#region src/scheduled-publish.ts
347
+ const SCHEDULED_PUBLISH_BATCH_LIMIT = 100;
348
+ async function publishDueContent(db, options = {}) {
349
+ const { publish, onPublished, limit = SCHEDULED_PUBLISH_BATCH_LIMIT } = options;
350
+ const published = [];
351
+ let collections;
352
+ try {
353
+ collections = await new SchemaRegistry(db).listCollections();
354
+ } catch (error) {
355
+ console.error("[scheduled-publish] Failed to list collections:", error);
356
+ return published;
357
+ }
358
+ const repo = new ContentRepository(db);
359
+ const doPublish = publish ?? ((collection, id, opts) => handleContentPublish(db, collection, id, opts));
360
+ const batchLimit = limit > 0 ? limit : void 0;
361
+ for (const collection of collections) try {
362
+ const due = await repo.findReadyToPublish(collection.slug, batchLimit);
363
+ const batch = [];
364
+ for (const item of due) {
365
+ const publishedAt = item.publishedAt == null ? item.scheduledAt ?? void 0 : void 0;
366
+ const result = await doPublish(collection.slug, item.id, {
367
+ publishedAt,
368
+ requireScheduledDue: true
369
+ });
370
+ if (result.success) batch.push({
371
+ collection: collection.slug,
372
+ id: item.id
373
+ });
374
+ else if (result.error?.code !== "NOT_DUE") console.error(`[scheduled-publish] Failed to publish ${collection.slug}/${item.id}:`, result.error);
375
+ }
376
+ if (batch.length > 0) {
377
+ published.push(...batch);
378
+ if (onPublished) try {
379
+ await onPublished(batch);
380
+ } catch (error) {
381
+ console.error(`[scheduled-publish] onPublished failed after "${collection.slug}" batch:`, error);
382
+ }
383
+ }
384
+ } catch (error) {
385
+ console.error(`[scheduled-publish] Sweep failed for "${collection.slug}":`, error);
386
+ }
387
+ return published;
388
+ }
389
+
390
+ //#endregion
391
+ //#region src/utils/init-lock.ts
392
+ const DEFAULT_DEADLINE_MS = 15e3;
393
+ const DEFAULT_POLL_MS = 50;
394
+ const MAX_WAIT_HEADROOM_MS = 15e3;
395
+ function sleep(ms) {
396
+ return new Promise((resolve) => setTimeout(resolve, ms));
397
+ }
398
+ function createInitLock() {
399
+ return {
400
+ ownerStartedAt: null,
401
+ generation: 0
402
+ };
403
+ }
404
+ async function initWithLock(lock, getCached, init, options) {
405
+ const deadlineMs = options?.deadlineMs ?? DEFAULT_DEADLINE_MS;
406
+ const pollMs = options?.pollMs ?? DEFAULT_POLL_MS;
407
+ const maxWaitMs = options?.maxWaitMs ?? deadlineMs + MAX_WAIT_HEADROOM_MS;
408
+ const waitStart = Date.now();
409
+ for (;;) {
410
+ const cached = getCached();
411
+ if (cached !== null && cached !== void 0) return cached;
412
+ const ownerStartedAt = lock.ownerStartedAt;
413
+ if (ownerStartedAt === null || Date.now() - ownerStartedAt > deadlineMs) {
414
+ lock.generation += 1;
415
+ const claim = lock.generation;
416
+ lock.ownerStartedAt = Date.now();
417
+ try {
418
+ const isCurrentClaim = () => lock.generation === claim;
419
+ const initPromise = Promise.resolve().then(() => init(isCurrentClaim));
420
+ options?.anchor?.(initPromise.then(() => void 0, () => void 0));
421
+ return await initPromise;
422
+ } finally {
423
+ if (lock.generation === claim) lock.ownerStartedAt = null;
424
+ }
425
+ }
426
+ if (Date.now() - waitStart > maxWaitMs) throw new Error(`initWithLock: timed out after ${maxWaitMs}ms waiting for initialization`);
427
+ await sleep(pollMs);
428
+ }
429
+ }
430
+
345
431
  //#endregion
346
432
  //#region src/dineway-runtime.ts
347
433
  const LEADING_SLASH_PATTERN = /^\//;
@@ -430,8 +516,20 @@ const FIELD_TYPE_TO_KIND = {
430
516
  function contentItemToRecord(item) {
431
517
  return { ...item };
432
518
  }
433
- const dbCache = /* @__PURE__ */ new Map();
434
- let dbInitPromise = null;
519
+ const DB_INIT_DEADLINE_MS = 3e4;
520
+ const DB_HOLDER_KEY = Symbol.for("dineway:db-cache");
521
+ const globalSymbolStore = globalThis;
522
+ function getDbHolder() {
523
+ let holder = globalSymbolStore[DB_HOLDER_KEY];
524
+ if (!holder) {
525
+ holder = {
526
+ cache: /* @__PURE__ */ new Map(),
527
+ lock: createInitLock()
528
+ };
529
+ globalSymbolStore[DB_HOLDER_KEY] = holder;
530
+ }
531
+ return holder;
532
+ }
435
533
  const storageCache = /* @__PURE__ */ new Map();
436
534
  const sandboxedPluginCache = /* @__PURE__ */ new Map();
437
535
  const marketplacePluginKeys = /* @__PURE__ */ new Set();
@@ -523,6 +621,45 @@ var DinewayRuntime = class DinewayRuntime {
523
621
  return sandboxRunner;
524
622
  }
525
623
  /**
624
+ * Publish any content whose scheduled time has passed.
625
+ * Routes through the runtime wrapper so after-publish hooks still fire.
626
+ */
627
+ async publishScheduled() {
628
+ return publishDueContent(this.db, { publish: (collection, id, options) => this.handleContentPublish(collection, id, options) });
629
+ }
630
+ /**
631
+ * Run all scheduled maintenance work from a heartbeat driver.
632
+ */
633
+ async runScheduledTasks(options = {}) {
634
+ if (this.cronExecutor) {
635
+ try {
636
+ await this.cronExecutor.tick();
637
+ } catch (error) {
638
+ console.error("[cron] Tick failed:", error);
639
+ }
640
+ try {
641
+ await this.cronExecutor.recoverStaleLocks();
642
+ } catch (error) {
643
+ console.error("[cron] Stale lock recovery failed:", error);
644
+ }
645
+ }
646
+ let published = [];
647
+ try {
648
+ published = await publishDueContent(this.db, {
649
+ publish: (collection, id, opts) => this.handleContentPublish(collection, id, opts),
650
+ onPublished: options.onPublished
651
+ });
652
+ } catch (error) {
653
+ console.error("[scheduled-publish] Sweep failed:", error);
654
+ }
655
+ try {
656
+ await runSystemCleanup(this.db, this.storage ?? void 0);
657
+ } catch (error) {
658
+ console.error("[cleanup] System cleanup failed:", error);
659
+ }
660
+ return { published };
661
+ }
662
+ /**
526
663
  * Tick the cron system from request context (piggyback mode).
527
664
  * Call this from middleware on each request to ensure cron tasks
528
665
  * execute even when no dedicated scheduler is available.
@@ -691,33 +828,49 @@ var DinewayRuntime = class DinewayRuntime {
691
828
  /**
692
829
  * Create and initialize the runtime
693
830
  */
694
- static async create(deps) {
695
- const db = await DinewayRuntime.getDatabase(deps);
696
- await validateEncryptionKeyAtStartup();
831
+ static async create(deps, timings) {
832
+ const phase = async (name, desc, fn) => {
833
+ if (!timings) return fn();
834
+ const start = performance.now();
835
+ try {
836
+ return await fn();
837
+ } finally {
838
+ timings.push({
839
+ name,
840
+ dur: performance.now() - start,
841
+ desc
842
+ });
843
+ }
844
+ };
845
+ const db = await phase("rt.db", "DB init + migrations", () => DinewayRuntime.getDatabase(deps));
846
+ await phase("rt.secrets", "Validate encryption key", () => validateEncryptionKeyAtStartup());
697
847
  const storage = DinewayRuntime.getStorage(deps);
698
848
  let pluginStates = /* @__PURE__ */ new Map();
699
- try {
700
- const states = await db.selectFrom("_plugin_state").select(["plugin_id", "status"]).execute();
701
- pluginStates = new Map(states.map((s) => [s.plugin_id, s.status]));
702
- } catch {}
849
+ let siteInfo;
850
+ await Promise.all([phase("rt.plugins", "Plugin states", async () => {
851
+ try {
852
+ const states = await db.selectFrom("_plugin_state").select(["plugin_id", "status"]).execute();
853
+ pluginStates = new Map(states.map((s) => [s.plugin_id, s.status]));
854
+ } catch {}
855
+ }), phase("rt.site", "Site info options", async () => {
856
+ try {
857
+ const siteOptions = await new OptionsRepository(db).getMany([
858
+ "dineway:site_title",
859
+ "dineway:site_url",
860
+ "dineway:locale"
861
+ ]);
862
+ siteInfo = {
863
+ siteName: siteOptions.get("dineway:site_title") ?? void 0,
864
+ siteUrl: siteOptions.get("dineway:site_url") ?? void 0,
865
+ locale: siteOptions.get("dineway:locale") ?? void 0
866
+ };
867
+ } catch {}
868
+ })]);
703
869
  const enabledPlugins = /* @__PURE__ */ new Set();
704
870
  for (const plugin of deps.plugins) {
705
871
  const status = pluginStates.get(plugin.id);
706
872
  if (status === void 0 || status === "active") enabledPlugins.add(plugin.id);
707
873
  }
708
- let siteInfo;
709
- try {
710
- const siteOptions = await new OptionsRepository(db).getMany([
711
- "dineway:site_title",
712
- "dineway:site_url",
713
- "dineway:locale"
714
- ]);
715
- siteInfo = {
716
- siteName: siteOptions.get("dineway:site_title") ?? void 0,
717
- siteUrl: siteOptions.get("dineway:site_url") ?? void 0,
718
- locale: siteOptions.get("dineway:locale") ?? void 0
719
- };
720
- } catch {}
721
874
  const allPipelinePlugins = [...deps.plugins];
722
875
  if (import.meta.env.DEV) try {
723
876
  const devConsolePlugin = definePlugin({
@@ -765,8 +918,8 @@ var DinewayRuntime = class DinewayRuntime {
765
918
  siteInfo,
766
919
  cronReschedule: () => cronScheduler?.reschedule()
767
920
  });
768
- const sandboxedPlugins = await DinewayRuntime.loadSandboxedPlugins(deps, sandboxRunnerOptions);
769
- if (deps.config.marketplace && storage) await DinewayRuntime.loadMarketplacePlugins(db, storage, deps, sandboxedPlugins, sandboxRunnerOptions);
921
+ const sandboxedPlugins = await phase("rt.sandbox", "Sandboxed plugins", () => DinewayRuntime.loadSandboxedPlugins(deps, sandboxRunnerOptions));
922
+ if (deps.config.marketplace && storage) await phase("rt.market", "Marketplace plugins", () => DinewayRuntime.loadMarketplacePlugins(db, storage, deps, sandboxedPlugins, sandboxRunnerOptions));
770
923
  const mediaProviders = /* @__PURE__ */ new Map();
771
924
  const mediaProviderEntries = deps.mediaProviderEntries ?? [];
772
925
  const providerContext = {
@@ -779,7 +932,7 @@ var DinewayRuntime = class DinewayRuntime {
779
932
  } catch (error) {
780
933
  console.warn(`Failed to initialize media provider "${entry.id}":`, error);
781
934
  }
782
- await DinewayRuntime.resolveExclusiveHooks(pipeline, db, deps);
935
+ await phase("rt.hooks", "Exclusive hook resolution", () => DinewayRuntime.resolveExclusiveHooks(pipeline, db, deps));
783
936
  const emailPipeline = new EmailPipeline(pipeline);
784
937
  if (sandboxRunner) sandboxRunner.setEmailSend((message, pluginId) => emailPipeline.send(message, pluginId));
785
938
  const pipelineRef = { current: pipeline };
@@ -792,32 +945,43 @@ var DinewayRuntime = class DinewayRuntime {
792
945
  emailPipeline
793
946
  });
794
947
  let cronExecutor = null;
795
- try {
796
- cronExecutor = new CronExecutor(db, invokeCronHook);
797
- const executorForRecovery = cronExecutor;
798
- after(async () => {
799
- try {
800
- const recovered = await executorForRecovery.recoverStaleLocks();
801
- if (recovered > 0) console.log(`[cron] Recovered ${recovered} stale task lock(s)`);
802
- } catch (error) {
803
- console.error("[cron] Failed to recover stale task locks:", error);
804
- }
805
- });
806
- if (shouldUsePiggybackScheduler()) cronScheduler = new PiggybackScheduler(cronExecutor);
807
- else cronScheduler = new NodeCronScheduler(cronExecutor);
808
- cronScheduler.setSystemCleanup(async () => {
809
- try {
810
- await runSystemCleanup(db, storage ?? void 0);
811
- } catch (error) {
812
- console.error("[cleanup] System cleanup failed:", error);
813
- }
814
- });
815
- pipeline.setContextFactory({ cronReschedule: () => cronScheduler?.reschedule() });
816
- await cronScheduler.start();
817
- } catch (error) {
818
- console.warn("[cron] Failed to initialize cron system:", error);
819
- }
820
- return new DinewayRuntime(db, storage, deps.plugins, sandboxedPlugins, deps.sandboxedPluginEntries, pipeline, enabledPlugins, pluginStates, deps.config, mediaProviders, mediaProviderEntries, cronExecutor, cronScheduler, emailPipeline, allPipelinePlugins, pipelineFactoryOptions, deps, pipelineRef);
948
+ const runtimeRef = { current: null };
949
+ await phase("rt.cron", "Cron init (recovery deferred post-response)", async () => {
950
+ try {
951
+ cronExecutor = new CronExecutor(db, invokeCronHook);
952
+ const executorForRecovery = cronExecutor;
953
+ after(async () => {
954
+ try {
955
+ const recovered = await executorForRecovery.recoverStaleLocks();
956
+ if (recovered > 0) console.log(`[cron] Recovered ${recovered} stale task lock(s)`);
957
+ } catch (error) {
958
+ console.error("[cron] Failed to recover stale task locks:", error);
959
+ }
960
+ });
961
+ if (shouldUsePiggybackScheduler()) cronScheduler = new PiggybackScheduler(cronExecutor);
962
+ else cronScheduler = new NodeCronScheduler(cronExecutor);
963
+ cronScheduler.setSystemCleanup(async () => {
964
+ try {
965
+ const runtime = runtimeRef.current;
966
+ await publishDueContent(db, { publish: runtime ? (collection, id, options) => runtime.handleContentPublish(collection, id, options) : void 0 });
967
+ } catch (error) {
968
+ console.error("[scheduled-publish] Sweep failed:", error);
969
+ }
970
+ try {
971
+ await runSystemCleanup(db, storage ?? void 0);
972
+ } catch (error) {
973
+ console.error("[cleanup] System cleanup failed:", error);
974
+ }
975
+ });
976
+ pipeline.setContextFactory({ cronReschedule: () => cronScheduler?.reschedule() });
977
+ await cronScheduler.start();
978
+ } catch (error) {
979
+ console.warn("[cron] Failed to initialize cron system:", error);
980
+ }
981
+ });
982
+ const runtime = new DinewayRuntime(db, storage, deps.plugins, sandboxedPlugins, deps.sandboxedPluginEntries, pipeline, enabledPlugins, pluginStates, deps.config, mediaProviders, mediaProviderEntries, cronExecutor, cronScheduler, emailPipeline, allPipelinePlugins, pipelineFactoryOptions, deps, pipelineRef);
983
+ runtimeRef.current = runtime;
984
+ return runtime;
821
985
  }
822
986
  /**
823
987
  * Get a media provider by ID
@@ -849,10 +1013,8 @@ var DinewayRuntime = class DinewayRuntime {
849
1013
  throw new Error("Dineway database not configured. Either configure database in astro.config.mjs or use dinewayLoader in live.config.ts");
850
1014
  }
851
1015
  const cacheKey = dbConfig.entrypoint;
852
- const cached = dbCache.get(cacheKey);
853
- if (cached) return cached;
854
- if (dbInitPromise) return dbInitPromise;
855
- dbInitPromise = (async () => {
1016
+ const holder = getDbHolder();
1017
+ return initWithLock(holder.lock, () => holder.cache.get(cacheKey), async (isCurrentClaim) => {
856
1018
  const db = new Kysely({
857
1019
  dialect: deps.createDialect(dbConfig.config),
858
1020
  log: kyselyLogOption()
@@ -868,9 +1030,9 @@ var DinewayRuntime = class DinewayRuntime {
868
1030
  }
869
1031
  })();
870
1032
  if (collectionCount.count === 0 && !setupDone) {
871
- const { applySeed } = await import("../apply-BpRBCqUt.mjs").then((n) => n.n);
872
- const { loadSeed } = await import("../load-BdbvtoDb.mjs").then((n) => n.r);
873
- const { validateSeed } = await import("../validate-CK4a1sIF.mjs").then((n) => n.n);
1033
+ const { applySeed } = await import("../apply-CX3no7XE.mjs").then((n) => n.n);
1034
+ const { loadSeed } = await import("../load-xE01Jm0V.mjs").then((n) => n.r);
1035
+ const { validateSeed } = await import("../validate-7SYRbz2f.mjs").then((n) => n.n);
874
1036
  const seed = await loadSeed();
875
1037
  if (validateSeed(seed).valid) {
876
1038
  await applySeed(db, seed, { onConflict: "skip" });
@@ -878,14 +1040,12 @@ var DinewayRuntime = class DinewayRuntime {
878
1040
  }
879
1041
  }
880
1042
  } catch {}
881
- dbCache.set(cacheKey, db);
1043
+ if (isCurrentClaim()) holder.cache.set(cacheKey, db);
882
1044
  return db;
883
- })();
884
- try {
885
- return await dbInitPromise;
886
- } finally {
887
- dbInitPromise = null;
888
- }
1045
+ }, {
1046
+ deadlineMs: DB_INIT_DEADLINE_MS,
1047
+ anchor: (promise) => after(() => promise)
1048
+ });
889
1049
  }
890
1050
  /**
891
1051
  * Get or create storage instance
@@ -1002,6 +1162,7 @@ var DinewayRuntime = class DinewayRuntime {
1002
1162
  pipeline,
1003
1163
  isActive: () => true,
1004
1164
  getOption: (key) => optionsRepo.get(key),
1165
+ getOptions: (keys) => optionsRepo.getMany(keys),
1005
1166
  setOption: (key, value) => optionsRepo.set(key, value),
1006
1167
  deleteOption: async (key) => {
1007
1168
  await optionsRepo.delete(key);
@@ -1137,6 +1298,9 @@ var DinewayRuntime = class DinewayRuntime {
1137
1298
  async handleContentList(collection, params) {
1138
1299
  return handleContentList(this.db, collection, params);
1139
1300
  }
1301
+ async handleContentAuthors(collection) {
1302
+ return handleContentAuthors(this.db, collection);
1303
+ }
1140
1304
  async handleContentGet(collection, id, locale) {
1141
1305
  return handleContentGet(this.db, collection, id, locale);
1142
1306
  }
@@ -1158,7 +1322,7 @@ var DinewayRuntime = class DinewayRuntime {
1158
1322
  return result;
1159
1323
  }
1160
1324
  async handleContentUpdate(collection, id, body) {
1161
- const { ContentRepository } = await import("../content-BfyjOiMi.mjs").then((n) => n.n);
1325
+ const { ContentRepository } = await import("../content-QaryevFO.mjs").then((n) => n.n);
1162
1326
  const repo = new ContentRepository(this.db);
1163
1327
  const resolvedItem = await repo.findByIdOrSlug(collection, id, body.locale);
1164
1328
  const resolvedId = resolvedItem?.id ?? id;
@@ -1654,6 +1818,47 @@ var DinewayRuntime = class DinewayRuntime {
1654
1818
  }
1655
1819
  };
1656
1820
 
1821
+ //#endregion
1822
+ //#region src/astro/middleware/stream-end-metrics.ts
1823
+ /**
1824
+ * Stream-end metrics.
1825
+ *
1826
+ * Server-Timing counters are captured when middleware receives the Response,
1827
+ * but Astro may continue rendering the body afterwards. When query logging is
1828
+ * enabled, this wrapper emits one final snapshot after the response body has
1829
+ * finished streaming so post-header database/cache work is visible too.
1830
+ */
1831
+ const STREAM_END_PREFIX = "[dineway-stream-end]";
1832
+ const ASTRO_COOKIES_SYMBOL$1 = Symbol.for("astro.cookies");
1833
+ function wrapBodyForStreamMetrics(response) {
1834
+ if (!isInstrumentationEnabled()) return response;
1835
+ if (!response.body) return response;
1836
+ const ctx = getRequestContext();
1837
+ const metrics = ctx?.metrics;
1838
+ if (!metrics) return response;
1839
+ const recorder = ctx.queryRecorder;
1840
+ const transform = new TransformStream({ flush() {
1841
+ const snapshot = {
1842
+ route: recorder?.route,
1843
+ method: recorder?.method,
1844
+ phase: recorder?.phase,
1845
+ totalMs: performance.now() - metrics.start,
1846
+ dbCount: metrics.dbCount,
1847
+ dbTotalMs: metrics.dbTotalMs,
1848
+ dbFirstOffset: metrics.dbFirstOffset,
1849
+ dbLastOffset: metrics.dbLastOffset,
1850
+ cacheHits: metrics.cacheHits,
1851
+ cacheMisses: metrics.cacheMisses
1852
+ };
1853
+ console.log(`${STREAM_END_PREFIX} ${JSON.stringify(snapshot)}`);
1854
+ } });
1855
+ const wrapped = new Response(response.body.pipeThrough(transform), response);
1856
+ const astroCookies = Reflect.get(response, ASTRO_COOKIES_SYMBOL$1);
1857
+ if (astroCookies !== void 0) Reflect.set(wrapped, ASTRO_COOKIES_SYMBOL$1, astroCookies);
1858
+ wrapped.headers.delete("Content-Length");
1859
+ return wrapped;
1860
+ }
1861
+
1657
1862
  //#endregion
1658
1863
  //#region src/astro/public-plugin-api-routes.ts
1659
1864
  function pluginRouteNotFound() {
@@ -1680,8 +1885,8 @@ function createPublicPluginApiRouteHandler(runtime) {
1680
1885
  * Thin wrapper that initializes DinewayRuntime and attaches it to locals.
1681
1886
  * All heavy lifting happens in DinewayRuntime.
1682
1887
  */
1683
- let runtimeInstance = null;
1684
- let runtimeInitializing = false;
1888
+ const RUNTIME_INIT_DEADLINE_MS = DB_INIT_DEADLINE_MS + 3e4;
1889
+ const RUNTIME_HOLDER_KEY = Symbol.for("dineway:runtime");
1685
1890
  /** Whether i18n config has been initialized from the virtual module */
1686
1891
  let i18nInitialized = false;
1687
1892
  /**
@@ -1699,6 +1904,17 @@ let i18nInitialized = false;
1699
1904
  */
1700
1905
  const SETUP_VERIFIED_KEY = Symbol.for("dineway:setup-verified");
1701
1906
  const setupFlagStore = globalThis;
1907
+ function getRuntimeHolder() {
1908
+ let holder = setupFlagStore[RUNTIME_HOLDER_KEY];
1909
+ if (!holder) {
1910
+ holder = {
1911
+ instance: null,
1912
+ lock: createInitLock()
1913
+ };
1914
+ setupFlagStore[RUNTIME_HOLDER_KEY] = holder;
1915
+ }
1916
+ return holder;
1917
+ }
1702
1918
  function isSetupVerified() {
1703
1919
  return setupFlagStore[SETUP_VERIFIED_KEY] === true;
1704
1920
  }
@@ -1744,21 +1960,18 @@ function buildDependencies(config) {
1744
1960
  /**
1745
1961
  * Get or create the runtime instance
1746
1962
  */
1747
- async function getRuntime(config) {
1748
- if (runtimeInstance) return runtimeInstance;
1749
- if (runtimeInitializing) {
1750
- await new Promise((resolve) => setTimeout(resolve, 50));
1751
- return getRuntime(config);
1752
- }
1753
- runtimeInitializing = true;
1754
- try {
1963
+ async function getRuntime(config, timings) {
1964
+ const holder = getRuntimeHolder();
1965
+ return initWithLock(holder.lock, () => holder.instance, async (isCurrentClaim) => {
1755
1966
  const deps = buildDependencies(config);
1756
- const runtime = await DinewayRuntime.create(deps);
1757
- runtimeInstance = runtime;
1967
+ const runtime = await DinewayRuntime.create(deps, timings);
1968
+ if (isCurrentClaim()) holder.instance = runtime;
1969
+ else await runtime.stopCron();
1758
1970
  return runtime;
1759
- } finally {
1760
- runtimeInitializing = false;
1761
- }
1971
+ }, {
1972
+ deadlineMs: RUNTIME_INIT_DEADLINE_MS,
1973
+ anchor: (promise) => after(() => promise)
1974
+ });
1762
1975
  }
1763
1976
  const ASTRO_COOKIES_SYMBOL = Symbol.for("astro.cookies");
1764
1977
  /**
@@ -1836,7 +2049,7 @@ const onRequest = defineMiddleware(async (context, next) => {
1836
2049
  const url = context.url;
1837
2050
  const queryRecorder = isInstrumentationEnabled() ? createRecorder(url.pathname, request.method, request.headers.get("x-dineway-perf-phase") ?? "default") : void 0;
1838
2051
  const serverTimings = createServerTimings();
1839
- const metrics = serverTimings ? createRequestMetrics(performance.now()) : void 0;
2052
+ const metrics = serverTimings || queryRecorder ? createRequestMetrics(performance.now()) : void 0;
1840
2053
  const middlewareStart = startServerTiming(serverTimings);
1841
2054
  const handleRequest = async () => {
1842
2055
  const isDinewayRoute = url.pathname.startsWith("/_dineway");
@@ -1850,7 +2063,7 @@ const onRequest = defineMiddleware(async (context, next) => {
1850
2063
  if (!isSetupVerified()) {
1851
2064
  const setupStart = startServerTiming(serverTimings);
1852
2065
  try {
1853
- const { getDb } = await import("../loader-Y0QvC_QO.mjs").then((n) => n.i);
2066
+ const { getDb } = await import("../loader-tg63WSY2.mjs").then((n) => n.i);
1854
2067
  await (await getDb()).selectFrom("_dineway_migrations").selectAll().limit(1).execute();
1855
2068
  markSetupVerified();
1856
2069
  } catch (error) {
@@ -1862,8 +2075,10 @@ const onRequest = defineMiddleware(async (context, next) => {
1862
2075
  const config = getConfig();
1863
2076
  if (config) {
1864
2077
  const runtimeStart = startServerTiming(serverTimings);
2078
+ const initSubTimings = serverTimings ? [] : void 0;
1865
2079
  try {
1866
- const runtime = await getRuntime(config);
2080
+ const runtime = await getRuntime(config, initSubTimings);
2081
+ runtime.tickCron();
1867
2082
  markSetupVerified();
1868
2083
  locals.dineway = {
1869
2084
  handlePublicPluginApiRoute: createPublicPluginApiRouteHandler(runtime),
@@ -1875,13 +2090,14 @@ const onRequest = defineMiddleware(async (context, next) => {
1875
2090
  };
1876
2091
  } catch {}
1877
2092
  addServerTiming(serverTimings, "rt", runtimeStart, "Runtime init");
2093
+ if (serverTimings && initSubTimings) serverTimings.push(...initSubTimings);
1878
2094
  }
1879
2095
  const renderStart = startServerTiming(serverTimings);
1880
2096
  const response = await next();
1881
2097
  addServerTiming(serverTimings, "render", renderStart, "Page render");
1882
2098
  addServerTiming(serverTimings, "mw", middlewareStart, "Total middleware");
1883
2099
  addRequestMetricTimings(serverTimings, metrics);
1884
- return setBaselineSecurityHeaders(response, url.pathname, serverTimings);
2100
+ return wrapBodyForStreamMetrics(setBaselineSecurityHeaders(response, url.pathname, serverTimings));
1885
2101
  }
1886
2102
  }
1887
2103
  const config = getConfig();
@@ -1892,8 +2108,11 @@ const onRequest = defineMiddleware(async (context, next) => {
1892
2108
  const doInit = async () => {
1893
2109
  try {
1894
2110
  let timingStart = startServerTiming(serverTimings);
1895
- const runtime = await getRuntime(config);
2111
+ const initSubTimings = serverTimings ? [] : void 0;
2112
+ const runtime = await getRuntime(config, initSubTimings);
2113
+ runtime.tickCron();
1896
2114
  addServerTiming(serverTimings, "rt", timingStart, "Runtime init");
2115
+ if (serverTimings && initSubTimings) serverTimings.push(...initSubTimings);
1897
2116
  markSetupVerified();
1898
2117
  locals.dineway = {
1899
2118
  handleContentList: runtime.handleContentList.bind(runtime),
@@ -1952,7 +2171,7 @@ const onRequest = defineMiddleware(async (context, next) => {
1952
2171
  addServerTiming(serverTimings, "render", renderStart, "Page render");
1953
2172
  addServerTiming(serverTimings, "mw", middlewareStart, "Total middleware");
1954
2173
  addRequestMetricTimings(serverTimings, metrics);
1955
- return setBaselineSecurityHeaders(response, url.pathname, serverTimings);
2174
+ return wrapBodyForStreamMetrics(setBaselineSecurityHeaders(response, url.pathname, serverTimings));
1956
2175
  };
1957
2176
  if (requestDb) {
1958
2177
  const editMode = context.cookies.get("dineway-edit-mode")?.value === "true";
@@ -1981,4 +2200,4 @@ const onRequest = defineMiddleware(async (context, next) => {
1981
2200
  });
1982
2201
 
1983
2202
  //#endregion
1984
- export { onRequest as default, onRequest };
2203
+ export { RUNTIME_INIT_DEADLINE_MS, onRequest as default, onRequest };