dineway 0.2.33 → 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 (458) hide show
  1. package/dist/{activity-CfryM8jO.mjs → activity-BbtYp_4V.mjs} +2 -2
  2. package/dist/{activity-events-BVo9rMUz.mjs → activity-events-CiFN61xq.mjs} +1 -1
  3. package/dist/{actor-DrJJsvy6.mjs → actor-DxUAJgQX.mjs} +20 -6
  4. package/dist/{adapters-DHt3f2lu.d.mts → adapters-Rol-inz6.d.mts} +5 -7
  5. package/dist/after-BVaUn7bK.mjs +24 -0
  6. package/dist/{allowed-origins-DGSyhRCz.mjs → allowed-origins-Cp7BI3L9.mjs} +1 -1
  7. package/dist/api/route-utils.d.mts +10 -10
  8. package/dist/api/route-utils.mjs +23 -19
  9. package/dist/api/schemas/index.d.mts +1 -1
  10. package/dist/api/schemas/index.mjs +5 -5
  11. package/dist/{api-CTf1SLmg.mjs → api-CwhrR7H5.mjs} +55 -1215
  12. package/dist/api-tokens-DA18zxza.mjs +3 -0
  13. package/dist/{api-tokens-CSomx-l3.mjs → api-tokens-OAgvq4xg.mjs} +1 -1
  14. package/dist/{apply-Bs2jXsms.mjs → apply-BTfAReIv.mjs} +109 -93
  15. package/dist/astro/index.d.mts +16 -12
  16. package/dist/astro/index.mjs +50 -9
  17. package/dist/astro/middleware/auth.d.mts +9 -9
  18. package/dist/astro/middleware/auth.mjs +29 -8
  19. package/dist/astro/middleware/redirect.mjs +8 -7
  20. package/dist/astro/middleware/request-context.mjs +17 -10
  21. package/dist/astro/middleware/seed.d.mts +1 -1
  22. package/dist/astro/middleware/seed.mjs +93 -71
  23. package/dist/astro/middleware/setup.mjs +1 -1
  24. package/dist/astro/middleware/workers.d.mts +6 -0
  25. package/dist/astro/middleware/workers.mjs +8 -0
  26. package/dist/astro/middleware.mjs +287 -159
  27. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +7 -7
  28. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +7 -7
  29. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
  30. package/dist/astro/routes/api/admin/api-tokens/index.mjs +7 -7
  31. package/dist/astro/routes/api/admin/briefing.mjs +25 -23
  32. package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +5 -4
  33. package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +11 -10
  34. package/dist/astro/routes/api/admin/byline-fields/index.mjs +11 -10
  35. package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +11 -10
  36. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +22 -20
  37. package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +22 -20
  38. package/dist/astro/routes/api/admin/bylines/index.mjs +22 -20
  39. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +18 -16
  40. package/dist/astro/routes/api/admin/comments/_id_.mjs +8 -7
  41. package/dist/astro/routes/api/admin/comments/bulk.mjs +14 -13
  42. package/dist/astro/routes/api/admin/comments/counts.mjs +8 -7
  43. package/dist/astro/routes/api/admin/comments/index.mjs +14 -13
  44. package/dist/astro/routes/api/admin/context/_id_/history.mjs +42 -31
  45. package/dist/astro/routes/api/admin/context/_id_/index.mjs +42 -31
  46. package/dist/astro/routes/api/admin/context/_id_/review.mjs +47 -36
  47. package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +47 -36
  48. package/dist/astro/routes/api/admin/context/diff.mjs +46 -35
  49. package/dist/astro/routes/api/admin/context/index.mjs +47 -36
  50. package/dist/astro/routes/api/admin/context/stale.mjs +46 -35
  51. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +42 -31
  52. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +46 -35
  53. package/dist/astro/routes/api/admin/hitl-requests/index.mjs +46 -35
  54. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +43 -32
  55. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
  56. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +7 -7
  57. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +7 -7
  58. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +71 -66
  59. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +71 -66
  60. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +63 -58
  61. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +70 -65
  62. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +70 -65
  63. package/dist/astro/routes/api/admin/plugins/index.mjs +63 -58
  64. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
  65. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +63 -58
  66. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +70 -65
  67. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +63 -58
  68. package/dist/astro/routes/api/admin/plugins/updates.mjs +63 -58
  69. package/dist/astro/routes/api/admin/review-requests/_id_/image.mjs +26 -23
  70. package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +39 -25
  71. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +55 -43
  72. package/dist/astro/routes/api/admin/review-requests/_id_/revoke.mjs +10 -9
  73. package/dist/astro/routes/api/admin/review-requests/index.mjs +53 -41
  74. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +63 -58
  75. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
  76. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +63 -58
  77. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +20 -12
  78. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +1 -1
  79. package/dist/astro/routes/api/admin/users/_id_/index.mjs +40 -32
  80. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +3 -3
  81. package/dist/astro/routes/api/admin/users/index.mjs +7 -7
  82. package/dist/astro/routes/api/auth/dev-bypass.mjs +6 -5
  83. package/dist/astro/routes/api/auth/invite/accept.mjs +1 -1
  84. package/dist/astro/routes/api/auth/invite/complete.mjs +12 -12
  85. package/dist/astro/routes/api/auth/invite/index.mjs +9 -9
  86. package/dist/astro/routes/api/auth/invite/register-options.mjs +11 -11
  87. package/dist/astro/routes/api/auth/logout.mjs +2 -2
  88. package/dist/astro/routes/api/auth/magic-link/send.mjs +12 -11
  89. package/dist/astro/routes/api/auth/magic-link/verify.mjs +2 -2
  90. package/dist/astro/routes/api/auth/me.mjs +11 -11
  91. package/dist/astro/routes/api/auth/mode.mjs +1 -1
  92. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +5 -4
  93. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +5 -4
  94. package/dist/astro/routes/api/auth/passkey/_id_.mjs +7 -7
  95. package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
  96. package/dist/astro/routes/api/auth/passkey/options.mjs +14 -13
  97. package/dist/astro/routes/api/auth/passkey/register/options.mjs +11 -11
  98. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +12 -12
  99. package/dist/astro/routes/api/auth/passkey/verify.mjs +12 -12
  100. package/dist/astro/routes/api/auth/setup-token/index.mjs +32 -23
  101. package/dist/astro/routes/api/auth/setup-token/verify.mjs +32 -26
  102. package/dist/astro/routes/api/auth/signup/complete.mjs +12 -12
  103. package/dist/astro/routes/api/auth/signup/request.mjs +12 -11
  104. package/dist/astro/routes/api/auth/signup/verify.mjs +1 -1
  105. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +73 -2
  106. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +91 -49
  107. package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +19 -16
  108. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
  109. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +8 -7
  110. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +8 -7
  111. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +8 -7
  112. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +24 -21
  113. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +34 -22
  114. package/dist/astro/routes/api/content/_collection_/_id_/release-readiness.mjs +9 -9
  115. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +8 -7
  116. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
  117. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +34 -22
  118. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +23 -19
  119. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
  120. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +8 -7
  121. package/dist/astro/routes/api/content/_collection_/_id_.mjs +14 -13
  122. package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
  123. package/dist/astro/routes/api/content/_collection_/index.mjs +14 -13
  124. package/dist/astro/routes/api/content/_collection_/trash.mjs +8 -8
  125. package/dist/astro/routes/api/dashboard.mjs +16 -11
  126. package/dist/astro/routes/api/dev/emails.mjs +2 -2
  127. package/dist/astro/routes/api/health.mjs +1 -1
  128. package/dist/astro/routes/api/import/probe.d.mts +3 -3
  129. package/dist/astro/routes/api/import/probe.mjs +25 -24
  130. package/dist/astro/routes/api/import/wordpress/analyze.mjs +12 -11
  131. package/dist/astro/routes/api/import/wordpress/execute.d.mts +9 -9
  132. package/dist/astro/routes/api/import/wordpress/execute.mjs +50 -42
  133. package/dist/astro/routes/api/import/wordpress/media.d.mts +9 -9
  134. package/dist/astro/routes/api/import/wordpress/media.mjs +14 -14
  135. package/dist/astro/routes/api/import/wordpress/prepare.mjs +51 -40
  136. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +10 -10
  137. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +49 -38
  138. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
  139. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +29 -27
  140. package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
  141. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +9 -9
  142. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +55 -47
  143. package/dist/astro/routes/api/integration/artifact.mjs +11 -8
  144. package/dist/astro/routes/api/integration/dispatch.mjs +17 -14
  145. package/dist/astro/routes/api/integrations/_provider_.mjs +11 -8
  146. package/dist/astro/routes/api/integrations/index.mjs +10 -7
  147. package/dist/astro/routes/api/manifest.mjs +5 -5
  148. package/dist/astro/routes/api/mcp.mjs +97 -88
  149. package/dist/astro/routes/api/media/_id_/confirm.mjs +12 -12
  150. package/dist/astro/routes/api/media/_id_.mjs +9 -9
  151. package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
  152. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
  153. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
  154. package/dist/astro/routes/api/media/providers/index.mjs +2 -2
  155. package/dist/astro/routes/api/media/upload-url.mjs +13 -13
  156. package/dist/astro/routes/api/media.mjs +16 -16
  157. package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +47 -36
  158. package/dist/astro/routes/api/menus/_name_/items.mjs +47 -36
  159. package/dist/astro/routes/api/menus/_name_/reorder.mjs +47 -36
  160. package/dist/astro/routes/api/menus/_name_/translations.mjs +47 -36
  161. package/dist/astro/routes/api/menus/_name_.mjs +47 -36
  162. package/dist/astro/routes/api/menus/index.mjs +47 -36
  163. package/dist/astro/routes/api/oauth/authorize.mjs +9 -7
  164. package/dist/astro/routes/api/oauth/device/authorize.mjs +7 -6
  165. package/dist/astro/routes/api/oauth/device/code.mjs +11 -9
  166. package/dist/astro/routes/api/oauth/device/token.mjs +10 -8
  167. package/dist/astro/routes/api/oauth/register.mjs +4 -4
  168. package/dist/astro/routes/api/oauth/token/refresh.mjs +7 -6
  169. package/dist/astro/routes/api/oauth/token/revoke.mjs +7 -6
  170. package/dist/astro/routes/api/oauth/token.mjs +8 -6
  171. package/dist/astro/routes/api/openapi.json.mjs +5 -5
  172. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +4 -4
  173. package/dist/astro/routes/api/redirects/404s/index.mjs +15 -14
  174. package/dist/astro/routes/api/redirects/404s/summary.mjs +15 -14
  175. package/dist/astro/routes/api/redirects/_id_.mjs +47 -37
  176. package/dist/astro/routes/api/redirects/index.mjs +47 -37
  177. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
  178. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
  179. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +65 -60
  180. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +65 -60
  181. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +65 -60
  182. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +65 -60
  183. package/dist/astro/routes/api/schema/collections/index.mjs +65 -60
  184. package/dist/astro/routes/api/schema/index.mjs +12 -11
  185. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +63 -58
  186. package/dist/astro/routes/api/schema/orphans/index.mjs +63 -58
  187. package/dist/astro/routes/api/search/enable.mjs +15 -14
  188. package/dist/astro/routes/api/search/index.mjs +14 -13
  189. package/dist/astro/routes/api/search/rebuild.mjs +15 -14
  190. package/dist/astro/routes/api/search/stats.mjs +9 -8
  191. package/dist/astro/routes/api/search/suggest.mjs +14 -13
  192. package/dist/astro/routes/api/sections/_slug_.mjs +47 -36
  193. package/dist/astro/routes/api/sections/index.mjs +47 -36
  194. package/dist/astro/routes/api/settings/email.mjs +5 -5
  195. package/dist/astro/routes/api/settings/reviews.mjs +11 -10
  196. package/dist/astro/routes/api/settings.mjs +47 -36
  197. package/dist/astro/routes/api/setup/admin-verify.mjs +14 -14
  198. package/dist/astro/routes/api/setup/admin.mjs +12 -12
  199. package/dist/astro/routes/api/setup/dev-bypass.mjs +35 -31
  200. package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
  201. package/dist/astro/routes/api/setup/index.mjs +37 -33
  202. package/dist/astro/routes/api/setup/status.mjs +3 -3
  203. package/dist/astro/routes/api/snapshot.mjs +11 -9
  204. package/dist/astro/routes/api/system/heartbeat.mjs +2 -2
  205. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +50 -39
  206. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +50 -39
  207. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +50 -39
  208. package/dist/astro/routes/api/taxonomies/index.mjs +50 -39
  209. package/dist/astro/routes/api/themes/preview.mjs +8 -6
  210. package/dist/astro/routes/api/typegen.mjs +4 -4
  211. package/dist/astro/routes/api/well-known/auth.mjs +3 -3
  212. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
  213. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
  214. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +46 -35
  215. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +47 -36
  216. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +47 -36
  217. package/dist/astro/routes/api/widget-areas/_name_.mjs +44 -33
  218. package/dist/astro/routes/api/widget-areas/index.mjs +47 -36
  219. package/dist/astro/routes/api/widget-components.mjs +2 -2
  220. package/dist/astro/routes/robots.txt.mjs +11 -10
  221. package/dist/astro/routes/sitemap-_collection_.xml.mjs +20 -18
  222. package/dist/astro/routes/sitemap.xml.mjs +19 -17
  223. package/dist/astro/session-driver.d.mts +1 -1
  224. package/dist/astro/session-driver.mjs +4 -4
  225. package/dist/astro/types.d.mts +13 -13
  226. package/dist/atomic-authority-CnBQJ14T.mjs +33 -0
  227. package/dist/{audit-CYjfxG9i.mjs → audit-F5iWkbcJ.mjs} +11 -4
  228. package/dist/auth/providers/github.d.mts +1 -1
  229. package/dist/auth/providers/google.d.mts +1 -1
  230. package/dist/{auth-control-guard-CITT8ZA_.mjs → auth-control-guard-DPOSBNFI.mjs} +1 -1
  231. package/dist/{authorize-KcI0pAfN.mjs → authorize-CXIjxIfC.mjs} +1 -1
  232. package/dist/{briefing-BgQTljQt.mjs → briefing-5zf0YZbR.mjs} +445 -447
  233. package/dist/{briefing-r3hXCDQC.mjs → briefing-DiupPvyN.mjs} +1 -1
  234. package/dist/{bundle-S6zx-V4D.mjs → bundle-DImnxo71.mjs} +3 -3
  235. package/dist/{byline-Ctil4rij.mjs → byline-DEZKlzD9.mjs} +107 -113
  236. package/dist/{byline-fields-51ja6JDa.d.mts → byline-fields-BO96fXLv.d.mts} +8 -8
  237. package/dist/{byline-fields-DiCyW6eQ.mjs → byline-fields-CY6V0ew1.mjs} +1 -1
  238. package/dist/{byline-fields-QpmruT5r.mjs → byline-fields-DGNKitg3.mjs} +3 -3
  239. package/dist/{byline-registry-rkr73qSE.mjs → byline-registry-CkuVVeJJ.mjs} +46 -76
  240. package/dist/{bylines-v_ZUQnR-.mjs → bylines-CXyKpVLQ.mjs} +6 -6
  241. package/dist/{bylines-BcuBpzVi.mjs → bylines-gSAfpHl4.mjs} +4 -4
  242. package/dist/{cache-V2BCplaY.mjs → cache-DZDOBJv3.mjs} +2 -2
  243. package/dist/{chunks-CnuL55JE.mjs → chunks-BnG3LPMN.mjs} +1 -1
  244. package/dist/cli/index.mjs +452 -263
  245. package/dist/cli/plugin-kit.d.mts +9 -9
  246. package/dist/cli/plugin-kit.mjs +2 -2
  247. package/dist/client/external-auth-headers.d.mts +1 -1
  248. package/dist/client/index.d.mts +11 -11
  249. package/dist/client/index.mjs +2 -2
  250. package/dist/{client-factory-C-y9VZDX.mjs → client-factory-6vLLT06O.mjs} +1 -1
  251. package/dist/{comment-_nvJSS-A.mjs → comment-kgLTdtQD.mjs} +15 -8
  252. package/dist/{comment-reaction-DhVgJ17S.mjs → comment-reaction-Cun5eIXL.mjs} +1 -1
  253. package/dist/{comments-D4mIDjvA.mjs → comments-ZYK_cZvx.mjs} +1 -1
  254. package/dist/{content-CVCrcuvD.mjs → content-D9xKUSno.mjs} +287 -165
  255. package/dist/{content-refresh-QvBIyb_g.mjs → content-refresh-9M9cc55-.mjs} +170 -193
  256. package/dist/{context-JjKucxBm.mjs → context-BU8AbLmY.mjs} +2 -2
  257. package/dist/{context-MftkHbWx.mjs → context-C5lPtfeh.mjs} +95 -77
  258. package/dist/{context-route-helpers-e1APrqSm.mjs → context-route-helpers-CWAHJFl3.mjs} +2 -2
  259. package/dist/{cron-mGVPQ5e6.mjs → cron-BVYo08mi.mjs} +36 -32
  260. package/dist/d1-binding-D6HZa3ks.mjs +8 -0
  261. package/dist/d1-dialect-BBxPg6Om.mjs +48 -0
  262. package/dist/{dashboard-ZJ7sMcBI.mjs → dashboard-BnD5krLg.mjs} +5 -5
  263. package/dist/database/batch.d.mts +22 -0
  264. package/dist/database/batch.mjs +92 -0
  265. package/dist/database/d1/index.d.mts +18 -0
  266. package/dist/database/d1/index.mjs +8 -0
  267. package/dist/db/d1.d.mts +7 -0
  268. package/dist/db/d1.mjs +13 -0
  269. package/dist/db/index.d.mts +4 -4
  270. package/dist/db/index.mjs +10 -7
  271. package/dist/db/libsql.d.mts +1 -1
  272. package/dist/db/libsql.mjs +46 -3
  273. package/dist/db/postgres.d.mts +1 -1
  274. package/dist/db/sqlite.d.mts +1 -1
  275. package/dist/{device-flow-eOcL5m0Q.mjs → device-flow-Prqg6ycD.mjs} +130 -94
  276. package/dist/{dialect-helpers-fk43GbDb.mjs → dialect-helpers-C6xtO-Ui.mjs} +1 -1
  277. package/dist/{discovery-CJkuHGhZ.mjs → discovery-CYcZJ1o3.mjs} +5 -5
  278. package/dist/{enrich-KErvJOuI.mjs → enrich-BjF-J4sF.mjs} +1 -1
  279. package/dist/{evidence-6IUv9ML3.mjs → evidence-krrA3uiG.mjs} +7 -7
  280. package/dist/{field-defs-cache-CwrIyZFT.mjs → field-defs-cache-BKKFFf_V.mjs} +5 -5
  281. package/dist/{forgeway-account-lYJ8iX3G.mjs → forgeway-account-CnWOIusE.mjs} +1 -1
  282. package/dist/{fts-manager-DX7ZkrCa.mjs → fts-manager-DA74x_uP.mjs} +72 -57
  283. package/dist/{hitl-requests-CmYVunm-.mjs → hitl-requests-CGjA1jND.mjs} +2 -2
  284. package/dist/{hitl-route-helpers-CRm537zS.mjs → hitl-route-helpers-BxSL0iZB.mjs} +5 -5
  285. package/dist/{import-DqRAgsKr.mjs → import-CayDCPaH.mjs} +9 -9
  286. package/dist/{index-Co7xtjkd.d.mts → index-mlJSqFkG.d.mts} +7 -4
  287. package/dist/index.d.mts +16 -16
  288. package/dist/index.mjs +103 -96
  289. package/dist/{integration-credentials-qudN6yRr.mjs → integration-credentials-Br16M1VE.mjs} +2 -2
  290. package/dist/{jsonld-BpvnSp2m.d.mts → jsonld-BUiFEiCZ.d.mts} +2 -2
  291. package/dist/{load-fCOciq0Q.mjs → load-B2oitobd.mjs} +1 -1
  292. package/dist/{loader-BDje8ME2.mjs → loader-Cgsx23wU.mjs} +4 -4
  293. package/dist/{manifest-schema-CfKD0thC.mjs → manifest-schema-DBXM_g8l.mjs} +1 -1
  294. package/dist/{mcp-reviewed-executor-DmhM3Cy6.mjs → mcp-reviewed-executor-RJ71uyQb.mjs} +7 -7
  295. package/dist/media/image-endpoint.mjs +1 -1
  296. package/dist/media/index.d.mts +1 -1
  297. package/dist/media/index.mjs +2 -2
  298. package/dist/media/local-runtime.d.mts +11 -11
  299. package/dist/media/local-runtime.mjs +3 -3
  300. package/dist/{media-dvRjj4po.mjs → media-BZqwtRTZ.mjs} +12 -4
  301. package/dist/{media-allowlist-DaG6lNoy.mjs → media-allowlist-CyByjUXh.mjs} +1 -1
  302. package/dist/{menus-CZbz5L_V.mjs → menus-2o-DVcwA.mjs} +8 -8
  303. package/dist/{menus-CpuR4Qkm.mjs → menus-5liJusbp.mjs} +138 -90
  304. package/dist/migrations-C7YXse7V.mjs +76 -0
  305. package/dist/oauth-authority-DOjME4Hh.mjs +43 -0
  306. package/dist/{oauth-authorization-Jf5e3azH.mjs → oauth-authorization-B_mmz7O2.mjs} +89 -98
  307. package/dist/{oauth-clients-tovQ4D4h.mjs → oauth-clients-Cr4pdIAE.mjs} +2 -2
  308. package/dist/object-cache/memory.d.mts +1 -1
  309. package/dist/{object-cache-D51qOseS.mjs → object-cache-BGjIlY9s.mjs} +1 -1
  310. package/dist/page/index.d.mts +10 -10
  311. package/dist/page/index.mjs +1 -1
  312. package/dist/{parse-IsGn-5lt.mjs → parse-BscLr3p2.mjs} +1 -1
  313. package/dist/plugin-utils.d.mts +9 -9
  314. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
  315. package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
  316. package/dist/{plugins-DXyLI3Hb.mjs → plugins-f48yrwfI.mjs} +35 -84
  317. package/dist/{policy-DKdNMv8y.mjs → policy-CrK1vl8l.mjs} +2 -2
  318. package/dist/{preview-BXmS1SXL.mjs → preview-E1xKZGsX.mjs} +2 -2
  319. package/dist/{provider-loader-DDq7R_RN.d.mts → provider-loader-H2wdGD0o.d.mts} +1 -1
  320. package/dist/{public-url-Ci7UbC0W.d.mts → public-url-CI700CW4.d.mts} +1 -1
  321. package/dist/{public-url-BQ9vf0AS.d.mts → public-url-zoO-QbN6.d.mts} +2 -2
  322. package/dist/{publication-authorization-C-vYPGD8.mjs → publication-authorization-Dq_20SZR.mjs} +458 -33
  323. package/dist/{query-DcB9uGTW.mjs → query-BkWWdxyb.mjs} +4 -4
  324. package/dist/{query-CrW2yI6G.mjs → query-D6oNo9iz.mjs} +15 -15
  325. package/dist/{rate-limit-DEkoxTsP.mjs → rate-limit-RaBJEgyt.mjs} +2 -2
  326. package/dist/{redirect-DG-o0CKV.mjs → redirect-HLI3wT5Y.mjs} +26 -14
  327. package/dist/{redirects-Bjp4iKJU.mjs → redirects-D16GFaOa.mjs} +5 -5
  328. package/dist/{redirects-N8gmWhVM.mjs → redirects-DpRiuRWn.mjs} +3 -3
  329. package/dist/{registry-D-IV_h50.mjs → registry-DcV93OL_.mjs} +183 -186
  330. package/dist/release-CZfAeyXm.mjs +5148 -0
  331. package/dist/request-context.d.mts +8 -0
  332. package/dist/{request-meta-BW0the1R.mjs → request-meta-C6yGqnGD.mjs} +1 -1
  333. package/dist/{resolve-pZ4NQM-X.mjs → resolve-CpOV2jt_.mjs} +1 -1
  334. package/dist/review-payload-LLIi1sxO.mjs +1386 -0
  335. package/dist/{review-requests-DICrYH2-.mjs → review-requests-BF2eEKr8.mjs} +93 -37
  336. package/dist/{review-requests-BTKfeWlS.mjs → review-requests-C7prIbCo.mjs} +2 -2
  337. package/dist/{review-route-helpers-DaZBBps8.mjs → review-route-helpers-BYx3Px90.mjs} +2 -2
  338. package/dist/{revision-De7OmYVD.mjs → revision-090sZyGc.mjs} +28 -22
  339. package/dist/revocation-DZ8e4JCS.mjs +53 -0
  340. package/dist/{runner-DJiRFyLI.mjs → runner-CVeq0266.mjs} +594 -491
  341. package/dist/{runner-Dye73myO.d.mts → runner-Cxl-vyk2.d.mts} +1 -1
  342. package/dist/{runs-DEujUDOj.mjs → runs-B8kCirJ6.mjs} +5 -5
  343. package/dist/runtime-env-v-1UXPAH.mjs +19 -0
  344. package/dist/runtime.d.mts +10 -10
  345. package/dist/runtime.mjs +5 -5
  346. package/dist/schema-DFeC5axi.mjs +8 -0
  347. package/dist/{search-DxUKN9Zz.mjs → search-C9qOBgvo.mjs} +4 -4
  348. package/dist/{secrets-AdCrGg1c.mjs → secrets-BP2YTPWn.mjs} +10 -11
  349. package/dist/{sections-BPFOEMK6.mjs → sections-CkoQY7Z9.mjs} +2 -2
  350. package/dist/seed/index.d.mts +2 -2
  351. package/dist/seed/index.mjs +29 -25
  352. package/dist/seo/index.d.mts +3 -3
  353. package/dist/seo/index.mjs +11 -10
  354. package/dist/{seo-GfovzqpU.mjs → seo-Bypxm1iD.mjs} +1 -1
  355. package/dist/{seo-DWHdo5aW.mjs → seo-DYpc_rQ1.mjs} +25 -15
  356. package/dist/{service-BrNKVCjC.mjs → service-DOFqfUVv.mjs} +46 -21
  357. package/dist/{service-DbgjHWyW.mjs → service-mJBl4ZP4.mjs} +2 -2
  358. package/dist/{session-user-D8WwGEPH.mjs → session-user-DacoiKrJ.mjs} +1 -1
  359. package/dist/{settings-BKEHw6Bu.mjs → settings-2p7TuNWG.mjs} +2 -2
  360. package/dist/{settings-CAsQLi0N.mjs → settings-DRFy8JQx.mjs} +8 -8
  361. package/dist/{setup-complete-CHCYS5KV.mjs → setup-complete-CWMnrNFN.mjs} +1 -1
  362. package/dist/{site-activity-7oezuHXK.mjs → site-activity-BrN2NviL.mjs} +11 -4
  363. package/dist/{site-context-CA7rbxux.mjs → site-context-D9oETfxF.mjs} +50 -37
  364. package/dist/{site-url-DoZf_jVj.mjs → site-url-DoTPKRND.mjs} +1 -1
  365. package/dist/state-D8AogXCV.mjs +30 -0
  366. package/dist/storage/local.d.mts +1 -1
  367. package/dist/storage/local.mjs +1 -1
  368. package/dist/storage/s3.d.mts +1 -1
  369. package/dist/storage/s3.mjs +3 -3
  370. package/dist/{store-c4qx3gVh.mjs → store-CjmmGlVw.mjs} +37 -12
  371. package/dist/submission-BLvkvewK.mjs +411 -0
  372. package/dist/{taxonomies-ALDiRQ84.mjs → taxonomies-C5ayPp3T.mjs} +3 -3
  373. package/dist/{taxonomies-93DV-1QT.mjs → taxonomies-DW6Fps-w.mjs} +7 -7
  374. package/dist/{taxonomy-BOBTJ_aE.mjs → taxonomy-DWxxLpp5.mjs} +3 -3
  375. package/dist/{tokens-c-qxNqzC.mjs → tokens-I3tSjoFI.mjs} +1 -1
  376. package/dist/{trusted-proxy-CdEl6g6B.mjs → trusted-proxy-CvDP0g0F.mjs} +4 -12
  377. package/dist/{types-6KmeXInJ.d.mts → types-BFoQ5a1v.d.mts} +1 -1
  378. package/dist/{types-BpSTdH1H.mjs → types-BqxIv8Il.mjs} +2 -2
  379. package/dist/{types-BRCUO8NR.d.mts → types-CVRNRAA5.d.mts} +1 -0
  380. package/dist/{types-CfpX1og5.d.mts → types-Tt_IGMno.d.mts} +360 -172
  381. package/dist/ui/server-runtime.d.mts +13 -13
  382. package/dist/ui/server-runtime.mjs +28 -26
  383. package/dist/{user-D0NJ7gYf.mjs → user-1-YV30lf.mjs} +2 -2
  384. package/dist/{utils-BK2efsHv.mjs → utils-BoWkoty8.mjs} +2 -2
  385. package/dist/{validate-CDWVODvc.d.mts → validate-CCOsvPg2.d.mts} +3 -3
  386. package/dist/{validate-C9g9iX3q.mjs → validate-CupwWNWL.mjs} +3 -3
  387. package/dist/version-DpT-k_Ny.mjs +6 -0
  388. package/dist/{widgets-Cm5Qx2Np.mjs → widgets-DbOctkXv.mjs} +3 -3
  389. package/dist/{wordpress-slugs-WdPZaVXf.mjs → wordpress-slugs-pQlLXbKn.mjs} +1 -1
  390. package/dist/{worker-Bhuu7eqS.mjs → worker-wjRq4FI9.mjs} +76 -47
  391. package/dist/workers-build-QVrquLLe.mjs +36 -0
  392. package/dist/{zod-generator-DS5oZNaL.mjs → zod-generator-BzACAoR5.mjs} +2 -2
  393. package/package.json +34 -8
  394. package/dist/after-BfniwgIf.mjs +0 -9
  395. package/dist/api-tokens-CmT83Bgj.mjs +0 -3
  396. package/dist/db/libsql-http.d.mts +0 -27
  397. package/dist/db/libsql-http.mjs +0 -29
  398. package/dist/libsql-dialect-CANq6UNI.mjs +0 -47
  399. package/dist/oauth-user-lookup-B451pZmd.mjs +0 -25
  400. package/dist/review-payload-f1L4lzQg.mjs +0 -111
  401. package/dist/revocation-CkTOhdlw.mjs +0 -42
  402. package/dist/schema-IjuRxkqq.mjs +0 -8
  403. package/dist/submission-C47cHBIg.mjs +0 -67
  404. package/dist/transaction-BGQgnwUi.mjs +0 -28
  405. package/dist/version-CJqc1mwj.mjs +0 -6
  406. /package/dist/{base64-F8-DUraK.mjs → base64-Cz-aU0X1.mjs} +0 -0
  407. /package/dist/{challenge-store-CDKfye2r.mjs → challenge-store-DFGsDtCj.mjs} +0 -0
  408. /package/dist/{components-DAq_4iPX.mjs → components-gMTtJqHg.mjs} +0 -0
  409. /package/dist/{config-CVssduLe.mjs → config-XW5tMrH8.mjs} +0 -0
  410. /package/dist/{content-index-names-Bbu1FY1r.mjs → content-index-names-CDc2IQIx.mjs} +0 -0
  411. /package/dist/{context-types-CPWAJRs5.mjs → context-types-DLD_HnKT.mjs} +0 -0
  412. /package/dist/{default-BeIzUa1e.mjs → default-w3MwLng7.mjs} +0 -0
  413. /package/dist/{email-console-Bfi_exVg.mjs → email-console-CpvgEN1w.mjs} +0 -0
  414. /package/dist/{error-DLg1H2LT.mjs → error-B-44r5TD.mjs} +0 -0
  415. /package/dist/{escape-C6lkys0j.mjs → escape-B1GM0yJU.mjs} +0 -0
  416. /package/dist/{experimental-workflows-B9x8delL.mjs → experimental-workflows-fzJHB3ZI.mjs} +0 -0
  417. /package/dist/{hash-jhbF98tT.mjs → hash-DvMZXj2L.mjs} +0 -0
  418. /package/dist/{media-url-CL3NzgLh.mjs → media-url-D-elxQjL.mjs} +0 -0
  419. /package/dist/{mime-CDTtL7jE.mjs → mime-D_ae-u_U.mjs} +0 -0
  420. /package/dist/{mode-DJeacFCZ.mjs → mode-BJwb_MgK.mjs} +0 -0
  421. /package/dist/{normalize-Ev3FiBMx.mjs → normalize-5rct_U0I.mjs} +0 -0
  422. /package/dist/{oauth-state-store-Do1a_o3H.mjs → oauth-state-store-D2H9hKcN.mjs} +0 -0
  423. /package/dist/{options-1dBRkoCl.mjs → options-BcqHWpc-.mjs} +0 -0
  424. /package/dist/{output-8j9oltTf.mjs → output-CdmbQioY.mjs} +0 -0
  425. /package/dist/{parser-C9rzPuSZ.mjs → parser-ehIlj32k.mjs} +0 -0
  426. /package/dist/{passkey-config-CRN44T04.mjs → passkey-config-sUQoLEj_.mjs} +0 -0
  427. /package/dist/{patterns-3XE9bU4r.mjs → patterns-CZ7D4y_R.mjs} +0 -0
  428. /package/dist/{placeholder-D03pGvqM.d.mts → placeholder-CQKI6vLd.d.mts} +0 -0
  429. /package/dist/{portable-text-BdRm4uZq.d.mts → portable-text-BE7nszX6.d.mts} +0 -0
  430. /package/dist/{portable-text-tIk9_uz_.mjs → portable-text-DH3Om_2D.mjs} +0 -0
  431. /package/dist/{process-cache-B-L-A9zg.mjs → process-cache-MHM4Sqzs.mjs} +0 -0
  432. /package/dist/{provider-loader-C4i82ll1.mjs → provider-loader-Dnv2neOu.mjs} +0 -0
  433. /package/dist/{public-discovery-CyDzK1-S.mjs → public-discovery-CTql6jdZ.mjs} +0 -0
  434. /package/dist/{public-url-BVIjzMo3.mjs → public-url-4sMO36Gw.mjs} +0 -0
  435. /package/dist/{public-url-oudwI7K0.mjs → public-url-DNt9A1yS.mjs} +0 -0
  436. /package/dist/{redirect-Dp5u-8dH.mjs → redirect-Cjjb5VYr.mjs} +0 -0
  437. /package/dist/{request-cache-BruBnFAR.mjs → request-cache-DPmV5nk4.mjs} +0 -0
  438. /package/dist/{seo-contributions-BAtRDXEQ.mjs → seo-contributions-atY3jZEV.mjs} +0 -0
  439. /package/dist/{service-DeX1PRNt.mjs → service-CeEi6nax.mjs} +0 -0
  440. /package/dist/{setup-nonce-D-CEYlw7.mjs → setup-nonce-BUmfCiY1.mjs} +0 -0
  441. /package/dist/{sidecar-client-Bw2C0XTf.mjs → sidecar-client-CbrX8nuw.mjs} +0 -0
  442. /package/dist/{slugify-KSsVD_D3.mjs → slugify-Di8Q_MFq.mjs} +0 -0
  443. /package/dist/{ssrf-C7tTSD1r.mjs → ssrf-COxLChKv.mjs} +0 -0
  444. /package/dist/{stable-hash-DF7R5eN8.mjs → stable-hash-DEtJgcp7.mjs} +0 -0
  445. /package/dist/{status-Bba6RbkS.mjs → status-DBSB6tdS.mjs} +0 -0
  446. /package/dist/{transport-ktLL9r2O.d.mts → transport-CZbtxgKZ.d.mts} +0 -0
  447. /package/dist/{transport-BddGhTAI.mjs → transport-aPKvM53n.mjs} +0 -0
  448. /package/dist/{types-CKIt_jmM.d.mts → types-1qU0-N1P.d.mts} +0 -0
  449. /package/dist/{types-BQZFeZjd.mjs → types-BKsk4nnM.mjs} +0 -0
  450. /package/dist/{types-CLMOusxP.d.mts → types-BWsEjujW.d.mts} +0 -0
  451. /package/dist/{types--3oJQ0hs.d.mts → types-CAD4OvmF.d.mts} +0 -0
  452. /package/dist/{types-BbkkkAb6.mjs → types-ChSk0dmw.mjs} +0 -0
  453. /package/dist/{types-C0DPvhR5.mjs → types-CyBH89BS.mjs} +0 -0
  454. /package/dist/{types-CU3Wn2HC.d.mts → types-DNPP-eu4.d.mts} +0 -0
  455. /package/dist/{types-CPaVj_GC.d.mts → types-SddyDti7.d.mts} +0 -0
  456. /package/dist/{url-C_pLSrGZ.mjs → url-Ce0qtSdB.mjs} +0 -0
  457. /package/dist/{url-Dumsft7G.mjs → url-DfqolpO2.mjs} +0 -0
  458. /package/dist/{validate-VPnKoIzW.mjs → validate-Co3j6T_K.mjs} +0 -0
@@ -1,16 +1,18 @@
1
- import { n as validateJsonFieldName } from "./validate-VPnKoIzW.mjs";
2
- import { c as jsonExtractExpr } from "./dialect-helpers-fk43GbDb.mjs";
3
- import { i as encodeCursor, r as decodeCursor } from "./types-BpSTdH1H.mjs";
4
- import { t as ContentRepository } from "./content-CVCrcuvD.mjs";
5
- import { t as MediaRepository } from "./media-dvRjj4po.mjs";
6
- import { t as UserRepository } from "./user-D0NJ7gYf.mjs";
7
- import { t as OptionsRepository } from "./options-1dBRkoCl.mjs";
8
- import { t as withTransaction } from "./transaction-BGQgnwUi.mjs";
9
- import { t as enrichImageMetadata } from "./enrich-KErvJOuI.mjs";
10
- import { t as SeoRepository } from "./seo-DWHdo5aW.mjs";
11
- import { a as markContentMediaUsageCollectionStaleSafely } from "./content-refresh-QvBIyb_g.mjs";
12
- import { a as validateExternalUrl, i as stripCredentialHeaders, t as SsrfError } from "./ssrf-C7tTSD1r.mjs";
13
- import { t as CronAccessImpl } from "./cron-mGVPQ5e6.mjs";
1
+ import { atomicBatch } from "./database/batch.mjs";
2
+ import { n as validateJsonFieldName } from "./validate-Co3j6T_K.mjs";
3
+ import { c as jsonExtractExpr } from "./dialect-helpers-C6xtO-Ui.mjs";
4
+ import { i as encodeCursor, r as decodeCursor } from "./types-BqxIv8Il.mjs";
5
+ import { t as contentWriteChecks } from "./atomic-authority-CnBQJ14T.mjs";
6
+ import { o as invalidateCollectionCache } from "./object-cache-BGjIlY9s.mjs";
7
+ import { t as ContentRepository } from "./content-D9xKUSno.mjs";
8
+ import { t as MediaRepository } from "./media-BZqwtRTZ.mjs";
9
+ import { t as UserRepository } from "./user-1-YV30lf.mjs";
10
+ import { t as OptionsRepository } from "./options-BcqHWpc-.mjs";
11
+ import { t as enrichImageMetadata } from "./enrich-BjF-J4sF.mjs";
12
+ import { t as SeoRepository } from "./seo-DYpc_rQ1.mjs";
13
+ import { o as prepareContentMediaUsageCollectionStale } from "./content-refresh-9M9cc55-.mjs";
14
+ import { a as validateExternalUrl, i as stripCredentialHeaders, t as SsrfError } from "./ssrf-COxLChKv.mjs";
15
+ import { t as CronAccessImpl } from "./cron-BVYo08mi.mjs";
14
16
  import { sql } from "kysely";
15
17
  import { ulid } from "ulidx";
16
18
 
@@ -223,26 +225,24 @@ var PluginStorageRepository = class {
223
225
  async putMany(items) {
224
226
  if (items.length === 0) return;
225
227
  const now = (/* @__PURE__ */ new Date()).toISOString();
226
- await withTransaction(this.db, async (trx) => {
227
- for (const item of items) {
228
- const jsonData = JSON.stringify(item.data);
229
- await trx.insertInto("_plugin_storage").values({
230
- plugin_id: this.pluginId,
231
- collection: this.collection,
232
- id: item.id,
233
- data: jsonData,
234
- created_at: now,
235
- updated_at: now
236
- }).onConflict((oc) => oc.columns([
237
- "plugin_id",
238
- "collection",
239
- "id"
240
- ]).doUpdateSet({
241
- data: jsonData,
242
- updated_at: now
243
- })).execute();
244
- }
245
- });
228
+ await atomicBatch(this.db, { statements: items.map((item) => {
229
+ const jsonData = JSON.stringify(item.data);
230
+ return this.db.insertInto("_plugin_storage").values({
231
+ plugin_id: this.pluginId,
232
+ collection: this.collection,
233
+ id: item.id,
234
+ data: jsonData,
235
+ created_at: now,
236
+ updated_at: now
237
+ }).onConflict((oc) => oc.columns([
238
+ "plugin_id",
239
+ "collection",
240
+ "id"
241
+ ]).doUpdateSet({
242
+ data: jsonData,
243
+ updated_at: now
244
+ })).compile();
245
+ }) });
246
246
  }
247
247
  /**
248
248
  * Delete multiple documents
@@ -330,6 +330,12 @@ var PluginStorageRepository = class {
330
330
  //#endregion
331
331
  //#region src/plugins/context.ts
332
332
  /**
333
+ * Plugin Context v2
334
+ *
335
+ * Creates the unified context object provided to plugins in all hooks and routes.
336
+ *
337
+ */
338
+ /**
333
339
  * Create KV accessor for a plugin
334
340
  * All keys are automatically prefixed with the plugin ID
335
341
  */
@@ -488,58 +494,70 @@ function createContentAccessWithWrite(db) {
488
494
  ...createContentAccess(db),
489
495
  async create(collection, data) {
490
496
  const { fields, seo } = splitSeoFromInput(data);
491
- let contentMutated = false;
492
- try {
493
- const created = await withTransaction(db, async (trx) => {
494
- const trxContentRepo = new ContentRepository(trx);
495
- const trxSeoRepo = new SeoRepository(trx);
496
- const hasSeo = await assertSeoEnabled(trxSeoRepo, collection, seo);
497
- const item = await trxContentRepo.create({
498
- type: collection,
499
- data: fields
500
- });
501
- contentMutated = true;
502
- const result = toPluginContentItem(item);
503
- if (hasSeo) result.seo = seo !== void 0 ? await trxSeoRepo.upsert(collection, item.id, seo) : await trxSeoRepo.get(collection, item.id);
504
- return result;
505
- });
506
- await markContentMediaUsageCollectionStaleSafely(db, collection, "CONTENT_USAGE_STALE");
507
- return created;
508
- } catch (error) {
509
- if (contentMutated) await markContentMediaUsageCollectionStaleSafely(db, collection, "CONTENT_USAGE_STALE");
510
- throw error;
497
+ const repo = new ContentRepository(db);
498
+ const seoRepo = new SeoRepository(db);
499
+ const hasSeo = await assertSeoEnabled(seoRepo, collection, seo);
500
+ const prepared = await repo.prepareCreate({
501
+ type: collection,
502
+ data: fields
503
+ });
504
+ const statements = [...prepared.batch.statements];
505
+ if (hasSeo && seo !== void 0) {
506
+ const write = seoRepo.prepareUpsert(collection, prepared.id, seo);
507
+ if (write) statements.push(write);
511
508
  }
509
+ statements.push(prepareContentMediaUsageCollectionStale(db, collection, "CONTENT_USAGE_STALE"));
510
+ await atomicBatch(db, {
511
+ checks: [...prepared.batch.checks ?? [], sql`COALESCE((SELECT has_seo FROM _dineway_collections WHERE slug = ${collection}), 0) = ${hasSeo ? 1 : 0}`],
512
+ statements
513
+ });
514
+ invalidateCollectionCache(collection);
515
+ const item = await repo.findById(collection, prepared.id);
516
+ if (!item) throw new Error("Content not found");
517
+ const result = toPluginContentItem(item);
518
+ if (hasSeo) result.seo = await seoRepo.get(collection, item.id);
519
+ return result;
512
520
  },
513
521
  async update(collection, id, data) {
514
522
  const { fields, seo } = splitSeoFromInput(data);
515
523
  const hasFieldUpdates = Object.keys(fields).length > 0;
516
- let contentMutated = false;
517
- try {
518
- const updated = await withTransaction(db, async (trx) => {
519
- const trxContentRepo = new ContentRepository(trx);
520
- const trxSeoRepo = new SeoRepository(trx);
521
- const hasSeo = await assertSeoEnabled(trxSeoRepo, collection, seo);
522
- const item = hasFieldUpdates ? await trxContentRepo.update(collection, id, { data: fields }) : await (async () => {
523
- const existing = await trxContentRepo.findById(collection, id);
524
- if (!existing) throw new Error("Content not found");
525
- return existing;
526
- })();
527
- if (hasFieldUpdates) contentMutated = true;
528
- const result = toPluginContentItem(item);
529
- if (hasSeo) result.seo = seo !== void 0 ? await trxSeoRepo.upsert(collection, item.id, seo) : await trxSeoRepo.get(collection, item.id);
530
- return result;
531
- });
532
- if (hasFieldUpdates) await markContentMediaUsageCollectionStaleSafely(db, collection, "CONTENT_USAGE_STALE");
533
- return updated;
534
- } catch (error) {
535
- if (contentMutated) await markContentMediaUsageCollectionStaleSafely(db, collection, "CONTENT_USAGE_STALE");
536
- throw error;
524
+ const repo = new ContentRepository(db);
525
+ const seoRepo = new SeoRepository(db);
526
+ const hasSeo = await assertSeoEnabled(seoRepo, collection, seo);
527
+ const snapshot = await repo.snapshot(collection, id);
528
+ if (!snapshot) throw new Error("Content not found");
529
+ const statements = hasFieldUpdates ? [repo.prepareUpdate(collection, id, { data: fields })] : [];
530
+ if (hasSeo && seo !== void 0) {
531
+ const write = seoRepo.prepareUpsert(collection, id, seo);
532
+ if (write) statements.push(write);
537
533
  }
534
+ if (hasFieldUpdates) statements.push(prepareContentMediaUsageCollectionStale(db, collection, "CONTENT_USAGE_STALE"));
535
+ await atomicBatch(db, {
536
+ checks: [
537
+ snapshot.check,
538
+ ...contentWriteChecks(collection, id, "edit"),
539
+ sql`COALESCE((SELECT has_seo FROM _dineway_collections WHERE slug = ${collection}), 0) = ${hasSeo ? 1 : 0}`
540
+ ],
541
+ statements
542
+ });
543
+ invalidateCollectionCache(collection);
544
+ const item = await repo.findById(collection, id);
545
+ if (!item) throw new Error("Content not found");
546
+ const result = toPluginContentItem(item);
547
+ if (hasSeo) result.seo = await seoRepo.get(collection, id);
548
+ return result;
538
549
  },
539
550
  async delete(collection, id) {
540
- const deleted = await new ContentRepository(db).delete(collection, id);
541
- if (deleted) await markContentMediaUsageCollectionStaleSafely(db, collection, "CONTENT_USAGE_STALE");
542
- return deleted;
551
+ const repo = new ContentRepository(db);
552
+ const snapshot = await repo.snapshot(collection, id);
553
+ if (!snapshot) return false;
554
+ const prepared = repo.prepareDelete(collection, id);
555
+ const [result] = await atomicBatch(db, {
556
+ checks: [snapshot.check, ...prepared.checks ?? []],
557
+ statements: [...prepared.statements, prepareContentMediaUsageCollectionStale(db, collection, "CONTENT_USAGE_STALE")]
558
+ });
559
+ invalidateCollectionCache(collection);
560
+ return (result?.numAffectedRows ?? 0n) > 0n;
543
561
  }
544
562
  };
545
563
  }
@@ -1,5 +1,5 @@
1
- import { n as resolveActorIdentity } from "./actor-DrJJsvy6.mjs";
2
- import { p as logSiteActivitySafely } from "./activity-events-BVo9rMUz.mjs";
1
+ import { i as resolveActorIdentity } from "./actor-DxUAJgQX.mjs";
2
+ import { p as logSiteActivitySafely } from "./activity-events-CiFN61xq.mjs";
3
3
 
4
4
  //#region src/api/context-route-helpers.ts
5
5
  function resolveContextRouteActor(locals) {
@@ -38,22 +38,26 @@ var CronExecutor = class {
38
38
  * 4. On failure: reset to idle (retry on next tick).
39
39
  */
40
40
  async tick() {
41
- const now = (/* @__PURE__ */ new Date()).toISOString();
42
41
  let processed = 0;
43
- const claimed = await sql`
42
+ for (let index = 0; index < 10; index++) {
43
+ const now = (/* @__PURE__ */ new Date()).toISOString();
44
+ const lease = ulid();
45
+ const task = (await sql`
44
46
  UPDATE _dineway_cron_tasks
45
- SET status = 'running', locked_at = ${now}
46
- WHERE id IN (
47
+ SET status = 'running', locked_at = ${now}, lease_token = ${lease}
48
+ WHERE status = 'idle' AND enabled = 1 AND next_run_at <= ${now} AND id IN (
47
49
  SELECT id FROM _dineway_cron_tasks
48
50
  WHERE next_run_at <= ${now}
49
51
  AND status = 'idle'
50
52
  AND enabled = 1
51
53
  ORDER BY next_run_at ASC
52
- LIMIT 10
54
+ LIMIT 1
53
55
  )
54
56
  RETURNING id, plugin_id, task_name, schedule, is_oneshot, data, next_run_at
55
- `.execute(this.db);
56
- for (const task of claimed.rows) {
57
+ `.execute(this.db)).rows[0];
58
+ if (!task) break;
59
+ const ownedOccurrence = sql`id = ${task.id} AND status = 'running' AND enabled = 1 AND lease_token = ${lease}
60
+ AND schedule = ${task.schedule} AND next_run_at = ${task.next_run_at} AND data IS NOT DISTINCT FROM ${task.data}`;
57
61
  let parsedData;
58
62
  if (task.data) try {
59
63
  parsedData = JSON.parse(task.data);
@@ -61,12 +65,13 @@ var CronExecutor = class {
61
65
  console.error(`[cron] Invalid JSON data for ${task.plugin_id}:${task.task_name}, skipping`);
62
66
  await sql`
63
67
  UPDATE _dineway_cron_tasks
64
- SET status = 'idle', locked_at = NULL
65
- WHERE id = ${task.id}
68
+ SET status = 'failed', enabled = 0, locked_at = NULL, lease_token = NULL
69
+ WHERE ${ownedOccurrence}
66
70
  `.execute(this.db);
67
71
  continue;
68
72
  }
69
73
  const event = {
74
+ executionId: `${task.id}:${task.is_oneshot ? task.schedule : task.next_run_at}`,
70
75
  name: task.task_name,
71
76
  data: parsedData,
72
77
  scheduledAt: task.next_run_at
@@ -83,35 +88,37 @@ var CronExecutor = class {
83
88
  const rawRetryCount = retryMeta?.retryCount;
84
89
  const retryCount = typeof rawRetryCount === "number" && Number.isFinite(rawRetryCount) && rawRetryCount > 0 ? Math.floor(rawRetryCount) : 0;
85
90
  if (retryCount >= MAX_ONESHOT_RETRIES) {
86
- console.error(`[cron] One-shot task ${task.plugin_id}:${task.task_name} exceeded ${MAX_ONESHOT_RETRIES} retries, removing`);
91
+ console.error(`[cron] One-shot task ${task.plugin_id}:${task.task_name} exceeded ${MAX_ONESHOT_RETRIES} retries, retaining failed task`);
87
92
  await sql`
88
- DELETE FROM _dineway_cron_tasks WHERE id = ${task.id}
93
+ UPDATE _dineway_cron_tasks SET status = 'failed', enabled = 0, locked_at = NULL, lease_token = NULL WHERE ${ownedOccurrence}
89
94
  `.execute(this.db);
90
95
  } else {
91
96
  const backoffMs = 6e4 * Math.pow(2, retryCount);
92
97
  await sql`
93
98
  UPDATE _dineway_cron_tasks
94
- SET status = 'idle', locked_at = NULL, next_run_at = ${new Date(Date.now() + backoffMs).toISOString()}, data = ${JSON.stringify({
99
+ SET status = 'idle', locked_at = NULL, lease_token = NULL, next_run_at = ${new Date(Date.now() + backoffMs).toISOString()}, data = ${JSON.stringify({
95
100
  ...parsedData,
96
101
  __dineway: {
97
102
  ...retryMeta,
98
103
  retryCount: retryCount + 1
99
104
  }
100
105
  })}
101
- WHERE id = ${task.id}
106
+ WHERE ${ownedOccurrence}
102
107
  `.execute(this.db);
103
108
  }
104
109
  } else await sql`
105
- DELETE FROM _dineway_cron_tasks WHERE id = ${task.id}
110
+ DELETE FROM _dineway_cron_tasks WHERE ${ownedOccurrence}
106
111
  `.execute(this.db);
107
112
  else await sql`
108
113
  UPDATE _dineway_cron_tasks
109
114
  SET status = 'idle',
110
- locked_at = NULL,
115
+ locked_at = NULL, lease_token = NULL,
111
116
  last_run_at = ${now},
112
117
  next_run_at = ${nextCronTime(task.schedule)}
113
- WHERE id = ${task.id}
118
+ WHERE ${ownedOccurrence}
114
119
  `.execute(this.db);
120
+ await sql`UPDATE _dineway_cron_tasks SET status = 'idle', locked_at = NULL, lease_token = NULL
121
+ WHERE id = ${task.id} AND status = 'running' AND lease_token = ${lease}`.execute(this.db);
115
122
  processed++;
116
123
  }
117
124
  return processed;
@@ -123,7 +130,7 @@ var CronExecutor = class {
123
130
  async recoverStaleLocks() {
124
131
  const result = await sql`
125
132
  UPDATE _dineway_cron_tasks
126
- SET status = 'idle', locked_at = NULL
133
+ SET status = 'idle', locked_at = NULL, lease_token = NULL
127
134
  WHERE status = 'running'
128
135
  AND locked_at < ${(/* @__PURE__ */ new Date(Date.now() - STALE_LOCK_MINUTES * 60 * 1e3)).toISOString()}
129
136
  `.execute(this.db);
@@ -155,18 +162,20 @@ var CronAccessImpl = class {
155
162
  validateTaskName(name);
156
163
  validateSchedule(opts.schedule);
157
164
  const oneshot = isOneShot(opts.schedule);
158
- const nextRun = oneshot ? opts.schedule : nextCronTime(opts.schedule);
165
+ const schedule = oneshot ? new Date(opts.schedule).toISOString() : opts.schedule;
166
+ const nextRun = oneshot ? schedule : nextCronTime(schedule);
159
167
  const dataJson = opts.data ? JSON.stringify(opts.data) : null;
160
168
  await sql`
161
169
  INSERT INTO _dineway_cron_tasks (id, plugin_id, task_name, schedule, is_oneshot, data, next_run_at, status, enabled)
162
- VALUES (${ulid()}, ${this.pluginId}, ${name}, ${opts.schedule}, ${oneshot ? 1 : 0}, ${dataJson}, ${nextRun}, 'idle', 1)
170
+ VALUES (${ulid()}, ${this.pluginId}, ${name}, ${schedule}, ${oneshot ? 1 : 0}, ${dataJson}, ${nextRun}, 'idle', 1)
163
171
  ON CONFLICT (plugin_id, task_name) DO UPDATE SET
164
- schedule = ${opts.schedule},
172
+ schedule = ${schedule},
165
173
  is_oneshot = ${oneshot ? 1 : 0},
166
174
  data = ${dataJson},
167
175
  next_run_at = ${nextRun},
168
176
  status = CASE WHEN _dineway_cron_tasks.status = 'running' THEN 'running' ELSE 'idle' END,
169
177
  locked_at = CASE WHEN _dineway_cron_tasks.status = 'running' THEN _dineway_cron_tasks.locked_at ELSE NULL END,
178
+ lease_token = CASE WHEN _dineway_cron_tasks.status = 'running' THEN _dineway_cron_tasks.lease_token ELSE NULL END,
170
179
  enabled = 1
171
180
  `.execute(this.db);
172
181
  this.reschedule();
@@ -180,12 +189,13 @@ var CronAccessImpl = class {
180
189
  }
181
190
  async list() {
182
191
  return (await sql`
183
- SELECT task_name, schedule, next_run_at, last_run_at
192
+ SELECT task_name, schedule, next_run_at, last_run_at, status
184
193
  FROM _dineway_cron_tasks
185
- WHERE plugin_id = ${this.pluginId} AND enabled = 1
194
+ WHERE plugin_id = ${this.pluginId} AND (enabled = 1 OR status = 'failed')
186
195
  ORDER BY next_run_at ASC
187
196
  `.execute(this.db)).rows.map((row) => ({
188
197
  name: row.task_name,
198
+ status: row.status,
189
199
  schedule: row.schedule,
190
200
  nextRunAt: row.next_run_at,
191
201
  lastRunAt: row.last_run_at
@@ -227,17 +237,11 @@ function isCronExpression(schedule) {
227
237
  return false;
228
238
  }
229
239
  }
230
- /**
231
- * Check if a schedule string is a one-shot (ISO 8601 datetime) rather than
232
- * a recurring cron expression.
233
- *
234
- * Tries to parse as a cron expression first. Only if that fails does it
235
- * attempt Date.parse. This avoids misclassifying cron range expressions
236
- * like "1-5 * * * *" which Date.parse accepts as valid dates.
237
- */
240
+ const ISO_DATETIME = /^\d{4}-\d{2}-\d{2}T/;
241
+ /** Croner accepts ISO timestamps too; distinguish those before testing cron patterns. */
238
242
  function isOneShot(schedule) {
239
- if (schedule.startsWith("@")) return false;
240
- if (isCronExpression(schedule)) return false;
243
+ if (ISO_DATETIME.test(schedule)) return !isNaN(Date.parse(schedule));
244
+ if (schedule.startsWith("@") || isCronExpression(schedule)) return false;
241
245
  return !isNaN(Date.parse(schedule));
242
246
  }
243
247
  /** Max length for a task name */
@@ -0,0 +1,8 @@
1
+ //#region src/db/d1-binding.ts
2
+ const D1_BINDING = Symbol.for("dineway:database:d1");
3
+ function d1Database(db) {
4
+ return Reflect.get(db.getExecutor().adapter, D1_BINDING);
5
+ }
6
+
7
+ //#endregion
8
+ export { d1Database as n, D1_BINDING as t };
@@ -0,0 +1,48 @@
1
+ import { t as D1_BINDING } from "./d1-binding-D6HZa3ks.mjs";
2
+ import { OperationNodeTransformer, SqliteAdapter, SqliteIntrospector, TableNode, WhereNode, sql } from "kysely";
3
+ import { D1Dialect } from "kysely-d1";
4
+
5
+ //#region src/db/d1-dialect.ts
6
+ var DinewayD1Adapter = class extends SqliteAdapter {
7
+ [D1_BINDING];
8
+ constructor(database) {
9
+ super();
10
+ this[D1_BINDING] = database;
11
+ }
12
+ async acquireMigrationLock() {
13
+ throw new Error("D1 schema changes require the explicit Dineway migration runner.");
14
+ }
15
+ };
16
+ var DinewayD1Dialect = class extends D1Dialect {
17
+ constructor(binding) {
18
+ super({ database: binding });
19
+ this.binding = binding;
20
+ }
21
+ createAdapter() {
22
+ return new DinewayD1Adapter(this.binding);
23
+ }
24
+ createIntrospector(db) {
25
+ const transformer = new D1IntrospectionFilter();
26
+ return new SqliteIntrospector(db.withPlugin({
27
+ transformQuery: ({ node }) => transformer.transformNode(node),
28
+ transformResult: async ({ result }) => result
29
+ }));
30
+ }
31
+ };
32
+ var D1IntrospectionFilter = class extends OperationNodeTransformer {
33
+ transformSelectQuery(node) {
34
+ const select = super.transformSelectQuery(node);
35
+ if (!select.from?.froms.some((from) => TableNode.is(from) && from.table.identifier.name === "sqlite_master")) return select;
36
+ const filter = sql`name NOT GLOB '_cf_*'`.toOperationNode();
37
+ return {
38
+ ...select,
39
+ where: select.where ? WhereNode.cloneWithOperation(select.where, "And", filter) : WhereNode.create(filter)
40
+ };
41
+ }
42
+ };
43
+ function createD1Dialect(database) {
44
+ return new DinewayD1Dialect(database);
45
+ }
46
+
47
+ //#endregion
48
+ export { createD1Dialect as t };
@@ -1,8 +1,8 @@
1
- import { t as validateIdentifier } from "./validate-VPnKoIzW.mjs";
2
- import { t as ContentRepository } from "./content-CVCrcuvD.mjs";
3
- import { t as MediaRepository } from "./media-dvRjj4po.mjs";
4
- import { t as UserRepository } from "./user-D0NJ7gYf.mjs";
5
- import { n as ReviewRequestRepository } from "./review-requests-DICrYH2-.mjs";
1
+ import { t as validateIdentifier } from "./validate-Co3j6T_K.mjs";
2
+ import { t as ContentRepository } from "./content-D9xKUSno.mjs";
3
+ import { t as MediaRepository } from "./media-BZqwtRTZ.mjs";
4
+ import { t as UserRepository } from "./user-1-YV30lf.mjs";
5
+ import { r as ReviewRequestRepository } from "./review-requests-BF2eEKr8.mjs";
6
6
  import { sql } from "kysely";
7
7
 
8
8
  //#region src/api/handlers/dashboard.ts
@@ -0,0 +1,22 @@
1
+ import { CompiledQuery, Kysely, QueryResult, RawBuilder } from "kysely";
2
+
3
+ //#region src/database/batch.d.ts
4
+ interface AtomicBatch {
5
+ /** Conditions evaluated inside the same transaction as all writes. */
6
+ checks?: readonly RawBuilder<boolean>[];
7
+ statements: readonly CompiledQuery[];
8
+ }
9
+ /** Place checks between composed writes while retaining native Node transactions. */
10
+ declare function prepareAtomicChecks<DB>(db: Kysely<DB>, checks: readonly RawBuilder<boolean>[]): CompiledQuery[];
11
+ declare class AtomicWriteConflict extends Error {
12
+ constructor();
13
+ }
14
+ declare function isD1Database<DB>(db: Kysely<DB>): boolean;
15
+ /** Guard a read used to prepare writes; pass the original database row, including its key. */
16
+ declare function rowUnchanged(table: string, row: Record<string, unknown>): RawBuilder<boolean>;
17
+ /** Called during explicit schema installation, never during a user write. */
18
+ declare function ensureAtomicBatchSchema<DB>(db: Kysely<DB>): Promise<void>;
19
+ /** Executes precompiled writes once; conflicts and unknown commit outcomes are never replayed. */
20
+ declare function atomicBatch<DB>(db: Kysely<DB>, batch: AtomicBatch): Promise<QueryResult<unknown>[]>;
21
+ //#endregion
22
+ export { AtomicBatch, AtomicWriteConflict, atomicBatch, ensureAtomicBatchSchema, isD1Database, prepareAtomicChecks, rowUnchanged };
@@ -0,0 +1,92 @@
1
+ import { n as d1Database } from "../d1-binding-D6HZa3ks.mjs";
2
+ import { getRequestContext } from "../request-context.mjs";
3
+ import { sql } from "kysely";
4
+ import { ulid } from "ulidx";
5
+
6
+ //#region src/database/batch.ts
7
+ const inlineChecks = /* @__PURE__ */ new WeakMap();
8
+ /** Place checks between composed writes while retaining native Node transactions. */
9
+ function prepareAtomicChecks(db, checks) {
10
+ return checks.flatMap((check) => {
11
+ const id = ulid();
12
+ const assertion = sql`INSERT INTO _dineway_atomic_guards(id,ok) VALUES(${id},CASE WHEN ${check} THEN 1 ELSE 0 END)`.compile(db);
13
+ const cleanup = sql`DELETE FROM _dineway_atomic_guards WHERE id=${id}`.compile(db);
14
+ inlineChecks.set(assertion, check);
15
+ inlineChecks.set(cleanup, null);
16
+ return [assertion, cleanup];
17
+ });
18
+ }
19
+ var AtomicWriteConflict = class extends Error {
20
+ constructor() {
21
+ super("Atomic write precondition failed");
22
+ this.name = "AtomicWriteConflict";
23
+ }
24
+ };
25
+ function isD1Database(db) {
26
+ return d1Database(db) !== void 0;
27
+ }
28
+ /** Guard a read used to prepare writes; pass the original database row, including its key. */
29
+ function rowUnchanged(table, row) {
30
+ const entries = Object.entries(row);
31
+ if (!entries.length) throw new Error("An atomic row check requires a nonempty database row.");
32
+ return sql`EXISTS (SELECT 1 FROM ${sql.table(table)} WHERE ${sql.join(entries.map(([column, value]) => sql`${sql.ref(column)} IS NOT DISTINCT FROM ${value}`), sql` AND `)})`;
33
+ }
34
+ /** Called during explicit schema installation, never during a user write. */
35
+ async function ensureAtomicBatchSchema(db) {
36
+ await sql`CREATE TABLE IF NOT EXISTS _dineway_atomic_guards (
37
+ id TEXT PRIMARY KEY,
38
+ ok INTEGER NOT NULL CONSTRAINT dineway_atomic_precondition CHECK (ok = 1)
39
+ )`.execute(db);
40
+ }
41
+ function assertQueryLimits(query) {
42
+ if (query.parameters.length > 100) throw new Error("D1 statements support at most 100 bound parameters.");
43
+ if (new TextEncoder().encode(query.sql).length > 1e5) throw new Error("D1 statements must not exceed 100 KB.");
44
+ }
45
+ /** Executes precompiled writes once; conflicts and unknown commit outcomes are never replayed. */
46
+ async function atomicBatch(db, batch) {
47
+ if (!batch.statements.length && !batch.checks?.length) return [];
48
+ const checks = [...await getRequestContext()?.prepareWriteChecks?.(db) ?? [], ...batch.checks ?? []];
49
+ const binding = d1Database(db);
50
+ if (!binding) {
51
+ const execute = async (transaction) => {
52
+ for (const check of checks) if ((await sql`SELECT CASE WHEN ${check} THEN 1 ELSE 0 END AS ok`.execute(transaction)).rows[0]?.ok !== 1) throw new AtomicWriteConflict();
53
+ const results = [];
54
+ try {
55
+ for (const statement of batch.statements) if (inlineChecks.has(statement)) {
56
+ const check = inlineChecks.get(statement);
57
+ if (check) {
58
+ if ((await sql`SELECT CASE WHEN ${check} THEN 1 ELSE 0 END AS ok`.execute(transaction)).rows[0]?.ok !== 1) throw new AtomicWriteConflict();
59
+ }
60
+ results.push({ rows: [] });
61
+ } else results.push(await transaction.executeQuery(statement));
62
+ } catch (error) {
63
+ if (error instanceof Error && `${error.message} ${String(error.cause)}`.includes("dineway_atomic_precondition")) throw new AtomicWriteConflict();
64
+ throw error;
65
+ }
66
+ return results;
67
+ };
68
+ return db.isTransaction ? execute(db) : db.transaction().execute(execute);
69
+ }
70
+ const id = ulid();
71
+ const statements = checks.length ? [
72
+ ...checks.map((check, index) => sql`INSERT INTO _dineway_atomic_guards (id, ok) VALUES (${sql.lit(`${id}:${index}`)}, CASE WHEN ${check} THEN 1 ELSE 0 END)`.compile(db)),
73
+ ...batch.statements,
74
+ sql`DELETE FROM _dineway_atomic_guards WHERE id GLOB ${`${id}:*`}`.compile(db)
75
+ ] : [...batch.statements];
76
+ if (!statements.length) return [];
77
+ for (const statement of statements) assertQueryLimits(statement);
78
+ try {
79
+ const results = await binding.batch(statements.map((statement) => binding.prepare(statement.sql).bind(...statement.parameters)));
80
+ return (checks.length ? results.slice(checks.length, -1) : results).map((result) => ({
81
+ rows: result.results,
82
+ numAffectedRows: BigInt(result.meta.changes),
83
+ insertId: BigInt(result.meta.last_row_id)
84
+ }));
85
+ } catch (error) {
86
+ if (error instanceof Error && `${error.message} ${String(error.cause)}`.includes("dineway_atomic_precondition")) throw new AtomicWriteConflict();
87
+ throw error;
88
+ }
89
+ }
90
+
91
+ //#endregion
92
+ export { AtomicWriteConflict, atomicBatch, ensureAtomicBatchSchema, isD1Database, prepareAtomicChecks, rowUnchanged };
@@ -0,0 +1,18 @@
1
+ import { At as ResolvedPlugin, ac as D1Migration, cc as migrateD1, lc as D1SchemaObject, oc as D1MigrationOptions, sc as assertD1Migrations, uc as compileD1Schema } from "../../types-Tt_IGMno.mjs";
2
+ import "../../types-CVRNRAA5.mjs";
3
+ import "../../runner-Cxl-vyk2.mjs";
4
+ import "../../index-mlJSqFkG.mjs";
5
+ import "../../types-SddyDti7.mjs";
6
+ import "../../public-url-zoO-QbN6.mjs";
7
+ import "../../validate-CCOsvPg2.mjs";
8
+ import "../../byline-fields-BO96fXLv.mjs";
9
+ import "../../types-CAD4OvmF.mjs";
10
+ import { Kysely } from "kysely";
11
+
12
+ //#region src/database/d1/release.d.ts
13
+ /** Explicit maintenance entry point. A failed release stays unavailable until a successful retry. */
14
+ declare function migrateD1Release<DB>(db: Kysely<DB>, plugins: readonly ResolvedPlugin[], options?: {
15
+ adopt?: boolean;
16
+ }): Promise<Record<string, string[]>>;
17
+ //#endregion
18
+ export { type D1Migration, type D1MigrationOptions, type D1SchemaObject, assertD1Migrations, compileD1Schema, migrateD1, migrateD1Release };
@@ -0,0 +1,8 @@
1
+ import { o as assertD1Migrations, s as migrateD1 } from "../../runner-CVeq0266.mjs";
2
+ import "../../d1-binding-D6HZa3ks.mjs";
3
+ import "../../dialect-helpers-C6xtO-Ui.mjs";
4
+ import "../../migrations-C7YXse7V.mjs";
5
+ import "../../state-D8AogXCV.mjs";
6
+ import { n as compileD1Schema, t as migrateD1Release } from "../../release-CZfAeyXm.mjs";
7
+
8
+ export { assertD1Migrations, compileD1Schema, migrateD1, migrateD1Release };
@@ -0,0 +1,7 @@
1
+ import { t as D1Config } from "../adapters-Rol-inz6.mjs";
2
+ import { Dialect } from "kysely";
3
+
4
+ //#region src/db/d1.d.ts
5
+ declare function createDialect(config: D1Config): Dialect;
6
+ //#endregion
7
+ export { createDialect };
package/dist/db/d1.mjs ADDED
@@ -0,0 +1,13 @@
1
+ import "../d1-binding-D6HZa3ks.mjs";
2
+ import { t as createD1Dialect } from "../d1-dialect-BBxPg6Om.mjs";
3
+ import { env } from "cloudflare:workers";
4
+
5
+ //#region src/db/d1.ts
6
+ function createDialect(config) {
7
+ const binding = Reflect.get(env, config.binding);
8
+ if (!binding || typeof binding !== "object" || !("prepare" in binding) || !("batch" in binding)) throw new Error(`Missing D1 database binding: ${config.binding}`);
9
+ return createD1Dialect(binding);
10
+ }
11
+
12
+ //#endregion
13
+ export { createDialect };
@@ -1,4 +1,4 @@
1
- import "../types-BRCUO8NR.mjs";
2
- import { i as runMigrations, n as getMigrationStatus, r as rollbackMigration, t as MigrationStatus } from "../runner-Dye73myO.mjs";
3
- import { a as PostgresConfig, c as libsqlHttp, i as LibsqlHttpConfig, l as postgres, n as DatabaseDialectType, o as SqliteConfig, r as LibsqlConfig, s as libsql, t as DatabaseDescriptor, u as sqlite } from "../adapters-DHt3f2lu.mjs";
4
- export { type DatabaseDescriptor, type DatabaseDialectType, type LibsqlConfig, type LibsqlHttpConfig, type MigrationStatus, type PostgresConfig, type SqliteConfig, getMigrationStatus, libsql, libsqlHttp, postgres, rollbackMigration, runMigrations, sqlite };
1
+ import "../types-CVRNRAA5.mjs";
2
+ import { i as runMigrations, n as getMigrationStatus, r as rollbackMigration, t as MigrationStatus } from "../runner-Cxl-vyk2.mjs";
3
+ import { a as PostgresConfig, c as libsql, i as LibsqlConfig, l as postgres, n as DatabaseDescriptor, o as SqliteConfig, r as DatabaseDialectType, s as d1, t as D1Config, u as sqlite } from "../adapters-Rol-inz6.mjs";
4
+ export { type D1Config, type DatabaseDescriptor, type DatabaseDialectType, type LibsqlConfig, type MigrationStatus, type PostgresConfig, type SqliteConfig, d1, getMigrationStatus, libsql, postgres, rollbackMigration, runMigrations, sqlite };