dineway 0.2.34 → 0.2.35

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 (405) hide show
  1. package/dist/{activity-events-D-yGV7cW.mjs → activity-events-CiFN61xq.mjs} +1 -1
  2. package/dist/{allowed-origins-DV3LWuWW.mjs → allowed-origins-Cp7BI3L9.mjs} +1 -1
  3. package/dist/api/route-utils.d.mts +10 -10
  4. package/dist/api/route-utils.mjs +11 -11
  5. package/dist/api/schemas/index.d.mts +1 -1
  6. package/dist/api/schemas/index.mjs +5 -5
  7. package/dist/{api-CL4pG2zf.mjs → api-CwhrR7H5.mjs} +8 -8
  8. package/dist/{api-tokens-_6tMD1W4.mjs → api-tokens-OAgvq4xg.mjs} +1 -1
  9. package/dist/{apply-CYLUMiZg.mjs → apply-BTfAReIv.mjs} +13 -13
  10. package/dist/astro/index.d.mts +11 -11
  11. package/dist/astro/index.mjs +4 -4
  12. package/dist/astro/middleware/auth.d.mts +9 -9
  13. package/dist/astro/middleware/auth.mjs +6 -6
  14. package/dist/astro/middleware/redirect.mjs +2 -2
  15. package/dist/astro/middleware/request-context.mjs +3 -3
  16. package/dist/astro/middleware/seed.d.mts +1 -1
  17. package/dist/astro/middleware/seed.mjs +1 -1
  18. package/dist/astro/middleware/setup.mjs +1 -1
  19. package/dist/astro/middleware.mjs +82 -83
  20. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +7 -7
  21. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +7 -7
  22. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  23. package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
  24. package/dist/astro/routes/api/admin/briefing.mjs +14 -14
  25. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +3 -3
  26. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +9 -9
  27. package/dist/astro/routes/api/admin/byline-fields/index.mjs +9 -9
  28. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +9 -9
  29. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +11 -11
  30. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +11 -11
  31. package/dist/astro/routes/api/admin/bylines/index.mjs +11 -11
  32. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +13 -12
  33. package/dist/astro/routes/api/admin/comments/_id_.mjs +4 -4
  34. package/dist/astro/routes/api/admin/comments/bulk.mjs +10 -10
  35. package/dist/astro/routes/api/admin/comments/counts.mjs +4 -4
  36. package/dist/astro/routes/api/admin/comments/index.mjs +10 -10
  37. package/dist/astro/routes/api/admin/context/_id_/history.mjs +23 -24
  38. package/dist/astro/routes/api/admin/context/_id_/index.mjs +23 -24
  39. package/dist/astro/routes/api/admin/context/_id_/review.mjs +28 -29
  40. package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +28 -29
  41. package/dist/astro/routes/api/admin/context/diff.mjs +27 -28
  42. package/dist/astro/routes/api/admin/context/index.mjs +28 -29
  43. package/dist/astro/routes/api/admin/context/stale.mjs +27 -28
  44. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +23 -24
  45. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +27 -28
  46. package/dist/astro/routes/api/admin/hitl-requests/index.mjs +27 -28
  47. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +24 -25
  48. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +2 -2
  49. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
  50. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
  51. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +50 -51
  52. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +50 -51
  53. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +42 -43
  54. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +49 -50
  55. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +49 -50
  56. package/dist/astro/routes/api/admin/plugins/index.mjs +42 -43
  57. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
  58. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +42 -43
  59. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +49 -50
  60. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +42 -43
  61. package/dist/astro/routes/api/admin/plugins/updates.mjs +42 -43
  62. package/dist/astro/routes/api/admin/review-requests/_id_/image.mjs +15 -15
  63. package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +25 -19
  64. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +36 -37
  65. package/dist/astro/routes/api/admin/review-requests/_id_/revoke.mjs +4 -4
  66. package/dist/astro/routes/api/admin/review-requests/index.mjs +34 -35
  67. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +42 -43
  68. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
  69. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +42 -43
  70. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +1 -1
  71. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
  72. package/dist/astro/routes/api/admin/users/_id_/index.mjs +7 -7
  73. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +2 -2
  74. package/dist/astro/routes/api/admin/users/index.mjs +7 -7
  75. package/dist/astro/routes/api/auth/dev-bypass.mjs +3 -3
  76. package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
  77. package/dist/astro/routes/api/auth/invite/complete.mjs +11 -11
  78. package/dist/astro/routes/api/auth/invite/index.mjs +8 -8
  79. package/dist/astro/routes/api/auth/invite/register-options.mjs +10 -10
  80. package/dist/astro/routes/api/auth/logout.mjs +2 -2
  81. package/dist/astro/routes/api/auth/magic-link/send.mjs +11 -11
  82. package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
  83. package/dist/astro/routes/api/auth/me.mjs +7 -7
  84. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  85. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
  86. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +3 -3
  87. package/dist/astro/routes/api/auth/passkey/_id_.mjs +7 -7
  88. package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
  89. package/dist/astro/routes/api/auth/passkey/options.mjs +13 -13
  90. package/dist/astro/routes/api/auth/passkey/register/options.mjs +10 -10
  91. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +11 -11
  92. package/dist/astro/routes/api/auth/passkey/verify.mjs +11 -11
  93. package/dist/astro/routes/api/auth/setup-token/index.mjs +3 -3
  94. package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
  95. package/dist/astro/routes/api/auth/signup/complete.mjs +11 -11
  96. package/dist/astro/routes/api/auth/signup/request.mjs +11 -11
  97. package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
  98. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +73 -2
  99. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +85 -46
  100. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +14 -14
  101. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
  102. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +4 -4
  103. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +4 -4
  104. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +4 -4
  105. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +16 -16
  106. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +15 -16
  107. package/dist/astro/routes/api/content/_collection_/_id_/release-readiness.mjs +8 -8
  108. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +4 -4
  109. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
  110. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +15 -16
  111. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +11 -11
  112. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
  113. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +4 -4
  114. package/dist/astro/routes/api/content/_collection_/_id_.mjs +10 -10
  115. package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
  116. package/dist/astro/routes/api/content/_collection_/index.mjs +10 -10
  117. package/dist/astro/routes/api/content/_collection_/trash.mjs +8 -8
  118. package/dist/astro/routes/api/dashboard.mjs +5 -5
  119. package/dist/astro/routes/api/dev/emails.mjs +2 -2
  120. package/dist/astro/routes/api/health.mjs +1 -1
  121. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  122. package/dist/astro/routes/api/import/probe.mjs +16 -16
  123. package/dist/astro/routes/api/import/wordpress/analyze.mjs +8 -8
  124. package/dist/astro/routes/api/import/wordpress/execute.d.mts +9 -9
  125. package/dist/astro/routes/api/import/wordpress/execute.mjs +29 -30
  126. package/dist/astro/routes/api/import/wordpress/media.d.mts +9 -9
  127. package/dist/astro/routes/api/import/wordpress/media.mjs +11 -11
  128. package/dist/astro/routes/api/import/wordpress/prepare.mjs +31 -32
  129. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +10 -10
  130. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +28 -29
  131. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  132. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +19 -19
  133. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +9 -9
  134. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +33 -34
  135. package/dist/astro/routes/api/integration/artifact.mjs +5 -5
  136. package/dist/astro/routes/api/integration/dispatch.mjs +9 -9
  137. package/dist/astro/routes/api/integrations/_provider_.mjs +7 -7
  138. package/dist/astro/routes/api/integrations/index.mjs +6 -6
  139. package/dist/astro/routes/api/manifest.mjs +4 -4
  140. package/dist/astro/routes/api/mcp.mjs +61 -62
  141. package/dist/astro/routes/api/media/_id_/confirm.mjs +9 -9
  142. package/dist/astro/routes/api/media/_id_.mjs +9 -9
  143. package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
  144. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
  145. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
  146. package/dist/astro/routes/api/media/providers/index.mjs +2 -2
  147. package/dist/astro/routes/api/media/upload-url.mjs +10 -10
  148. package/dist/astro/routes/api/media.mjs +12 -12
  149. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +27 -28
  150. package/dist/astro/routes/api/menus/_name_/items.mjs +27 -28
  151. package/dist/astro/routes/api/menus/_name_/reorder.mjs +27 -28
  152. package/dist/astro/routes/api/menus/_name_/translations.mjs +27 -28
  153. package/dist/astro/routes/api/menus/_name_.mjs +27 -28
  154. package/dist/astro/routes/api/menus/index.mjs +27 -28
  155. package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
  156. package/dist/astro/routes/api/oauth/device/authorize.mjs +5 -5
  157. package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
  158. package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
  159. package/dist/astro/routes/api/oauth/register.mjs +4 -4
  160. package/dist/astro/routes/api/oauth/token/refresh.mjs +5 -5
  161. package/dist/astro/routes/api/oauth/token/revoke.mjs +5 -5
  162. package/dist/astro/routes/api/oauth/token.mjs +6 -6
  163. package/dist/astro/routes/api/openapi.json.mjs +5 -5
  164. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +3 -3
  165. package/dist/astro/routes/api/redirects/404s/index.mjs +9 -9
  166. package/dist/astro/routes/api/redirects/404s/summary.mjs +9 -9
  167. package/dist/astro/routes/api/redirects/_id_.mjs +28 -29
  168. package/dist/astro/routes/api/redirects/index.mjs +28 -29
  169. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
  170. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
  171. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +44 -45
  172. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +44 -45
  173. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +44 -45
  174. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +44 -45
  175. package/dist/astro/routes/api/schema/collections/index.mjs +44 -45
  176. package/dist/astro/routes/api/schema/index.mjs +8 -8
  177. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +42 -43
  178. package/dist/astro/routes/api/schema/orphans/index.mjs +42 -43
  179. package/dist/astro/routes/api/search/enable.mjs +10 -10
  180. package/dist/astro/routes/api/search/index.mjs +9 -9
  181. package/dist/astro/routes/api/search/rebuild.mjs +10 -10
  182. package/dist/astro/routes/api/search/stats.mjs +4 -4
  183. package/dist/astro/routes/api/search/suggest.mjs +9 -9
  184. package/dist/astro/routes/api/sections/_slug_.mjs +28 -29
  185. package/dist/astro/routes/api/sections/index.mjs +28 -29
  186. package/dist/astro/routes/api/settings/email.mjs +3 -3
  187. package/dist/astro/routes/api/settings/reviews.mjs +6 -6
  188. package/dist/astro/routes/api/settings.mjs +28 -29
  189. package/dist/astro/routes/api/setup/admin-verify.mjs +13 -13
  190. package/dist/astro/routes/api/setup/admin.mjs +11 -11
  191. package/dist/astro/routes/api/setup/dev-bypass.mjs +17 -17
  192. package/dist/astro/routes/api/setup/dev-reset.mjs +1 -1
  193. package/dist/astro/routes/api/setup/index.mjs +19 -19
  194. package/dist/astro/routes/api/setup/status.mjs +3 -3
  195. package/dist/astro/routes/api/snapshot.mjs +7 -7
  196. package/dist/astro/routes/api/system/heartbeat.mjs +2 -2
  197. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +30 -31
  198. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +30 -31
  199. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +30 -31
  200. package/dist/astro/routes/api/taxonomies/index.mjs +30 -31
  201. package/dist/astro/routes/api/themes/preview.mjs +5 -5
  202. package/dist/astro/routes/api/typegen.mjs +4 -4
  203. package/dist/astro/routes/api/well-known/auth.mjs +2 -2
  204. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
  205. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
  206. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +27 -28
  207. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +28 -29
  208. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +28 -29
  209. package/dist/astro/routes/api/widget-areas/_name_.mjs +25 -26
  210. package/dist/astro/routes/api/widget-areas/index.mjs +28 -29
  211. package/dist/astro/routes/api/widget-components.mjs +2 -2
  212. package/dist/astro/routes/robots.txt.mjs +3 -3
  213. package/dist/astro/routes/sitemap-_collection_.xml.mjs +10 -10
  214. package/dist/astro/routes/sitemap.xml.mjs +9 -9
  215. package/dist/astro/session-driver.d.mts +1 -1
  216. package/dist/astro/types.d.mts +12 -12
  217. package/dist/auth/providers/github.d.mts +1 -1
  218. package/dist/auth/providers/google.d.mts +1 -1
  219. package/dist/{auth-control-guard-D4WW-wFF.mjs → auth-control-guard-DPOSBNFI.mjs} +1 -1
  220. package/dist/{authorize-EnP57AQl.mjs → authorize-CXIjxIfC.mjs} +1 -1
  221. package/dist/{briefing-CkCi6S-W.mjs → briefing-5zf0YZbR.mjs} +3 -3
  222. package/dist/{briefing-BXsVwd4P.mjs → briefing-DiupPvyN.mjs} +1 -1
  223. package/dist/{bundle-Cgak1zGE.mjs → bundle-DImnxo71.mjs} +1 -1
  224. package/dist/{byline-fields-BmkhEDFF.d.mts → byline-fields-BO96fXLv.d.mts} +14 -14
  225. package/dist/{byline-fields-BGEIA9dZ.mjs → byline-fields-DGNKitg3.mjs} +2 -2
  226. package/dist/{bylines-LqNRjma2.mjs → bylines-CXyKpVLQ.mjs} +2 -2
  227. package/dist/cli/index.mjs +28 -28
  228. package/dist/cli/plugin-kit.d.mts +9 -9
  229. package/dist/cli/plugin-kit.mjs +2 -2
  230. package/dist/client/external-auth-headers.d.mts +1 -1
  231. package/dist/client/index.d.mts +11 -11
  232. package/dist/client/index.mjs +2 -2
  233. package/dist/{comment-Bi7cJ9SS.mjs → comment-kgLTdtQD.mjs} +13 -6
  234. package/dist/{comments-Dg_gWBEB.mjs → comments-ZYK_cZvx.mjs} +1 -1
  235. package/dist/{content-NobcQti0.mjs → content-D9xKUSno.mjs} +50 -7
  236. package/dist/{content-refresh-l4mPoGeX.mjs → content-refresh-9M9cc55-.mjs} +1 -1
  237. package/dist/{context-B0SG9Xkc.mjs → context-BU8AbLmY.mjs} +2 -2
  238. package/dist/{context-6uqzU-M9.mjs → context-C5lPtfeh.mjs} +6 -6
  239. package/dist/{context-route-helpers-C8s26uDT.mjs → context-route-helpers-CWAHJFl3.mjs} +1 -1
  240. package/dist/{dashboard-B-OybCMw.mjs → dashboard-BnD5krLg.mjs} +2 -2
  241. package/dist/database/batch.d.mts +3 -1
  242. package/dist/database/batch.mjs +25 -2
  243. package/dist/database/d1/index.d.mts +9 -9
  244. package/dist/database/d1/index.mjs +3 -3
  245. package/dist/db/d1.d.mts +1 -1
  246. package/dist/db/d1.mjs +1 -1
  247. package/dist/db/index.d.mts +3 -3
  248. package/dist/db/libsql.d.mts +1 -1
  249. package/dist/db/postgres.d.mts +1 -1
  250. package/dist/db/sqlite.d.mts +1 -1
  251. package/dist/{device-flow-DhpCzMo0.mjs → device-flow-Prqg6ycD.mjs} +3 -3
  252. package/dist/{discovery-CqXbN0WZ.mjs → discovery-CYcZJ1o3.mjs} +3 -3
  253. package/dist/{evidence-xJf8hQgH.mjs → evidence-krrA3uiG.mjs} +5 -5
  254. package/dist/{hitl-requests-evSsel48.mjs → hitl-requests-CGjA1jND.mjs} +2 -2
  255. package/dist/{hitl-route-helpers-D2kJSOFX.mjs → hitl-route-helpers-BxSL0iZB.mjs} +4 -4
  256. package/dist/{import-Jpta-CYE.mjs → import-CayDCPaH.mjs} +6 -6
  257. package/dist/{index-CSUSBfdD.d.mts → index-mlJSqFkG.d.mts} +3 -3
  258. package/dist/index.d.mts +16 -16
  259. package/dist/index.mjs +75 -76
  260. package/dist/{integration-credentials-BrQr0fb_.mjs → integration-credentials-Br16M1VE.mjs} +2 -2
  261. package/dist/{jsonld-CqIVIeZK.d.mts → jsonld-BUiFEiCZ.d.mts} +2 -2
  262. package/dist/{manifest-schema-DG29meRy.mjs → manifest-schema-DBXM_g8l.mjs} +1 -1
  263. package/dist/{mcp-reviewed-executor-DAZL3Ckt.mjs → mcp-reviewed-executor-RJ71uyQb.mjs} +5 -5
  264. package/dist/media/index.d.mts +1 -1
  265. package/dist/media/local-runtime.d.mts +11 -11
  266. package/dist/media/local-runtime.mjs +1 -1
  267. package/dist/{media-3fK0u-bo.mjs → media-BZqwtRTZ.mjs} +11 -3
  268. package/dist/{menus-CbR_J8cJ.mjs → menus-2o-DVcwA.mjs} +4 -4
  269. package/dist/{oauth-authorization--0UtTZpv.mjs → oauth-authorization-B_mmz7O2.mjs} +4 -4
  270. package/dist/{oauth-clients-D4WBYaYW.mjs → oauth-clients-Cr4pdIAE.mjs} +2 -2
  271. package/dist/object-cache/memory.d.mts +1 -1
  272. package/dist/page/index.d.mts +10 -10
  273. package/dist/page/index.mjs +1 -1
  274. package/dist/{parse--7nG62_h.mjs → parse-BscLr3p2.mjs} +1 -1
  275. package/dist/plugin-utils.d.mts +9 -9
  276. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
  277. package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
  278. package/dist/{plugins-DK1wLuao.mjs → plugins-f48yrwfI.mjs} +5 -5
  279. package/dist/{preview-q0pkibNO.mjs → preview-E1xKZGsX.mjs} +2 -2
  280. package/dist/{provider-loader-C0GaLwKB.d.mts → provider-loader-H2wdGD0o.d.mts} +1 -1
  281. package/dist/{public-url-B9zEdO8p.d.mts → public-url-CI700CW4.d.mts} +1 -1
  282. package/dist/{public-url-BV-YQ_LF.d.mts → public-url-zoO-QbN6.d.mts} +2 -2
  283. package/dist/{publication-authorization-BrEZ2TsE.mjs → publication-authorization-Dq_20SZR.mjs} +5 -6
  284. package/dist/{query-DAS6VbMS.mjs → query-BkWWdxyb.mjs} +1 -1
  285. package/dist/{query-CEn9HXnf.mjs → query-D6oNo9iz.mjs} +5 -5
  286. package/dist/{rate-limit-Dd1TnzZP.mjs → rate-limit-RaBJEgyt.mjs} +2 -2
  287. package/dist/{redirects-DmOdfRjI.mjs → redirects-D16GFaOa.mjs} +2 -2
  288. package/dist/{redirects-UCXyL0lP.mjs → redirects-DpRiuRWn.mjs} +3 -3
  289. package/dist/{registry-RD9qTnYL.mjs → registry-DcV93OL_.mjs} +3 -3
  290. package/dist/{release-BR08Slqf.mjs → release-CZfAeyXm.mjs} +2 -2
  291. package/dist/{request-meta-BOcuHAXD.mjs → request-meta-C6yGqnGD.mjs} +1 -1
  292. package/dist/{content-De_XeXy_.mjs → review-payload-LLIi1sxO.mjs} +161 -5
  293. package/dist/{review-requests-CyfWbJ6W.mjs → review-requests-C7prIbCo.mjs} +1 -1
  294. package/dist/{review-route-helpers-lKA-CXms.mjs → review-route-helpers-BYx3Px90.mjs} +1 -1
  295. package/dist/{runner-JnJSGXEB.d.mts → runner-Cxl-vyk2.d.mts} +1 -1
  296. package/dist/{runs-B5BExdKO.mjs → runs-B8kCirJ6.mjs} +2 -2
  297. package/dist/runtime.d.mts +10 -10
  298. package/dist/runtime.mjs +1 -1
  299. package/dist/{schema-DLMkODQc.mjs → schema-DFeC5axi.mjs} +1 -1
  300. package/dist/{search-CRzWNfxX.mjs → search-C9qOBgvo.mjs} +1 -1
  301. package/dist/{secrets-Cg0D2gQW.mjs → secrets-BP2YTPWn.mjs} +1 -1
  302. package/dist/seed/index.d.mts +2 -2
  303. package/dist/seed/index.mjs +12 -12
  304. package/dist/seo/index.d.mts +3 -3
  305. package/dist/seo/index.mjs +7 -7
  306. package/dist/{seo-B_tBFyud.mjs → seo-Bypxm1iD.mjs} +1 -1
  307. package/dist/{service-DilVsWGD.mjs → service-DOFqfUVv.mjs} +45 -20
  308. package/dist/{service--bQht6oN.mjs → service-mJBl4ZP4.mjs} +2 -2
  309. package/dist/{settings-Deqx3Upy.mjs → settings-2p7TuNWG.mjs} +1 -1
  310. package/dist/{settings-DFzevIrU.mjs → settings-DRFy8JQx.mjs} +2 -2
  311. package/dist/{site-context-vCiDRr4H.mjs → site-context-D9oETfxF.mjs} +11 -11
  312. package/dist/storage/local.d.mts +1 -1
  313. package/dist/storage/local.mjs +1 -1
  314. package/dist/storage/s3.d.mts +1 -1
  315. package/dist/storage/s3.mjs +2 -2
  316. package/dist/{store-C1yDxxfv.mjs → store-CjmmGlVw.mjs} +2 -2
  317. package/dist/submission-BLvkvewK.mjs +411 -0
  318. package/dist/{taxonomies-4cnTcbD6.mjs → taxonomies-C5ayPp3T.mjs} +1 -1
  319. package/dist/{taxonomies-CllxqaH0.mjs → taxonomies-DW6Fps-w.mjs} +2 -2
  320. package/dist/{trusted-proxy-CAW9o4Dw.mjs → trusted-proxy-CvDP0g0F.mjs} +1 -1
  321. package/dist/{types-CFgTpfPk.d.mts → types-BFoQ5a1v.d.mts} +1 -1
  322. package/dist/{types-QjOcidFc.d.mts → types-Tt_IGMno.d.mts} +75 -15
  323. package/dist/ui/server-runtime.d.mts +13 -13
  324. package/dist/ui/server-runtime.mjs +19 -19
  325. package/dist/{validate-A27peRc4.d.mts → validate-CCOsvPg2.d.mts} +3 -3
  326. package/dist/{validate-Wl4MSf3V.mjs → validate-CupwWNWL.mjs} +1 -1
  327. package/dist/version-DpT-k_Ny.mjs +6 -0
  328. package/dist/{widgets-Di-6yDH7.mjs → widgets-DbOctkXv.mjs} +1 -1
  329. package/dist/{worker-RpaMP71d.mjs → worker-wjRq4FI9.mjs} +7 -7
  330. package/dist/{zod-generator-Cylvl_SM.mjs → zod-generator-BzACAoR5.mjs} +1 -1
  331. package/package.json +2 -2
  332. package/dist/review-payload-DEylbssM.mjs +0 -159
  333. package/dist/submission-BsHNfHc7.mjs +0 -155
  334. package/dist/version-BWxyC5s4.mjs +0 -6
  335. /package/dist/{activity-CZnq5YlZ.mjs → activity-BbtYp_4V.mjs} +0 -0
  336. /package/dist/{adapters-BQ8CQbBm.d.mts → adapters-Rol-inz6.d.mts} +0 -0
  337. /package/dist/{api-tokens-D5K_Csub.mjs → api-tokens-DA18zxza.mjs} +0 -0
  338. /package/dist/{byline-fields-Qg8TesxL.mjs → byline-fields-CY6V0ew1.mjs} +0 -0
  339. /package/dist/{bylines-7BQxRGyG.mjs → bylines-gSAfpHl4.mjs} +0 -0
  340. /package/dist/{cache-CSTy-R-K.mjs → cache-DZDOBJv3.mjs} +0 -0
  341. /package/dist/{challenge-store-D-_-VavY.mjs → challenge-store-DFGsDtCj.mjs} +0 -0
  342. /package/dist/{client-factory-BLSkgsTg.mjs → client-factory-6vLLT06O.mjs} +0 -0
  343. /package/dist/{comment-reaction-BLqIj5mx.mjs → comment-reaction-Cun5eIXL.mjs} +0 -0
  344. /package/dist/{components-BWQUCJEr.mjs → components-gMTtJqHg.mjs} +0 -0
  345. /package/dist/{context-types-DqTo6C79.mjs → context-types-DLD_HnKT.mjs} +0 -0
  346. /package/dist/{cron-D7zB6m8i.mjs → cron-BVYo08mi.mjs} +0 -0
  347. /package/dist/{d1-dialect-B1b8cmxX.mjs → d1-dialect-BBxPg6Om.mjs} +0 -0
  348. /package/dist/{default-D9zxuUU7.mjs → default-w3MwLng7.mjs} +0 -0
  349. /package/dist/{email-console-BONByQiC.mjs → email-console-CpvgEN1w.mjs} +0 -0
  350. /package/dist/{error-Dd8LtpG5.mjs → error-B-44r5TD.mjs} +0 -0
  351. /package/dist/{escape-BWC4s5bV.mjs → escape-B1GM0yJU.mjs} +0 -0
  352. /package/dist/{experimental-workflows-M5D3RTFo.mjs → experimental-workflows-fzJHB3ZI.mjs} +0 -0
  353. /package/dist/{forgeway-account-BeKJlKh1.mjs → forgeway-account-CnWOIusE.mjs} +0 -0
  354. /package/dist/{fts-manager-BeWtB7ZD.mjs → fts-manager-DA74x_uP.mjs} +0 -0
  355. /package/dist/{hash-lNx3KJis.mjs → hash-DvMZXj2L.mjs} +0 -0
  356. /package/dist/{load-Dc5ttyg4.mjs → load-B2oitobd.mjs} +0 -0
  357. /package/dist/{media-allowlist-rN4qIF6W.mjs → media-allowlist-CyByjUXh.mjs} +0 -0
  358. /package/dist/{media-url-B4YtTY6c.mjs → media-url-D-elxQjL.mjs} +0 -0
  359. /package/dist/{migrations-CMdxWKx-.mjs → migrations-C7YXse7V.mjs} +0 -0
  360. /package/dist/{mode-CPf_KZ37.mjs → mode-BJwb_MgK.mjs} +0 -0
  361. /package/dist/{oauth-authority-CCqo4eBm.mjs → oauth-authority-DOjME4Hh.mjs} +0 -0
  362. /package/dist/{oauth-state-store-CMgcimzA.mjs → oauth-state-store-D2H9hKcN.mjs} +0 -0
  363. /package/dist/{output-BYpiVUBf.mjs → output-CdmbQioY.mjs} +0 -0
  364. /package/dist/{parser-BV0wzQHo.mjs → parser-ehIlj32k.mjs} +0 -0
  365. /package/dist/{passkey-config-BG4GO4OO.mjs → passkey-config-sUQoLEj_.mjs} +0 -0
  366. /package/dist/{placeholder-BHTaoCYx.d.mts → placeholder-CQKI6vLd.d.mts} +0 -0
  367. /package/dist/{policy-Dej7NJFD.mjs → policy-CrK1vl8l.mjs} +0 -0
  368. /package/dist/{portable-text-FKf3IrPz.d.mts → portable-text-BE7nszX6.d.mts} +0 -0
  369. /package/dist/{portable-text-B9YuySom.mjs → portable-text-DH3Om_2D.mjs} +0 -0
  370. /package/dist/{provider-loader-3MY1SjzA.mjs → provider-loader-Dnv2neOu.mjs} +0 -0
  371. /package/dist/{public-discovery-BAbOvKiR.mjs → public-discovery-CTql6jdZ.mjs} +0 -0
  372. /package/dist/{public-url-D5Wjq0sy.mjs → public-url-4sMO36Gw.mjs} +0 -0
  373. /package/dist/{public-url-C7pbmS_7.mjs → public-url-DNt9A1yS.mjs} +0 -0
  374. /package/dist/{redirect-Bx96u2nS.mjs → redirect-Cjjb5VYr.mjs} +0 -0
  375. /package/dist/{resolve-C80Pm2DW.mjs → resolve-CpOV2jt_.mjs} +0 -0
  376. /package/dist/{revocation-B7GL5fMl.mjs → revocation-DZ8e4JCS.mjs} +0 -0
  377. /package/dist/{runtime-env-CQVAWHzH.mjs → runtime-env-v-1UXPAH.mjs} +0 -0
  378. /package/dist/{sections-BwUjOGqn.mjs → sections-CkoQY7Z9.mjs} +0 -0
  379. /package/dist/{seo-BOTuCeh-.mjs → seo-DYpc_rQ1.mjs} +0 -0
  380. /package/dist/{seo-contributions-Dt57p6Sq.mjs → seo-contributions-atY3jZEV.mjs} +0 -0
  381. /package/dist/{service-wYQ_ePZ4.mjs → service-CeEi6nax.mjs} +0 -0
  382. /package/dist/{session-user-DeqTcAmR.mjs → session-user-DacoiKrJ.mjs} +0 -0
  383. /package/dist/{setup-complete-BFqudwbW.mjs → setup-complete-CWMnrNFN.mjs} +0 -0
  384. /package/dist/{setup-nonce-CAqDUxxU.mjs → setup-nonce-BUmfCiY1.mjs} +0 -0
  385. /package/dist/{sidecar-client-CnpGTvYq.mjs → sidecar-client-CbrX8nuw.mjs} +0 -0
  386. /package/dist/{site-url-wXFqbm9c.mjs → site-url-DoTPKRND.mjs} +0 -0
  387. /package/dist/{ssrf-LN16WMip.mjs → ssrf-COxLChKv.mjs} +0 -0
  388. /package/dist/{state-jyNZ6-7L.mjs → state-D8AogXCV.mjs} +0 -0
  389. /package/dist/{status-Bwkeuz8g.mjs → status-DBSB6tdS.mjs} +0 -0
  390. /package/dist/{tokens-Bjuf1HID.mjs → tokens-I3tSjoFI.mjs} +0 -0
  391. /package/dist/{transport-C0jj-Nc8.d.mts → transport-CZbtxgKZ.d.mts} +0 -0
  392. /package/dist/{transport-472KVGBe.mjs → transport-aPKvM53n.mjs} +0 -0
  393. /package/dist/{types-Bs-7Geuh.d.mts → types-1qU0-N1P.d.mts} +0 -0
  394. /package/dist/{types-BDq9t5lG.mjs → types-BKsk4nnM.mjs} +0 -0
  395. /package/dist/{types-CwkJp6zr.d.mts → types-BWsEjujW.d.mts} +0 -0
  396. /package/dist/{types-DTjrkhKU.d.mts → types-CAD4OvmF.d.mts} +0 -0
  397. /package/dist/{types-7Th6Mwz3.d.mts → types-CVRNRAA5.d.mts} +0 -0
  398. /package/dist/{types-D17dJRht.mjs → types-ChSk0dmw.mjs} +0 -0
  399. /package/dist/{types-b2sq7ZDk.d.mts → types-DNPP-eu4.d.mts} +0 -0
  400. /package/dist/{types-DkXuBo8k.d.mts → types-SddyDti7.d.mts} +0 -0
  401. /package/dist/{url-D375-6LM.mjs → url-Ce0qtSdB.mjs} +0 -0
  402. /package/dist/{url-bv5i4JN0.mjs → url-DfqolpO2.mjs} +0 -0
  403. /package/dist/{utils-Cglcqpm2.mjs → utils-BoWkoty8.mjs} +0 -0
  404. /package/dist/{wordpress-slugs-vOx7R1dM.mjs → wordpress-slugs-pQlLXbKn.mjs} +0 -0
  405. /package/dist/{workers-build-BaQCrSmf.mjs → workers-build-QVrquLLe.mjs} +0 -0
@@ -2,13 +2,13 @@ import "../d1-binding-D6HZa3ks.mjs";
2
2
  import "../dialect-helpers-C6xtO-Ui.mjs";
3
3
  import "../base64-Cz-aU0X1.mjs";
4
4
  import "../types-BqxIv8Il.mjs";
5
- import "../content-refresh-l4mPoGeX.mjs";
6
- import "../fts-manager-BeWtB7ZD.mjs";
7
- import { i as satisfiesPublicDiscoveryRules } from "../public-discovery-BAbOvKiR.mjs";
8
- import "../registry-RD9qTnYL.mjs";
9
- import { n as resolveCanonicalUrl, t as listPublicContent } from "../discovery-CqXbN0WZ.mjs";
10
- import { t as resolveContentUrl } from "../public-url-C7pbmS_7.mjs";
11
- import { t as buildSeoImageUrl } from "../media-url-B4YtTY6c.mjs";
5
+ import "../content-refresh-9M9cc55-.mjs";
6
+ import "../fts-manager-DA74x_uP.mjs";
7
+ import { i as satisfiesPublicDiscoveryRules } from "../public-discovery-CTql6jdZ.mjs";
8
+ import "../registry-DcV93OL_.mjs";
9
+ import { n as resolveCanonicalUrl, t as listPublicContent } from "../discovery-CYcZJ1o3.mjs";
10
+ import { t as resolveContentUrl } from "../public-url-DNt9A1yS.mjs";
11
+ import { t as buildSeoImageUrl } from "../media-url-D-elxQjL.mjs";
12
12
 
13
13
  //#region src/seo/index.ts
14
14
  /**
@@ -1,4 +1,4 @@
1
- import { t as listPublicContent } from "./discovery-CqXbN0WZ.mjs";
1
+ import { t as listPublicContent } from "./discovery-CYcZJ1o3.mjs";
2
2
 
3
3
  //#region src/api/handlers/seo.ts
4
4
  /** Internal XML batch, not an unbounded public JSON list endpoint. */
@@ -1,6 +1,8 @@
1
1
  import { t as validateIdentifier } from "./validate-Co3j6T_K.mjs";
2
- import { t as CommentRepository } from "./comment-Bi7cJ9SS.mjs";
3
- import { t as escapeHtml } from "./escape-BWC4s5bV.mjs";
2
+ import { s as invalidateCommentObjectCache } from "./object-cache-BGjIlY9s.mjs";
3
+ import { t as CommentRepository } from "./comment-kgLTdtQD.mjs";
4
+ import { t as escapeHtml } from "./escape-B1GM0yJU.mjs";
5
+ import { sql } from "kysely";
4
6
 
5
7
  //#region src/comments/notifications.ts
6
8
  const NOTIFICATION_SOURCE = "dineway-comments";
@@ -90,11 +92,23 @@ async function lookupContentAuthor(db, collection, contentId) {
90
92
  //#endregion
91
93
  //#region src/comments/service.ts
92
94
  /**
95
+ * Comment Service
96
+ *
97
+ * Orchestrates comment creation through the hook pipeline:
98
+ * 1. Run comment:beforeCreate pipeline (transform/reject)
99
+ * 2. Query priorApprovedCount for first-time moderation
100
+ * 3. Invoke comment:moderate exclusive hook (or built-in fallback)
101
+ * 4. Save comment with determined status
102
+ * 5. Fire comment:afterCreate (fire-and-forget)
103
+ *
104
+ * Also handles admin moderation (status changes) with afterModerate hooks.
105
+ */
106
+ /**
93
107
  * Create a comment through the full hook pipeline.
94
108
  *
95
109
  * Returns null if the comment was rejected by a beforeCreate handler.
96
110
  */
97
- async function createComment(db, input, collectionSettings, hooks, contentInfo) {
111
+ async function prepareComment(db, input, collectionSettings, hooks, contentInfo) {
98
112
  const repo = new CommentRepository(db);
99
113
  const beforeCreateEvent = {
100
114
  comment: {
@@ -121,7 +135,7 @@ async function createComment(db, input, collectionSettings, hooks, contentInfo)
121
135
  priorApprovedCount
122
136
  };
123
137
  const decision = await hooks.runModerate(moderateEvent);
124
- const comment = await repo.create({
138
+ const prepared = repo.prepareCreate({
125
139
  collection: event.comment.collection,
126
140
  contentId: event.comment.contentId,
127
141
  parentId: event.comment.parentId,
@@ -134,23 +148,34 @@ async function createComment(db, input, collectionSettings, hooks, contentInfo)
134
148
  userAgent: event.comment.userAgent,
135
149
  moderationMetadata: Object.keys(event.metadata).length > 0 ? event.metadata : null
136
150
  });
137
- if (contentInfo) {
138
- const afterEvent = {
139
- comment: commentToStored(comment),
140
- metadata: event.metadata,
141
- content: {
142
- id: contentInfo.id,
143
- collection: contentInfo.collection,
144
- slug: contentInfo.slug,
145
- title: contentInfo.title
146
- },
147
- contentAuthor: contentInfo.author
148
- };
149
- hooks.fireAfterCreate(afterEvent);
150
- }
151
+ const comment = prepared.comment;
152
+ let completed;
153
+ const afterCommit = () => completed ??= (async () => {
154
+ if (!await repo.findById(comment.id)) throw new Error("The comment has not been committed.");
155
+ invalidateCommentObjectCache();
156
+ if (contentInfo) {
157
+ const afterEvent = {
158
+ comment: commentToStored(comment),
159
+ metadata: event.metadata,
160
+ content: {
161
+ id: contentInfo.id,
162
+ collection: contentInfo.collection,
163
+ slug: contentInfo.slug,
164
+ title: contentInfo.title
165
+ },
166
+ contentAuthor: contentInfo.author
167
+ };
168
+ await hooks.fireAfterCreate(afterEvent);
169
+ }
170
+ })();
151
171
  return {
152
172
  comment,
153
- decision
173
+ decision,
174
+ afterCommit,
175
+ batch: {
176
+ checks: [sql`(SELECT COUNT(*) FROM _dineway_comments WHERE author_email = ${event.comment.authorEmail} AND status = 'approved') = ${priorApprovedCount}`],
177
+ statements: [prepared.statement]
178
+ }
154
179
  };
155
180
  }
156
181
  /**
@@ -191,4 +216,4 @@ function commentToStored(comment) {
191
216
  }
192
217
 
193
218
  //#endregion
194
- export { sendCommentNotification as i, moderateComment as n, lookupContentAuthor as r, createComment as t };
219
+ export { sendCommentNotification as i, prepareComment as n, lookupContentAuthor as r, moderateComment as t };
@@ -1,5 +1,5 @@
1
- import { n as DinewayToolsService, r as integrationResponse } from "./service-wYQ_ePZ4.mjs";
2
- import { r as getSiteIntegrationCatalog, t as SiteIntegrationRuns } from "./runs-B5BExdKO.mjs";
1
+ import { n as DinewayToolsService, r as integrationResponse } from "./service-CeEi6nax.mjs";
2
+ import { r as getSiteIntegrationCatalog, t as SiteIntegrationRuns } from "./runs-B8kCirJ6.mjs";
3
3
 
4
4
  //#region src/integrations/service.ts
5
5
  function createSiteIntegrationService(options, actorId) {
@@ -1,5 +1,5 @@
1
1
  import { c as __exportAll } from "./runner-CVeq0266.mjs";
2
- import { a as getSiteSettingsWithDb, s as setSiteSettings } from "./settings-DFzevIrU.mjs";
2
+ import { a as getSiteSettingsWithDb, s as setSiteSettings } from "./settings-DRFy8JQx.mjs";
3
3
 
4
4
  //#region src/api/handlers/settings.ts
5
5
  var settings_exports = /* @__PURE__ */ __exportAll({
@@ -2,11 +2,11 @@ import { getRequestContext } from "./request-context.mjs";
2
2
  import { r as getDb } from "./loader-Cgsx23wU.mjs";
3
3
  import { t as after } from "./after-BVaUn7bK.mjs";
4
4
  import { l as invalidateObjectCache, n as cachedQuery, t as CacheNamespace } from "./object-cache-BGjIlY9s.mjs";
5
- import { t as MediaRepository } from "./media-3fK0u-bo.mjs";
5
+ import { t as MediaRepository } from "./media-BZqwtRTZ.mjs";
6
6
  import { t as OptionsRepository } from "./options-BcqHWpc-.mjs";
7
7
  import { n as peekRequestCache, r as requestCached } from "./request-cache-DPmV5nk4.mjs";
8
8
  import { n as invalidateProcessCache, r as processCachedAsync, t as createProcessCache } from "./process-cache-MHM4Sqzs.mjs";
9
- import { i as resolvePublicMediaUrl } from "./url-D375-6LM.mjs";
9
+ import { i as resolvePublicMediaUrl } from "./url-Ce0qtSdB.mjs";
10
10
 
11
11
  //#region src/settings/index.ts
12
12
  /** Prefix for site settings in the options table */
@@ -1,20 +1,20 @@
1
1
  import { atomicBatch, rowUnchanged } from "./database/batch.mjs";
2
2
  import { t as validateIdentifier } from "./validate-Co3j6T_K.mjs";
3
3
  import { i as encodeCursor, r as decodeCursor } from "./types-BqxIv8Il.mjs";
4
- import { t as ContentRepository } from "./content-NobcQti0.mjs";
4
+ import { t as ContentRepository } from "./content-D9xKUSno.mjs";
5
5
  import { t as SiteActivityRepository } from "./site-activity-BrN2NviL.mjs";
6
6
  import { r as ReviewRequestRepository } from "./review-requests-BF2eEKr8.mjs";
7
- import { o as HitlRequestRepository } from "./publication-authorization-BrEZ2TsE.mjs";
7
+ import { o as HitlRequestRepository } from "./publication-authorization-Dq_20SZR.mjs";
8
8
  import { r as isPattern } from "./patterns-CZ7D4y_R.mjs";
9
- import { n as buildStableActionHash, t as ReviewPayloadBuilder } from "./review-payload-DEylbssM.mjs";
10
- import { d as ContextRepository, i as parseSiteBriefingScope, l as handlePluginList } from "./briefing-CkCi6S-W.mjs";
11
- import { t as FTSManager } from "./fts-manager-BeWtB7ZD.mjs";
12
- import { n as SchemaRegistry } from "./registry-RD9qTnYL.mjs";
13
- import { a as getSiteSettingsWithDb } from "./settings-DFzevIrU.mjs";
14
- import { n as assertExperimentalSiteContextWorkflowsEnabled } from "./experimental-workflows-M5D3RTFo.mjs";
15
- import { m as normalizeUrl } from "./utils-Cglcqpm2.mjs";
16
- import { t as sanitizeWordPressImportSlug } from "./wordpress-slugs-vOx7R1dM.mjs";
17
- import { s as searchCollection } from "./search-CRzWNfxX.mjs";
9
+ import { n as buildStableActionHash, t as ReviewPayloadBuilder } from "./review-payload-LLIi1sxO.mjs";
10
+ import { d as ContextRepository, i as parseSiteBriefingScope, l as handlePluginList } from "./briefing-5zf0YZbR.mjs";
11
+ import { t as FTSManager } from "./fts-manager-DA74x_uP.mjs";
12
+ import { n as SchemaRegistry } from "./registry-DcV93OL_.mjs";
13
+ import { a as getSiteSettingsWithDb } from "./settings-DRFy8JQx.mjs";
14
+ import { n as assertExperimentalSiteContextWorkflowsEnabled } from "./experimental-workflows-fzJHB3ZI.mjs";
15
+ import { m as normalizeUrl } from "./utils-BoWkoty8.mjs";
16
+ import { t as sanitizeWordPressImportSlug } from "./wordpress-slugs-pQlLXbKn.mjs";
17
+ import { s as searchCollection } from "./search-C9qOBgvo.mjs";
18
18
  import { sql } from "kysely";
19
19
  import { ulid } from "ulidx";
20
20
  import { Role } from "@dineway-ai/auth";
@@ -1,4 +1,4 @@
1
- import { a as ListOptions, d as Storage, l as SignedUploadOptions, o as ListResult, p as UploadResult, r as DownloadResult, s as LocalStorageConfig, u as SignedUploadUrl } from "../types-CwkJp6zr.mjs";
1
+ import { a as ListOptions, d as Storage, l as SignedUploadOptions, o as ListResult, p as UploadResult, r as DownloadResult, s as LocalStorageConfig, u as SignedUploadUrl } from "../types-BWsEjujW.mjs";
2
2
 
3
3
  //#region src/storage/local.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as DinewayStorageError } from "../types-BDq9t5lG.mjs";
1
+ import { t as DinewayStorageError } from "../types-BKsk4nnM.mjs";
2
2
  import { createReadStream, existsSync } from "node:fs";
3
3
  import * as path from "node:path";
4
4
  import mime from "mime/lite";
@@ -1,4 +1,4 @@
1
- import { a as ListOptions, c as S3StorageConfig, d as Storage, l as SignedUploadOptions, o as ListResult, p as UploadResult, r as DownloadResult, u as SignedUploadUrl } from "../types-CwkJp6zr.mjs";
1
+ import { a as ListOptions, c as S3StorageConfig, d as Storage, l as SignedUploadOptions, o as ListResult, p as UploadResult, r as DownloadResult, u as SignedUploadUrl } from "../types-BWsEjujW.mjs";
2
2
 
3
3
  //#region src/storage/s3.d.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { t as readRuntimeEnv } from "../runtime-env-CQVAWHzH.mjs";
2
- import { t as DinewayStorageError } from "../types-BDq9t5lG.mjs";
1
+ import { t as readRuntimeEnv } from "../runtime-env-v-1UXPAH.mjs";
2
+ import { t as DinewayStorageError } from "../types-BKsk4nnM.mjs";
3
3
  import { DeleteObjectCommand, GetObjectCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
4
4
  import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { atomicBatch, rowUnchanged } from "./database/batch.mjs";
2
2
  import { i as encodeBase64url, n as decodeBase64url } from "./base64-Cz-aU0X1.mjs";
3
- import { t as readRuntimeEnv } from "./runtime-env-CQVAWHzH.mjs";
4
- import { i as parseEncryptionKeys, t as DinewaySecretsError } from "./secrets-Cg0D2gQW.mjs";
3
+ import { t as readRuntimeEnv } from "./runtime-env-v-1UXPAH.mjs";
4
+ import { i as parseEncryptionKeys, t as DinewaySecretsError } from "./secrets-BP2YTPWn.mjs";
5
5
 
6
6
  //#region src/database/repositories/integration-credentials.ts
7
7
  var IntegrationCredentialRepository = class {
@@ -0,0 +1,411 @@
1
+ import { AtomicWriteConflict, atomicBatch, prepareAtomicChecks, rowUnchanged } from "./database/batch.mjs";
2
+ import { r as isI18nEnabled } from "./config-XW5tMrH8.mjs";
3
+ import { t as DinewayValidationError } from "./types-BqxIv8Il.mjs";
4
+ import { t as contentWriteChecks } from "./atomic-authority-CnBQJ14T.mjs";
5
+ import { o as invalidateCollectionCache } from "./object-cache-BGjIlY9s.mjs";
6
+ import { t as RevisionRepository } from "./revision-090sZyGc.mjs";
7
+ import { t as ContentRepository } from "./content-D9xKUSno.mjs";
8
+ import { t as buildStableHash } from "./stable-hash-DEtJgcp7.mjs";
9
+ import { i as isSupersededReview, r as ReviewRequestRepository, t as REVIEW_SUPERSESSION_ACTOR } from "./review-requests-BF2eEKr8.mjs";
10
+ import { t as RedirectRepository } from "./redirect-HLI3wT5Y.mjs";
11
+ import { i as invalidateRedirectCache } from "./cache-DZDOBJv3.mjs";
12
+ import { D as validateMediaFields, E as validateContentDataFields, T as prepareNonTranslatableFields, k as encodeRev, r as contentWriteConfiguration, t as ReviewPayloadBuilder } from "./review-payload-LLIi1sxO.mjs";
13
+ import { i as reviewDraft } from "./evidence-krrA3uiG.mjs";
14
+ import { sql } from "kysely";
15
+ import { z } from "zod";
16
+
17
+ //#region src/api/handlers/content-write.ts
18
+ const fieldData = (data) => Object.fromEntries(Object.entries(data).filter(([key]) => !key.startsWith("_")));
19
+ const reviews = /* @__PURE__ */ new WeakMap();
20
+ function preparedContentReview(write) {
21
+ const stored = reviews.get(write);
22
+ if (!stored) throw new DinewayValidationError("Review requires an unmodified prepared content write.");
23
+ return structuredClone(stored);
24
+ }
25
+ /** Prepare a draft or direct backing-row edit without committing site-owned writes separately. */
26
+ async function prepareContentWrite(db, collection, input) {
27
+ const configuration = await contentWriteConfiguration(db, collection);
28
+ const supports = JSON.parse(configuration.row?.supports ?? "[]");
29
+ const usesRevisions = Array.isArray(supports) && supports.includes("revisions");
30
+ if (input.status !== void 0 && input.status !== "draft") throw new DinewayValidationError("Prepared status changes must use publish or unpublish.");
31
+ if (input.publish && input.unpublish) throw new DinewayValidationError("Publish and unpublish cannot be combined.");
32
+ const validateData = async (data) => {
33
+ const fields = await validateContentDataFields(db, collection, fieldData(data));
34
+ if (fields && !fields.success) throw new DinewayValidationError(fields.error.message);
35
+ const media = await validateMediaFields(db, collection, fieldData(data));
36
+ if (!media.success) throw new DinewayValidationError(media.error.message);
37
+ };
38
+ if (input.data) await validateData(input.data);
39
+ const repo = new ContentRepository(db);
40
+ const checks = [...configuration.checks];
41
+ const statements = [];
42
+ let item;
43
+ let previousSlug = null;
44
+ let wasPublished = false;
45
+ let live = null;
46
+ let draft = null;
47
+ let now = (/* @__PURE__ */ new Date()).toISOString();
48
+ if (input.id) {
49
+ const snapshot = await repo.snapshot(collection, input.id);
50
+ if (!snapshot) throw new DinewayValidationError("Content item not found.");
51
+ if (input.expectedRev !== void 0 && encodeRev(snapshot.item) !== input.expectedRev) throw new AtomicWriteConflict();
52
+ previousSlug = snapshot.item.slug;
53
+ wasPublished = snapshot.item.status === "published";
54
+ item = {
55
+ ...snapshot.item,
56
+ updatedAt: now,
57
+ version: snapshot.item.version + 1
58
+ };
59
+ checks.push(snapshot.check, ...contentWriteChecks(collection, item.id, "edit"));
60
+ for (const [kind, id] of [["live", item.liveRevisionId], ["draft", item.draftRevisionId]]) {
61
+ if (!id) continue;
62
+ const revision = await db.selectFrom("revisions").selectAll().where("id", "=", id).executeTakeFirst();
63
+ if (!revision || revision.collection !== collection || revision.entry_id !== item.id) throw new DinewayValidationError("Content revision is missing or belongs to another entry.");
64
+ checks.push(rowUnchanged("revisions", revision));
65
+ if (kind === "live") live = JSON.parse(revision.data);
66
+ else draft = JSON.parse(revision.data);
67
+ }
68
+ const stage = input.stageDraft !== false && usesRevisions;
69
+ const changedDraft = stage && (Object.keys(input.data ?? {}).length > 0 || input.slug !== void 0);
70
+ if (changedDraft) draft = {
71
+ ...draft ?? item.data,
72
+ ...input.data,
73
+ ...input.slug === void 0 ? {} : { _slug: input.slug }
74
+ };
75
+ if (input.draftData) {
76
+ const previous = draft ?? live ?? item.data;
77
+ await validateData(Object.fromEntries(Object.entries(input.draftData).filter(([key, value]) => JSON.stringify(previous[key]) !== JSON.stringify(value))));
78
+ draft = structuredClone(input.draftData);
79
+ }
80
+ if (!stage) {
81
+ item.data = {
82
+ ...item.data,
83
+ ...await repo.normalizePreparedData(collection, fieldData(input.data ?? {}))
84
+ };
85
+ for (const [key, value] of Object.entries(item.data)) if (typeof value === "boolean") item.data[key] = Number(value);
86
+ for (const [key, value] of Object.entries(item.data)) if (value === null || value === void 0) delete item.data[key];
87
+ if (input.slug !== void 0) item.slug = input.slug;
88
+ }
89
+ if (!stage && input.slug && previousSlug && input.slug !== previousSlug) statements.push(...new RedirectRepository(db).prepareAutoRedirect(collection, previousSlug, input.slug, item.id, configuration.row?.url_pattern ?? null).statements);
90
+ if (!stage && isI18nEnabled() && input.data && item.translationGroup) {
91
+ const sync = prepareNonTranslatableFields(db, collection, item.id, item.translationGroup, fieldData(input.data), configuration.fields.filter((field) => field.translatable === 0).map((field) => field.slug));
92
+ if (sync) statements.push(sync);
93
+ }
94
+ if (input.status !== void 0) item.status = input.status;
95
+ if (input.authorId !== void 0) item.authorId = input.authorId;
96
+ statements.push(repo.prepareUpdate(collection, item.id, {
97
+ data: stage ? void 0 : input.data && fieldData(input.data),
98
+ slug: stage ? void 0 : input.slug,
99
+ status: input.status,
100
+ authorId: input.authorId
101
+ }, now));
102
+ if (changedDraft || input.draftData || input.unpublish && !draft && live) {
103
+ draft ??= live;
104
+ if (draft) {
105
+ const revision = new RevisionRepository(db).prepareCreateSnapshot({
106
+ collection,
107
+ entryId: item.id,
108
+ data: sql`${JSON.stringify(draft)}`,
109
+ authorId: input.authorId
110
+ });
111
+ item.draftRevisionId = revision.id;
112
+ statements.push(revision.statement, sql`UPDATE ${sql.table(`ec_${collection}`)} SET draft_revision_id=${revision.id} WHERE id=${item.id}`.compile(db));
113
+ }
114
+ }
115
+ } else {
116
+ if (input.expectedRev !== void 0 || input.unpublish) throw new DinewayValidationError("A new draft cannot reference an existing revision.");
117
+ const data = fieldData(input.data ?? {});
118
+ if (input.draftData) await validateData(input.draftData);
119
+ const slugSource = [data.title, data.name].find((value) => typeof value === "string" && value.length > 0);
120
+ const slug = input.slug ?? (slugSource ? await repo.generateUniqueSlug(collection, slugSource, input.locale) : void 0);
121
+ if (slug) checks.push(sql`NOT EXISTS(SELECT 1 FROM ${sql.table(`ec_${collection}`)} WHERE slug=${slug} ${input.locale ? sql`AND locale=${input.locale}` : sql``})`);
122
+ const created = await repo.prepareCreate({
123
+ type: collection,
124
+ data,
125
+ slug,
126
+ status: "draft",
127
+ authorId: input.authorId,
128
+ locale: input.locale
129
+ }, { captureDefaults: true });
130
+ item = created.item;
131
+ now = item.updatedAt;
132
+ checks.push(...created.batch.checks ?? []);
133
+ statements.push(...created.batch.statements);
134
+ if (usesRevisions || input.draftData) {
135
+ draft = structuredClone(input.draftData ?? {
136
+ ...item.data,
137
+ ...Object.fromEntries(Object.entries(input.data ?? {}).filter(([key]) => key.startsWith("_")))
138
+ });
139
+ const revision = new RevisionRepository(db).prepareCreateSnapshot({
140
+ collection,
141
+ entryId: item.id,
142
+ data: sql`${JSON.stringify(draft)}`,
143
+ authorId: input.authorId
144
+ });
145
+ item.draftRevisionId = revision.id;
146
+ statements.push(revision.statement, sql`UPDATE ${sql.table(`ec_${collection}`)} SET draft_revision_id=${revision.id} WHERE id=${item.id}`.compile(db));
147
+ }
148
+ }
149
+ if (input.publish) {
150
+ const authority = contentWriteChecks(collection, item.id, "publish");
151
+ if (input.id) checks.push(...authority);
152
+ else statements.push(...prepareAtomicChecks(db, authority));
153
+ const data = draft ?? live ?? item.data;
154
+ let revisionId = item.draftRevisionId ?? item.liveRevisionId;
155
+ if (!revisionId) {
156
+ const revision = new RevisionRepository(db).prepareCreateSnapshot({
157
+ collection,
158
+ entryId: item.id,
159
+ data: sql`${JSON.stringify(data)}`,
160
+ authorId: input.authorId
161
+ });
162
+ revisionId = revision.id;
163
+ statements.push(revision.statement);
164
+ }
165
+ const sync = repo.prepareSyncDataColumns(collection, item.id, data);
166
+ if (sync) statements.push(sync);
167
+ const slug = typeof data._slug === "string" ? data._slug : item.slug;
168
+ if (wasPublished && previousSlug && slug && previousSlug !== slug) statements.push(...new RedirectRepository(db).prepareAutoRedirect(collection, previousSlug, slug, item.id, configuration.row?.url_pattern ?? null).statements);
169
+ item = {
170
+ ...item,
171
+ slug,
172
+ status: "published",
173
+ liveRevisionId: revisionId,
174
+ draftRevisionId: null,
175
+ scheduledAt: null,
176
+ publishedAt: item.publishedAt ?? now,
177
+ updatedAt: now,
178
+ data: {
179
+ ...item.data,
180
+ ...await repo.normalizePreparedData(collection, fieldData(data))
181
+ }
182
+ };
183
+ for (const [key, value] of Object.entries(item.data)) {
184
+ if (typeof value === "boolean") item.data[key] = Number(value);
185
+ if (value === null || value === void 0) delete item.data[key];
186
+ }
187
+ statements.push(sql`UPDATE ${sql.table(`ec_${collection}`)} SET slug=${slug},status='published',live_revision_id=${revisionId},draft_revision_id=NULL,scheduled_at=NULL,published_at=${item.publishedAt},updated_at=${now} WHERE id=${item.id}`.compile(db));
188
+ live = data;
189
+ draft = null;
190
+ }
191
+ if (input.unpublish) {
192
+ checks.push(...contentWriteChecks(collection, item.id, "publish"));
193
+ item.liveRevisionId = null;
194
+ item.status = "draft";
195
+ live = null;
196
+ statements.push(sql`UPDATE ${sql.table(`ec_${collection}`)} SET live_revision_id=NULL,status='draft' WHERE id=${item.id}`.compile(db));
197
+ }
198
+ const prepared = {
199
+ id: item.id,
200
+ item,
201
+ rev: encodeRev(item),
202
+ draftData: draft,
203
+ batch: {
204
+ checks,
205
+ statements
206
+ },
207
+ afterCommit: () => {
208
+ invalidateCollectionCache(collection);
209
+ if (previousSlug !== item.slug) invalidateRedirectCache();
210
+ }
211
+ };
212
+ reviews.set(prepared, structuredClone({
213
+ item,
214
+ live,
215
+ draft
216
+ }));
217
+ return prepared;
218
+ }
219
+
220
+ //#endregion
221
+ //#region src/review-automation/submission.ts
222
+ var ReviewSubmissionError = class extends Error {
223
+ constructor(message, code = "REVIEW_SUBMISSION_INVALID") {
224
+ super(message);
225
+ this.code = code;
226
+ }
227
+ };
228
+ async function prepareAutomatedReview(db, handlers, input, options = {}) {
229
+ const projected = options.draft ? preparedContentReview(options.draft) : null;
230
+ if (projected && (projected.item.id !== input.id || projected.item.type !== input.collection)) throw new ReviewSubmissionError("Prepared draft does not match the review target.");
231
+ const contentRepo = new ContentRepository(db);
232
+ const entry = projected ? projected.item : await contentRepo.findByIdOrSlug(input.collection, input.id);
233
+ const snapshot = projected ? {
234
+ item: projected.item,
235
+ check: sql`true`
236
+ } : entry ? await contentRepo.snapshot(input.collection, entry.id) : null;
237
+ if (!snapshot) throw new ReviewSubmissionError("The submitted content could not be read.");
238
+ const revisionIds = projected ? [] : [snapshot.item.liveRevisionId, snapshot.item.draftRevisionId].filter((id) => id !== null);
239
+ const revisions = revisionIds.length ? await db.selectFrom("revisions").selectAll().where("id", "in", revisionIds).execute() : [];
240
+ const built = await new ReviewPayloadBuilder(projected ? {
241
+ handleContentGet: async () => ({
242
+ success: true,
243
+ data: {
244
+ item: projected.item,
245
+ _rev: encodeRev(projected.item)
246
+ }
247
+ }),
248
+ handleContentCompare: async () => ({
249
+ success: true,
250
+ data: {
251
+ live: projected.live,
252
+ draft: projected.draft,
253
+ hasChanges: projected.item.draftRevisionId !== null && projected.item.draftRevisionId !== projected.item.liveRevisionId
254
+ }
255
+ })
256
+ } : handlers).buildContentReviewPayload(input);
257
+ if (input.expectedRev !== void 0 && input.expectedRev !== built.reviewedRev) throw new ReviewSubmissionError("Reload the latest draft before submitting it.", "REVIEW_REVISION_CHANGED");
258
+ const contentHash = await buildStableHash(reviewDraft(built));
259
+ const targetKey = await buildStableHash({
260
+ collection: built.collection,
261
+ id: built.entryId,
262
+ actionHash: built.actionHash
263
+ });
264
+ if (built.reviewedRev !== encodeRev(snapshot.item) || built.draftRevisionId !== snapshot.item.draftRevisionId || built.liveRevisionId !== snapshot.item.liveRevisionId) throw new ReviewSubmissionError("The submitted content changed. Review the latest draft.");
265
+ const scheduledAt = snapshot.item.scheduledAt;
266
+ const checks = [...options.draft?.batch.checks ?? [snapshot.check], ...revisions.map((revision) => rowUnchanged("revisions", revision))];
267
+ const projectedGuard = [];
268
+ if (projected) {
269
+ const future = sql`${rowUnchanged(`ec_${input.collection}`, {
270
+ id: projected.item.id,
271
+ version: projected.item.version,
272
+ updated_at: projected.item.updatedAt,
273
+ live_revision_id: projected.item.liveRevisionId,
274
+ draft_revision_id: projected.item.draftRevisionId,
275
+ status: projected.item.status,
276
+ scheduled_at: projected.item.scheduledAt
277
+ })} AND ${projected.item.draftRevisionId && projected.draft ? sql`EXISTS(SELECT 1 FROM revisions WHERE id=${projected.item.draftRevisionId} AND collection=${input.collection} AND entry_id=${input.id} AND json(data)=json(${JSON.stringify(projected.draft)}))` : sql`true`}`;
278
+ projectedGuard.push(...prepareAtomicChecks(db, [future]));
279
+ }
280
+ const reviews = new ReviewRequestRepository(db);
281
+ const prepareSupersession = async () => {
282
+ const statements = [];
283
+ if (!input.supersedePending) return {
284
+ checks: [],
285
+ statements
286
+ };
287
+ const query = db.selectFrom("_dineway_review_requests").where("collection", "=", built.collection).where("entry_id", "=", built.entryId).where("action_type", "=", built.actionType).where("requested_by_actor_type", "=", input.actor.actorType).where("requested_by_actor_id", "=", input.actor.actorId).where("status", "=", "pending").where("revoked_at", "is", null).where((eb) => eb.or([eb("reviewed_rev", "!=", built.reviewedRev), eb("action_hash", "!=", built.actionHash)]));
288
+ const previous = await query.select("id").execute();
289
+ const supersessionChecks = [sql`${query.select((eb) => eb.fn.countAll().as("count"))} = ${previous.length}`];
290
+ for (const prior of previous) {
291
+ const batch = await reviews.prepareResolve(prior.id, {
292
+ decision: "rejected",
293
+ resolvedByActorType: "system",
294
+ resolvedByActorId: REVIEW_SUPERSESSION_ACTOR,
295
+ reviewNote: "Superseded by a newer submission. This is not an editorial rejection."
296
+ });
297
+ if (!batch) throw new AtomicWriteConflict();
298
+ supersessionChecks.push(...batch.checks ?? []);
299
+ statements.push(...batch.statements);
300
+ }
301
+ return {
302
+ checks: supersessionChecks,
303
+ statements
304
+ };
305
+ };
306
+ const reuseReview = async (item) => {
307
+ const batch = await prepareSupersession();
308
+ return {
309
+ id: item.id,
310
+ targetKey,
311
+ created: false,
312
+ batch: {
313
+ checks: [
314
+ ...checks,
315
+ rowUnchanged("_dineway_review_requests", {
316
+ id: item.id,
317
+ status: item.status,
318
+ revoked_at: item.revokedAt ?? null
319
+ }),
320
+ ...batch.checks
321
+ ],
322
+ statements: [...projectedGuard, ...batch.statements]
323
+ }
324
+ };
325
+ };
326
+ const findExisting = async () => {
327
+ const existing = await db.selectFrom("_dineway_review_jobs").select("review_id").where("target_key", "=", targetKey).executeTakeFirst();
328
+ if (existing) {
329
+ const item = await reviews.findById(existing.review_id);
330
+ if (!item || item.status === "rejected" || item.revokedAt) throw new ReviewSubmissionError("Edit the content before submitting a rejected or revoked target again.");
331
+ return item;
332
+ }
333
+ return null;
334
+ };
335
+ const existingReview = await findExisting();
336
+ if (existingReview) return reuseReview(existingReview);
337
+ const rejected = await db.selectFrom("_dineway_review_requests").select([
338
+ "id",
339
+ "status",
340
+ "review_payload",
341
+ "resolved_by_actor_type",
342
+ "resolved_by_actor_id"
343
+ ]).where("collection", "=", built.collection).where("entry_id", "=", built.entryId).where("status", "=", "rejected").execute();
344
+ checks.push(sql`NOT EXISTS (SELECT 1 FROM _dineway_review_jobs WHERE target_key = ${targetKey})`, sql`(SELECT COUNT(*) FROM _dineway_review_requests WHERE collection = ${built.collection} AND entry_id = ${built.entryId} AND status = 'rejected') = ${rejected.length}`, ...rejected.map((row) => rowUnchanged("_dineway_review_requests", row)));
345
+ for (const row of rejected) {
346
+ if (isSupersededReview(row)) continue;
347
+ if (await buildStableHash(z.object({ diff: z.object({ draft: z.unknown().optional() }).optional() }).parse(JSON.parse(row.review_payload)).diff?.draft) === contentHash) throw new ReviewSubmissionError("This content was rejected. Change it before submitting a new review.");
348
+ }
349
+ const approved = await reviews.findApprovedForTarget(built);
350
+ if (approved) return reuseReview(approved);
351
+ const pendingQuery = db.selectFrom("_dineway_review_requests").where("collection", "=", built.collection).where("entry_id", "=", built.entryId).where("action_type", "=", built.actionType).where("reviewed_rev", "=", built.reviewedRev).where("action_hash", "=", built.actionHash).where("status", "=", "pending").where("revoked_at", "is", null);
352
+ const pending = await pendingQuery.selectAll().orderBy("created_at").orderBy("id").executeTakeFirst();
353
+ checks.push(pending ? rowUnchanged("_dineway_review_requests", pending) : sql`NOT EXISTS ${pendingQuery.select("id")}`);
354
+ const prepared = pending ? null : reviews.prepareCreate({
355
+ ...built,
356
+ riskReason: input.riskReason,
357
+ requestedByActorType: input.actor.actorType,
358
+ requestedByActorId: input.actor.actorId,
359
+ requestedAuthMetadata: input.actor.authMetadata
360
+ });
361
+ const reviewId = pending?.id ?? prepared.id;
362
+ const supersession = await prepareSupersession();
363
+ checks.push(...supersession.checks);
364
+ const now = (/* @__PURE__ */ new Date()).toISOString();
365
+ const job = db.insertInto("_dineway_review_jobs").values({
366
+ review_id: reviewId,
367
+ target_key: targetKey,
368
+ content_hash: contentHash,
369
+ state: "queued",
370
+ release_state: "none",
371
+ evidence_json: null,
372
+ reason: "Automated review in progress",
373
+ release_reason: null,
374
+ scheduled_at: scheduledAt,
375
+ created_at: now,
376
+ updated_at: now
377
+ }).compile();
378
+ return {
379
+ id: reviewId,
380
+ targetKey,
381
+ created: !pending,
382
+ batch: {
383
+ checks,
384
+ statements: [
385
+ ...projectedGuard,
386
+ ...supersession.statements,
387
+ ...prepared ? [prepared.statement] : [],
388
+ job
389
+ ]
390
+ }
391
+ };
392
+ }
393
+ async function submitAutomatedReview(db, handlers, input) {
394
+ let prepared = await prepareAutomatedReview(db, handlers, input);
395
+ try {
396
+ await atomicBatch(db, prepared.batch);
397
+ } catch (error) {
398
+ if (!(error instanceof AtomicWriteConflict)) throw error;
399
+ const existing = await prepareAutomatedReview(db, handlers, input);
400
+ if (existing.created || existing.targetKey !== prepared.targetKey) throw error;
401
+ await atomicBatch(db, existing.batch);
402
+ prepared = existing;
403
+ }
404
+ return {
405
+ item: await new ReviewRequestRepository(db).findById(prepared.id),
406
+ created: prepared.created
407
+ };
408
+ }
409
+
410
+ //#endregion
411
+ export { prepareContentWrite as i, prepareAutomatedReview as n, submitAutomatedReview as r, ReviewSubmissionError as t };
@@ -1,6 +1,6 @@
1
1
  import { c as __exportAll } from "./runner-CVeq0266.mjs";
2
2
  import { t as TaxonomyRepository } from "./taxonomy-DWxxLpp5.mjs";
3
- import { c as invalidateTaxonomyDefsCache, l as invalidateTermCache } from "./taxonomies-CllxqaH0.mjs";
3
+ import { c as invalidateTaxonomyDefsCache, l as invalidateTermCache } from "./taxonomies-DW6Fps-w.mjs";
4
4
  import { ulid } from "ulidx";
5
5
 
6
6
  //#region src/api/handlers/taxonomies.ts