emdash 0.18.0 → 0.19.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 (408) hide show
  1. package/dist/api/route-utils.d.mts +2 -2
  2. package/dist/api/route-utils.mjs +14 -14
  3. package/dist/api/schemas/index.d.mts +2 -2
  4. package/dist/api/schemas/index.mjs +3 -3
  5. package/dist/{api-Cs7DAACP.mjs → api-BZ6bhjYs.mjs} +88 -16
  6. package/dist/api-BZ6bhjYs.mjs.map +1 -0
  7. package/dist/{apply-BWMV4Zmw.mjs → apply-hQkKKBCf.mjs} +23 -23
  8. package/dist/apply-hQkKKBCf.mjs.map +1 -0
  9. package/dist/astro/index.d.mts +8 -8
  10. package/dist/astro/index.d.mts.map +1 -1
  11. package/dist/astro/index.mjs +113 -23
  12. package/dist/astro/index.mjs.map +1 -1
  13. package/dist/astro/middleware/auth.d.mts +7 -7
  14. package/dist/astro/middleware/auth.mjs +2 -2
  15. package/dist/astro/middleware/redirect.mjs +4 -4
  16. package/dist/astro/middleware/request-context.mjs +2 -2
  17. package/dist/astro/middleware.d.mts +26 -4
  18. package/dist/astro/middleware.d.mts.map +1 -1
  19. package/dist/astro/middleware.mjs +205 -173
  20. package/dist/astro/middleware.mjs.map +1 -1
  21. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +5 -5
  22. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +5 -5
  23. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +2 -2
  24. package/dist/astro/routes/api/admin/api-tokens/index.mjs +3 -3
  25. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +5 -5
  26. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +8 -8
  27. package/dist/astro/routes/api/admin/byline-fields/index.mjs +8 -8
  28. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +8 -8
  29. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +12 -12
  30. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +12 -12
  31. package/dist/astro/routes/api/admin/bylines/index.mjs +12 -12
  32. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +11 -11
  33. package/dist/astro/routes/api/admin/comments/_id_.mjs +5 -5
  34. package/dist/astro/routes/api/admin/comments/bulk.mjs +8 -8
  35. package/dist/astro/routes/api/admin/comments/counts.mjs +5 -5
  36. package/dist/astro/routes/api/admin/comments/index.mjs +8 -8
  37. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +5 -5
  38. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +4 -4
  39. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +3 -3
  40. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +3 -3
  41. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +31 -31
  42. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +31 -31
  43. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +30 -30
  44. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +30 -30
  45. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +30 -30
  46. package/dist/astro/routes/api/admin/plugins/index.mjs +30 -30
  47. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
  48. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +30 -30
  49. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +30 -30
  50. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +30 -30
  51. package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +30 -30
  52. package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +31 -31
  53. package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +30 -30
  54. package/dist/astro/routes/api/admin/plugins/registry/install.mjs +31 -31
  55. package/dist/astro/routes/api/admin/plugins/updates.mjs +30 -30
  56. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +30 -30
  57. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
  58. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +30 -30
  59. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +3 -3
  60. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
  61. package/dist/astro/routes/api/admin/users/_id_/index.mjs +6 -6
  62. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +4 -4
  63. package/dist/astro/routes/api/admin/users/index.mjs +5 -5
  64. package/dist/astro/routes/api/auth/dev-bypass.mjs +3 -3
  65. package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
  66. package/dist/astro/routes/api/auth/invite/complete.mjs +6 -6
  67. package/dist/astro/routes/api/auth/invite/index.mjs +7 -7
  68. package/dist/astro/routes/api/auth/invite/register-options.mjs +6 -6
  69. package/dist/astro/routes/api/auth/logout.mjs +2 -2
  70. package/dist/astro/routes/api/auth/magic-link/send.mjs +8 -8
  71. package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
  72. package/dist/astro/routes/api/auth/me.mjs +6 -6
  73. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +2 -2
  74. package/dist/astro/routes/api/auth/passkey/_id_.mjs +5 -5
  75. package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
  76. package/dist/astro/routes/api/auth/passkey/options.mjs +7 -7
  77. package/dist/astro/routes/api/auth/passkey/register/options.mjs +6 -6
  78. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +6 -6
  79. package/dist/astro/routes/api/auth/passkey/verify.mjs +6 -6
  80. package/dist/astro/routes/api/auth/signup/complete.mjs +6 -6
  81. package/dist/astro/routes/api/auth/signup/request.mjs +8 -8
  82. package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
  83. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +11 -11
  84. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +3 -3
  85. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +6 -5
  86. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs.map +1 -1
  87. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +3 -3
  88. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
  89. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +8 -8
  90. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +9 -8
  91. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs.map +1 -1
  92. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +3 -3
  93. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +3 -3
  94. package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts.map +1 -1
  95. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +12 -10
  96. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs.map +1 -1
  97. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +11 -11
  98. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +3 -3
  99. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +6 -5
  100. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs.map +1 -1
  101. package/dist/astro/routes/api/content/_collection_/_id_.mjs +9 -8
  102. package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
  103. package/dist/astro/routes/api/content/_collection_/authors.d.mts +8 -0
  104. package/dist/astro/routes/api/content/_collection_/authors.d.mts.map +1 -0
  105. package/dist/astro/routes/api/content/_collection_/authors.mjs +19 -0
  106. package/dist/astro/routes/api/content/_collection_/authors.mjs.map +1 -0
  107. package/dist/astro/routes/api/content/_collection_/index.mjs +6 -6
  108. package/dist/astro/routes/api/content/_collection_/trash.mjs +6 -6
  109. package/dist/astro/routes/api/dashboard.mjs +7 -7
  110. package/dist/astro/routes/api/dev/emails.mjs +2 -2
  111. package/dist/astro/routes/api/import/probe.d.mts +2 -2
  112. package/dist/astro/routes/api/import/probe.mjs +6 -6
  113. package/dist/astro/routes/api/import/wordpress/analyze.mjs +4 -4
  114. package/dist/astro/routes/api/import/wordpress/execute.d.mts +7 -7
  115. package/dist/astro/routes/api/import/wordpress/execute.mjs +9 -9
  116. package/dist/astro/routes/api/import/wordpress/media.mjs +6 -6
  117. package/dist/astro/routes/api/import/wordpress/prepare.mjs +9 -9
  118. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +8 -8
  119. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +6 -6
  120. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +9 -9
  121. package/dist/astro/routes/api/manifest.mjs +3 -3
  122. package/dist/astro/routes/api/mcp.mjs +28 -28
  123. package/dist/astro/routes/api/media/_id_/confirm.mjs +6 -6
  124. package/dist/astro/routes/api/media/_id_.mjs +6 -6
  125. package/dist/astro/routes/api/media/file/_...key_.mjs +2 -2
  126. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +3 -3
  127. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +3 -3
  128. package/dist/astro/routes/api/media/providers/index.mjs +3 -3
  129. package/dist/astro/routes/api/media/upload-url.mjs +6 -6
  130. package/dist/astro/routes/api/media.mjs +7 -7
  131. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +7 -7
  132. package/dist/astro/routes/api/menus/_name_/items.mjs +7 -7
  133. package/dist/astro/routes/api/menus/_name_/reorder.mjs +7 -7
  134. package/dist/astro/routes/api/menus/_name_/translations.mjs +7 -7
  135. package/dist/astro/routes/api/menus/_name_.mjs +7 -7
  136. package/dist/astro/routes/api/menus/index.mjs +7 -7
  137. package/dist/astro/routes/api/oauth/authorize.mjs +1 -1
  138. package/dist/astro/routes/api/oauth/device/authorize.mjs +4 -4
  139. package/dist/astro/routes/api/oauth/device/code.mjs +5 -5
  140. package/dist/astro/routes/api/oauth/device/token.mjs +5 -5
  141. package/dist/astro/routes/api/oauth/register.mjs +2 -2
  142. package/dist/astro/routes/api/oauth/token/refresh.mjs +4 -4
  143. package/dist/astro/routes/api/oauth/token/revoke.mjs +4 -4
  144. package/dist/astro/routes/api/oauth/token.mjs +4 -4
  145. package/dist/astro/routes/api/openapi.json.mjs +17 -3
  146. package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
  147. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
  148. package/dist/astro/routes/api/redirects/404s/index.mjs +9 -9
  149. package/dist/astro/routes/api/redirects/404s/summary.mjs +9 -9
  150. package/dist/astro/routes/api/redirects/_id_.mjs +10 -10
  151. package/dist/astro/routes/api/redirects/index.mjs +10 -10
  152. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +3 -3
  153. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +3 -3
  154. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +30 -30
  155. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +30 -30
  156. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +30 -30
  157. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +30 -30
  158. package/dist/astro/routes/api/schema/collections/index.mjs +30 -30
  159. package/dist/astro/routes/api/schema/index.mjs +6 -6
  160. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +30 -30
  161. package/dist/astro/routes/api/schema/orphans/index.mjs +30 -30
  162. package/dist/astro/routes/api/search/enable.mjs +9 -9
  163. package/dist/astro/routes/api/search/index.mjs +8 -8
  164. package/dist/astro/routes/api/search/rebuild.mjs +9 -9
  165. package/dist/astro/routes/api/search/stats.mjs +6 -6
  166. package/dist/astro/routes/api/search/suggest.mjs +8 -8
  167. package/dist/astro/routes/api/sections/_slug_.mjs +8 -8
  168. package/dist/astro/routes/api/sections/index.mjs +8 -8
  169. package/dist/astro/routes/api/settings/email.mjs +5 -5
  170. package/dist/astro/routes/api/settings.mjs +12 -12
  171. package/dist/astro/routes/api/setup/admin-verify.mjs +6 -6
  172. package/dist/astro/routes/api/setup/admin.mjs +6 -6
  173. package/dist/astro/routes/api/setup/dev-bypass.mjs +18 -18
  174. package/dist/astro/routes/api/setup/dev-reset.mjs +3 -3
  175. package/dist/astro/routes/api/setup/index.mjs +21 -21
  176. package/dist/astro/routes/api/setup/status.mjs +3 -3
  177. package/dist/astro/routes/api/snapshot.mjs +5 -5
  178. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +11 -11
  179. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +11 -11
  180. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +11 -11
  181. package/dist/astro/routes/api/taxonomies/index.mjs +11 -11
  182. package/dist/astro/routes/api/themes/preview.mjs +5 -5
  183. package/dist/astro/routes/api/typegen.mjs +5 -5
  184. package/dist/astro/routes/api/well-known/auth.mjs +1 -1
  185. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +6 -6
  186. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +8 -8
  187. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +8 -8
  188. package/dist/astro/routes/api/widget-areas/_name_.mjs +5 -5
  189. package/dist/astro/routes/api/widget-areas/index.mjs +8 -8
  190. package/dist/astro/routes/api/widget-components.mjs +2 -2
  191. package/dist/astro/routes/robots.txt.mjs +6 -6
  192. package/dist/astro/routes/sitemap-_collection_.xml.mjs +6 -6
  193. package/dist/astro/routes/sitemap.xml.mjs +6 -6
  194. package/dist/astro/types.d.mts +15 -8
  195. package/dist/astro/types.d.mts.map +1 -1
  196. package/dist/{authorize-CotM4Yiu.mjs → authorize-C_8t2KGa.mjs} +2 -2
  197. package/dist/{authorize-CotM4Yiu.mjs.map → authorize-C_8t2KGa.mjs.map} +1 -1
  198. package/dist/{byline-CWQ9aSoz.mjs → byline-DUx48sJp.mjs} +6 -6
  199. package/dist/{byline-CWQ9aSoz.mjs.map → byline-DUx48sJp.mjs.map} +1 -1
  200. package/dist/{byline-fields-Dr-xcb6S.mjs → byline-fields-51kg6Vuv.mjs} +3 -3
  201. package/dist/{byline-fields-Dr-xcb6S.mjs.map → byline-fields-51kg6Vuv.mjs.map} +1 -1
  202. package/dist/{byline-fields-DC3Wkk-U.mjs → byline-fields-C_OsR-KF.mjs} +2 -2
  203. package/dist/{byline-fields-DC3Wkk-U.mjs.map → byline-fields-C_OsR-KF.mjs.map} +1 -1
  204. package/dist/{byline-fields-BNy7Ng1U.d.mts → byline-fields-DYXKDuNX.d.mts} +26 -2
  205. package/dist/byline-fields-DYXKDuNX.d.mts.map +1 -0
  206. package/dist/{byline-registry-CxK5g559.mjs → byline-registry-CWP7I71B.mjs} +3 -3
  207. package/dist/{byline-registry-CxK5g559.mjs.map → byline-registry-CWP7I71B.mjs.map} +1 -1
  208. package/dist/{bylines-LJMgENMI.mjs → bylines-Cx5n-WqP.mjs} +3 -3
  209. package/dist/{bylines-LJMgENMI.mjs.map → bylines-Cx5n-WqP.mjs.map} +1 -1
  210. package/dist/{bylines-BJSva1Un.mjs → bylines-wurS258E.mjs} +50 -6
  211. package/dist/{bylines-BJSva1Un.mjs.map → bylines-wurS258E.mjs.map} +1 -1
  212. package/dist/{cache-lZL7SgVb.mjs → cache-B_HzASVT.mjs} +3 -3
  213. package/dist/{cache-lZL7SgVb.mjs.map → cache-B_HzASVT.mjs.map} +1 -1
  214. package/dist/{chunks-BU-vP9Dh.mjs → chunks-BerYVuve.mjs} +2 -2
  215. package/dist/{chunks-BU-vP9Dh.mjs.map → chunks-BerYVuve.mjs.map} +1 -1
  216. package/dist/cli/index.mjs +40 -27
  217. package/dist/cli/index.mjs.map +1 -1
  218. package/dist/client/cf-access.d.mts +1 -1
  219. package/dist/client/index.d.mts +1 -1
  220. package/dist/{comment-C4jVbCM8.mjs → comment-sqQxNpN3.mjs} +2 -2
  221. package/dist/{comment-C4jVbCM8.mjs.map → comment-sqQxNpN3.mjs.map} +1 -1
  222. package/dist/{comments-BTAbC0Ek.mjs → comments-CJ0RZsYR.mjs} +3 -3
  223. package/dist/{comments-BTAbC0Ek.mjs.map → comments-CJ0RZsYR.mjs.map} +1 -1
  224. package/dist/{content-CyqOmOzm.mjs → content-BIlVx-RX.mjs} +132 -43
  225. package/dist/content-BIlVx-RX.mjs.map +1 -0
  226. package/dist/{context-DZ7bEh5-.mjs → context-GG52SPgh.mjs} +10 -10
  227. package/dist/{context-DZ7bEh5-.mjs.map → context-GG52SPgh.mjs.map} +1 -1
  228. package/dist/{cron-DZovZUnC.mjs → cron-BJ2ClIlj.mjs} +4 -3
  229. package/dist/cron-BJ2ClIlj.mjs.map +1 -0
  230. package/dist/{dashboard-B5WQpNTP.mjs → dashboard-2JgAMWxK.mjs} +4 -4
  231. package/dist/{dashboard-B5WQpNTP.mjs.map → dashboard-2JgAMWxK.mjs.map} +1 -1
  232. package/dist/db/index.d.mts +2 -2
  233. package/dist/db/index.mjs +1 -1
  234. package/dist/{device-flow-ptLrVINd.mjs → device-flow-s6_q3T7A.mjs} +2 -2
  235. package/dist/{device-flow-ptLrVINd.mjs.map → device-flow-s6_q3T7A.mjs.map} +1 -1
  236. package/dist/{error-DJOsMVSt.mjs → error-RwM4dD35.mjs} +2 -2
  237. package/dist/{error-DJOsMVSt.mjs.map → error-RwM4dD35.mjs.map} +1 -1
  238. package/dist/{fts-manager-DR1ERA0c.mjs → fts-manager-1RgHmopc.mjs} +2 -2
  239. package/dist/{fts-manager-DR1ERA0c.mjs.map → fts-manager-1RgHmopc.mjs.map} +1 -1
  240. package/dist/{index-D60_SzHG.d.mts → index-BpYeJO1E.d.mts} +2 -2
  241. package/dist/{index-D60_SzHG.d.mts.map → index-BpYeJO1E.d.mts.map} +1 -1
  242. package/dist/{index-CjKdMZ3U.d.mts → index-FfiTQJq2.d.mts} +199 -17
  243. package/dist/index-FfiTQJq2.d.mts.map +1 -0
  244. package/dist/index.d.mts +9 -9
  245. package/dist/index.mjs +43 -43
  246. package/dist/{load-6ZrRhepW.mjs → load-B84ohfBk.mjs} +2 -2
  247. package/dist/{load-6ZrRhepW.mjs.map → load-B84ohfBk.mjs.map} +1 -1
  248. package/dist/{loader-Dyx8dhFV.mjs → loader-CpZKpFz0.mjs} +32 -30
  249. package/dist/loader-CpZKpFz0.mjs.map +1 -0
  250. package/dist/media/index.mjs +1 -1
  251. package/dist/media/local-runtime.d.mts +7 -7
  252. package/dist/media/local-runtime.mjs +6 -6
  253. package/dist/{media-C-oovGCG.mjs → media-JOf3pNkw.mjs} +2 -2
  254. package/dist/{media-C-oovGCG.mjs.map → media-JOf3pNkw.mjs.map} +1 -1
  255. package/dist/{menus-DugoYwTX.mjs → menus-DX4_E01q.mjs} +3 -3
  256. package/dist/{menus-DugoYwTX.mjs.map → menus-DX4_E01q.mjs.map} +1 -1
  257. package/dist/{menus-BKkxXCmd.mjs → menus-Dp9xporj.mjs} +86 -9
  258. package/dist/menus-Dp9xporj.mjs.map +1 -0
  259. package/dist/{normalize-DVV8nbrL.mjs → normalize-CK5o04zr.mjs} +2 -2
  260. package/dist/{normalize-DVV8nbrL.mjs.map → normalize-CK5o04zr.mjs.map} +1 -1
  261. package/dist/{oauth-authorization-DvBAL75d.mjs → oauth-authorization-1aPAYjiC.mjs} +2 -2
  262. package/dist/{oauth-authorization-DvBAL75d.mjs.map → oauth-authorization-1aPAYjiC.mjs.map} +1 -1
  263. package/dist/{options-BL4X94qY.mjs → options-BPCVnesz.mjs} +1 -1
  264. package/dist/{options-BL4X94qY.mjs.map → options-BPCVnesz.mjs.map} +1 -1
  265. package/dist/{options-tb7DJROi.d.mts → options-D4MnavW_.d.mts} +3 -3
  266. package/dist/{options-tb7DJROi.d.mts.map → options-D4MnavW_.d.mts.map} +1 -1
  267. package/dist/{parse-BBkFmLVr.mjs → parse-CrGndy1A.mjs} +2 -2
  268. package/dist/{parse-BBkFmLVr.mjs.map → parse-CrGndy1A.mjs.map} +1 -1
  269. package/dist/{patterns-CqG5Ya3i.mjs → patterns-p-RBdTbM.mjs} +1 -1
  270. package/dist/{patterns-CqG5Ya3i.mjs.map → patterns-p-RBdTbM.mjs.map} +1 -1
  271. package/dist/plugin-utils.d.mts +7 -7
  272. package/dist/plugins/adapt-sandbox-entry.d.mts +7 -7
  273. package/dist/{query-Ctlq1aOk.mjs → query-BFQ029Ts.mjs} +21 -15
  274. package/dist/query-BFQ029Ts.mjs.map +1 -0
  275. package/dist/{rate-limit-CH6W6ikK.mjs → rate-limit-ClFFUga6.mjs} +2 -2
  276. package/dist/{rate-limit-CH6W6ikK.mjs.map → rate-limit-ClFFUga6.mjs.map} +1 -1
  277. package/dist/{redirect-C6tJA7tk.mjs → redirect-CRWIt8Zj.mjs} +3 -3
  278. package/dist/{redirect-C6tJA7tk.mjs.map → redirect-CRWIt8Zj.mjs.map} +1 -1
  279. package/dist/{redirects-C0L9JUk4.mjs → redirects-DEygMrRO.mjs} +25 -3
  280. package/dist/redirects-DEygMrRO.mjs.map +1 -0
  281. package/dist/{redirects-CacE9eQa.mjs → redirects-OIu6vQ2i.mjs} +5 -5
  282. package/dist/{redirects-CacE9eQa.mjs.map → redirects-OIu6vQ2i.mjs.map} +1 -1
  283. package/dist/{registry-CIDxZbhh.mjs → registry-brYh-rAT.mjs} +6 -6
  284. package/dist/{registry-CIDxZbhh.mjs.map → registry-brYh-rAT.mjs.map} +1 -1
  285. package/dist/{request-cache-BYMs-BGX.mjs → request-cache-D32LpnmI.mjs} +1 -1
  286. package/dist/{request-cache-BYMs-BGX.mjs.map → request-cache-D32LpnmI.mjs.map} +1 -1
  287. package/dist/{runner-pt6Wl-l-.mjs → runner--4wMWwKM.mjs} +217 -166
  288. package/dist/runner--4wMWwKM.mjs.map +1 -0
  289. package/dist/{runner-DM1yR5qd.d.mts → runner-BcRuXq_h.d.mts} +2 -2
  290. package/dist/{runner-DM1yR5qd.d.mts.map → runner-BcRuXq_h.d.mts.map} +1 -1
  291. package/dist/runtime.d.mts +7 -7
  292. package/dist/runtime.mjs +2 -2
  293. package/dist/{schema-B4tk0HAG.mjs → schema-CS7Eg5gh.mjs} +5 -5
  294. package/dist/{schema-B4tk0HAG.mjs.map → schema-CS7Eg5gh.mjs.map} +1 -1
  295. package/dist/{search-f-fNfwab.mjs → search-o-aQzHI1.mjs} +4 -4
  296. package/dist/{search-f-fNfwab.mjs.map → search-o-aQzHI1.mjs.map} +1 -1
  297. package/dist/{secrets-YYbTgB1w.mjs → secrets-C_ZtRos3.mjs} +2 -2
  298. package/dist/{secrets-YYbTgB1w.mjs.map → secrets-C_ZtRos3.mjs.map} +1 -1
  299. package/dist/{sections-biElLfT9.mjs → sections-DhsZ0ns9.mjs} +3 -3
  300. package/dist/{sections-biElLfT9.mjs.map → sections-DhsZ0ns9.mjs.map} +1 -1
  301. package/dist/seed/index.d.mts +2 -2
  302. package/dist/seed/index.mjs +16 -16
  303. package/dist/seo/index.d.mts +1 -1
  304. package/dist/{seo-BR39kvTF.mjs → seo-B5e6y9Wk.mjs} +2 -2
  305. package/dist/{seo-BR39kvTF.mjs.map → seo-B5e6y9Wk.mjs.map} +1 -1
  306. package/dist/{service-BhR2acnc.mjs → service-DAxg8RPR.mjs} +2 -2
  307. package/dist/{service-BhR2acnc.mjs.map → service-DAxg8RPR.mjs.map} +1 -1
  308. package/dist/{settings-b5zW1R1T.mjs → settings-B1p-gPUK.mjs} +5 -5
  309. package/dist/{settings-b5zW1R1T.mjs.map → settings-B1p-gPUK.mjs.map} +1 -1
  310. package/dist/{settings-D_NJvjgN.mjs → settings-DIsbHTRE.mjs} +3 -3
  311. package/dist/{settings-D_NJvjgN.mjs.map → settings-DIsbHTRE.mjs.map} +1 -1
  312. package/dist/{setup-complete-VoEZfasi.mjs → setup-complete-Yuv78yua.mjs} +2 -2
  313. package/dist/{setup-complete-VoEZfasi.mjs.map → setup-complete-Yuv78yua.mjs.map} +1 -1
  314. package/dist/{site-url-Cm8-sJy7.mjs → site-url-mEVmwIFi.mjs} +2 -2
  315. package/dist/{site-url-Cm8-sJy7.mjs.map → site-url-mEVmwIFi.mjs.map} +1 -1
  316. package/dist/{taxonomies-Crtzy4MT.mjs → taxonomies-BEW7S5AI.mjs} +7 -6
  317. package/dist/taxonomies-BEW7S5AI.mjs.map +1 -0
  318. package/dist/{taxonomies-Mhn9rjTQ.mjs → taxonomies-UusDXv3C.mjs} +4 -4
  319. package/dist/{taxonomies-Mhn9rjTQ.mjs.map → taxonomies-UusDXv3C.mjs.map} +1 -1
  320. package/dist/{taxonomy-DTZrIQpi.mjs → taxonomy-CdllE4oq.mjs} +3 -3
  321. package/dist/{taxonomy-DTZrIQpi.mjs.map → taxonomy-CdllE4oq.mjs.map} +1 -1
  322. package/dist/{transaction-NQj4VJ7Z.mjs → transaction-x2tJQ-A1.mjs} +1 -1
  323. package/dist/{transaction-NQj4VJ7Z.mjs.map → transaction-x2tJQ-A1.mjs.map} +1 -1
  324. package/dist/{transport-OnMNbsIA.d.mts → transport-BwQeeY2p.d.mts} +1 -1
  325. package/dist/{transport-OnMNbsIA.d.mts.map → transport-BwQeeY2p.d.mts.map} +1 -1
  326. package/dist/{types-K3MDsxpy.mjs → types-BXSUSAjt.mjs} +16 -3
  327. package/dist/{types-K3MDsxpy.mjs.map → types-BXSUSAjt.mjs.map} +1 -1
  328. package/dist/{types-D8bhH891.mjs → types-DZk_y-MU.mjs} +1 -1
  329. package/dist/{types-D8bhH891.mjs.map → types-DZk_y-MU.mjs.map} +1 -1
  330. package/dist/{types-DawhLFwy.d.mts → types-OT_Es5mp.d.mts} +26 -1
  331. package/dist/{types-DawhLFwy.d.mts.map → types-OT_Es5mp.d.mts.map} +1 -1
  332. package/dist/{types-i8_uzhMD.d.mts → types-WVmpZBJV.d.mts} +18 -3
  333. package/dist/types-WVmpZBJV.d.mts.map +1 -0
  334. package/dist/{user-DzEUl5zA.mjs → user-C0um7wrg.mjs} +18 -2
  335. package/dist/user-C0um7wrg.mjs.map +1 -0
  336. package/dist/{validate-Dy6nkNls.d.mts → validate-BPAHUSge.d.mts} +10 -2
  337. package/dist/validate-BPAHUSge.d.mts.map +1 -0
  338. package/dist/{validate-JCXcsqiY.mjs → validate-ZP9Dvg0P.mjs} +6 -3
  339. package/dist/validate-ZP9Dvg0P.mjs.map +1 -0
  340. package/dist/{validation-Bq-VyKJg.mjs → validation-CE5i4q0c.mjs} +5 -5
  341. package/dist/{validation-Bq-VyKJg.mjs.map → validation-CE5i4q0c.mjs.map} +1 -1
  342. package/dist/version-Dw0JXu45.mjs +7 -0
  343. package/dist/{version-CnS-Cr8A.mjs.map → version-Dw0JXu45.mjs.map} +1 -1
  344. package/dist/{widgets-Bap1eS1X.mjs → widgets-ClEnYQCH.mjs} +2 -2
  345. package/dist/{widgets-Bap1eS1X.mjs.map → widgets-ClEnYQCH.mjs.map} +1 -1
  346. package/dist/{zod-generator-BSDpkqSH.mjs → zod-generator-Djo_VHCt.mjs} +2 -2
  347. package/dist/{zod-generator-BSDpkqSH.mjs.map → zod-generator-Djo_VHCt.mjs.map} +1 -1
  348. package/package.json +5 -5
  349. package/src/api/handlers/content.ts +107 -8
  350. package/src/api/handlers/index.ts +2 -0
  351. package/src/api/openapi/document.ts +25 -0
  352. package/src/api/schemas/content.ts +33 -0
  353. package/src/astro/integration/index.ts +98 -0
  354. package/src/astro/integration/routes.ts +6 -0
  355. package/src/astro/integration/virtual-modules.ts +39 -0
  356. package/src/astro/integration/vite-config.ts +12 -0
  357. package/src/astro/middleware.ts +28 -0
  358. package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +4 -2
  359. package/src/astro/routes/api/content/[collection]/[id]/publish.ts +4 -2
  360. package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +8 -4
  361. package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +4 -2
  362. package/src/astro/routes/api/content/[collection]/[id].ts +4 -2
  363. package/src/astro/routes/api/content/[collection]/authors.ts +34 -0
  364. package/src/astro/types.ts +8 -1
  365. package/src/bylines/index.ts +57 -0
  366. package/src/cli/commands/export-seed.ts +28 -12
  367. package/src/components/EmDashImage.astro +22 -4
  368. package/src/components/Image.astro +20 -3
  369. package/src/database/migrations/043_content_references.ts +121 -0
  370. package/src/database/migrations/runner.ts +2 -0
  371. package/src/database/repositories/content.ts +225 -67
  372. package/src/database/repositories/index.ts +7 -0
  373. package/src/database/repositories/relation.ts +467 -0
  374. package/src/database/repositories/types.ts +31 -0
  375. package/src/database/repositories/user.ts +18 -0
  376. package/src/database/types.ts +34 -0
  377. package/src/emdash-runtime.ts +141 -42
  378. package/src/index.ts +8 -1
  379. package/src/loader.ts +67 -34
  380. package/src/media/responsive.ts +125 -0
  381. package/src/plugins/cron.ts +3 -2
  382. package/src/plugins/index.ts +5 -0
  383. package/src/plugins/scheduler/node.ts +9 -2
  384. package/src/query.ts +32 -5
  385. package/src/scheduled-publish.ts +153 -0
  386. package/src/seed/apply.ts +16 -6
  387. package/src/seed/types.ts +9 -0
  388. package/src/seed/validate.ts +15 -0
  389. package/src/taxonomies/index.ts +1 -0
  390. package/src/virtual-modules.d.ts +11 -0
  391. package/dist/api-Cs7DAACP.mjs.map +0 -1
  392. package/dist/apply-BWMV4Zmw.mjs.map +0 -1
  393. package/dist/byline-fields-BNy7Ng1U.d.mts.map +0 -1
  394. package/dist/content-CyqOmOzm.mjs.map +0 -1
  395. package/dist/cron-DZovZUnC.mjs.map +0 -1
  396. package/dist/index-CjKdMZ3U.d.mts.map +0 -1
  397. package/dist/loader-Dyx8dhFV.mjs.map +0 -1
  398. package/dist/menus-BKkxXCmd.mjs.map +0 -1
  399. package/dist/query-Ctlq1aOk.mjs.map +0 -1
  400. package/dist/redirects-C0L9JUk4.mjs.map +0 -1
  401. package/dist/runner-pt6Wl-l-.mjs.map +0 -1
  402. package/dist/taxonomies-Crtzy4MT.mjs.map +0 -1
  403. package/dist/types-i8_uzhMD.d.mts.map +0 -1
  404. package/dist/user-DzEUl5zA.mjs.map +0 -1
  405. package/dist/validate-Dy6nkNls.d.mts.map +0 -1
  406. package/dist/validate-JCXcsqiY.mjs.map +0 -1
  407. package/dist/version-CnS-Cr8A.mjs +0 -7
  408. package/src/plugins/scheduler/piggyback.ts +0 -71
@@ -1,12 +1,12 @@
1
- import "../../options-tb7DJROi.mjs";
2
- import "../../types-DawhLFwy.mjs";
1
+ import "../../options-D4MnavW_.mjs";
2
+ import "../../types-OT_Es5mp.mjs";
3
3
  import "../../types-DMwSpvcw.mjs";
4
- import "../../byline-fields-BNy7Ng1U.mjs";
5
- import "../../index-CjKdMZ3U.mjs";
6
- import "../../runner-DM1yR5qd.mjs";
7
- import "../../index-D60_SzHG.mjs";
4
+ import "../../byline-fields-DYXKDuNX.mjs";
5
+ import "../../index-FfiTQJq2.mjs";
6
+ import "../../runner-BcRuXq_h.mjs";
7
+ import "../../index-BpYeJO1E.mjs";
8
8
  import "../../types-DWnN7weG.mjs";
9
- import "../../validate-Dy6nkNls.mjs";
9
+ import "../../validate-BPAHUSge.mjs";
10
10
  import { EmDashHandlers } from "../types.mjs";
11
11
  import { User } from "@emdash-cms/auth";
12
12
  import * as astro from "astro";
@@ -1,6 +1,6 @@
1
1
  import "../../base64-CqR-7kqF.mjs";
2
- import "../../types-K3MDsxpy.mjs";
3
- import { t as apiError } from "../../error-DJOsMVSt.mjs";
2
+ import "../../types-BXSUSAjt.mjs";
3
+ import { t as apiError } from "../../error-RwM4dD35.mjs";
4
4
  import { n as getPublicOrigin } from "../../public-url-egRHCy1m.mjs";
5
5
  import { t as getAuthMode } from "../../mode-BjlXswIw.mjs";
6
6
  import { i as hasScope } from "../../api-tokens-B6VgoE6M.mjs";
@@ -1,9 +1,9 @@
1
1
  import "../../dialect-helpers-DRI5pyY3.mjs";
2
2
  import "../../base64-CqR-7kqF.mjs";
3
- import "../../types-K3MDsxpy.mjs";
4
- import { t as RedirectRepository } from "../../redirect-C6tJA7tk.mjs";
5
- import { a as setCachedRedirects, i as matchCachedPatterns, n as getCachedRedirects } from "../../cache-lZL7SgVb.mjs";
6
- import { r as getDb } from "../../loader-Dyx8dhFV.mjs";
3
+ import "../../types-BXSUSAjt.mjs";
4
+ import { t as RedirectRepository } from "../../redirect-CRWIt8Zj.mjs";
5
+ import { a as setCachedRedirects, i as matchCachedPatterns, n as getCachedRedirects } from "../../cache-B_HzASVT.mjs";
6
+ import { r as getDb } from "../../loader-CpZKpFz0.mjs";
7
7
  import { defineMiddleware } from "astro:middleware";
8
8
 
9
9
  //#region src/astro/middleware/redirect.ts
@@ -1,8 +1,8 @@
1
1
  import "../../base64-CqR-7kqF.mjs";
2
- import "../../options-BL4X94qY.mjs";
2
+ import "../../options-BPCVnesz.mjs";
3
3
  import { getRequestContext, runWithContext } from "../../request-context.mjs";
4
4
  import { n as parseContentId, r as verifyPreviewToken } from "../../tokens-Bx2afeT-.mjs";
5
- import { i as resolveSecretsCached } from "../../secrets-YYbTgB1w.mjs";
5
+ import { i as resolveSecretsCached } from "../../secrets-C_ZtRos3.mjs";
6
6
  import { defineMiddleware } from "astro:middleware";
7
7
 
8
8
  //#region src/visual-editing/toolbar.ts
@@ -1,13 +1,35 @@
1
+ import "../types-OT_Es5mp.mjs";
2
+ import { Kysely } from "kysely";
1
3
  import * as astro from "astro";
2
4
 
5
+ //#region src/scheduled-publish.d.ts
6
+ /** A content item that was promoted to published by a sweep. */
7
+ interface PublishedRef {
8
+ collection: string;
9
+ id: string;
10
+ }
11
+ //#endregion
3
12
  //#region src/astro/middleware.d.ts
4
13
  /**
5
- * EmDash middleware
14
+ * Run scheduled maintenance (cron tasks, scheduled publishing, system cleanup)
15
+ * outside any request. Resolves the runtime from the build-time virtual config
16
+ * and the cached singleton — the same instance request handlers use.
17
+ *
18
+ * Wired into a platform heartbeat that is not a request: the Cloudflare Worker's
19
+ * `scheduled()` handler (Cron Trigger) calls this. On Node the runtime's own
20
+ * timer-based scheduler already drives the same work, so this isn't needed there.
6
21
  *
7
- * Thin wrapper that initializes EmDashRuntime and attaches it to locals.
8
- * All heavy lifting happens in EmDashRuntime.
22
+ * Returns the content promoted by the publishing sweep so the caller can purge
23
+ * edge-cache tags for it. `onPublished` (optional) is awaited after each
24
+ * collection's batch so the caller can invalidate edge-cache tags incrementally
25
+ * rather than only after the whole sweep.
9
26
  */
27
+ declare function runScheduledTasks(options?: {
28
+ onPublished?: (refs: PublishedRef[]) => Promise<void>;
29
+ }): Promise<{
30
+ published: PublishedRef[];
31
+ }>;
10
32
  declare const onRequest: astro.MiddlewareHandler;
11
33
  //#endregion
12
- export { onRequest as default, onRequest };
34
+ export { onRequest as default, onRequest, runScheduledTasks };
13
35
  //# sourceMappingURL=middleware.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.mts","names":[],"sources":["../../src/astro/middleware.ts"],"mappings":";;;;;;AA8UA;;;cAAa,SAAA,EA+VX,KAAA,CA/VoB,iBAAA"}
1
+ {"version":3,"file":"middleware.d.mts","names":[],"sources":["../../src/scheduled-publish.ts","../../src/astro/middleware.ts"],"mappings":";;;;;ACwQA;AAAA,UDpPiB,YAAA;EAChB,UAAA;EACA,EAAA;AAAA;;;;;;;;;ACkPD;;;;;;;;iBAAsB,iBAAA,CACrB,OAAA;EAAW,WAAA,IAAe,IAAA,EAAM,YAAA,OAAmB,OAAA;AAAA,IACjD,OAAA;EAAU,SAAA,EAAW,YAAA;AAAA;AAAA,cAgGX,SAAA,EA+VX,KAAA,CA/VoB,iBAAA"}
@@ -1,70 +1,70 @@
1
- import { i as runMigrations, t as MIGRATION_RACE_WAIT_MS } from "../runner-pt6Wl-l-.mjs";
1
+ import { i as runMigrations, t as MIGRATION_RACE_WAIT_MS } from "../runner--4wMWwKM.mjs";
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 definePlugin, f as PluginRouteRegistry, g as resolveExclusiveHooks, h as createHookPipeline, p as EmailPipeline, v as after } from "../menus-BKkxXCmd.mjs";
6
- import { r as RevisionRepository } from "../content-CyqOmOzm.mjs";
5
+ import { _ as resolveExclusiveHooks, g as createHookPipeline, m as EmailPipeline, p as PluginRouteRegistry, v as definePlugin, y as after } from "../menus-Dp9xporj.mjs";
6
+ import { r as RevisionRepository, t as ContentRepository } from "../content-BIlVx-RX.mjs";
7
7
  import "../base64-CqR-7kqF.mjs";
8
- import "../types-K3MDsxpy.mjs";
9
- import { t as MediaRepository } from "../media-C-oovGCG.mjs";
10
- import "../user-DzEUl5zA.mjs";
11
- import "../taxonomy-DTZrIQpi.mjs";
12
- import "../comment-C4jVbCM8.mjs";
13
- import { t as OptionsRepository } from "../options-BL4X94qY.mjs";
14
- import "../context-DZ7bEh5-.mjs";
15
- import "../menus-DugoYwTX.mjs";
16
- import "../redirect-C6tJA7tk.mjs";
8
+ import "../types-BXSUSAjt.mjs";
9
+ import { t as MediaRepository } from "../media-JOf3pNkw.mjs";
10
+ import "../user-C0um7wrg.mjs";
11
+ import "../taxonomy-CdllE4oq.mjs";
12
+ import "../comment-sqQxNpN3.mjs";
13
+ import { t as OptionsRepository } from "../options-BPCVnesz.mjs";
14
+ import "../context-GG52SPgh.mjs";
15
+ import "../menus-DX4_E01q.mjs";
16
+ import "../redirect-CRWIt8Zj.mjs";
17
17
  import { createRequestMetrics, getRequestContext, runWithContext } from "../request-context.mjs";
18
- import { r as requestCached } from "../request-cache-BYMs-BGX.mjs";
19
- import "../byline-registry-CxK5g559.mjs";
20
- import "../byline-CWQ9aSoz.mjs";
21
- import { t as normalizeMediaValue } from "../normalize-DVV8nbrL.mjs";
18
+ import { r as requestCached } from "../request-cache-D32LpnmI.mjs";
19
+ import "../byline-registry-CWP7I71B.mjs";
20
+ import "../byline-DUx48sJp.mjs";
21
+ import { n as normalizeMediaValue } from "../normalize-CK5o04zr.mjs";
22
22
  import "../placeholder-BZxr8W1j.mjs";
23
- import "../seo-BR39kvTF.mjs";
23
+ import "../seo-B5e6y9Wk.mjs";
24
24
  import { n as isMissingTableError } from "../db-errors-CtzxKBxe.mjs";
25
- import { $ as handleContentGetIncludingTrashed, B as handleMediaUpdate, G as handleContentCompare, H as handleRevisionList, I as handleMediaCreate, J as handleContentCreate, K as handleContentCountScheduled, L as handleMediaDelete, Q as handleContentGet, R as handleMediaGet, S as PluginStateRepository, U as handleRevisionRestore, V as handleRevisionGet, X as handleContentDiscardDraft, Y as handleContentDelete, Z as handleContentDuplicate, _ as loadBundleFromR2, at as handleContentSchedule, ct as handleContentUnschedule, et as handleContentList, it as handleContentRestore, lt as handleContentUpdate, nt as handleContentPermanentDelete, ot as handleContentTranslations, q as handleContentCountTrashed, rt as handleContentPublish, s as normalizeRegistryConfig, st as handleContentUnpublish, tt as handleContentListTrashed, ut as validateRev, z as handleMediaList } from "../api-Cs7DAACP.mjs";
26
- import "../dashboard-B5WQpNTP.mjs";
25
+ 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-BZ6bhjYs.mjs";
26
+ import "../dashboard-2JgAMWxK.mjs";
27
27
  import { n as hashString } from "../hash-9w3pd3-m.mjs";
28
- import { t as FTSManager } from "../fts-manager-DR1ERA0c.mjs";
29
- import { n as SchemaRegistry } from "../registry-CIDxZbhh.mjs";
28
+ import { t as FTSManager } from "../fts-manager-1RgHmopc.mjs";
29
+ import { n as SchemaRegistry } from "../registry-brYh-rAT.mjs";
30
30
  import { createRecorder, flushRecorder, isInstrumentationEnabled, kyselyLogOption } from "../database/instrumentation.mjs";
31
- import { r as getDb } from "../loader-Dyx8dhFV.mjs";
32
- import "../schema-B4tk0HAG.mjs";
33
- import "../zod-generator-BSDpkqSH.mjs";
31
+ import { r as getDb } from "../loader-CpZKpFz0.mjs";
32
+ import "../schema-CS7Eg5gh.mjs";
33
+ import "../zod-generator-Djo_VHCt.mjs";
34
34
  import "../seo-DfjLvu8i.mjs";
35
- import "../sections-biElLfT9.mjs";
36
- import { o as invalidateSiteSettingsCache } from "../settings-b5zW1R1T.mjs";
37
- import "../settings-D_NJvjgN.mjs";
35
+ import "../sections-DhsZ0ns9.mjs";
36
+ import { o as invalidateSiteSettingsCache } from "../settings-B1p-gPUK.mjs";
37
+ import "../settings-DIsbHTRE.mjs";
38
38
  import "../resolve-BqYMVG0D.mjs";
39
- import "../taxonomies-Crtzy4MT.mjs";
40
- import "../taxonomies-Mhn9rjTQ.mjs";
39
+ import "../taxonomies-BEW7S5AI.mjs";
40
+ import "../taxonomies-UusDXv3C.mjs";
41
41
  import { r as normalizeManifestRoute } from "../manifest-schema-Cj-YrzrF.mjs";
42
42
  import "../types-Cj2S6FuC.mjs";
43
43
  import "../ssrf-BsVGIE0Z.mjs";
44
- import "../error-DJOsMVSt.mjs";
45
- import "../parse-BBkFmLVr.mjs";
46
- import "../redirects-C0L9JUk4.mjs";
47
- import "../byline-fields-Dr-xcb6S.mjs";
48
- import { a as invalidateUrlPatternCache } from "../query-Ctlq1aOk.mjs";
44
+ import "../error-RwM4dD35.mjs";
45
+ import "../parse-CrGndy1A.mjs";
46
+ import "../redirects-DEygMrRO.mjs";
47
+ import "../byline-fields-51kg6Vuv.mjs";
48
+ import { a as invalidateUrlPatternCache } from "../query-BFQ029Ts.mjs";
49
49
  import "../import-Dh8bWmyq.mjs";
50
50
  import { t as getTrustedProxyHeaders } from "../trusted-proxy-B4AfnoAp.mjs";
51
51
  import { n as sanitizeHeadersForSandbox, t as extractRequestMeta } from "../request-meta-7ByVLxB-.mjs";
52
52
  import "../ssrf-BvgVcfNQ.mjs";
53
- import { n as CronExecutor } from "../cron-DZovZUnC.mjs";
53
+ import { n as CronExecutor } from "../cron-BJ2ClIlj.mjs";
54
54
  import { r as devConsoleEmailDeliver, t as DEV_CONSOLE_EMAIL_PLUGIN_ID } from "../email-console-DHT2Fbpj.mjs";
55
55
  import "../utils-C4Ih4DML.mjs";
56
56
  import "../tokens-Bx2afeT-.mjs";
57
57
  import "../preview-BfuRkVKW.mjs";
58
- import "../bylines-BJSva1Un.mjs";
59
- import "../widgets-Bap1eS1X.mjs";
60
- import "../apply-BWMV4Zmw.mjs";
61
- import "../load-6ZrRhepW.mjs";
62
- import "../search-f-fNfwab.mjs";
58
+ import "../bylines-wurS258E.mjs";
59
+ import "../widgets-ClEnYQCH.mjs";
60
+ import "../apply-hQkKKBCf.mjs";
61
+ import "../load-B84ohfBk.mjs";
62
+ import "../search-o-aQzHI1.mjs";
63
63
  import "../index.mjs";
64
- import { n as VERSION, t as COMMIT } from "../version-CnS-Cr8A.mjs";
64
+ import { n as VERSION, t as COMMIT } from "../version-Dw0JXu45.mjs";
65
65
  import { t as getAuthMode } from "../mode-BjlXswIw.mjs";
66
66
  import { t as cleanupExpiredChallenges } from "../challenge-store-DGwuCc4R.mjs";
67
- import { a as validateEncryptionKeyAtStartup } from "../secrets-YYbTgB1w.mjs";
67
+ import { a as validateEncryptionKeyAtStartup } from "../secrets-C_ZtRos3.mjs";
68
68
  import { Kysely, sql } from "kysely";
69
69
  import { defineMiddleware } from "astro:middleware";
70
70
  import virtualConfig from "virtual:emdash/config";
@@ -73,6 +73,7 @@ import { mediaProviders } from "virtual:emdash/media-providers";
73
73
  import { plugins } from "virtual:emdash/plugins";
74
74
  import * as virtualSandboxRunnerModule from "virtual:emdash/sandbox-runner";
75
75
  import { sandboxedPlugins } from "virtual:emdash/sandboxed-plugins";
76
+ import { createScheduler } from "virtual:emdash/scheduler";
76
77
  import { createStorage } from "virtual:emdash/storage";
77
78
  import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
78
79
 
@@ -249,115 +250,70 @@ async function defaultCommentModerate(event, _ctx) {
249
250
  }
250
251
 
251
252
  //#endregion
252
- //#region src/plugins/scheduler/node.ts
253
- /** Minimum polling interval (ms) — prevents tight loops if next_run_at is in the past */
254
- const MIN_INTERVAL_MS = 1e3;
255
- /** Maximum polling interval (ms) wake up periodically to check for stale locks */
256
- const MAX_INTERVAL_MS = 300 * 1e3;
257
- var NodeCronScheduler = class {
258
- timer = null;
259
- running = false;
260
- systemCleanup = null;
261
- constructor(executor) {
262
- this.executor = executor;
263
- }
264
- setSystemCleanup(fn) {
265
- this.systemCleanup = fn;
266
- }
267
- start() {
268
- this.running = true;
269
- this.arm();
270
- }
271
- stop() {
272
- this.running = false;
273
- if (this.timer) {
274
- clearTimeout(this.timer);
275
- this.timer = null;
276
- }
277
- }
278
- reschedule() {
279
- if (!this.running) return;
280
- if (this.timer) {
281
- clearTimeout(this.timer);
282
- this.timer = null;
253
+ //#region src/scheduled-publish.ts
254
+ /**
255
+ * Default cap on items promoted per collection in a single sweep. Bounds the
256
+ * publish/webhook fan-out of one tick so a large backlog can't exhaust a Worker
257
+ * invocation's CPU/subrequest budget; the remainder drains on later ticks.
258
+ */
259
+ const SCHEDULED_PUBLISH_BATCH_LIMIT = 100;
260
+ /**
261
+ * Publish every content item whose `scheduled_at` is in the past.
262
+ *
263
+ * Iterates all collections, finds due items (`findReadyToPublish` returns both
264
+ * scheduled drafts and published entries with pending scheduled changes), and
265
+ * publishes each. `publish()` clears `scheduled_at`, so a second sweep is a
266
+ * no-op — safe to run on every tick.
267
+ *
268
+ * Bounded per collection by `limit` (default `SCHEDULED_PUBLISH_BATCH_LIMIT`):
269
+ * a large backlog drains across successive ticks rather than in one unbounded
270
+ * pass. After each collection's batch, `onPublished` (if given) is awaited so
271
+ * cache-tag invalidation happens incrementally, not just at the very end.
272
+ *
273
+ * Returns every item it promoted so request-less callers (the Cloudflare
274
+ * `scheduled()` handler) can also act on the full set.
275
+ */
276
+ async function publishDueContent(db, options = {}) {
277
+ const { publish, onPublished, limit = SCHEDULED_PUBLISH_BATCH_LIMIT } = options;
278
+ const published = [];
279
+ let collections;
280
+ try {
281
+ collections = await new SchemaRegistry(db).listCollections();
282
+ } catch (error) {
283
+ console.error("[scheduled-publish] Failed to list collections:", error);
284
+ return published;
285
+ }
286
+ const repo = new ContentRepository(db);
287
+ const doPublish = publish ?? ((collection, id, opts) => handleContentPublish(db, collection, id, opts));
288
+ const batchLimit = limit > 0 ? limit : void 0;
289
+ for (const collection of collections) try {
290
+ const due = await repo.findReadyToPublish(collection.slug, batchLimit);
291
+ const batch = [];
292
+ for (const item of due) {
293
+ const publishedAt = item.publishedAt == null ? item.scheduledAt ?? void 0 : void 0;
294
+ const result = await doPublish(collection.slug, item.id, {
295
+ publishedAt,
296
+ requireScheduledDue: true
297
+ });
298
+ if (result.success) batch.push({
299
+ collection: collection.slug,
300
+ id: item.id
301
+ });
302
+ else if (result.error?.code === "NOT_DUE") {} else console.error(`[scheduled-publish] Failed to publish ${collection.slug}/${item.id}:`, result.error);
283
303
  }
284
- this.arm();
285
- }
286
- arm() {
287
- if (!this.running) return;
288
- this.executor.getNextDueTime().then((nextDue) => {
289
- if (!this.running) return void 0;
290
- let delayMs;
291
- if (nextDue) {
292
- const dueAt = new Date(nextDue).getTime();
293
- delayMs = Math.max(dueAt - Date.now(), MIN_INTERVAL_MS);
294
- delayMs = Math.min(delayMs, MAX_INTERVAL_MS);
295
- } else delayMs = MAX_INTERVAL_MS;
296
- this.timer = setTimeout(() => {
297
- if (!this.running) return;
298
- this.executeTick();
299
- }, delayMs);
300
- if (this.timer && typeof this.timer === "object" && "unref" in this.timer) this.timer.unref();
301
- }).catch((error) => {
302
- console.error("[cron:node] Failed to get next due time:", error);
303
- if (this.running) {
304
- this.timer = setTimeout(() => this.arm(), MAX_INTERVAL_MS);
305
- if (this.timer && typeof this.timer === "object" && "unref" in this.timer) this.timer.unref();
304
+ if (batch.length > 0) {
305
+ published.push(...batch);
306
+ if (onPublished) try {
307
+ await onPublished(batch);
308
+ } catch (error) {
309
+ console.error(`[scheduled-publish] onPublished failed after "${collection.slug}" batch:`, error);
306
310
  }
307
- });
308
- }
309
- executeTick() {
310
- if (!this.running) return;
311
- const tasks = [this.executor.tick(), this.executor.recoverStaleLocks()];
312
- if (this.systemCleanup) tasks.push(this.systemCleanup());
313
- Promise.allSettled(tasks).then((results) => {
314
- for (const r of results) if (r.status === "rejected") console.error("[cron:node] Tick task failed:", r.reason);
315
- }).finally(() => {
316
- if (this.running) this.arm();
317
- });
318
- }
319
- };
320
-
321
- //#endregion
322
- //#region src/plugins/scheduler/piggyback.ts
323
- /** Minimum interval between tick attempts (ms) */
324
- const DEBOUNCE_MS = 60 * 1e3;
325
- var PiggybackScheduler = class {
326
- lastTickAt = 0;
327
- running = false;
328
- systemCleanup = null;
329
- constructor(executor) {
330
- this.executor = executor;
331
- }
332
- setSystemCleanup(fn) {
333
- this.systemCleanup = fn;
334
- }
335
- start() {
336
- this.running = true;
337
- }
338
- stop() {
339
- this.running = false;
340
- }
341
- /**
342
- * No-op for piggyback — tick happens on next request.
343
- */
344
- reschedule() {}
345
- /**
346
- * Call this from middleware on each request.
347
- * Debounced: only actually ticks if enough time has passed.
348
- */
349
- onRequest() {
350
- if (!this.running) return;
351
- const now = Date.now();
352
- if (now - this.lastTickAt < DEBOUNCE_MS) return;
353
- this.lastTickAt = now;
354
- const tasks = [this.executor.tick(), this.executor.recoverStaleLocks()];
355
- if (this.systemCleanup) tasks.push(this.systemCleanup());
356
- Promise.allSettled(tasks).then((results) => {
357
- for (const r of results) if (r.status === "rejected") console.error("[cron:piggyback] Tick task failed:", r.reason);
358
- });
311
+ }
312
+ } catch (error) {
313
+ console.error(`[scheduled-publish] Sweep failed for "${collection.slug}":`, error);
359
314
  }
360
- };
315
+ return published;
316
+ }
361
317
 
362
318
  //#endregion
363
319
  //#region src/emdash-runtime.ts
@@ -576,12 +532,54 @@ var EmDashRuntime = class EmDashRuntime {
576
532
  return this.runtimeDeps.sandboxBypassed === true;
577
533
  }
578
534
  /**
579
- * Tick the cron system from request context (piggyback mode).
580
- * Call this from middleware on each request to ensure cron tasks
581
- * execute even when no dedicated scheduler is available.
535
+ * Publish any content whose scheduled time has passed.
536
+ * Returns the items promoted so callers can invalidate their cache tags.
582
537
  */
583
- tickCron() {
584
- if (this.cronScheduler instanceof PiggybackScheduler) this.cronScheduler.onRequest();
538
+ async publishScheduled() {
539
+ return publishDueContent(this.db, { publish: (collection, id, options) => this.handleContentPublish(collection, id, options) });
540
+ }
541
+ /**
542
+ * Run the full scheduled-maintenance batch: cron tasks, scheduled
543
+ * publishing, and system cleanup. For request-less drivers — the
544
+ * Cloudflare `scheduled()` handler invokes this from a Cron Trigger.
545
+ * (On Node the timer-based scheduler drives the same work itself.)
546
+ *
547
+ * Each step is independent and non-fatal. Returns the content promoted
548
+ * by the publishing sweep so the caller can purge edge-cache tags.
549
+ *
550
+ * `onPublished` (optional) is awaited after each collection's batch so a
551
+ * request-less driver can invalidate edge-cache tags incrementally rather
552
+ * than only after the whole sweep — bounding stale-cache exposure if the
553
+ * runtime is killed mid-sweep.
554
+ */
555
+ async runScheduledTasks(options = {}) {
556
+ if (this.cronExecutor) {
557
+ try {
558
+ await this.cronExecutor.tick();
559
+ } catch (error) {
560
+ console.error("[cron] Tick failed:", error);
561
+ }
562
+ try {
563
+ await this.cronExecutor.recoverStaleLocks();
564
+ } catch (error) {
565
+ console.error("[cron] Stale lock recovery failed:", error);
566
+ }
567
+ }
568
+ let published = [];
569
+ try {
570
+ published = await publishDueContent(this.db, {
571
+ publish: (collection, id, opts) => this.handleContentPublish(collection, id, opts),
572
+ onPublished: options.onPublished
573
+ });
574
+ } catch (error) {
575
+ console.error("[scheduled-publish] Sweep failed:", error);
576
+ }
577
+ try {
578
+ await runSystemCleanup(this.db, this.storage ?? void 0);
579
+ } catch (error) {
580
+ console.error("[cleanup] System cleanup failed:", error);
581
+ }
582
+ return { published };
585
583
  }
586
584
  /**
587
585
  * Stop the cron scheduler gracefully.
@@ -991,6 +989,7 @@ var EmDashRuntime = class EmDashRuntime {
991
989
  });
992
990
  let cronExecutor = null;
993
991
  let cronScheduler = null;
992
+ const runtimeRef = { current: null };
994
993
  await phase("rt.cron", "Cron init (recovery deferred post-response)", async () => {
995
994
  try {
996
995
  cronExecutor = new CronExecutor(db, invokeCronHook);
@@ -1003,22 +1002,30 @@ var EmDashRuntime = class EmDashRuntime {
1003
1002
  console.error("[cron] Failed to recover stale task locks:", error);
1004
1003
  }
1005
1004
  });
1006
- if (typeof globalThis.navigator !== "undefined" && globalThis.navigator.userAgent === "Cloudflare-Workers") cronScheduler = new PiggybackScheduler(cronExecutor);
1007
- else cronScheduler = new NodeCronScheduler(cronExecutor);
1008
- cronScheduler.setSystemCleanup(async () => {
1009
- try {
1010
- await runSystemCleanup(db, storage ?? void 0);
1011
- } catch (error) {
1012
- console.error("[cleanup] System cleanup failed:", error);
1013
- }
1014
- });
1015
- pipeline.setContextFactory({ cronReschedule: () => cronScheduler?.reschedule() });
1016
- await cronScheduler.start();
1005
+ if (deps.createScheduler) {
1006
+ const scheduler = deps.createScheduler(cronExecutor);
1007
+ cronScheduler = scheduler;
1008
+ scheduler.setSystemCleanup(async () => {
1009
+ try {
1010
+ const runtime = runtimeRef.current;
1011
+ await publishDueContent(db, { publish: runtime ? (collection, id, options) => runtime.handleContentPublish(collection, id, options) : void 0 });
1012
+ } catch (error) {
1013
+ console.error("[scheduled-publish] Sweep failed:", error);
1014
+ }
1015
+ try {
1016
+ await runSystemCleanup(db, storage ?? void 0);
1017
+ } catch (error) {
1018
+ console.error("[cleanup] System cleanup failed:", error);
1019
+ }
1020
+ });
1021
+ pipeline.setContextFactory({ cronReschedule: () => cronScheduler?.reschedule() });
1022
+ scheduler.start();
1023
+ }
1017
1024
  } catch (error) {
1018
1025
  console.warn("[cron] Failed to initialize cron system:", error);
1019
1026
  }
1020
1027
  });
1021
- return new EmDashRuntime({
1028
+ const runtime = new EmDashRuntime({
1022
1029
  db,
1023
1030
  storage,
1024
1031
  configuredPlugins: [...deps.plugins, ...bypassedPluginsList],
@@ -1038,6 +1045,8 @@ var EmDashRuntime = class EmDashRuntime {
1038
1045
  runtimeDeps: deps,
1039
1046
  pipelineRef
1040
1047
  });
1048
+ runtimeRef.current = runtime;
1049
+ return runtime;
1041
1050
  }
1042
1051
  /**
1043
1052
  * Get a media provider by ID
@@ -1086,9 +1095,9 @@ var EmDashRuntime = class EmDashRuntime {
1086
1095
  }
1087
1096
  })();
1088
1097
  if (collectionCount.count === 0 && !setupDone) {
1089
- const { applySeed } = await import("../apply-BWMV4Zmw.mjs").then((n) => n.n);
1090
- const { loadSeed } = await import("../load-6ZrRhepW.mjs").then((n) => n.r);
1091
- const { validateSeed } = await import("../validate-JCXcsqiY.mjs").then((n) => n.n);
1098
+ const { applySeed } = await import("../apply-hQkKKBCf.mjs").then((n) => n.n);
1099
+ const { loadSeed } = await import("../load-B84ohfBk.mjs").then((n) => n.r);
1100
+ const { validateSeed } = await import("../validate-ZP9Dvg0P.mjs").then((n) => n.n);
1092
1101
  const seed = await loadSeed();
1093
1102
  if (validateSeed(seed).valid) {
1094
1103
  await applySeed(db, seed, { onConflict: "skip" });
@@ -1563,6 +1572,9 @@ var EmDashRuntime = class EmDashRuntime {
1563
1572
  async handleContentList(collection, params) {
1564
1573
  return handleContentList(this.db, collection, params);
1565
1574
  }
1575
+ async handleContentAuthors(collection) {
1576
+ return handleContentAuthors(this.db, collection);
1577
+ }
1566
1578
  async handleContentGet(collection, id, locale) {
1567
1579
  const result = await handleContentGet(this.db, collection, id, locale);
1568
1580
  return this.hydrateDraftData(result);
@@ -1619,7 +1631,7 @@ var EmDashRuntime = class EmDashRuntime {
1619
1631
  if (this.hooks.hasHooks("content:beforeSave")) processedData = (await this.hooks.runContentBeforeSave(body.data, collection, true)).content;
1620
1632
  processedData = await this.runSandboxedBeforeSave(processedData, collection, true);
1621
1633
  processedData = await this.normalizeMediaFields(collection, processedData);
1622
- const { validateContentData } = await import("../validation-Bq-VyKJg.mjs");
1634
+ const { validateContentData } = await import("../validation-CE5i4q0c.mjs");
1623
1635
  const validation = await validateContentData(this.db, collection, processedData, { partial: false });
1624
1636
  if (!validation.ok) return {
1625
1637
  success: false,
@@ -1635,7 +1647,7 @@ var EmDashRuntime = class EmDashRuntime {
1635
1647
  return result;
1636
1648
  }
1637
1649
  async handleContentUpdate(collection, id, body) {
1638
- const { ContentRepository } = await import("../content-CyqOmOzm.mjs").then((n) => n.n);
1650
+ const { ContentRepository } = await import("../content-BIlVx-RX.mjs").then((n) => n.n);
1639
1651
  const repo = new ContentRepository(this.db);
1640
1652
  const resolvedItem = await repo.findByIdOrSlug(collection, id, body.locale);
1641
1653
  const resolvedId = resolvedItem?.id ?? id;
@@ -1662,7 +1674,7 @@ var EmDashRuntime = class EmDashRuntime {
1662
1674
  if (this.hooks.hasHooks("content:beforeSave")) processedData = (await this.hooks.runContentBeforeSave(bodyWithoutRev.data, collection, false)).content;
1663
1675
  processedData = await this.runSandboxedBeforeSave(processedData, collection, false);
1664
1676
  processedData = await this.normalizeMediaFields(collection, processedData);
1665
- const { validateContentData } = await import("../validation-Bq-VyKJg.mjs");
1677
+ const { validateContentData } = await import("../validation-CE5i4q0c.mjs");
1666
1678
  const validation = await validateContentData(this.db, collection, processedData, { partial: true });
1667
1679
  if (!validation.ok) return {
1668
1680
  success: false,
@@ -2375,6 +2387,7 @@ function buildDependencies(config) {
2375
2387
  plugins: getPlugins(),
2376
2388
  createDialect,
2377
2389
  createStorage,
2390
+ createScheduler,
2378
2391
  sandboxEnabled: sandboxModule.sandboxEnabled,
2379
2392
  sandboxBypassed: sandboxModule.sandboxBypassed ?? false,
2380
2393
  sandboxedPluginEntries: sandboxedPlugins || [],
@@ -2406,6 +2419,25 @@ async function getRuntime(config, initTimings) {
2406
2419
  });
2407
2420
  }
2408
2421
  /**
2422
+ * Run scheduled maintenance (cron tasks, scheduled publishing, system cleanup)
2423
+ * outside any request. Resolves the runtime from the build-time virtual config
2424
+ * and the cached singleton — the same instance request handlers use.
2425
+ *
2426
+ * Wired into a platform heartbeat that is not a request: the Cloudflare Worker's
2427
+ * `scheduled()` handler (Cron Trigger) calls this. On Node the runtime's own
2428
+ * timer-based scheduler already drives the same work, so this isn't needed there.
2429
+ *
2430
+ * Returns the content promoted by the publishing sweep so the caller can purge
2431
+ * edge-cache tags for it. `onPublished` (optional) is awaited after each
2432
+ * collection's batch so the caller can invalidate edge-cache tags incrementally
2433
+ * rather than only after the whole sweep.
2434
+ */
2435
+ async function runScheduledTasks(options = {}) {
2436
+ const config = getConfig();
2437
+ if (!config) return { published: [] };
2438
+ return (await getRuntime(config)).runScheduledTasks(options);
2439
+ }
2440
+ /**
2409
2441
  * Astro attaches AstroCookies to outgoing responses via a well-known global
2410
2442
  * symbol. Cloning a Response (`new Response(body, init)`) drops non-header
2411
2443
  * metadata, so any middleware that wraps the response must explicitly forward
@@ -2509,7 +2541,7 @@ const onRequest = defineMiddleware(async (context, next) => {
2509
2541
  if (!isSetupVerified()) {
2510
2542
  const t0 = performance.now();
2511
2543
  try {
2512
- const { getDb } = await import("../loader-Dyx8dhFV.mjs").then((n) => n.i);
2544
+ const { getDb } = await import("../loader-CpZKpFz0.mjs").then((n) => n.i);
2513
2545
  await (await getDb()).selectFrom("_emdash_migrations").selectAll().limit(1).execute();
2514
2546
  markSetupVerified();
2515
2547
  } catch (error) {
@@ -2726,5 +2758,5 @@ const onRequest = defineMiddleware(async (context, next) => {
2726
2758
  });
2727
2759
 
2728
2760
  //#endregion
2729
- export { onRequest as default, onRequest };
2761
+ export { onRequest as default, onRequest, runScheduledTasks };
2730
2762
  //# sourceMappingURL=middleware.mjs.map