dineway 0.2.39 → 0.2.41

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 (460) hide show
  1. package/dist/{activity-LXZdjKwI.mjs → activity-BuhkMdv8.mjs} +2 -2
  2. package/dist/{activity-events-DoqeOM8x.mjs → activity-events-DkHsy7Y0.mjs} +1 -1
  3. package/dist/{allowed-origins-DiVrMLxh.mjs → allowed-origins-Clitkhiv.mjs} +1 -1
  4. package/dist/api/route-utils.d.mts +15 -12
  5. package/dist/api/route-utils.mjs +27 -20
  6. package/dist/api/schemas/index.d.mts +1 -1
  7. package/dist/api/schemas/index.mjs +10 -5
  8. package/dist/{api-COSxvdOi.mjs → api-CMbsIQ46.mjs} +41 -13
  9. package/dist/{api-tokens-CNHnKO57.mjs → api-tokens-ciHNTdN2.mjs} +1 -1
  10. package/dist/{apply-D4rZHDyg.mjs → apply-B5qoX19G.mjs} +62 -18
  11. package/dist/astro/index.d.mts +16 -13
  12. package/dist/astro/index.mjs +31 -5
  13. package/dist/astro/middleware/auth.d.mts +14 -11
  14. package/dist/astro/middleware/auth.mjs +8 -8
  15. package/dist/astro/middleware/redirect.mjs +10 -6
  16. package/dist/astro/middleware/request-context.mjs +5 -5
  17. package/dist/astro/middleware/seed.d.mts +1 -1
  18. package/dist/astro/middleware/seed.mjs +2 -2
  19. package/dist/astro/middleware/setup.mjs +1 -1
  20. package/dist/astro/middleware.d.mts +2 -2
  21. package/dist/astro/middleware.mjs +266 -176
  22. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +12 -7
  23. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +12 -7
  24. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  25. package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
  26. package/dist/astro/routes/api/admin/briefing.mjs +41 -22
  27. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
  28. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +14 -10
  29. package/dist/astro/routes/api/admin/byline-fields/index.mjs +14 -10
  30. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +14 -10
  31. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +25 -19
  32. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +25 -19
  33. package/dist/astro/routes/api/admin/bylines/index.mjs +25 -19
  34. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +20 -16
  35. package/dist/astro/routes/api/admin/comments/_id_.mjs +10 -7
  36. package/dist/astro/routes/api/admin/comments/bulk.mjs +18 -13
  37. package/dist/astro/routes/api/admin/comments/counts.mjs +10 -7
  38. package/dist/astro/routes/api/admin/comments/index.mjs +18 -13
  39. package/dist/astro/routes/api/admin/context/_id_/history.mjs +51 -39
  40. package/dist/astro/routes/api/admin/context/_id_/index.mjs +51 -39
  41. package/dist/astro/routes/api/admin/context/_id_/review.mjs +57 -44
  42. package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +57 -44
  43. package/dist/astro/routes/api/admin/context/diff.mjs +56 -43
  44. package/dist/astro/routes/api/admin/context/index.mjs +57 -44
  45. package/dist/astro/routes/api/admin/context/stale.mjs +56 -43
  46. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +51 -39
  47. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +56 -43
  48. package/dist/astro/routes/api/admin/hitl-requests/index.mjs +56 -43
  49. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +52 -40
  50. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
  51. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +7 -7
  52. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +7 -7
  53. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +78 -68
  54. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +78 -68
  55. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +71 -60
  56. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +78 -67
  57. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +78 -67
  58. package/dist/astro/routes/api/admin/plugins/index.mjs +71 -60
  59. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
  60. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +71 -60
  61. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +78 -67
  62. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +71 -60
  63. package/dist/astro/routes/api/admin/plugins/updates.mjs +71 -60
  64. package/dist/astro/routes/api/admin/review-requests/_id_/image.mjs +38 -23
  65. package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +46 -36
  66. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +63 -52
  67. package/dist/astro/routes/api/admin/review-requests/_id_/revoke.mjs +9 -9
  68. package/dist/astro/routes/api/admin/review-requests/index.mjs +61 -50
  69. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +71 -60
  70. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
  71. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +71 -60
  72. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
  73. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
  74. package/dist/astro/routes/api/admin/users/_id_/index.mjs +11 -7
  75. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
  76. package/dist/astro/routes/api/admin/users/index.mjs +12 -7
  77. package/dist/astro/routes/api/auth/dev-bypass.mjs +4 -4
  78. package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
  79. package/dist/astro/routes/api/auth/invite/complete.mjs +17 -12
  80. package/dist/astro/routes/api/auth/invite/index.mjs +14 -9
  81. package/dist/astro/routes/api/auth/invite/register-options.mjs +16 -11
  82. package/dist/astro/routes/api/auth/logout.mjs +2 -2
  83. package/dist/astro/routes/api/auth/magic-link/send.mjs +17 -12
  84. package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
  85. package/dist/astro/routes/api/auth/me.mjs +14 -11
  86. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  87. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
  88. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +3 -3
  89. package/dist/astro/routes/api/auth/passkey/_id_.mjs +12 -7
  90. package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
  91. package/dist/astro/routes/api/auth/passkey/options.mjs +19 -14
  92. package/dist/astro/routes/api/auth/passkey/register/options.mjs +16 -11
  93. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +17 -12
  94. package/dist/astro/routes/api/auth/passkey/verify.mjs +17 -12
  95. package/dist/astro/routes/api/auth/setup-token/index.mjs +6 -6
  96. package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
  97. package/dist/astro/routes/api/auth/signup/complete.mjs +17 -12
  98. package/dist/astro/routes/api/auth/signup/request.mjs +17 -12
  99. package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
  100. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +14 -11
  101. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +23 -19
  102. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +23 -18
  103. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
  104. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +8 -8
  105. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +8 -8
  106. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +8 -8
  107. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +25 -20
  108. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +41 -31
  109. package/dist/astro/routes/api/content/_collection_/_id_/release-readiness.mjs +14 -9
  110. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +8 -8
  111. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
  112. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +41 -31
  113. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +30 -20
  114. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
  115. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +8 -8
  116. package/dist/astro/routes/api/content/_collection_/_id_.mjs +25 -14
  117. package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
  118. package/dist/astro/routes/api/content/_collection_/index.mjs +25 -14
  119. package/dist/astro/routes/api/content/_collection_/trash.mjs +13 -8
  120. package/dist/astro/routes/api/dashboard.mjs +21 -13
  121. package/dist/astro/routes/api/dev/emails.mjs +2 -2
  122. package/dist/astro/routes/api/health.mjs +1 -1
  123. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  124. package/dist/astro/routes/api/import/probe.mjs +30 -23
  125. package/dist/astro/routes/api/import/wordpress/analyze.mjs +13 -10
  126. package/dist/astro/routes/api/import/wordpress/execute.d.mts +14 -11
  127. package/dist/astro/routes/api/import/wordpress/execute.mjs +58 -47
  128. package/dist/astro/routes/api/import/wordpress/media.d.mts +14 -11
  129. package/dist/astro/routes/api/import/wordpress/media.mjs +17 -14
  130. package/dist/astro/routes/api/import/wordpress/prepare.mjs +61 -48
  131. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +15 -12
  132. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +58 -45
  133. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  134. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +32 -26
  135. package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
  136. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +14 -11
  137. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +63 -52
  138. package/dist/astro/routes/api/integration/artifact.mjs +9 -9
  139. package/dist/astro/routes/api/integration/dispatch.mjs +14 -14
  140. package/dist/astro/routes/api/integrations/_provider_.mjs +9 -9
  141. package/dist/astro/routes/api/integrations/index.mjs +8 -8
  142. package/dist/astro/routes/api/manifest.mjs +5 -5
  143. package/dist/astro/routes/api/mcp.mjs +141 -93
  144. package/dist/astro/routes/api/media/_id_/confirm.mjs +15 -12
  145. package/dist/astro/routes/api/media/_id_.mjs +14 -9
  146. package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
  147. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
  148. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
  149. package/dist/astro/routes/api/media/providers/index.mjs +2 -2
  150. package/dist/astro/routes/api/media/upload-url.mjs +16 -13
  151. package/dist/astro/routes/api/media.mjs +19 -16
  152. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +57 -44
  153. package/dist/astro/routes/api/menus/_name_/items.mjs +57 -44
  154. package/dist/astro/routes/api/menus/_name_/reorder.mjs +57 -44
  155. package/dist/astro/routes/api/menus/_name_/translations.mjs +57 -44
  156. package/dist/astro/routes/api/menus/_name_.mjs +57 -44
  157. package/dist/astro/routes/api/menus/index.mjs +57 -44
  158. package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
  159. package/dist/astro/routes/api/oauth/device/authorize.mjs +5 -5
  160. package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
  161. package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
  162. package/dist/astro/routes/api/oauth/register.mjs +4 -4
  163. package/dist/astro/routes/api/oauth/token/refresh.mjs +5 -5
  164. package/dist/astro/routes/api/oauth/token/revoke.mjs +5 -5
  165. package/dist/astro/routes/api/oauth/token.mjs +6 -6
  166. package/dist/astro/routes/api/openapi.json.mjs +10 -5
  167. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
  168. package/dist/astro/routes/api/redirects/404s/index.mjs +15 -13
  169. package/dist/astro/routes/api/redirects/404s/summary.mjs +15 -13
  170. package/dist/astro/routes/api/redirects/_id_.mjs +57 -44
  171. package/dist/astro/routes/api/redirects/index.mjs +57 -44
  172. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
  173. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
  174. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +73 -62
  175. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +73 -62
  176. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +73 -62
  177. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +73 -62
  178. package/dist/astro/routes/api/schema/collections/index.mjs +73 -62
  179. package/dist/astro/routes/api/schema/index.mjs +13 -10
  180. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +71 -60
  181. package/dist/astro/routes/api/schema/orphans/index.mjs +71 -60
  182. package/dist/astro/routes/api/search/enable.mjs +20 -13
  183. package/dist/astro/routes/api/search/index.mjs +19 -12
  184. package/dist/astro/routes/api/search/rebuild.mjs +20 -13
  185. package/dist/astro/routes/api/search/stats.mjs +12 -7
  186. package/dist/astro/routes/api/search/suggest.mjs +19 -12
  187. package/dist/astro/routes/api/sections/_slug_.mjs +57 -44
  188. package/dist/astro/routes/api/sections/index.mjs +57 -44
  189. package/dist/astro/routes/api/settings/email.mjs +5 -5
  190. package/dist/astro/routes/api/settings/reviews.mjs +11 -11
  191. package/dist/astro/routes/api/settings.mjs +57 -44
  192. package/dist/astro/routes/api/setup/admin-verify.mjs +19 -14
  193. package/dist/astro/routes/api/setup/admin.mjs +17 -12
  194. package/dist/astro/routes/api/setup/dev-bypass.mjs +44 -32
  195. package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
  196. package/dist/astro/routes/api/setup/index.mjs +47 -34
  197. package/dist/astro/routes/api/setup/status.mjs +3 -3
  198. package/dist/astro/routes/api/snapshot.mjs +9 -9
  199. package/dist/astro/routes/api/system/heartbeat.mjs +2 -2
  200. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +60 -47
  201. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +60 -47
  202. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +60 -47
  203. package/dist/astro/routes/api/taxonomies/index.mjs +60 -47
  204. package/dist/astro/routes/api/themes/preview.mjs +7 -7
  205. package/dist/astro/routes/api/typegen.mjs +4 -4
  206. package/dist/astro/routes/api/well-known/auth.mjs +3 -3
  207. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
  208. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
  209. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +56 -43
  210. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +57 -44
  211. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +57 -44
  212. package/dist/astro/routes/api/widget-areas/_name_.mjs +53 -41
  213. package/dist/astro/routes/api/widget-areas/index.mjs +57 -44
  214. package/dist/astro/routes/api/widget-components.mjs +2 -2
  215. package/dist/astro/routes/robots.txt.mjs +14 -9
  216. package/dist/astro/routes/sitemap-_collection_.xml.mjs +20 -16
  217. package/dist/astro/routes/sitemap.xml.mjs +19 -15
  218. package/dist/astro/session-driver.d.mts +1 -1
  219. package/dist/astro/session-driver.mjs +8 -3
  220. package/dist/astro/types.d.mts +21 -14
  221. package/dist/{atomic-authority-CnBQJ14T.mjs → atomic-authority-Bf5QZboB.mjs} +2 -2
  222. package/dist/{audit-Cl495Ze3.mjs → audit-hXJBTPY0.mjs} +1 -1
  223. package/dist/auth/providers/github.d.mts +1 -1
  224. package/dist/auth/providers/google.d.mts +1 -1
  225. package/dist/{auth-control-guard-DbjgJdlo.mjs → auth-control-guard-DpUP6Fs_.mjs} +1 -1
  226. package/dist/{authorize-DDmgmnW-.mjs → authorize-DWNOqMKq.mjs} +1 -1
  227. package/dist/{briefing-DsD-Ouwc.mjs → briefing-BzvBeIJh.mjs} +1 -1
  228. package/dist/{briefing-COw-WcYz.mjs → briefing-DYiV93rg.mjs} +995 -7
  229. package/dist/{bundle-bhiszAui.mjs → bundle-DWn5eFKz.mjs} +2 -2
  230. package/dist/{byline-TYk2kad6.mjs → byline-3qjp1-oa.mjs} +65 -14
  231. package/dist/{byline-fields-CKhPED5o.d.mts → byline-fields-Bne2v0ti.d.mts} +42 -38
  232. package/dist/{byline-fields-BKj5f3Ub.mjs → byline-fields-DRMCc0V_.mjs} +1 -1
  233. package/dist/{byline-fields-DZ46DF10.mjs → byline-fields-wWu2Cb3l.mjs} +3 -3
  234. package/dist/{byline-registry-CJihchD1.mjs → byline-registry-Caj0_gbU.mjs} +1 -1
  235. package/dist/{bylines-6T9iVC9j.mjs → bylines-BSn9O1Wx.mjs} +3 -3
  236. package/dist/{bylines-CvTSCAw9.mjs → bylines-CGuJi-zu.mjs} +5 -5
  237. package/dist/{patterns-Ay-4KImK.mjs → cache-DsEbwFVE.mjs} +51 -1
  238. package/dist/{chunks-C8vSD_5L.mjs → chunks-Bb56aCtB.mjs} +1 -1
  239. package/dist/cli/index.mjs +488 -58
  240. package/dist/cli/plugin-kit.d.mts +14 -11
  241. package/dist/cli/plugin-kit.mjs +2 -2
  242. package/dist/client/external-auth-headers.d.mts +1 -1
  243. package/dist/client/index.d.mts +16 -13
  244. package/dist/client/index.mjs +2 -2
  245. package/dist/{client-factory-C1ZQCMog.mjs → client-factory-BLbm250o.mjs} +1 -1
  246. package/dist/{comment-DAQfUjqt.mjs → comment-BWDG1nQm.mjs} +2 -2
  247. package/dist/{comment-reaction-Dp3G7UZc.mjs → comment-reaction-B7pLTlQ7.mjs} +1 -1
  248. package/dist/{comments-BrvIaRAx.mjs → comments-xkten8nV.mjs} +1 -1
  249. package/dist/config-6R0bchVE.mjs +125 -0
  250. package/dist/{content-CIKsrvU9.mjs → content-BigS8BAv.mjs} +302 -45
  251. package/dist/content-Dr22fzA_.mjs +390 -0
  252. package/dist/{content-refresh-BilzqcLt.mjs → content-refresh-DJuFIqQ4.mjs} +14 -8
  253. package/dist/content-storage/index.d.mts +180 -0
  254. package/dist/content-storage/index.mjs +29 -0
  255. package/dist/content-storage/store.d.mts +3 -0
  256. package/dist/content-storage/store.mjs +5 -0
  257. package/dist/{review-payload-Bap86e75.mjs → content-write-DAZCNKWl.mjs} +838 -131
  258. package/dist/{context-DAs_MZjJ.mjs → context-0806nV9h.mjs} +292 -23
  259. package/dist/{context-DVTvucNb.mjs → context-CCsI5nTK.mjs} +2 -2
  260. package/dist/{context-route-helpers-BP-UJ4u8.mjs → context-route-helpers-TP3EqxRQ.mjs} +2 -2
  261. package/dist/{dashboard-BAjWCGCP.mjs → dashboard-CSrnhBO6.mjs} +4 -4
  262. package/dist/database/batch.d.mts +1 -1
  263. package/dist/database/batch.mjs +1 -1
  264. package/dist/database/d1/index.d.mts +14 -11
  265. package/dist/database/d1/index.mjs +4 -4
  266. package/dist/database/instrumentation.mjs +3 -2
  267. package/dist/db/index.d.mts +3 -3
  268. package/dist/db/index.mjs +1 -1
  269. package/dist/db/libsql.d.mts +1 -1
  270. package/dist/db/postgres.d.mts +1 -1
  271. package/dist/db/sqlite.d.mts +1 -1
  272. package/dist/{device-flow-Dh0rNlh1.mjs → device-flow-SoZh-HvN.mjs} +3 -3
  273. package/dist/{discovery-V0e0Gg8j.mjs → discovery-49qXmdwv.mjs} +4 -4
  274. package/dist/{enrich-B7PIJ8Iy.mjs → enrich-CAMsD1aT.mjs} +1 -1
  275. package/dist/{error-B5a45Tfb.mjs → error-sL4aemcW.mjs} +2 -0
  276. package/dist/{evidence-Vnp_fQbC.mjs → evidence-B3O9_VKm.mjs} +7 -7
  277. package/dist/{field-defs-cache-aXUeXJdC.mjs → field-defs-cache-dn5Tw79A.mjs} +4 -4
  278. package/dist/{fts-manager-BrPpYtK0.mjs → fts-manager-Zu5ITic0.mjs} +1 -1
  279. package/dist/{hitl-requests-BxMMON3s.mjs → hitl-requests-B5vOPseK.mjs} +2 -2
  280. package/dist/{hitl-route-helpers-sdnjpx2k.mjs → hitl-route-helpers-C3icmGdj.mjs} +5 -5
  281. package/dist/hook-events-BQw73jc7.d.mts +32 -0
  282. package/dist/{import-C2-v4FCs.mjs → import-CKnKQj3f.mjs} +9 -9
  283. package/dist/{index-BVGe04wF.d.mts → index-CLj17kW9.d.mts} +12 -5
  284. package/dist/index.d.mts +19 -16
  285. package/dist/index.mjs +107 -98
  286. package/dist/{integration-credentials-DMEXZU2J.mjs → integration-credentials-DpuRw1kx.mjs} +2 -2
  287. package/dist/{jsonld-XWmmAoVo.d.mts → jsonld-CN91qtDw.d.mts} +2 -2
  288. package/dist/{load-DvCVppOF.mjs → load-CiRTddkJ.mjs} +1 -1
  289. package/dist/{loader-Dp6zLmQm.mjs → loader-CCwWFQSh.mjs} +16 -5
  290. package/dist/{manifest-schema-CCvogfrP.mjs → manifest-schema-DaQpgyTB.mjs} +1 -1
  291. package/dist/{mcp-reviewed-executor-B8Gbin3T.mjs → mcp-reviewed-executor-DA6Q9sDc.mjs} +6 -6
  292. package/dist/media/image-endpoint.mjs +1 -1
  293. package/dist/media/index.d.mts +1 -1
  294. package/dist/media/index.mjs +2 -2
  295. package/dist/media/local-runtime.d.mts +16 -13
  296. package/dist/media/local-runtime.mjs +3 -3
  297. package/dist/{media-C5ba8fvI.mjs → media-BjH5OD-A.mjs} +1 -1
  298. package/dist/{media-allowlist-DQvscVkS.mjs → media-allowlist-C8HJ2O61.mjs} +1 -1
  299. package/dist/{menus-CyNpBQrX.mjs → menus-CbBi7Ad7.mjs} +2 -2
  300. package/dist/{menus-w5xwT-f5.mjs → menus-D0c8CeVg.mjs} +7 -7
  301. package/dist/migration-DJuj7ZwN.mjs +526 -0
  302. package/dist/{migrations-CLlX25HO.mjs → migrations-BAjF60cl.mjs} +1 -1
  303. package/dist/{oauth-authorization-CdqJZUMf.mjs → oauth-authorization-CSSRMOKn.mjs} +4 -4
  304. package/dist/{oauth-clients-CHNb9MAZ.mjs → oauth-clients-DX5HIJJv.mjs} +2 -2
  305. package/dist/object-cache/memory.d.mts +1 -1
  306. package/dist/{object-cache-mxCW-Rpt.mjs → object-cache-DyI1SOBK.mjs} +3 -1
  307. package/dist/owned-metadata-BPmUjZqI.mjs +69 -0
  308. package/dist/page/index.d.mts +15 -12
  309. package/dist/page/index.mjs +1 -1
  310. package/dist/{parse-THHCpJLB.mjs → parse-C6kCR1OT.mjs} +1 -1
  311. package/dist/plugin-utils.d.mts +14 -11
  312. package/dist/plugins/adapt-sandbox-entry.d.mts +14 -11
  313. package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
  314. package/dist/{plugins-pfraURNp.mjs → plugins-V0W65r3v.mjs} +16 -962
  315. package/dist/{policy-B6mVa7ib.mjs → policy-DbceGc4P.mjs} +2 -2
  316. package/dist/{preview-Bh7D7F27.mjs → preview-CWiIjMDi.mjs} +2 -2
  317. package/dist/{provider-loader-DT7vQ5FI.d.mts → provider-loader-oLKm1AU8.d.mts} +1 -1
  318. package/dist/{public-url-Ccv0Xmue.d.mts → public-url-CEC1vj02.d.mts} +2 -2
  319. package/dist/{public-url-BvnTaacI.d.mts → public-url-CKrUov8D.d.mts} +1 -1
  320. package/dist/{publication-authorization-B_HJSnzR.mjs → publication-authorization-wMR-tEQ_.mjs} +43 -17
  321. package/dist/{query-xspvw7Ui.mjs → query-DDi367tF.mjs} +14 -14
  322. package/dist/{query-DLeahg3x.mjs → query-DLnnpEuf.mjs} +4 -4
  323. package/dist/{rate-limit-BsBr_U9g.mjs → rate-limit-DeVLLe4z.mjs} +2 -2
  324. package/dist/{redirect-BQFa1THe.mjs → redirect-CJ-FAbNK.mjs} +2 -2
  325. package/dist/{redirects-DJcsgz_X.mjs → redirects-BKi6mek4.mjs} +4 -5
  326. package/dist/{redirects-CVfxefrz.mjs → redirects-I78-ZYLV.mjs} +5 -386
  327. package/dist/{registry-Dclv9iHv.mjs → registry-zXXZezu-.mjs} +7 -7
  328. package/dist/{release-B3Q-9B7N.mjs → release-Cpi0-Bzq.mjs} +173 -22
  329. package/dist/request-context.d.mts +30 -0
  330. package/dist/{request-meta-CjORiJQ_.mjs → request-meta-DZYuLXx_.mjs} +1 -1
  331. package/dist/review-payload-Bhi52CbI.mjs +112 -0
  332. package/dist/{review-requests-CcSUTm_l.mjs → review-requests-C-ScxD9n.mjs} +2 -2
  333. package/dist/{review-requests-CUVn0RBl.mjs → review-requests-DZYM51yI.mjs} +2 -2
  334. package/dist/{review-route-helpers-CKBfGKCi.mjs → review-route-helpers-DXNDyx_q.mjs} +2 -2
  335. package/dist/{revision-W6FDfDqx.mjs → revision-B_HYO2AE.mjs} +42 -7
  336. package/dist/revisions-CQ7rMP5d.mjs +55 -0
  337. package/dist/{revocation-C_ZQvGRT.mjs → revocation-4we8kfBg.mjs} +2 -2
  338. package/dist/{runner-CRU7BXjr.mjs → runner-CuG8o1uW.mjs} +558 -487
  339. package/dist/{runner-SoP1rphP.d.mts → runner-DXQkyPeX.d.mts} +1 -1
  340. package/dist/{runs-BtaAiLTw.mjs → runs-BjgLfqCn.mjs} +5 -5
  341. package/dist/runtime-Bs2JMbb2.d.mts +45 -0
  342. package/dist/runtime-Ch5G-tnG.mjs +400 -0
  343. package/dist/runtime.d.mts +15 -12
  344. package/dist/runtime.mjs +9 -4
  345. package/dist/schema-BA05k0TN.mjs +8 -0
  346. package/dist/{search-BI9uKr7U.mjs → search-DMrzhfx_.mjs} +4 -98
  347. package/dist/{secrets-D_pergcD.mjs → secrets-CIYcw9T9.mjs} +4 -4
  348. package/dist/{sections-BqqYq9RW.mjs → sections-BTrSEhqB.mjs} +2 -2
  349. package/dist/seed/index.d.mts +2 -2
  350. package/dist/seed/index.mjs +38 -26
  351. package/dist/seo/index.d.mts +3 -3
  352. package/dist/seo/index.mjs +12 -9
  353. package/dist/{seo-Bs_DUxJf.mjs → seo-Cv7ud_m2.mjs} +44 -5
  354. package/dist/{seo-B-5PsaJO.mjs → seo-DkjtBh-y.mjs} +1 -1
  355. package/dist/{service-W2xuGLgw.mjs → service-BBJM08uD.mjs} +2 -2
  356. package/dist/{service-B65aJsN7.mjs → service-CkMuD5AE.mjs} +3 -3
  357. package/dist/{settings-DsBzKeUQ.mjs → settings-BUONaNnG.mjs} +7 -7
  358. package/dist/{settings-CyJ2-MKx.mjs → settings-CI-NtWEc.mjs} +2 -2
  359. package/dist/{setup-complete-DeivSVJi.mjs → setup-complete-DoVbVrHx.mjs} +1 -1
  360. package/dist/{site-activity-DU0UPDji.mjs → site-activity-hpfJkmxQ.mjs} +1 -1
  361. package/dist/{site-context-Dic2jHuw.mjs → site-context-BW3GRCJH.mjs} +15 -15
  362. package/dist/{site-url-Tw6CfBB2.mjs → site-url-CYatfe3q.mjs} +1 -1
  363. package/dist/{state-DM7blWfT.mjs → state-CKkqoA6i.mjs} +1 -1
  364. package/dist/storage/local.d.mts +1 -1
  365. package/dist/storage/local.mjs +1 -1
  366. package/dist/storage/s3.d.mts +1 -1
  367. package/dist/storage/s3.mjs +2 -2
  368. package/dist/{store-32e6dfD-.mjs → store-BzaAtszy.mjs} +3 -3
  369. package/dist/submission-DLgjQ_Ew.mjs +205 -0
  370. package/dist/{taxonomies-BFsUR7kc.mjs → taxonomies-C02-Vuh3.mjs} +3 -3
  371. package/dist/{taxonomies-lWGNLKgn.mjs → taxonomies-D5wO9zmB.mjs} +7 -7
  372. package/dist/{taxonomy-DN6i1upz.mjs → taxonomy-BK7JmHlo.mjs} +53 -3
  373. package/dist/terms-EskuqbKE.mjs +104 -0
  374. package/dist/text-extraction-CdqMGYQK.mjs +96 -0
  375. package/dist/{tokens-D-StaTAQ.mjs → tokens-D8HEH277.mjs} +1 -1
  376. package/dist/{trusted-proxy-hYufGFPK.mjs → trusted-proxy-Dg3U9Lrv.mjs} +1 -1
  377. package/dist/{types-RFzE_V1M.mjs → types-BI3ULB3A.mjs} +2 -2
  378. package/dist/{types-CJynaYg1.d.mts → types-C3jUu4Bc.d.mts} +90 -34
  379. package/dist/{types-B--VyN3n.d.mts → types-Dpv_MvwZ.d.mts} +1 -1
  380. package/dist/{types-CgcOeaiQ.d.mts → types-ex-UrNlz.d.mts} +1 -1
  381. package/dist/types-qOEot0UQ.d.mts +83 -0
  382. package/dist/ui/server-runtime.d.mts +18 -15
  383. package/dist/ui/server-runtime.mjs +29 -25
  384. package/dist/{user-Btai9rl3.mjs → user-Bl2_8rhJ.mjs} +2 -2
  385. package/dist/{utils-CYxGuO_P.mjs → utils-CklSLz9F.mjs} +2 -2
  386. package/dist/{validate-C05z0m7M.mjs → validate-C-yk7mmX.mjs} +3 -3
  387. package/dist/{validate-kmN2lS8H.d.mts → validate-DUscf6VG.d.mts} +3 -3
  388. package/dist/version-BlE1LEPb.mjs +6 -0
  389. package/dist/version-store-BXv2D0de.mjs +208 -0
  390. package/dist/version-store-B_THJCc0.d.mts +98 -0
  391. package/dist/{widgets-BOrDZdQ3.mjs → widgets-9xHBhL_L.mjs} +3 -3
  392. package/dist/{wordpress-slugs-ROzITIBK.mjs → wordpress-slugs-yaeD7cxn.mjs} +1 -1
  393. package/dist/{worker-Bg35R37I.mjs → worker-CC_Rt1pB.mjs} +10 -10
  394. package/dist/write-intent-DuHVqks9.mjs +108 -0
  395. package/dist/{zod-generator-DkrWuID7.mjs → zod-generator-B5Pt8fv0.mjs} +2 -2
  396. package/package.json +16 -4
  397. package/dist/cache-B5NSHhxG.mjs +0 -52
  398. package/dist/cron-C7HCJPPl.mjs +0 -271
  399. package/dist/schema-CosVhHJt.mjs +0 -8
  400. package/dist/submission-DJmRejGR.mjs +0 -411
  401. package/dist/version-BnLdwIT1.mjs +0 -6
  402. /package/dist/{actor-DxUAJgQX.mjs → actor-D0AW80ld.mjs} +0 -0
  403. /package/dist/{adapter-symbols-Bq3JsWGM.d.mts → adapter-symbols-B9mi-BUh.d.mts} +0 -0
  404. /package/dist/{adapters-C8nRpUuj.d.mts → adapters-lDnJjNDz.d.mts} +0 -0
  405. /package/dist/{api-tokens-0N3nafqZ.mjs → api-tokens-CdfsE9PL.mjs} +0 -0
  406. /package/dist/{base64-Cz-aU0X1.mjs → base64-qvSs0Gxy.mjs} +0 -0
  407. /package/dist/{challenge-store-BPn3goP9.mjs → challenge-store-7IZ_NqWg.mjs} +0 -0
  408. /package/dist/{components-rFN8NH3N.mjs → components-JA6tFHmE.mjs} +0 -0
  409. /package/dist/{context-types-CPWAJRs5.mjs → context-types-DDIJhGLs.mjs} +0 -0
  410. /package/dist/{default-BS6VQRkB.mjs → default-C2azCFSB.mjs} +0 -0
  411. /package/dist/{email-console-GqK6hgMJ.mjs → email-console-BYQp_5Qr.mjs} +0 -0
  412. /package/dist/{escape-CE7xOWzJ.mjs → escape-4_NNa6GR.mjs} +0 -0
  413. /package/dist/{experimental-workflows-BbxpWwBy.mjs → experimental-workflows-CPNiI2EL.mjs} +0 -0
  414. /package/dist/{forgeway-account-DcTxh3Gw.mjs → forgeway-account-YzraapbX.mjs} +0 -0
  415. /package/dist/{hash-D2Rqd2J2.mjs → hash-qSYPMJ8w.mjs} +0 -0
  416. /package/dist/{media-url-D9kdpoLS.mjs → media-url-D5E1a47B.mjs} +0 -0
  417. /package/dist/{mime-BnVhH671.mjs → mime-FkfazULS.mjs} +0 -0
  418. /package/dist/{mode-D0gePRtf.mjs → mode-C3RI5Z5t.mjs} +0 -0
  419. /package/dist/{normalize-aTwryvvi.mjs → normalize-DrmlLn40.mjs} +0 -0
  420. /package/dist/{oauth-authority-P5YMSk2z.mjs → oauth-authority-DVlLFhsZ.mjs} +0 -0
  421. /package/dist/{oauth-state-store-CMqLdo4I.mjs → oauth-state-store-nf-78RbK.mjs} +0 -0
  422. /package/dist/{options-JiLWB6Bt.mjs → options-yFkLUuTw.mjs} +0 -0
  423. /package/dist/{output-7HDrYTSQ.mjs → output-ljHaxIHX.mjs} +0 -0
  424. /package/dist/{parser-kettsjWc.mjs → parser-CTlxybRo.mjs} +0 -0
  425. /package/dist/{passkey-config-DVzQ3dv3.mjs → passkey-config-BLon3ct9.mjs} +0 -0
  426. /package/dist/{placeholder-DJLP_HY7.d.mts → placeholder-DdZV3I8x.d.mts} +0 -0
  427. /package/dist/{portable-text-tQhvPLf1.mjs → portable-text-CSbRjM-T.mjs} +0 -0
  428. /package/dist/{portable-text-BE7nszX6.d.mts → portable-text-HNmwL-7L.d.mts} +0 -0
  429. /package/dist/{process-cache-C19OA3am.mjs → process-cache-CMy5M80h.mjs} +0 -0
  430. /package/dist/{provider-loader-DERzBMUz.mjs → provider-loader-DlaT1usE.mjs} +0 -0
  431. /package/dist/{public-discovery-BGyhuD5U.mjs → public-discovery-BnqYofSK.mjs} +0 -0
  432. /package/dist/{public-url-DFXUU6Wp.mjs → public-url-BHjYWuaN.mjs} +0 -0
  433. /package/dist/{public-url-sR8SVmTt.mjs → public-url-GQygrYmg.mjs} +0 -0
  434. /package/dist/{redirect-BxacnBYL.mjs → redirect-CokmLN5o.mjs} +0 -0
  435. /package/dist/{request-cache-8_ifFzVw.mjs → request-cache-CizvDoxV.mjs} +0 -0
  436. /package/dist/{resolve-DEKC4qVa.mjs → resolve-BxFGSKYu.mjs} +0 -0
  437. /package/dist/{runtime-env-CPTzh0mZ.mjs → runtime-env-DpYGy4pT.mjs} +0 -0
  438. /package/dist/{scheduled-publish-BxdShRGs.d.mts → scheduled-publish-eCNGpvNm.d.mts} +0 -0
  439. /package/dist/{seo-contributions-LEFs1d7w.mjs → seo-contributions-ZKqrqsdT.mjs} +0 -0
  440. /package/dist/{service-kQ5ljRzX.mjs → service-DeX1PRNt.mjs} +0 -0
  441. /package/dist/{session-user-eweCNKzW.mjs → session-user-D36BRaZY.mjs} +0 -0
  442. /package/dist/{setup-nonce-B6A5Y1ea.mjs → setup-nonce-B9IO7PbK.mjs} +0 -0
  443. /package/dist/{sidecar-client-BwPhhz-F.mjs → sidecar-client-2hx5G46s.mjs} +0 -0
  444. /package/dist/{slugify-kD31VIv2.mjs → slugify-DvoaEPtL.mjs} +0 -0
  445. /package/dist/{ssrf-C9dyjU8O.mjs → ssrf-DcD8vn3E.mjs} +0 -0
  446. /package/dist/{stable-hash-B9Tbb2f_.mjs → stable-hash-9RDJgfif.mjs} +0 -0
  447. /package/dist/{status-Bjf_uSrW.mjs → status-B2xUokyJ.mjs} +0 -0
  448. /package/dist/{transport-BrU1aDY5.mjs → transport-BHYE4pox.mjs} +0 -0
  449. /package/dist/{transport-CZbtxgKZ.d.mts → transport-CVU5rp7W.d.mts} +0 -0
  450. /package/dist/{types-DNBL-4Sn.mjs → types-B3Uq7Czg.mjs} +0 -0
  451. /package/dist/{types-DsJTXStN.d.mts → types-BJztoTbF.d.mts} +0 -0
  452. /package/dist/{types-COvyXIp7.mjs → types-BgUxCuwu.mjs} +0 -0
  453. /package/dist/{types-KFzuijKE.d.mts → types-C0heD9oI.d.mts} +0 -0
  454. /package/dist/{types-B03h5jt_.d.mts → types-DheoByey.d.mts} +0 -0
  455. /package/dist/{types-SlLXjRpg.d.mts → types-I5LHzk_M.d.mts} +0 -0
  456. /package/dist/{types-PLJ9hlhh.mjs → types-Nm0cMxEh.mjs} +0 -0
  457. /package/dist/{types-CtGSEKEJ.d.mts → types-PxxPTFSl.d.mts} +0 -0
  458. /package/dist/{url-DGG3hw_h.mjs → url-Coamqvs4.mjs} +0 -0
  459. /package/dist/{url-DUz3LbCs.mjs → url-dn4mFfCI.mjs} +0 -0
  460. /package/dist/{workers-build-5UQ4j69Q.mjs → workers-build-4926MPc0.mjs} +0 -0
@@ -1,5 +1,5 @@
1
- import { n as normalizeMediaValue } from "../normalize-aTwryvvi.mjs";
2
- import { n as generatePlaceholder, t as enrichImageMetadata } from "../enrich-B7PIJ8Iy.mjs";
1
+ import { n as normalizeMediaValue } from "../normalize-DrmlLn40.mjs";
2
+ import { n as generatePlaceholder, t as enrichImageMetadata } from "../enrich-CAMsD1aT.mjs";
3
3
 
4
4
  //#region src/media/types.ts
5
5
  /**
@@ -1,16 +1,19 @@
1
- import "../types-CJynaYg1.mjs";
2
- import { t as Database } from "../types-B--VyN3n.mjs";
3
- import { h as MediaProviderItem, o as CreateMediaProviderFn } from "../placeholder-DJLP_HY7.mjs";
4
- import "../runner-SoP1rphP.mjs";
5
- import "../index-BVGe04wF.mjs";
6
- import "../types-B03h5jt_.mjs";
7
- import "../adapters-C8nRpUuj.mjs";
8
- import { d as Storage } from "../types-KFzuijKE.mjs";
9
- import "../scheduled-publish-BxdShRGs.mjs";
10
- import "../public-url-Ccv0Xmue.mjs";
11
- import "../validate-kmN2lS8H.mjs";
12
- import "../byline-fields-CKhPED5o.mjs";
13
- import "../types-DsJTXStN.mjs";
1
+ import "../types-C3jUu4Bc.mjs";
2
+ import { n as Database } from "../types-Dpv_MvwZ.mjs";
3
+ import { h as MediaProviderItem, o as CreateMediaProviderFn } from "../placeholder-DdZV3I8x.mjs";
4
+ import "../runner-DXQkyPeX.mjs";
5
+ import "../index-CLj17kW9.mjs";
6
+ import "../types-qOEot0UQ.mjs";
7
+ import "../types-DheoByey.mjs";
8
+ import "../adapters-lDnJjNDz.mjs";
9
+ import "../runtime-Bs2JMbb2.mjs";
10
+ import "../hook-events-BQw73jc7.mjs";
11
+ import { d as Storage } from "../types-C0heD9oI.mjs";
12
+ import "../scheduled-publish-eCNGpvNm.mjs";
13
+ import "../public-url-CEC1vj02.mjs";
14
+ import "../validate-DUscf6VG.mjs";
15
+ import "../byline-fields-Bne2v0ti.mjs";
16
+ import "../types-BJztoTbF.mjs";
14
17
  import "../index.mjs";
15
18
  import { Kysely } from "kysely";
16
19
 
@@ -1,6 +1,6 @@
1
- import "../base64-Cz-aU0X1.mjs";
2
- import "../types-RFzE_V1M.mjs";
3
- import { t as MediaRepository } from "../media-C5ba8fvI.mjs";
1
+ import "../base64-qvSs0Gxy.mjs";
2
+ import "../types-BI3ULB3A.mjs";
3
+ import { t as MediaRepository } from "../media-BjH5OD-A.mjs";
4
4
 
5
5
  //#region src/media/local-runtime.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { i as encodeCursor, r as decodeCursor } from "./types-RFzE_V1M.mjs";
1
+ import { i as encodeCursor, r as decodeCursor } from "./types-BI3ULB3A.mjs";
2
2
  import { sql } from "kysely";
3
3
  import { ulid } from "ulidx";
4
4
 
@@ -1,4 +1,4 @@
1
- import { r as parseAllowedMimeTypes } from "./mime-BnVhH671.mjs";
1
+ import { r as parseAllowedMimeTypes } from "./mime-FkfazULS.mjs";
2
2
 
3
3
  //#region src/api/handlers/media-allowlist.ts
4
4
  /**
@@ -1,7 +1,7 @@
1
- import { c as __exportAll } from "./runner-CRU7BXjr.mjs";
1
+ import { c as __exportAll } from "./runner-CuG8o1uW.mjs";
2
2
  import { AtomicWriteConflict, atomicBatch, rowUnchanged } from "./database/batch.mjs";
3
3
  import { n as getI18nConfig } from "./config-XW5tMrH8.mjs";
4
- import { c as invalidateMenuObjectCache } from "./object-cache-mxCW-Rpt.mjs";
4
+ import { c as invalidateMenuObjectCache } from "./object-cache-DyI1SOBK.mjs";
5
5
  import { sql } from "kysely";
6
6
  import { ulid } from "ulidx";
7
7
 
@@ -1,11 +1,11 @@
1
1
  import { t as validateIdentifier } from "./validate-Co3j6T_K.mjs";
2
- import { r as getDb } from "./loader-Dp6zLmQm.mjs";
3
- import { n as cachedQuery, t as CacheNamespace } from "./object-cache-mxCW-Rpt.mjs";
4
- import { t as CommentRepository } from "./comment-DAQfUjqt.mjs";
5
- import { r as requestCached } from "./request-cache-8_ifFzVw.mjs";
6
- import { n as resolveLocaleChain, t as resolveLocale } from "./resolve-DEKC4qVa.mjs";
7
- import { n as sanitizeHref } from "./url-DGG3hw_h.mjs";
8
- import { t as CommentReactionRepository } from "./comment-reaction-Dp3G7UZc.mjs";
2
+ import { r as getDb } from "./loader-CCwWFQSh.mjs";
3
+ import { r as requestCached } from "./request-cache-CizvDoxV.mjs";
4
+ import { n as cachedQuery, t as CacheNamespace } from "./object-cache-DyI1SOBK.mjs";
5
+ import { t as CommentRepository } from "./comment-BWDG1nQm.mjs";
6
+ import { n as resolveLocaleChain, t as resolveLocale } from "./resolve-BxFGSKYu.mjs";
7
+ import { n as sanitizeHref } from "./url-Coamqvs4.mjs";
8
+ import { t as CommentReactionRepository } from "./comment-reaction-B7pLTlQ7.mjs";
9
9
  import { sql } from "kysely";
10
10
 
11
11
  //#region src/comments/ranking.ts
@@ -0,0 +1,526 @@
1
+ import { atomicBatch, rowUnchanged } from "./database/batch.mjs";
2
+ import { a as validateContentStorage, i as resolveContentPartition, n as contentDigest, o as ContentStorageError, t as canonicalContentJson } from "./config-6R0bchVE.mjs";
3
+ import { h as prepareContentChangeJournal, m as contentChangeSequence, p as readContentPartitionRoute, r as getContentStorage, u as cancelContentMigration } from "./runtime-Ch5G-tnG.mjs";
4
+ import { n as readRevisionDataBatch, r as storedRevisionIndex } from "./revisions-CQ7rMP5d.mjs";
5
+ import { t as ContentRepository } from "./content-BigS8BAv.mjs";
6
+ import { o as invalidateCollectionCache } from "./object-cache-DyI1SOBK.mjs";
7
+ import { A as prepareContentProjection, i as contentWriteConfiguration, j as snapshotPartitionDependencies, k as contentProjectionValues } from "./content-write-DAZCNKWl.mjs";
8
+ import { a as contentVersionSchema } from "./version-store-BXv2D0de.mjs";
9
+ import { a as contentItemSchema } from "./content-Dr22fzA_.mjs";
10
+ import { sql } from "kysely";
11
+ import { z } from "zod";
12
+
13
+ //#region src/content-storage/config-migration.ts
14
+ /** Explicit deployment step. Mapping changes retain the source until its data migration completes. */
15
+ async function migrateContentStorageConfig(db, previous, next) {
16
+ validateContentStorage(previous);
17
+ validateContentStorage(next);
18
+ if (previous.version === next.version) throw new ContentStorageError("INVALID_CONFIG", "A routing configuration change requires a new version.");
19
+ const oldDigest = await contentDigest(previous);
20
+ const digest = await contentDigest(next);
21
+ const installed = (await sql`SELECT version,digest FROM _dineway_content_storage_config WHERE id='active'`.execute(db)).rows[0];
22
+ if (installed?.version === next.version && installed.digest === digest) return;
23
+ const checks = [
24
+ sql`NOT EXISTS (SELECT 1 FROM _dineway_content_hook_deliveries WHERE delivered_at IS NULL)`,
25
+ sql`EXISTS (SELECT 1 FROM _dineway_content_storage_config WHERE id='active' AND version=${previous.version} AND digest=${oldDigest})`,
26
+ sql`NOT EXISTS (SELECT 1 FROM _dineway_content_partitions WHERE state<>'active')`
27
+ ];
28
+ const statements = [];
29
+ for (const [name, descriptor] of Object.entries(previous.stores)) {
30
+ const replacement = next.stores[name];
31
+ if (replacement && replacement.identity !== descriptor.identity) throw new ContentStorageError("INVALID_CONFIG", "Add the replacement database under a new store name, migrate its partitions, then remove the old store.");
32
+ if (!replacement) checks.push(sql`NOT EXISTS (SELECT 1 FROM _dineway_content_locations WHERE store=${name})`, sql`NOT EXISTS (SELECT 1 FROM revisions WHERE json_extract(data,'$.__dineway_content_storage__.store')=${name})`, sql`NOT EXISTS (SELECT 1 FROM _dineway_content_partitions WHERE store=${name})`);
33
+ }
34
+ for (const collection of new Set([...Object.keys(previous.rules), ...Object.keys(next.rules)])) {
35
+ const oldRule = previous.rules[collection];
36
+ const rule = next.rules[collection];
37
+ const rebuild = !oldRule || !rule || canonicalContentJson(oldRule.partitionBy) !== canonicalContentJson(rule.partitionBy);
38
+ if (rebuild && oldRule) {
39
+ checks.push(sql`NOT EXISTS (SELECT 1 FROM _dineway_content_locations WHERE collection=${collection} AND store<>'primary')`, sql`NOT EXISTS (SELECT 1 FROM revisions WHERE collection=${collection} AND json_type(data,'$.__dineway_content_storage__') IS NOT NULL)`);
40
+ statements.push(sql`DELETE FROM _dineway_content_locations WHERE collection=${collection}`.compile(db), sql`DELETE FROM _dineway_content_partitions WHERE collection=${collection}`.compile(db));
41
+ }
42
+ if (!rule) continue;
43
+ statements.push(...await prepareContentChangeJournal(db, collection));
44
+ if (!rebuild) for (const partition of Object.keys(oldRule.stores)) {
45
+ if (Object.hasOwn(rule.stores, partition)) continue;
46
+ checks.push(sql`NOT EXISTS (SELECT 1 FROM _dineway_content_locations WHERE collection=${collection} AND partition=${partition})`);
47
+ statements.push(sql`DELETE FROM _dineway_content_partitions WHERE collection=${collection} AND partition=${partition}`.compile(db));
48
+ }
49
+ for (const [partition, store] of Object.entries(rule.stores)) if (rebuild || !Object.hasOwn(oldRule.stores, partition)) statements.push(sql`INSERT INTO _dineway_content_partitions (collection,partition,store,target_store,state,epoch,migration_id,updated_at) VALUES (${collection},${partition},'primary',${store},'active',1,NULL,${(/* @__PURE__ */ new Date()).toISOString()})`.compile(db));
50
+ else statements.push(sql`UPDATE _dineway_content_partitions SET target_store=${store},epoch=epoch+1,updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE collection=${collection} AND partition=${partition}`.compile(db));
51
+ }
52
+ statements.push(sql`UPDATE _dineway_content_operations SET state='aborted',updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE state='pending'`.compile(db), sql`UPDATE _dineway_content_storage_config SET version=${next.version},digest=${digest} WHERE id='active'`.compile(db));
53
+ await atomicBatch(db, {
54
+ checks,
55
+ statements
56
+ });
57
+ }
58
+
59
+ //#endregion
60
+ //#region src/content-storage/migration-snapshot.ts
61
+ const rowSchema = z.record(z.string(), z.json());
62
+ const revisionSchema = z.object({
63
+ id: z.string(),
64
+ collection: z.string(),
65
+ entry_id: z.string(),
66
+ data: z.string(),
67
+ author_id: z.string().nullable(),
68
+ created_at: z.string()
69
+ });
70
+ const contentMigrationSnapshotSchema = z.object({
71
+ collection: z.string(),
72
+ entryId: z.string(),
73
+ schemaDigest: z.string(),
74
+ changeSequence: z.number().int().nonnegative(),
75
+ row: rowSchema,
76
+ item: contentItemSchema.extend({ data: rowSchema }),
77
+ location: rowSchema.nullable(),
78
+ partitionDependencies: rowSchema,
79
+ revisions: z.array(z.object({
80
+ row: revisionSchema,
81
+ data: rowSchema
82
+ })),
83
+ owned: z.object({
84
+ terms: z.array(rowSchema),
85
+ bylines: z.array(rowSchema),
86
+ seo: z.array(rowSchema)
87
+ })
88
+ }).strict();
89
+ function contentMigrationSnapshotChecks(snapshot, options = {}) {
90
+ const { collection, entryId } = snapshot;
91
+ return [
92
+ ...options.journal === false ? [] : [sql`${contentChangeSequence(collection, entryId)}=${snapshot.changeSequence}`],
93
+ rowUnchanged(`ec_${collection}`, snapshot.row),
94
+ ...snapshot.revisions.map((revision) => rowUnchanged("revisions", revision.row)),
95
+ sql`(SELECT COUNT(*) FROM revisions WHERE collection=${collection} AND entry_id=${entryId})=${snapshot.revisions.length}`,
96
+ ...snapshot.owned.terms.map((row) => rowUnchanged("content_taxonomies", row)),
97
+ sql`(SELECT COUNT(*) FROM content_taxonomies WHERE collection=${collection} AND entry_id=${entryId})=${snapshot.owned.terms.length}`,
98
+ ...snapshot.owned.bylines.map((row) => rowUnchanged("_dineway_content_bylines", row)),
99
+ sql`(SELECT COUNT(*) FROM _dineway_content_bylines WHERE collection_slug=${collection} AND content_id=${entryId})=${snapshot.owned.bylines.length}`,
100
+ ...snapshot.owned.seo.map((row) => rowUnchanged("_dineway_seo", row)),
101
+ sql`(SELECT COUNT(*) FROM _dineway_seo WHERE collection=${collection} AND content_id=${entryId})=${snapshot.owned.seo.length}`,
102
+ ...snapshot.location ? [rowUnchanged("_dineway_content_locations", snapshot.location)] : [sql`NOT EXISTS (SELECT 1 FROM _dineway_content_locations WHERE collection=${collection} AND entry_id=${entryId})`]
103
+ ];
104
+ }
105
+ /** Capture an entry, complete history and owned metadata without changing its visibility. */
106
+ async function captureContentMigrationSnapshot(db, collection, entryId) {
107
+ const storage = getContentStorage(db, collection);
108
+ if (!storage) throw new ContentStorageError("INVALID_CONFIG", "The content type has no storage migration configuration.");
109
+ const configuration = await contentWriteConfiguration(db, collection);
110
+ const row = (await sql`SELECT * FROM ${sql.table(`ec_${collection}`)} WHERE id=${entryId}`.execute(db)).rows[0];
111
+ const item = await new ContentRepository(db).findByIdIncludingTrashed(collection, entryId);
112
+ if (!row || !item || row.version !== item.version) throw new ContentStorageError("CONFLICT", "The source entry changed while taking its snapshot.");
113
+ const revisions = [];
114
+ let afterId = "";
115
+ for (;;) {
116
+ const page = await db.selectFrom("revisions").selectAll().where("collection", "=", collection).where("entry_id", "=", entryId).where("id", ">", afterId).orderBy("id").limit(32).execute();
117
+ const data = await readRevisionDataBatch(db, page);
118
+ revisions.push(...page.map((revision, index) => ({
119
+ row: revision,
120
+ data: rowSchema.parse(data[index])
121
+ })));
122
+ if (page.length < 32) break;
123
+ afterId = page.at(-1).id;
124
+ }
125
+ const terms = await db.selectFrom("content_taxonomies").selectAll().where("collection", "=", collection).where("entry_id", "=", entryId).orderBy("taxonomy_id").execute();
126
+ const bylines = await db.selectFrom("_dineway_content_bylines").selectAll().where("collection_slug", "=", collection).where("content_id", "=", entryId).orderBy("id").execute();
127
+ const seo = await db.selectFrom("_dineway_seo").selectAll().where("collection", "=", collection).where("content_id", "=", entryId).execute();
128
+ const location = (await sql`SELECT * FROM _dineway_content_locations WHERE collection=${collection} AND entry_id=${entryId}`.execute(db)).rows[0] ?? null;
129
+ const dependencies = await snapshotPartitionDependencies(db, collection, item, storage.runtime.config.rules[collection]);
130
+ const changeSequence = (await sql`SELECT ${contentChangeSequence(collection, entryId)} AS sequence`.execute(db)).rows[0].sequence;
131
+ const snapshot = contentMigrationSnapshotSchema.parse({
132
+ collection,
133
+ entryId,
134
+ schemaDigest: await contentDigest({
135
+ collection: configuration.row,
136
+ fields: configuration.fields
137
+ }),
138
+ changeSequence,
139
+ row,
140
+ item,
141
+ location,
142
+ partitionDependencies: dependencies.dependencies,
143
+ revisions,
144
+ owned: {
145
+ terms,
146
+ bylines,
147
+ seo
148
+ }
149
+ });
150
+ await atomicBatch(db, {
151
+ checks: [
152
+ ...configuration.checks,
153
+ ...dependencies.checks,
154
+ ...contentMigrationSnapshotChecks(snapshot)
155
+ ],
156
+ statements: []
157
+ });
158
+ return snapshot;
159
+ }
160
+ /** Index legacy primary rows in resumable pages before taking a partition's write freeze. */
161
+ async function bootstrapContentDirectoryPage(db, collection, options = {}) {
162
+ const storage = getContentStorage(db, collection);
163
+ if (!storage) throw new ContentStorageError("INVALID_CONFIG", "The content type has no storage routing configuration.");
164
+ const limit = Math.min(100, Math.max(1, Math.trunc(options.limit ?? 20)));
165
+ const ids = (await sql`SELECT c.id FROM ${sql.table(`ec_${collection}`)} c WHERE c.id>${options.afterId ?? ""} AND NOT EXISTS (SELECT 1 FROM _dineway_content_locations l WHERE l.collection=${collection} AND l.entry_id=c.id) ORDER BY c.id LIMIT ${limit}`.execute(db)).rows;
166
+ for (const { id } of ids) {
167
+ const raw = (await sql`SELECT * FROM ${sql.table(`ec_${collection}`)} WHERE id=${id}`.execute(db)).rows[0];
168
+ const item = await new ContentRepository(db).findByIdIncludingTrashed(collection, id);
169
+ if (!raw || !item) throw new ContentStorageError("CONFLICT", "The source content changed during directory indexing.");
170
+ const dependencies = await snapshotPartitionDependencies(db, collection, item, storage.runtime.config.rules[collection]);
171
+ const destination = await resolveContentPartition(storage.runtime.config, {
172
+ collection,
173
+ id,
174
+ data: rowSchema.parse(item.data),
175
+ dependencies: dependencies.dependencies
176
+ }, storage.runtime.resolvers);
177
+ if (!destination) throw new ContentStorageError("INVALID_PARTITION", "The content has no partition.");
178
+ const partition = await readContentPartitionRoute(db, collection, destination.partition);
179
+ if (partition.route.store !== "primary" || partition.route.state === "frozen") throw new ContentStorageError("CONFLICT", "Legacy content can only be indexed while its primary partition remains writable.");
180
+ const digest = await contentDigest(item.data);
181
+ await atomicBatch(db, {
182
+ checks: [
183
+ rowUnchanged(`ec_${collection}`, raw),
184
+ partition.check,
185
+ ...dependencies.checks,
186
+ sql`NOT EXISTS (SELECT 1 FROM _dineway_content_locations WHERE collection=${collection} AND entry_id=${id})`
187
+ ],
188
+ statements: [sql`INSERT INTO _dineway_content_locations (collection, entry_id, store, partition, routing_version, version, digest) VALUES (${collection}, ${id}, 'primary', ${destination.partition}, ${storage.runtime.config.version}, ${`primary-${await contentDigest(raw)}`}, ${digest})`.compile(db)]
189
+ });
190
+ }
191
+ return {
192
+ indexed: ids.length,
193
+ nextCursor: ids.length === limit ? ids.at(-1)?.id : void 0
194
+ };
195
+ }
196
+
197
+ //#endregion
198
+ //#region src/content-storage/migration.ts
199
+ async function migrationState(db, migration) {
200
+ const row = (await sql`SELECT state, manifest_digest, verified_count FROM _dineway_content_migrations WHERE id=${migration.id} AND collection=${migration.collection} AND partition=${migration.partition}`.execute(db)).rows[0];
201
+ if (!row) throw new ContentStorageError("CONFLICT", "The migration record is missing.");
202
+ return row;
203
+ }
204
+ async function migrationManifest(db, migration) {
205
+ const rows = (await sql`SELECT * FROM _dineway_content_migration_entries WHERE migration_id=${migration.id} AND state<>'skipped' ORDER BY entry_id`.execute(db)).rows;
206
+ return {
207
+ rows,
208
+ digest: await contentDigest(rows.map((row) => ({
209
+ entryId: row.entry_id,
210
+ sourceDigest: row.source_digest,
211
+ archive: row.archive_key,
212
+ location: row.target_location
213
+ })))
214
+ };
215
+ }
216
+ async function entryCheckpoint(db, migration, entryId) {
217
+ return (await sql`SELECT * FROM _dineway_content_migration_entries WHERE migration_id=${migration.id} AND entry_id=${entryId}`.execute(db)).rows[0];
218
+ }
219
+ async function targetVersions(snapshot, migration, store, routingVersion) {
220
+ const sourceDigest = await contentDigest(snapshot);
221
+ const base = {
222
+ collection: snapshot.collection,
223
+ entryId: snapshot.entryId,
224
+ store,
225
+ partition: migration.partition,
226
+ routingVersion,
227
+ principalId: "content-migration",
228
+ expectedVersion: null
229
+ };
230
+ const revisions = [];
231
+ for (const revision of snapshot.revisions) {
232
+ const version = await contentDigest({
233
+ migration: migration.id,
234
+ sourceDigest,
235
+ revision: revision.row.id
236
+ });
237
+ revisions.push({
238
+ id: revision.row.id,
239
+ value: {
240
+ command: {
241
+ ...base,
242
+ kind: "revision",
243
+ version,
244
+ operationId: version,
245
+ digest: await contentDigest(revision.data)
246
+ },
247
+ data: revision.data
248
+ }
249
+ });
250
+ }
251
+ const { data: fields, ...metadata } = snapshot.item;
252
+ const data = contentVersionSchema.shape.data.parse({
253
+ ...fields,
254
+ _dineway: {
255
+ ...metadata,
256
+ deletedAt: snapshot.row.deleted_at ?? null,
257
+ partitionDependencies: snapshot.partitionDependencies,
258
+ owned: snapshot.owned,
259
+ revisions: revisions.map((revision) => ({
260
+ id: revision.id,
261
+ version: revision.value.command.version,
262
+ digest: revision.value.command.digest
263
+ }))
264
+ }
265
+ });
266
+ const version = await contentDigest({
267
+ migration: migration.id,
268
+ entryId: snapshot.entryId,
269
+ sourceDigest
270
+ });
271
+ return {
272
+ sourceDigest,
273
+ revisions,
274
+ root: {
275
+ command: {
276
+ ...base,
277
+ version,
278
+ operationId: version,
279
+ digest: await contentDigest(data)
280
+ },
281
+ data
282
+ }
283
+ };
284
+ }
285
+ /** Idempotent pre-copy. Full source data must be durably archived and read back first. */
286
+ async function stageContentMigrationEntry(db, migration, entryId, archive) {
287
+ return stageMigrationEntry(db, migration, entryId, archive);
288
+ }
289
+ async function stageMigrationEntry(db, migration, entryId, archive, verificationEpoch) {
290
+ const storage = getContentStorage(db, migration.collection);
291
+ if (!storage) throw new ContentStorageError("INVALID_CONFIG", "Content storage is not configured.");
292
+ const partition = await readContentPartitionRoute(db, migration.collection, migration.partition);
293
+ if (partition.route.migration_id !== migration.id || partition.route.state === "active") throw new ContentStorageError("CONFLICT", "The migration does not own this partition.");
294
+ const phase = await migrationState(db, migration);
295
+ if (verificationEpoch === void 0 ? !["copying", "frozen"].includes(phase.state) : phase.state !== "verifying" || partition.route.epoch !== verificationEpoch) throw new ContentStorageError("CONFLICT", "The verified manifest is immutable or another verifier superseded this attempt.");
296
+ const existing = await entryCheckpoint(db, migration, entryId);
297
+ if (existing?.state === "activated") return existing;
298
+ if (existing?.state === "prepared") {
299
+ const archived = contentMigrationSnapshotSchema.parse(await archive.get(existing.archive_key));
300
+ if (await contentDigest(archived) !== existing.source_digest) throw new ContentStorageError("UNAVAILABLE", "The source archive failed its read-back checksum.");
301
+ const sequence = (await sql`SELECT ${contentChangeSequence(migration.collection, entryId)} AS value`.execute(db)).rows[0].value;
302
+ const schema = await contentWriteConfiguration(db, migration.collection);
303
+ const dependencies = await snapshotPartitionDependencies(db, migration.collection, archived.item, storage.runtime.config.rules[migration.collection]);
304
+ if (sequence === archived.changeSequence && await contentDigest(dependencies.dependencies) === await contentDigest(archived.partitionDependencies) && await contentDigest({
305
+ collection: schema.row,
306
+ fields: schema.fields
307
+ }) === archived.schemaDigest) {
308
+ await atomicBatch(db, {
309
+ checks: [
310
+ partition.check,
311
+ rowUnchanged("_dineway_content_migration_entries", { ...existing }),
312
+ ...schema.checks,
313
+ ...dependencies.checks,
314
+ ...contentMigrationSnapshotChecks(archived)
315
+ ],
316
+ statements: []
317
+ });
318
+ return existing;
319
+ }
320
+ }
321
+ const snapshot = await captureContentMigrationSnapshot(db, migration.collection, entryId);
322
+ if (snapshot.location?.partition !== migration.partition || snapshot.location.store !== partition.route.store) throw new ContentStorageError("CONFLICT", "The entry is not in the migration's source partition.");
323
+ const versions = await targetVersions(snapshot, migration, partition.route.target_store, storage.runtime.config.version);
324
+ const archiveKey = `${migration.id}/${entryId}/${versions.sourceDigest}.json`;
325
+ await archive.put(archiveKey, snapshot);
326
+ if (await contentDigest(contentMigrationSnapshotSchema.parse(await archive.get(archiveKey))) !== versions.sourceDigest) throw new ContentStorageError("UNAVAILABLE", "The source archive failed its read-back checksum.");
327
+ if (partition.route.target_store !== "primary") {
328
+ const store = storage.stores[partition.route.target_store];
329
+ for (const revision of versions.revisions) await store.prepare(revision.value);
330
+ await store.prepare(versions.root);
331
+ await storage.coordinator.readLocations([...versions.revisions.map((revision) => revision.value.command), versions.root.command]);
332
+ }
333
+ const dependencies = await snapshotPartitionDependencies(db, migration.collection, snapshot.item, storage.runtime.config.rules[migration.collection]);
334
+ if (await contentDigest(dependencies.dependencies) !== await contentDigest(snapshot.partitionDependencies)) throw new ContentStorageError("CONFLICT", "Partition dependencies changed while copying content.");
335
+ await atomicBatch(db, {
336
+ checks: [
337
+ partition.check,
338
+ sql`EXISTS (SELECT 1 FROM _dineway_content_migrations WHERE id=${migration.id} AND state=${phase.state})`,
339
+ ...dependencies.checks,
340
+ ...contentMigrationSnapshotChecks(snapshot),
341
+ sql`NOT EXISTS (SELECT 1 FROM _dineway_content_migration_entries WHERE migration_id=${migration.id} AND entry_id=${entryId} AND state='activated')`
342
+ ],
343
+ statements: [sql`INSERT INTO _dineway_content_migration_entries (migration_id, entry_id, source_digest, archive_key, target_location, state, updated_at) VALUES (${migration.id}, ${entryId}, ${versions.sourceDigest}, ${archiveKey}, ${JSON.stringify(versions.root.command)}, 'prepared', ${(/* @__PURE__ */ new Date()).toISOString()}) ON CONFLICT (migration_id, entry_id) DO UPDATE SET source_digest=excluded.source_digest, archive_key=excluded.archive_key, target_location=excluded.target_location, state='prepared', updated_at=excluded.updated_at`.compile(db)]
344
+ });
345
+ return await entryCheckpoint(db, migration, entryId);
346
+ }
347
+ /** Activate one verified entry while the city remains frozen; retries use its persisted receipt. */
348
+ async function activateContentMigrationEntry(db, migration, entryId, archive) {
349
+ const storage = getContentStorage(db, migration.collection);
350
+ if (!storage) throw new ContentStorageError("INVALID_CONFIG", "Content storage is not configured.");
351
+ const partition = await readContentPartitionRoute(db, migration.collection, migration.partition);
352
+ if (partition.route.migration_id !== migration.id || partition.route.state !== "frozen") throw new ContentStorageError("CONFLICT", "Freeze the partition before activating imported content.");
353
+ const phase = await migrationState(db, migration);
354
+ if (!["verified", "activating"].includes(phase.state)) throw new ContentStorageError("CONFLICT", "Verify the complete frozen manifest before activating entries.");
355
+ const checkpoint = await entryCheckpoint(db, migration, entryId);
356
+ if (!checkpoint) throw new ContentStorageError("CONFLICT", "The entry has not been copied and verified.");
357
+ if (checkpoint.state === "activated") return;
358
+ const snapshot = contentMigrationSnapshotSchema.parse(await archive.get(checkpoint.archive_key));
359
+ if (snapshot.collection !== migration.collection || snapshot.entryId !== entryId || await contentDigest(snapshot) !== checkpoint.source_digest) throw new ContentStorageError("CONFLICT", "The migration archive does not match its checkpoint.");
360
+ const saved = contentVersionSchema.shape.command.parse(JSON.parse(checkpoint.target_location));
361
+ const versions = await targetVersions(snapshot, migration, partition.route.target_store, storage.runtime.config.version);
362
+ if (JSON.stringify(versions.root.command) !== checkpoint.target_location) throw new ContentStorageError("CONFLICT", "The target content identity changed.");
363
+ if (saved.store !== "primary") await storage.coordinator.readLocations([...versions.revisions.map((revision) => revision.value.command), versions.root.command], []);
364
+ const dependencies = await snapshotPartitionDependencies(db, migration.collection, snapshot.item, storage.runtime.config.rules[migration.collection]);
365
+ if (await contentDigest(dependencies.dependencies) !== await contentDigest(snapshot.partitionDependencies)) throw new ContentStorageError("CONFLICT", "Partition dependencies changed after copying.");
366
+ const destination = await resolveContentPartition(storage.runtime.config, {
367
+ collection: migration.collection,
368
+ id: entryId,
369
+ data: snapshot.item.data,
370
+ dependencies: dependencies.dependencies
371
+ }, storage.runtime.resolvers);
372
+ if (destination?.partition !== migration.partition || destination.store !== saved.store) throw new ContentStorageError("ROUTE_CHANGED", "The copied content belongs to another partition.");
373
+ const schema = await contentWriteConfiguration(db, migration.collection);
374
+ if (await contentDigest({
375
+ collection: schema.row,
376
+ fields: schema.fields
377
+ }) !== snapshot.schemaDigest) throw new ContentStorageError("CONFLICT", "The content schema changed after the migration snapshot.");
378
+ await atomicBatch(db, {
379
+ checks: [
380
+ partition.check,
381
+ sql`EXISTS (SELECT 1 FROM _dineway_content_migrations WHERE id=${migration.id} AND state IN ('verified','activating') AND manifest_digest=${phase.manifest_digest})`,
382
+ rowUnchanged("_dineway_content_migration_entries", { ...checkpoint }),
383
+ ...schema.checks,
384
+ ...dependencies.checks,
385
+ ...contentMigrationSnapshotChecks(snapshot)
386
+ ],
387
+ statements: [
388
+ prepareContentProjection(db, migration.collection, snapshot.item, schema.fields, false, saved.store === "primary"),
389
+ ...versions.revisions.map((revision) => db.updateTable("revisions").set({ data: saved.store === "primary" ? JSON.stringify(revision.value.data) : storedRevisionIndex(revision.value.command) }).where("id", "=", revision.id).compile()),
390
+ sql`UPDATE _dineway_content_locations SET store=${saved.store}, partition=${saved.partition}, routing_version=${saved.routingVersion}, version=${saved.version}, digest=${saved.digest} WHERE collection=${migration.collection} AND entry_id=${entryId}`.compile(db),
391
+ sql`UPDATE _dineway_content_migration_entries SET state='activated', updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE migration_id=${migration.id} AND entry_id=${entryId}`.compile(db),
392
+ sql`UPDATE _dineway_content_migrations SET state='activating', updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE id=${migration.id}`.compile(db)
393
+ ]
394
+ });
395
+ invalidateCollectionCache(migration.collection);
396
+ }
397
+ /** Refresh the frozen delta, verify all current IDs, and seal the activation manifest. */
398
+ async function verifyContentMigration(db, migration, archive) {
399
+ const partition = await readContentPartitionRoute(db, migration.collection, migration.partition);
400
+ if (partition.route.migration_id !== migration.id || partition.route.state !== "frozen") throw new ContentStorageError("CONFLICT", "The final verification requires a frozen partition.");
401
+ const phase = await migrationState(db, migration);
402
+ if (["verified", "activating"].includes(phase.state)) return {
403
+ count: phase.verified_count,
404
+ digest: phase.manifest_digest
405
+ };
406
+ if (!["frozen", "verifying"].includes(phase.state)) throw new ContentStorageError("CONFLICT", "The migration cannot be verified in its current state.");
407
+ await atomicBatch(db, {
408
+ checks: [partition.check, sql`EXISTS (SELECT 1 FROM _dineway_content_migrations WHERE id=${migration.id} AND state=${phase.state})`],
409
+ statements: [sql`UPDATE _dineway_content_partitions SET epoch=epoch+1, updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE collection=${migration.collection} AND partition=${migration.partition}`.compile(db), sql`UPDATE _dineway_content_migrations SET state='verifying', updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE id=${migration.id}`.compile(db)]
410
+ });
411
+ const verification = await readContentPartitionRoute(db, migration.collection, migration.partition);
412
+ let cursor = "";
413
+ for (;;) {
414
+ const ids = (await sql`SELECT c.id FROM ${sql.table(`ec_${migration.collection}`)} c JOIN _dineway_content_locations l ON l.collection=${migration.collection} AND l.entry_id=c.id WHERE l.partition=${migration.partition} AND c.id>${cursor} ORDER BY c.id LIMIT 20`.execute(db)).rows;
415
+ for (const { id } of ids) await stageMigrationEntry(db, migration, id, archive, verification.route.epoch);
416
+ if (ids.length < 20) break;
417
+ cursor = ids.at(-1).id;
418
+ }
419
+ await atomicBatch(db, {
420
+ checks: [verification.check],
421
+ statements: [sql`UPDATE _dineway_content_migration_entries SET state='skipped' WHERE migration_id=${migration.id} AND state='prepared' AND NOT EXISTS (SELECT 1 FROM ${sql.table(`ec_${migration.collection}`)} c JOIN _dineway_content_locations l ON l.collection=${migration.collection} AND l.entry_id=c.id WHERE c.id=_dineway_content_migration_entries.entry_id AND l.partition=${migration.partition})`.compile(db), sql`DELETE FROM _dineway_content_locations WHERE collection=${migration.collection} AND partition=${migration.partition} AND NOT EXISTS (SELECT 1 FROM ${sql.table(`ec_${migration.collection}`)} c WHERE c.id=_dineway_content_locations.entry_id)`.compile(db)]
422
+ });
423
+ const manifest = await migrationManifest(db, migration);
424
+ await atomicBatch(db, {
425
+ checks: [
426
+ verification.check,
427
+ sql`EXISTS (SELECT 1 FROM _dineway_content_migrations WHERE id=${migration.id} AND state='verifying')`,
428
+ sql`(SELECT COUNT(*) FROM _dineway_content_locations WHERE collection=${migration.collection} AND partition=${migration.partition})=${manifest.rows.length}`,
429
+ sql`NOT EXISTS (SELECT 1 FROM _dineway_content_locations l WHERE l.collection=${migration.collection} AND l.partition=${migration.partition} AND NOT EXISTS (SELECT 1 FROM _dineway_content_migration_entries m WHERE m.migration_id=${migration.id} AND m.entry_id=l.entry_id AND m.state='prepared'))`
430
+ ],
431
+ statements: [sql`UPDATE _dineway_content_migrations SET state='verified', manifest_digest=${manifest.digest}, verified_count=${manifest.rows.length}, updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE id=${migration.id} AND state='verifying'`.compile(db)]
432
+ });
433
+ return {
434
+ count: manifest.rows.length,
435
+ digest: manifest.digest
436
+ };
437
+ }
438
+ /** Reopen writes only after every sealed entry has activated; old archives remain retained. */
439
+ async function completeContentMigration(db, migration) {
440
+ const phase = await migrationState(db, migration);
441
+ if (phase.state === "complete") return;
442
+ const partition = await readContentPartitionRoute(db, migration.collection, migration.partition);
443
+ if (partition.route.state !== "frozen" || partition.route.migration_id !== migration.id || !["verified", "activating"].includes(phase.state)) throw new ContentStorageError("CONFLICT", "The migration is not ready to reopen writes.");
444
+ const manifest = await migrationManifest(db, migration);
445
+ if (manifest.digest !== phase.manifest_digest || manifest.rows.length !== phase.verified_count || manifest.rows.some((row) => row.state !== "activated")) throw new ContentStorageError("CONFLICT", "The sealed manifest has not completely activated.");
446
+ await atomicBatch(db, {
447
+ checks: [
448
+ partition.check,
449
+ sql`EXISTS (SELECT 1 FROM _dineway_content_migrations WHERE id=${migration.id} AND manifest_digest=${manifest.digest} AND state IN ('verified','activating'))`,
450
+ sql`NOT EXISTS (SELECT 1 FROM _dineway_content_migration_entries WHERE migration_id=${migration.id} AND state NOT IN ('activated','skipped'))`,
451
+ sql`NOT EXISTS (SELECT 1 FROM _dineway_content_locations WHERE collection=${migration.collection} AND partition=${migration.partition} AND store<>${partition.route.target_store})`
452
+ ],
453
+ statements: [sql`UPDATE _dineway_content_partitions SET store=target_store, state='active', migration_id=NULL, epoch=epoch+1, updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE collection=${migration.collection} AND partition=${migration.partition}`.compile(db), sql`UPDATE _dineway_content_migrations SET state='complete', retain_until=${new Date(Date.now() + 7 * 864e5).toISOString()}, updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE id=${migration.id}`.compile(db)]
454
+ });
455
+ invalidateCollectionCache(migration.collection);
456
+ }
457
+ /** Restore the archived source only before writes have reopened. Never deletes either copy. */
458
+ async function rollbackContentMigration(db, migration, archive) {
459
+ const phase = await migrationState(db, migration);
460
+ if (phase.state === "cancelled") return;
461
+ if (phase.state === "complete") throw new ContentStorageError("CONFLICT", "Writes have reopened. Returning to the old store requires a reverse data migration.");
462
+ const current = await readContentPartitionRoute(db, migration.collection, migration.partition);
463
+ if (current.route.migration_id !== migration.id || current.route.state !== "frozen") throw new ContentStorageError("CONFLICT", "Freeze the partition before restoring its archive.");
464
+ if (phase.state !== "rolling_back") await atomicBatch(db, {
465
+ checks: [current.check, sql`EXISTS (SELECT 1 FROM _dineway_content_migrations WHERE id=${migration.id} AND state=${phase.state})`],
466
+ statements: [sql`UPDATE _dineway_content_partitions SET epoch=epoch+1, updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE collection=${migration.collection} AND partition=${migration.partition}`.compile(db), sql`UPDATE _dineway_content_migrations SET state='rolling_back', updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE id=${migration.id}`.compile(db)]
467
+ });
468
+ const partition = await readContentPartitionRoute(db, migration.collection, migration.partition);
469
+ const schema = await contentWriteConfiguration(db, migration.collection);
470
+ for (;;) {
471
+ const entries = (await sql`SELECT * FROM _dineway_content_migration_entries WHERE migration_id=${migration.id} AND state='activated' ORDER BY entry_id LIMIT 20`.execute(db)).rows;
472
+ if (!entries.length) break;
473
+ for (const checkpoint of entries) {
474
+ const snapshot = contentMigrationSnapshotSchema.parse(await archive.get(checkpoint.archive_key));
475
+ if (snapshot.collection !== migration.collection || snapshot.entryId !== checkpoint.entry_id || await contentDigest(snapshot) !== checkpoint.source_digest) throw new ContentStorageError("CONFLICT", "The migration archive does not match its checkpoint.");
476
+ if (!snapshot.location || snapshot.location.store !== partition.route.store || await contentDigest({
477
+ collection: schema.row,
478
+ fields: schema.fields
479
+ }) !== snapshot.schemaDigest) throw new ContentStorageError("CONFLICT", "The source location or schema changed. The archive cannot be restored.");
480
+ const target = contentVersionSchema.shape.command.parse(JSON.parse(checkpoint.target_location));
481
+ const versions = await targetVersions(snapshot, migration, partition.route.target_store, target.routingVersion);
482
+ if (JSON.stringify(versions.root.command) !== checkpoint.target_location) throw new ContentStorageError("CONFLICT", "The target content identity changed.");
483
+ const expected = contentMigrationSnapshotSchema.parse({
484
+ ...snapshot,
485
+ row: {
486
+ ...snapshot.row,
487
+ ...contentProjectionValues(snapshot.item, schema.fields, target.store === "primary")
488
+ },
489
+ location: {
490
+ ...snapshot.location,
491
+ store: target.store,
492
+ partition: target.partition,
493
+ routing_version: target.routingVersion,
494
+ version: target.version,
495
+ digest: target.digest
496
+ },
497
+ revisions: snapshot.revisions.map((revision, index) => ({
498
+ ...revision,
499
+ row: {
500
+ ...revision.row,
501
+ data: target.store === "primary" ? JSON.stringify(revision.data) : storedRevisionIndex(versions.revisions[index].value.command)
502
+ }
503
+ }))
504
+ });
505
+ await atomicBatch(db, {
506
+ checks: [
507
+ partition.check,
508
+ rowUnchanged("_dineway_content_migration_entries", { ...checkpoint }),
509
+ ...schema.checks,
510
+ ...contentMigrationSnapshotChecks(expected, { journal: false })
511
+ ],
512
+ statements: [
513
+ sql`UPDATE ${sql.table(`ec_${migration.collection}`)} SET ${sql.join(Object.entries(snapshot.row).filter(([key]) => key !== "id").map(([key, value]) => sql`${sql.ref(key)}=${value}`))} WHERE id=${checkpoint.entry_id}`.compile(db),
514
+ ...snapshot.revisions.map((revision) => db.updateTable("revisions").set({ data: revision.row.data }).where("id", "=", revision.row.id).compile()),
515
+ sql`UPDATE _dineway_content_locations SET ${sql.join(Object.entries(snapshot.location).filter(([key]) => !["collection", "entry_id"].includes(key)).map(([key, value]) => sql`${sql.ref(key)}=${value}`))} WHERE collection=${migration.collection} AND entry_id=${checkpoint.entry_id}`.compile(db),
516
+ sql`UPDATE _dineway_content_migration_entries SET state='restored', updated_at=${(/* @__PURE__ */ new Date()).toISOString()} WHERE migration_id=${migration.id} AND entry_id=${checkpoint.entry_id}`.compile(db)
517
+ ]
518
+ });
519
+ }
520
+ }
521
+ await cancelContentMigration(db, migration);
522
+ invalidateCollectionCache(migration.collection);
523
+ }
524
+
525
+ //#endregion
526
+ export { verifyContentMigration as a, contentMigrationSnapshotSchema as c, stageContentMigrationEntry as i, migrateContentStorageConfig as l, completeContentMigration as n, bootstrapContentDirectoryPage as o, rollbackContentMigration as r, captureContentMigrationSnapshot as s, activateContentMigrationEntry as t };
@@ -1,4 +1,4 @@
1
- import { o as assertD1Migrations } from "./runner-CRU7BXjr.mjs";
1
+ import { o as assertD1Migrations } from "./runner-CuG8o1uW.mjs";
2
2
  import { t as d1Database } from "./d1-binding-DrLMBUxu.mjs";
3
3
  import { Migrator } from "kysely";
4
4