void 0.21.9 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/README.md +5 -1
  2. package/dist/{account-cmd-DZZGK80W.mjs → account-cmd-C84Ee8cO.mjs} +5 -5
  3. package/dist/{scan-ClYmX3sa.mjs → application-analysis-BVsVqc11.mjs} +135 -18
  4. package/dist/application-routing-B7QEjqSR.mjs +27 -0
  5. package/dist/{auth-CZuiVsFh.mjs → auth-CCjt0hcq.mjs} +1 -1
  6. package/dist/{auth-DLNN0D3Z.mjs → auth-CSkdO2Bb.mjs} +4 -47
  7. package/dist/{auth-link-B_CeugBw.mjs → auth-link-CioEg6uY.mjs} +5 -5
  8. package/dist/{auth-router-BgEFRuvZ.mjs → auth-router-BsR981d4.mjs} +5 -5
  9. package/dist/{better-auth-shared-rsBGBvWJ.mjs → better-auth-shared-hy6RPh9W.mjs} +13 -2
  10. package/dist/{build-cmd-Dpt0jd-x.mjs → build-cmd-LzvNJORH.mjs} +19 -7
  11. package/dist/{cache-7_UeZdTk.mjs → cache-C4MvnrMH.mjs} +4 -4
  12. package/dist/{cancel-deploy-D23R1RXT.mjs → cancel-deploy-abUxpP2n.mjs} +4 -4
  13. package/dist/{cf-build-output-CGT03qCD.mjs → cf-build-output-BPqOT964.mjs} +141 -63
  14. package/dist/cf-build-output-_0HNWysu.mjs +2 -0
  15. package/dist/cli/cli.mjs +114 -460
  16. package/dist/cli/cloudflare-operation-process.mjs +1103 -0
  17. package/dist/cli/env-schema-probe.d.mts +2 -1
  18. package/dist/cli/env-schema-probe.mjs +3 -3
  19. package/dist/client-Cu7jWiF1.mjs +2 -0
  20. package/dist/{client-QTl6ko_D.mjs → client-RV8NVeB8.mjs} +165 -21
  21. package/dist/{cloudflare-auth-C4_GPZr0.mjs → cloudflare-auth-Qdc7tw8F.mjs} +41 -43
  22. package/dist/{cloudflare-cmd-bSmZ1d5L.mjs → cloudflare-cmd-BcrVyTmJ.mjs} +9 -10
  23. package/dist/cloudflare-config-Bktvwtpf.mjs +182 -0
  24. package/dist/{cloudflare-connect-jAwacxxP.mjs → cloudflare-connect-B8uPZ4nx.mjs} +4 -4
  25. package/dist/{cloudflare-operations-BipGMJ5O.mjs → cloudflare-operations-AiWashgg.mjs} +1 -1
  26. package/dist/{cloudflare-operations-sMZXpk_S.mjs → cloudflare-operations-fxHb-byx.mjs} +118 -203
  27. package/dist/{preset-UHj9ARyP.mjs → cloudflare-process-B-wekeR6.mjs} +93 -6
  28. package/dist/{config-CF69HgXc.d.mts → config-BMHb8RCj.d.mts} +2 -2
  29. package/dist/{config-CafTW6Cz.mjs → config-Br_JZD6u.mjs} +2 -7
  30. package/dist/config-C_XRIPx2.mjs +89 -0
  31. package/dist/{config-s7Xj7tPb.mjs → config-CyQ-wVd7.mjs} +1 -1
  32. package/dist/config-entry.d.mts +1 -1
  33. package/dist/{config-write-BSduPMY8.mjs → config-write-B1f88wJA.mjs} +1 -1
  34. package/dist/{connect-BsUSRzln.mjs → connect-Bd4kJd9U.mjs} +6 -6
  35. package/dist/{create-project-BniEV0OW.mjs → create-project-Boczwj5r.mjs} +1 -1
  36. package/dist/{create-project-DBfFSZKY.mjs → create-project-bMf6ffLZ.mjs} +9 -5
  37. package/dist/{db-hRrvZaq_.mjs → db-8uG64XLl.mjs} +26 -26
  38. package/dist/{delete-D6dZ9B6B.mjs → delete-NvbiyeJf.mjs} +4 -4
  39. package/dist/{deploy-WaAQez1O.mjs → deploy-DzAIwqNU.mjs} +944 -607
  40. package/dist/{deploy-DDz7c8LK.mjs → deploy-bjXdFCtn.mjs} +1 -1
  41. package/dist/{dist-BR1quN_w.mjs → dist-AoCzRTJE.mjs} +226 -60
  42. package/dist/{dist-C5fND3R0.mjs → dist-BuDuKZJv.mjs} +1 -1
  43. package/dist/{dist-Dn6nn2IU.mjs → dist-CTBk70IR.mjs} +42 -42
  44. package/dist/{domain-Dmhvb2oU.mjs → domain-y5Tvydvo.mjs} +5 -5
  45. package/dist/{email-DFi-s2t4.mjs → email-B3umsW75.mjs} +15 -30
  46. package/dist/{env-Csi-tMbT.mjs → env-BS6qYHDb.mjs} +6 -6
  47. package/dist/{env-public-D_6u46fX.d.mts → env-public-BX_r8HR6.d.mts} +2 -1
  48. package/dist/{env-validation-BB4GkLxn.mjs → env-validation-BPn7vk-V.mjs} +18 -71
  49. package/dist/{env-validation-BXge7uyK.mjs → env-validation-DbTg7-ar.mjs} +1 -1
  50. package/dist/{fetch-CXDChK7B.mjs → fetch-BIZJh7vR.mjs} +2 -2
  51. package/dist/{fetch-stream-AOByI7Ki.mjs → fetch-stream-IvCYKyQL.mjs} +24 -4
  52. package/dist/{gen-Dz3X1Qab.mjs → gen-B580--vC.mjs} +5 -5
  53. package/dist/gen-BVaUUumi.mjs +2 -0
  54. package/dist/{github-cmd-BED3_9JD.mjs → github-cmd-v45BdfKX.mjs} +6 -8
  55. package/dist/{handler-BXJTXd02.d.mts → handler-CZ4nAylQ.d.mts} +2 -1
  56. package/dist/{headers-BOg_velo.mjs → headers-DWi2IXWx.mjs} +1 -1
  57. package/dist/help-DofyZuY7.mjs +2 -0
  58. package/dist/{help-DC7gdz7L.mjs → help-daGKjXGk.mjs} +268 -666
  59. package/dist/index.d.mts +1 -1
  60. package/dist/index.mjs +305 -1490
  61. package/dist/info-B97bTX9N.mjs +113 -0
  62. package/dist/{init-WO0JlPx8.mjs → init-Bvy7zrBo.mjs} +51 -20
  63. package/dist/limits-Bq5LG8Id.d.mts +27 -0
  64. package/dist/limits-Cjuk2VPm.mjs +68 -0
  65. package/dist/{link-CsHOinF7.mjs → link-CDqqCjFl.mjs} +5 -5
  66. package/dist/{list-CDb-4bZ1.mjs → list-CZj0dzKY.mjs} +5 -5
  67. package/dist/{live-CKiJilLr.d.mts → live-Chw1eIMv.d.mts} +1 -1
  68. package/dist/{local-d1-CC8sKFGu.mjs → local-d1-2CMnpuW_.mjs} +2 -2
  69. package/dist/login-DYt_An22.mjs +2 -0
  70. package/dist/{login-DvqXsfGs.mjs → login-UZKFM_u7.mjs} +5 -5
  71. package/dist/{logs-BdfiOezj.mjs → logs-CUZ6t9t3.mjs} +5 -5
  72. package/dist/migrate-8_2u55MD.mjs +2 -0
  73. package/dist/{migrate-B8KuoYsO.mjs → migrate-DHul7PRV.mjs} +5 -4
  74. package/dist/{node-BM43oz4G.mjs → node-BkyRWRx8.mjs} +2 -2
  75. package/dist/operator-args-CLgKGlwU.mjs +690 -0
  76. package/dist/{operator-cmd-03819ATr.mjs → operator-cmd-DBA6dl0m.mjs} +69 -23
  77. package/dist/output-Dm_A4Tbv.mjs +81 -0
  78. package/dist/pages/client.d.mts +34 -2
  79. package/dist/pages/client.mjs +59 -3
  80. package/dist/pages/index.d.mts +1 -1
  81. package/dist/pages/index.mjs +3 -3
  82. package/dist/pages/islands-plugin.d.mts +16 -6
  83. package/dist/pages/islands-plugin.mjs +2 -2
  84. package/dist/pages/protocol.d.mts +2 -2
  85. package/dist/pages/protocol.mjs +2 -308
  86. package/dist/{parse-filename-DioPHiR9.mjs → parse-filename-CUbj-1MP.mjs} +35 -1
  87. package/dist/{output-CCH48AMM.mjs → picocolors-BTps1_gs.mjs} +2 -76
  88. package/dist/plan-D1Q5rf-r.mjs +2 -0
  89. package/dist/plan-NPpwZ_kc.mjs +58 -0
  90. package/dist/platform-args-BJdRtlLq.mjs +506 -0
  91. package/dist/platform-args-D3RXyR6h.mjs +2 -0
  92. package/dist/{platform-auth-config-z92h63q5.mjs → platform-auth-config-B56E9YP1.mjs} +4 -4
  93. package/dist/{platform-auth-protection-DeE3yr2R.mjs → platform-auth-protection-BDWO_aER.mjs} +3 -3
  94. package/dist/{platform-auth-recovery-o_340Ixx.mjs → platform-auth-recovery-1gg4CSRe.mjs} +4 -4
  95. package/dist/{platform-cmd-C4ZV3Vpy.mjs → platform-cmd-Bt-1w6pY.mjs} +1 -1
  96. package/dist/{platform-cmd-DNl8WosH.mjs → platform-cmd-DMcQStSc.mjs} +26 -5
  97. package/dist/{platform-domain-CU1JtJkW.mjs → platform-domain-BNkcz0OB.mjs} +36 -9
  98. package/dist/{platform-lifecycle-Bc047IeT.mjs → platform-lifecycle-9OyBALhH.mjs} +850 -276
  99. package/dist/{platform-lifecycle-Bs2qx1E3.mjs → platform-lifecycle-BE6C_jxh.mjs} +1 -1
  100. package/dist/{platform-management-CVpGI9Y5.mjs → platform-management-CjwLVQwN.mjs} +59 -11
  101. package/dist/{platform-management-C8tt6D8h.mjs → platform-management-CnyTdcWX.mjs} +1 -1
  102. package/dist/platform-plans-config-BNGKGr4P.mjs +359 -0
  103. package/dist/{platform-recovery-dvUaptLr.mjs → platform-recovery-D6KSpuFm.mjs} +2 -2
  104. package/dist/{plugin-inference-BMfKRSqE.mjs → plugin-inference-CXWnn79A.mjs} +174 -64
  105. package/dist/{prepare-DyZ-Yok5.mjs → prepare-B5Mkic5u.mjs} +3 -3
  106. package/dist/{prepare-C3kt3Rst.mjs → prepare-DOsL0CC9.mjs} +4 -20
  107. package/dist/prepare-cgvDMtSb.mjs +2 -0
  108. package/dist/{project-cmd-B44I8J_W.mjs → project-cmd-CNzrqvBv.mjs} +30 -16
  109. package/dist/{project-team-BkbYIsXN.mjs → project-team-DQOWPfQT.mjs} +4 -4
  110. package/dist/{project-token-C8xEEQnB.mjs → project-token-CTDYU0Cc.mjs} +4 -4
  111. package/dist/project-zero-trust-BNAkW-_0.mjs +63 -0
  112. package/dist/{protocol-ZH3jP4a7.d.mts → protocol-CjF_iI9X.d.mts} +2 -2
  113. package/dist/protocol-U7bfjHmA.mjs +331 -0
  114. package/dist/{provision-DNtrtaVD.mjs → provision-C4ORE7G7.mjs} +1 -1
  115. package/dist/{provision-BhreDAOS.mjs → provision-CJFgTZY8.mjs} +111 -215
  116. package/dist/{requests-DFyhBMaf.mjs → requests-MhxYnau8.mjs} +4 -4
  117. package/dist/resource-name-C7LVpcRm.mjs +11 -0
  118. package/dist/{rollback-DHHxXZiS.mjs → rollback-CJ6iSDoU.mjs} +5 -5
  119. package/dist/route-url-CG7U-cRN.mjs +15 -0
  120. package/dist/{runner-B8wXwWlo.mjs → runner-CXA9Fh8h.mjs} +1 -1
  121. package/dist/{runner-p-dMs2UN.mjs → runner-Ol0TNjk6.mjs} +2 -2
  122. package/dist/runtime/ai.d.mts +12 -8
  123. package/dist/runtime/ai.mjs +84 -17
  124. package/dist/runtime/better-auth-mysql.mjs +1 -1
  125. package/dist/runtime/better-auth-pg.mjs +1 -1
  126. package/dist/runtime/better-auth.mjs +1 -1
  127. package/dist/runtime/client-react.mjs +2 -2
  128. package/dist/runtime/client-solid.mjs +2 -2
  129. package/dist/runtime/client-svelte.mjs +2 -2
  130. package/dist/runtime/client-vue.mjs +2 -2
  131. package/dist/runtime/client.mjs +2 -2
  132. package/dist/runtime/durable.d.mts +3 -1
  133. package/dist/runtime/durable.mjs +4 -1
  134. package/dist/runtime/email/testing.mjs +1 -1
  135. package/dist/runtime/env-public.d.mts +1 -1
  136. package/dist/runtime/fetch-stream.mjs +1 -1
  137. package/dist/runtime/fetch.mjs +1 -1
  138. package/dist/runtime/handler.d.mts +1 -1
  139. package/dist/runtime/kv.mjs +0 -1
  140. package/dist/runtime/limits.d.mts +2 -0
  141. package/dist/runtime/limits.mjs +2 -0
  142. package/dist/runtime/live-client.d.mts +1 -1
  143. package/dist/runtime/live-server.mjs +25 -16
  144. package/dist/runtime/live.d.mts +1 -1
  145. package/dist/runtime/migration-handler.mjs +62 -42
  146. package/dist/runtime/route-url.d.mts +4 -0
  147. package/dist/runtime/route-url.mjs +2 -0
  148. package/dist/runtime/routing.d.mts +180 -0
  149. package/dist/runtime/routing.mjs +1082 -0
  150. package/dist/runtime/sandbox-container.d.mts +3 -0
  151. package/dist/runtime/sandbox-container.mjs +2 -0
  152. package/dist/runtime/sandbox.d.mts +4 -32
  153. package/dist/runtime/sandbox.mjs +151 -75
  154. package/dist/runtime/sse.mjs +1 -1
  155. package/dist/runtime/validator.d.mts +1 -1
  156. package/dist/runtime/ws-server.d.mts +4 -2
  157. package/dist/runtime/ws-server.mjs +27 -2
  158. package/dist/runtime/ws.d.mts +2 -2
  159. package/dist/runtime/ws.mjs +8 -6
  160. package/dist/sandbox-XZAqzFlG.d.mts +52 -0
  161. package/dist/sandbox-container-Bo0eiFKz.d.mts +73 -0
  162. package/dist/sandbox-container-C6ItmVuN.mjs +281 -0
  163. package/dist/{scan-4tfN-PSn.mjs → scan-C7okrLyM.mjs} +4 -35
  164. package/dist/{secret-DN9sSNiV.mjs → secret-Dli5fP0B.mjs} +6 -6
  165. package/dist/{skills-O6FUaizK.mjs → skills-D1II1Juz.mjs} +1 -1
  166. package/dist/{sse-BaC1jXko.mjs → sse-CQNaDFFV.mjs} +6 -3
  167. package/dist/{subcommand-prompt-BuGYkAkC.mjs → subcommand-prompt-CY1C4fvl.mjs} +2 -2
  168. package/dist/validate-Dq_L3s0S.mjs +2 -0
  169. package/dist/{validate-CIUwFpjB.mjs → validate-ctOrgiS3.mjs} +2 -1
  170. package/dist/{wrangler-BymcxrRa.mjs → wrangler-7K-bW_DL.mjs} +14 -235
  171. package/dist/{ws-BwcqizuH.d.mts → ws-CL1w7GXU.d.mts} +13 -2
  172. package/package.json +48 -33
  173. package/sandbox.Dockerfile +4 -0
  174. package/schema.json +10 -22
  175. package/skills/migrate-vite-cloudflare-to-void/SKILL.md +34 -157
  176. package/skills/void/SKILL.md +50 -133
  177. package/skills/void/docs/guide/ai.md +94 -84
  178. package/skills/void/docs/guide/app-types.md +3 -32
  179. package/skills/void/docs/guide/auth.md +12 -116
  180. package/skills/void/docs/guide/database/d1.md +9 -54
  181. package/skills/void/docs/guide/database/mysql.md +1 -1
  182. package/skills/void/docs/guide/database/postgresql.md +5 -26
  183. package/skills/void/docs/guide/database.md +23 -75
  184. package/skills/void/docs/guide/deployment.md +27 -113
  185. package/skills/void/docs/guide/durable-state.md +43 -18
  186. package/skills/void/docs/guide/edge/headers.md +3 -47
  187. package/skills/void/docs/guide/edge/prerendering.md +5 -20
  188. package/skills/void/docs/guide/edge/redirects.md +11 -64
  189. package/skills/void/docs/guide/edge/revalidation.md +6 -19
  190. package/skills/void/docs/guide/edge/rewrites.md +56 -284
  191. package/skills/void/docs/guide/edge/static-assets.md +23 -72
  192. package/skills/void/docs/guide/email/domains.md +112 -0
  193. package/skills/void/docs/guide/email/receiving.md +139 -0
  194. package/skills/void/docs/guide/email/sending.md +231 -0
  195. package/skills/void/docs/guide/email.md +13 -619
  196. package/skills/void/docs/guide/env-migration.md +11 -11
  197. package/skills/void/docs/guide/env-vars.md +9 -29
  198. package/skills/void/docs/guide/index.md +0 -15
  199. package/skills/void/docs/guide/jobs.md +3 -18
  200. package/skills/void/docs/guide/kv.md +5 -11
  201. package/skills/void/docs/guide/live.md +5 -56
  202. package/skills/void/docs/guide/pages-routing/actions-and-forms.md +78 -125
  203. package/skills/void/docs/guide/pages-routing/head.md +10 -10
  204. package/skills/void/docs/guide/pages-routing/islands.md +6 -36
  205. package/skills/void/docs/guide/pages-routing/layouts.md +6 -128
  206. package/skills/void/docs/guide/pages-routing/loaders.md +3 -19
  207. package/skills/void/docs/guide/pages-routing/markdown.md +13 -171
  208. package/skills/void/docs/guide/pages-routing/overview.md +7 -17
  209. package/skills/void/docs/guide/pages-routing/view-transitions.md +1 -1
  210. package/skills/void/docs/guide/platform/administration/access.md +1 -4
  211. package/skills/void/docs/guide/platform/administration/email.md +35 -8
  212. package/skills/void/docs/guide/platform/administration/operations.md +26 -4
  213. package/skills/void/docs/guide/platform/administration/plans.md +126 -0
  214. package/skills/void/docs/guide/platform/administration/projects.md +5 -2
  215. package/skills/void/docs/guide/platform/administration/zero-trust.md +189 -0
  216. package/skills/void/docs/guide/platform/development/local.md +2 -2
  217. package/skills/void/docs/guide/platform/development/runtime.md +3 -13
  218. package/skills/void/docs/guide/platform/development/schema-ci.md +0 -58
  219. package/skills/void/docs/guide/platform/installation/credentials.md +6 -4
  220. package/skills/void/docs/guide/platform/installation/domains.md +31 -3
  221. package/skills/void/docs/guide/platform/installation/first-deployment.md +6 -0
  222. package/skills/void/docs/guide/platform/installation/maintenance.md +3 -1
  223. package/skills/void/docs/guide/platform/installation/prerequisites.md +21 -16
  224. package/skills/void/docs/guide/platform/installation/setup.md +9 -5
  225. package/skills/void/docs/guide/platform/installation/uninstall.md +17 -2
  226. package/skills/void/docs/guide/platform-administration.md +2 -0
  227. package/skills/void/docs/guide/queues.md +7 -9
  228. package/skills/void/docs/guide/quickstart.md +38 -37
  229. package/skills/void/docs/guide/remote-dev.md +4 -9
  230. package/skills/void/docs/guide/sandboxes.md +78 -41
  231. package/skills/void/docs/guide/server-routing.md +9 -72
  232. package/skills/void/docs/guide/sse.md +4 -18
  233. package/skills/void/docs/guide/ssg.md +3 -15
  234. package/skills/void/docs/guide/ssr.md +14 -62
  235. package/skills/void/docs/guide/storage.md +9 -4
  236. package/skills/void/docs/guide/type-safety.md +3 -14
  237. package/skills/void/docs/guide/typed-fetch.md +3 -7
  238. package/skills/void/docs/guide/websockets.md +68 -40
  239. package/skills/void/docs/integrations/agents.md +3 -3
  240. package/skills/void/docs/integrations/cloudflare.md +85 -316
  241. package/skills/void/docs/integrations/frameworks/analog.md +5 -64
  242. package/skills/void/docs/integrations/frameworks/astro.md +4 -73
  243. package/skills/void/docs/integrations/frameworks/nuxt.md +5 -62
  244. package/skills/void/docs/integrations/frameworks/overview.md +11 -54
  245. package/skills/void/docs/integrations/frameworks/react-router.md +5 -60
  246. package/skills/void/docs/integrations/frameworks/sveltekit.md +6 -65
  247. package/skills/void/docs/integrations/frameworks/tanstack-start.md +4 -62
  248. package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -69
  249. package/skills/void/docs/reference/api/auth.md +156 -0
  250. package/skills/void/docs/reference/api/client.md +87 -0
  251. package/skills/void/docs/reference/api/database.md +95 -0
  252. package/skills/void/docs/reference/api/durable.md +46 -0
  253. package/skills/void/docs/reference/api/env.md +50 -0
  254. package/skills/void/docs/reference/api/handlers.md +254 -0
  255. package/skills/void/docs/reference/api/pages.md +241 -0
  256. package/skills/void/docs/reference/api/plugin.md +39 -0
  257. package/skills/void/docs/reference/api/resources.md +109 -0
  258. package/skills/void/docs/reference/api/rewrites.md +76 -0
  259. package/skills/void/docs/reference/api/types.md +92 -0
  260. package/skills/void/docs/reference/api.md +56 -1218
  261. package/skills/void/docs/reference/cli/auth.md +88 -0
  262. package/skills/void/docs/reference/cli/database.md +128 -0
  263. package/skills/void/docs/reference/cli/deploy.md +85 -0
  264. package/skills/void/docs/reference/cli/domains.md +41 -0
  265. package/skills/void/docs/reference/cli/email.md +129 -0
  266. package/skills/void/docs/reference/cli/generate.md +116 -0
  267. package/skills/void/docs/reference/cli/github.md +189 -0
  268. package/skills/void/docs/reference/cli/platform-config.md +92 -0
  269. package/skills/void/docs/reference/cli/platform-email.md +81 -0
  270. package/skills/void/docs/reference/cli/platform-installation.md +127 -0
  271. package/skills/void/docs/reference/cli/platform-operations.md +90 -0
  272. package/skills/void/docs/reference/cli/platform-users.md +89 -0
  273. package/skills/void/docs/reference/cli/platform-zero-trust.md +45 -0
  274. package/skills/void/docs/reference/cli/platform.md +70 -0
  275. package/skills/void/docs/reference/cli/project.md +214 -0
  276. package/skills/void/docs/reference/cli/secrets.md +76 -0
  277. package/skills/void/docs/reference/cli/setup.md +70 -0
  278. package/skills/void/docs/reference/cli.md +33 -1621
  279. package/skills/void/docs/reference/config.md +26 -32
  280. package/skills/void/docs/reference/resource-inference.md +3 -58
  281. package/skills/void/docs/reference/structure.md +14 -41
  282. package/dist/canonical-json-DuDiiUsQ.mjs +0 -13
  283. package/dist/cli/cf-compat.mjs +0 -968
  284. package/dist/client-4cDVv7BO.mjs +0 -2
  285. package/dist/gen-Vnv2f65C.mjs +0 -2
  286. package/dist/help-DQMfeKMz.mjs +0 -2
  287. package/dist/login-DFQk7rbW.mjs +0 -2
  288. package/dist/migrate-TsHGBnDA.mjs +0 -2
  289. package/dist/plan-BEZ8VJW0.mjs +0 -256
  290. package/dist/plan-DpuOr14e.mjs +0 -2
  291. package/dist/prepare-BZXkjdNe.mjs +0 -2
  292. package/dist/validate-EKmJWxmy.mjs +0 -2
  293. /package/dist/cli/{cf-compat.d.mts → cloudflare-operation-process.d.mts} +0 -0
@@ -0,0 +1,15 @@
1
+ //#region src/runtime/route-url.ts
2
+ /** Expand complete route tokens without changing query strings or fragments. */
3
+ function interpolateRouteParams(path, params) {
4
+ if (!params) return path;
5
+ const suffixIndex = path.search(/[?#]/);
6
+ const pathname = suffixIndex === -1 ? path : path.slice(0, suffixIndex);
7
+ const suffix = suffixIndex === -1 ? "" : path.slice(suffixIndex);
8
+ return pathname.replace(/(^|\/):([^/{}]+)(\{\.\+\})?(?=\/|$)/g, (token, prefix, name, catchAll) => {
9
+ if (!Object.hasOwn(params, name)) return token;
10
+ const value = params[name];
11
+ return prefix + (catchAll ? value.split("/").map(encodeURIComponent).join("/") : encodeURIComponent(value));
12
+ }) + suffix;
13
+ }
14
+ //#endregion
15
+ export { interpolateRouteParams as t };
@@ -1,2 +1,2 @@
1
- import { i as openSqliteDatabase, n as getAppliedMigrations, o as runMigrations, r as getMiniflareDatabasePath, t as getApplicationTables } from "./runner-p-dMs2UN.mjs";
1
+ import { i as openSqliteDatabase, n as getAppliedMigrations, o as runMigrations, r as getMiniflareDatabasePath, t as getApplicationTables } from "./runner-Ol0TNjk6.mjs";
2
2
  export { getApplicationTables, getAppliedMigrations, getMiniflareDatabasePath, openSqliteDatabase, runMigrations };
@@ -1,7 +1,7 @@
1
1
  import { a as join, n as dirname } from "./dist-BVqXeR_h.mjs";
2
- import { n as hasPackageDependency, r as readNearestPackageJson } from "./package-json-DXfiT1jV.mjs";
3
2
  import { t as collectMigrations } from "./collect-DiTn9yr6.mjs";
4
- import { a as classifyMigration } from "./plan-BEZ8VJW0.mjs";
3
+ import { n as hasPackageDependency, r as readNearestPackageJson } from "./package-json-DXfiT1jV.mjs";
4
+ import { r as classifyMigration } from "./plan-NPpwZ_kc.mjs";
5
5
  import { existsSync, mkdirSync } from "node:fs";
6
6
  import { createHash, createHmac } from "node:crypto";
7
7
  //#region src/migrations/runner.ts
@@ -1,3 +1,4 @@
1
+ import { n as LimitOperation } from "../limits-Bq5LG8Id.mjs";
1
2
  //#region src/runtime/ai-types.d.ts
2
3
  type AiProviderName = "openai" | "anthropic" | "google-ai-studio" | "groq" | "mistral" | "grok" | "deepseek" | "openrouter" | "perplexity" | "cohere" | "cerebras" | "huggingface" | "replicate" | "baseten" | "cartesia" | "deepgram" | "elevenlabs" | "fal" | "ideogram" | "parallel";
3
4
  type AiProvider = AiProviderName | (string & {});
@@ -24,23 +25,26 @@ type AiProviderFetchInit = {
24
25
  * `stream()` calls `ai.run()` with `stream: true` and wraps the result
25
26
  * in a `Response` with SSE headers — ready to return from a route handler.
26
27
  */
27
- export type VoidAi = Omit<Ai, "run"> & {
28
+ export type VoidAi = {
29
+ models(...args: Parameters<Ai["models"]>): LimitOperation<Awaited<ReturnType<Ai["models"]>>>;
30
+ toMarkdown(files: Array<Parameters<Ai["toMarkdown"]>[0]>, options?: Parameters<Ai["toMarkdown"]>[1]): LimitOperation<Array<Awaited<ReturnType<Ai["toMarkdown"]>>>>;
31
+ toMarkdown(...args: Parameters<Ai["toMarkdown"]>): LimitOperation<Awaited<ReturnType<Ai["toMarkdown"]>>>;
28
32
  /** Workers AI inference (existing) */
29
- run<Name extends keyof AiModels>(model: Name, inputs: AiModels[Name]["inputs"], options?: AiOptions): Promise<AiModels[Name]["postProcessedOutputs"]>;
33
+ run<Name extends keyof AiModels>(model: Name, inputs: AiModels[Name]["inputs"], options?: AiOptions): LimitOperation<AiModels[Name]["postProcessedOutputs"]>;
30
34
  /** Cloudflare AI Gateway model inference. Accepts Cloudflare model IDs unchanged. */
31
- run(model: string, inputs: unknown, options?: AiOptions): Promise<unknown>;
35
+ run(model: string, inputs: unknown, options?: AiOptions): LimitOperation<unknown>;
32
36
  /** Image generation. Returns the proxy response so callers can return or parse it. */
33
- image<Name extends keyof AiModels>(model: Name, inputs: AiModels[Name]["inputs"], options?: AiOptions): Promise<Response>;
37
+ image<Name extends keyof AiModels>(model: Name, inputs: AiModels[Name]["inputs"], options?: AiOptions): LimitOperation<Response>;
34
38
  /** Cloudflare AI Gateway model inference returned as a Response. */
35
- image(model: string, inputs: unknown, options?: AiOptions): Promise<Response>;
39
+ image(model: string, inputs: unknown, options?: AiOptions): LimitOperation<Response>;
36
40
  /** Provider-native AI Gateway requests using a project secret for the provider API key. */
37
41
  provider(provider: AiProvider, options?: AiProviderOptions): {
38
- fetch(path: string, init?: AiProviderFetchInit): Promise<Response>;
42
+ fetch(path: string, init?: AiProviderFetchInit): LimitOperation<Response>;
39
43
  };
40
44
  /** Stream Workers AI response as SSE */
41
- stream<Name extends keyof AiModels>(model: Name, inputs: Omit<AiModels[Name]["inputs"], "stream">, options?: AiOptions): Promise<Response>;
45
+ stream<Name extends keyof AiModels>(model: Name, inputs: Omit<AiModels[Name]["inputs"], "stream">, options?: AiOptions): LimitOperation<Response>;
42
46
  /** Stream any Cloudflare AI Gateway model response as SSE */
43
- stream(model: string, inputs: Record<string, unknown>, options?: AiOptions): Promise<Response>;
47
+ stream(model: string, inputs: Record<string, unknown>, options?: AiOptions): LimitOperation<Response>;
44
48
  };
45
49
  export declare const ai: VoidAi;
46
50
  //#endregion
@@ -1,5 +1,6 @@
1
1
  import { t as cfAccessHeaders } from "../cf-access-DRsQRe6k.mjs";
2
2
  import { a as getRawRuntimeEnv } from "../env-raw-Cx8ElDdj.mjs";
3
+ import { a as readUsageLimit, i as limitOperation, r as limitFromResponse, t as UsageLimit } from "../limits-Cjuk2VPm.mjs";
3
4
  //#region src/runtime/ai-types.ts
4
5
  /** Maps provider prefix to expected env var name for the API key */
5
6
  const PROVIDER_KEY_MAP = {
@@ -315,6 +316,8 @@ function makeServiceBindingBackend(proxy, runtimeEnv) {
315
316
  ...body
316
317
  })
317
318
  });
319
+ const limit = await limitFromResponse(res, "ai");
320
+ if (limit) throw limit;
318
321
  if (options.throwOnError !== false && !res.ok) {
319
322
  const text = await res.text();
320
323
  throw new Error(`ai: Proxy request failed with ${res.status}: '${text}'.`);
@@ -395,6 +398,8 @@ function makeHttpBackend(token, projectId, runtimeEnv) {
395
398
  }),
396
399
  redirect: "manual"
397
400
  });
401
+ const limit = await limitFromResponse(res, "ai");
402
+ if (limit) throw limit;
398
403
  if (options.throwOnError !== false && !res.ok) {
399
404
  const text = await res.text();
400
405
  throw new Error(`ai: Proxy request failed with ${res.status}: '${text}'.`);
@@ -434,11 +439,24 @@ function makeHttpBackend(token, projectId, runtimeEnv) {
434
439
  };
435
440
  }
436
441
  function makeDirectBackend(directAi, runtimeEnv, gatewayId) {
442
+ const run = async (model, inputs, options) => {
443
+ const opts = options ?? {};
444
+ const response = await directAi.run(model, inputs, {
445
+ ...opts,
446
+ returnRawResponse: true
447
+ });
448
+ if (!(response instanceof Response)) return response;
449
+ const limit = await limitFromResponse(response, "ai");
450
+ if (limit) throw limit;
451
+ if (opts.returnRawResponse || opts.websocket) return response;
452
+ if (!response.ok) throw new Error(`ai: Request failed with ${response.status}: '${await response.text()}'.`);
453
+ return isJsonMediaType(mediaTypeFromContentType(response.headers.get("content-type"))) ? response.json() : response.body;
454
+ };
437
455
  return {
438
- run: directAi.run.bind(directAi),
456
+ run,
439
457
  async image(model, inputs, options) {
440
458
  const { runOptions } = splitImageOptions(options);
441
- return responseFromResult(await directAi.run(model, inputs, runOptions));
459
+ return responseFromResult(await run(model, inputs, runOptions));
442
460
  },
443
461
  async providerFetch(provider, path, init, options) {
444
462
  if (!gatewayId) return Response.json({ error: "ai: ai.provider().fetch() needs an AI Gateway when self-hosting. Set \"ai\": { \"gateway\": \"<id>\" } in void.json." }, { status: 501 });
@@ -474,22 +492,71 @@ let _backend;
474
492
  function backend() {
475
493
  return _backend ??= resolveBackend();
476
494
  }
495
+ /** Normalize provider 429 responses and binding quota failures before they reach callers. */
496
+ function aiOperation(execute, rawStream = false) {
497
+ return limitOperation(async () => {
498
+ const value = await execute();
499
+ if (value instanceof Response) {
500
+ const limit = await limitFromResponse(value, "ai");
501
+ if (limit) throw limit;
502
+ }
503
+ return value;
504
+ }, classifyAiLimit, (value, limited) => {
505
+ if (value instanceof Response && value.body && value.headers.get("content-type")?.includes("text/event-stream")) return new Response(streamResponse(value.body, limited).body, value);
506
+ if (rawStream && value instanceof ReadableStream) return streamResponse(value, limited).body;
507
+ return value;
508
+ });
509
+ }
510
+ function classifyAiLimit(error) {
511
+ if (error instanceof UsageLimit) return error;
512
+ const e = error;
513
+ return e && (e.status === 429 || e.statusCode === 429 || e.response?.status === 429) ? new UsageLimit({
514
+ resource: "ai",
515
+ reason: "rate_limit",
516
+ message: "AI usage limit exceeded."
517
+ }) : null;
518
+ }
519
+ /** Streaming failures after headers are sent end with an explicit terminal SSE event. */
520
+ function streamResponse(body, limited) {
521
+ const reader = body.getReader();
522
+ return new Response(new ReadableStream({
523
+ async pull(controller) {
524
+ try {
525
+ const chunk = await reader.read();
526
+ if (chunk.done) controller.close();
527
+ else controller.enqueue(chunk.value);
528
+ } catch (error) {
529
+ const limit = classifyAiLimit(error);
530
+ let data = { message: "Generation was interrupted. Please try again." };
531
+ if (limit) {
532
+ data = await limit.response().json();
533
+ try {
534
+ const fallback = await limited(limit);
535
+ if (fallback instanceof Response) data = readUsageLimit(await fallback.json().catch(() => null)) ?? data;
536
+ } catch {}
537
+ }
538
+ controller.enqueue(new TextEncoder().encode(`event: ${limit ? "void:limit" : "void:error"}\ndata: ${JSON.stringify(data)}\n\n`));
539
+ controller.close();
540
+ }
541
+ },
542
+ cancel(reason) {
543
+ return reader.cancel(reason);
544
+ }
545
+ }), { headers: {
546
+ "content-type": "text/event-stream",
547
+ "cache-control": "no-cache"
548
+ } });
549
+ }
477
550
  const ai = new Proxy({}, { get(_, prop) {
478
- if (prop === "stream") return async (model, inputs, options) => {
479
- const body = await backend().run(model, {
480
- ...inputs,
481
- stream: true
482
- }, options);
483
- return new Response(body, { headers: {
484
- "content-type": "text/event-stream",
485
- "cache-control": "no-cache"
486
- } });
487
- };
488
- if (prop === "run") return backend().run;
489
- if (prop === "image") return backend().image;
490
- if (prop === "provider") return (provider, options) => ({ fetch: (path, init) => backend().providerFetch(provider, path, init, options) });
491
- if (prop === "models") return backend().models;
492
- if (prop === "toMarkdown") return backend().toMarkdown;
551
+ if (prop === "stream") return (model, inputs, options) => aiOperation(async () => new Response(await backend().run(model, {
552
+ ...inputs,
553
+ stream: true
554
+ }, options), { headers: {
555
+ "content-type": "text/event-stream",
556
+ "cache-control": "no-cache"
557
+ } }));
558
+ if (prop === "provider") return (provider, options) => ({ fetch: (path, init) => aiOperation(() => backend().providerFetch(provider, path, init, options)) });
559
+ if (prop === "run" || prop === "image" || prop === "models" || prop === "toMarkdown") return (...args) => aiOperation(() => backend()[prop](...args), prop === "run" && hasStreamFlag(args[1]) && args[1].stream === true);
493
560
  } });
494
561
  //#endregion
495
562
  export { ai };
@@ -1,5 +1,5 @@
1
1
  import { t as applyMySqlAuthMigrations } from "../auth-migrations-9vif1uj8.mjs";
2
- import { t as createVoidAuthRuntime } from "../better-auth-shared-rsBGBvWJ.mjs";
2
+ import { t as createVoidAuthRuntime } from "../better-auth-shared-hy6RPh9W.mjs";
3
3
  //#region src/runtime/better-auth-mysql.ts
4
4
  function resolveConnectionString(env) {
5
5
  const connectionString = typeof env.DATABASE_URL === "string" && env.DATABASE_URL.length > 0 ? env.DATABASE_URL : typeof env.HYPERDRIVE?.connectionString === "string" && env.HYPERDRIVE.connectionString.length > 0 ? env.HYPERDRIVE.connectionString : void 0;
@@ -1,5 +1,5 @@
1
1
  import { n as applyPgAuthMigrations } from "../auth-migrations-9vif1uj8.mjs";
2
- import { t as createVoidAuthRuntime } from "../better-auth-shared-rsBGBvWJ.mjs";
2
+ import { t as createVoidAuthRuntime } from "../better-auth-shared-hy6RPh9W.mjs";
3
3
  import { t as disablePgPassFallback } from "../pg-J2HbZIkX.mjs";
4
4
  //#region src/runtime/better-auth-pg.ts
5
5
  function resolveConnectionString(env) {
@@ -1,5 +1,5 @@
1
1
  import { r as applySqliteAuthMigrations } from "../auth-migrations-9vif1uj8.mjs";
2
- import { t as createVoidAuthRuntime } from "../better-auth-shared-rsBGBvWJ.mjs";
2
+ import { t as createVoidAuthRuntime } from "../better-auth-shared-hy6RPh9W.mjs";
3
3
  //#region src/runtime/better-auth.ts
4
4
  async function resolveDatabase(env) {
5
5
  if (!env.DB) throw new Error("auth: Better Auth requires the \"DB\" D1 binding for sqlite apps.");
@@ -1,5 +1,5 @@
1
1
  import { t as FetchError } from "../fetch-error-Dj3crt0e.mjs";
2
- import { t as fetch } from "../fetch-CXDChK7B.mjs";
3
- import { t as fetchStream } from "../fetch-stream-AOByI7Ki.mjs";
2
+ import { t as fetch } from "../fetch-BIZJh7vR.mjs";
3
+ import { t as fetchStream } from "../fetch-stream-IvCYKyQL.mjs";
4
4
  import { n as createAuthClient, t as auth } from "../auth-client-react-CMLwT2xI.mjs";
5
5
  export { FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
@@ -1,5 +1,5 @@
1
1
  import { t as FetchError } from "../fetch-error-Dj3crt0e.mjs";
2
- import { t as fetch } from "../fetch-CXDChK7B.mjs";
3
- import { t as fetchStream } from "../fetch-stream-AOByI7Ki.mjs";
2
+ import { t as fetch } from "../fetch-BIZJh7vR.mjs";
3
+ import { t as fetchStream } from "../fetch-stream-IvCYKyQL.mjs";
4
4
  import { n as createAuthClient, t as auth } from "../auth-client-solid-UoreJWZG.mjs";
5
5
  export { FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
@@ -1,5 +1,5 @@
1
1
  import { t as FetchError } from "../fetch-error-Dj3crt0e.mjs";
2
- import { t as fetch } from "../fetch-CXDChK7B.mjs";
3
- import { t as fetchStream } from "../fetch-stream-AOByI7Ki.mjs";
2
+ import { t as fetch } from "../fetch-BIZJh7vR.mjs";
3
+ import { t as fetchStream } from "../fetch-stream-IvCYKyQL.mjs";
4
4
  import { n as createAuthClient, t as auth } from "../auth-client-svelte-Cv_WvrRk.mjs";
5
5
  export { FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
@@ -1,5 +1,5 @@
1
1
  import { t as FetchError } from "../fetch-error-Dj3crt0e.mjs";
2
- import { t as fetch } from "../fetch-CXDChK7B.mjs";
3
- import { t as fetchStream } from "../fetch-stream-AOByI7Ki.mjs";
2
+ import { t as fetch } from "../fetch-BIZJh7vR.mjs";
3
+ import { t as fetchStream } from "../fetch-stream-IvCYKyQL.mjs";
4
4
  import { n as createAuthClient, t as auth } from "../auth-client-vue-CFk7Xbv3.mjs";
5
5
  export { FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
@@ -1,5 +1,5 @@
1
1
  import { t as FetchError } from "../fetch-error-Dj3crt0e.mjs";
2
- import { t as fetch } from "../fetch-CXDChK7B.mjs";
3
- import { t as fetchStream } from "../fetch-stream-AOByI7Ki.mjs";
2
+ import { t as fetch } from "../fetch-BIZJh7vR.mjs";
3
+ import { t as fetchStream } from "../fetch-stream-IvCYKyQL.mjs";
4
4
  import { n as createAuthClient, t as auth } from "../auth-client-BWBT8HLp.mjs";
5
5
  export { FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
@@ -25,6 +25,8 @@ export type DurableStateClass<TMethods> = {
25
25
  };
26
26
  };
27
27
  export type DurableStateDefinition<TState, TEnv extends Record<string, unknown>, TMethods extends DurableStateMethods<TState, TEnv>> = {
28
+ /** Optional persistent resource name. Pin the name reported by `void info` before moving this definition. */
29
+ name?: string;
28
30
  initialState: TState | ((env: TEnv) => TState | Promise<TState>);
29
31
  /** Current persisted state version. Defaults to 0. */
30
32
  version?: number;
@@ -37,7 +39,7 @@ export type DurableStateDefinition<TState, TEnv extends Record<string, unknown>,
37
39
  export type DurableStateApi<TMethods> = {
38
40
  class: DurableStateClass<TMethods>;
39
41
  /** @internal Called by Void's generated worker entry. */
40
- __bind(bindingName: string): void;
42
+ __bind(bindingName: string, resourceName?: string): void;
41
43
  get(name: string): TypedDurableObjectStub<TMethods>;
42
44
  get(namespace: DurableObjectNamespace, name: string): TypedDurableObjectStub<TMethods>;
43
45
  getById(id: DurableObjectId): TypedDurableObjectStub<TMethods>;
@@ -1,3 +1,4 @@
1
+ import { t as isResourceName } from "../resource-name-C7LVpcRm.mjs";
1
2
  import { a as requireRuntimeBinding, o as withRuntimeEnv } from "../env-D5liuQYR.mjs";
2
3
  import { DurableObject } from "cloudflare:workers";
3
4
  //#region src/runtime/durable.ts
@@ -17,6 +18,7 @@ function assertMigrations(version, migrations) {
17
18
  return byVersion;
18
19
  }
19
20
  function defineDurableState(definition) {
21
+ if (definition.name !== void 0 && !isResourceName(definition.name)) throw new Error("durable: name must contain a word starting with a letter.");
20
22
  const version = definition.version ?? 0;
21
23
  if (!Number.isInteger(version) || version < 0) throw new Error("durable: version must be a non-negative integer.");
22
24
  const migrations = assertMigrations(version, definition.migrations ?? []);
@@ -126,7 +128,8 @@ function defineDurableState(definition) {
126
128
  }
127
129
  return {
128
130
  class: VoidDurableState,
129
- __bind(name) {
131
+ __bind(name, resourceName) {
132
+ if (definition.name !== resourceName) throw new Error("durable: name must be statically discoverable in defineDurableState(). Run void info to inspect this definition.");
130
133
  if (bindingName && bindingName !== name) throw new Error(`durable: state definition is already bound to '${bindingName}' and cannot also bind to '${name}'.`);
131
134
  bindingName = name;
132
135
  },
@@ -1,6 +1,6 @@
1
1
  import { i as normalizeEmail, r as buildMime } from "../../mime-D5Nmdzf7.mjs";
2
- import { y as registerEmailSink } from "../../dev-inbox-P0u4tM8Y.mjs";
3
2
  import { n as compileEmailPattern, t as compareEmailRoutes } from "../../email--tEtMoj_.mjs";
3
+ import { y as registerEmailSink } from "../../dev-inbox-P0u4tM8Y.mjs";
4
4
  import { i as createMessageProxy, n as MAX_INBOUND_HEADERS, t as MAX_INBOUND_BYTES } from "../../inbound-aVHEUhKo.mjs";
5
5
  //#region src/runtime/email/testing.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
1
  /// <reference types="@cloudflare/workers-types" />
2
2
  import { a as number, c as url, i as json, n as boolean, o as oneOf, r as email, s as string, t as EnvSchema } from "../env-helpers-CyKtOBpj.mjs";
3
- import { a as _getSchemaDefaults, c as defineEnv, i as _getRegisteredSchema, l as env, n as EnvValidationReport, o as _hasRegisteredSchema, r as ValidatedEnv, s as _validateEnvOnce, t as EnvValidationError, u as validateAllEnv } from "../env-public-D_6u46fX.mjs";
3
+ import { a as _getSchemaDefaults, c as defineEnv, i as _getRegisteredSchema, l as env, n as EnvValidationReport, o as _hasRegisteredSchema, r as ValidatedEnv, s as _validateEnvOnce, t as EnvValidationError, u as validateAllEnv } from "../env-public-BX_r8HR6.mjs";
4
4
  export { type EnvSchema, EnvValidationError, EnvValidationReport, ValidatedEnv, _getRegisteredSchema, _getSchemaDefaults, _hasRegisteredSchema, _validateEnvOnce, boolean, defineEnv, email, env, json, number, oneOf, string, url, validateAllEnv };
@@ -1,3 +1,3 @@
1
1
  import { t as FetchError } from "../fetch-error-Dj3crt0e.mjs";
2
- import { t as fetchStream } from "../fetch-stream-AOByI7Ki.mjs";
2
+ import { t as fetchStream } from "../fetch-stream-IvCYKyQL.mjs";
3
3
  export { FetchError as StreamError, fetchStream };
@@ -1,3 +1,3 @@
1
1
  import { t as FetchError } from "../fetch-error-Dj3crt0e.mjs";
2
- import { t as fetch } from "../fetch-CXDChK7B.mjs";
2
+ import { t as fetch } from "../fetch-BIZJh7vR.mjs";
3
3
  export { FetchError, fetch };
@@ -1,3 +1,3 @@
1
1
  /// <reference types="@cloudflare/workers-types" />
2
- import { C as defer, E as ValidatorSlots, S as InferProps, T as HandlerInput, _ as defineQueue, a as CloudEnv, b as Deferred, c as QueueRetryOptions, d as TypedQueueHandler, f as VoidAssetRewriteError, g as defineMiddleware, h as defineHead, i as CloudContextVariables, l as RenderAssetTags, m as defineHandler, n as CloudBindings, o as QueueBatch, p as basicAuth, r as CloudContext, s as QueueMessage, t as BasicAuthOptions, u as TypedHandler, v as defineRender, w as ValidationError, y as defineScheduled } from "../handler-BXJTXd02.mjs";
2
+ import { C as defer, E as ValidatorSlots, S as InferProps, T as HandlerInput, _ as defineQueue, a as CloudEnv, b as Deferred, c as QueueRetryOptions, d as TypedQueueHandler, f as VoidAssetRewriteError, g as defineMiddleware, h as defineHead, i as CloudContextVariables, l as RenderAssetTags, m as defineHandler, n as CloudBindings, o as QueueBatch, p as basicAuth, r as CloudContext, s as QueueMessage, t as BasicAuthOptions, u as TypedHandler, v as defineRender, w as ValidationError, y as defineScheduled } from "../handler-CZ4nAylQ.mjs";
3
3
  export { BasicAuthOptions, CloudBindings, CloudContext, CloudContextVariables, CloudEnv, type Deferred, type HandlerInput, type InferProps, QueueBatch, QueueMessage, QueueRetryOptions, RenderAssetTags, TypedHandler, TypedQueueHandler, ValidationError, type ValidatorSlots, VoidAssetRewriteError, basicAuth, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled };
@@ -9,7 +9,6 @@ function parseValue(raw) {
9
9
  }
10
10
  }
11
11
  function serializeValue(value) {
12
- if (typeof value === "string") return value;
13
12
  return JSON.stringify(value);
14
13
  }
15
14
  function getListCursor(result) {
@@ -0,0 +1,2 @@
1
+ import { a as asUsageLimit, c as readUsageLimit, i as UsageLimitData, n as LimitOperation, o as limitFromResponse, r as UsageLimit, s as limitOperation, t as LimitHandlers } from "../limits-Bq5LG8Id.mjs";
2
+ export { LimitHandlers, LimitOperation, UsageLimit, type UsageLimitData, asUsageLimit, limitFromResponse, limitOperation, readUsageLimit };
@@ -0,0 +1,2 @@
1
+ import { a as readUsageLimit, i as limitOperation, n as asUsageLimit, r as limitFromResponse, t as UsageLimit } from "../limits-Cjuk2VPm.mjs";
2
+ export { UsageLimit, asUsageLimit, limitFromResponse, limitOperation, readUsageLimit };
@@ -1,4 +1,4 @@
1
- import { t as LiveClientEvent } from "../live-CKiJilLr.mjs";
1
+ import { t as LiveClientEvent } from "../live-Chw1eIMv.mjs";
2
2
  //#region src/runtime/live-client.d.ts
3
3
  export type LiveSubscribeOptions<Data = unknown> = {
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import { n as eventStream } from "../sse-BaC1jXko.mjs";
1
+ import { n as eventStream } from "../sse-CQNaDFFV.mjs";
2
2
  import { t as __getLiveBindingName } from "../live-CB1y5IuC.mjs";
3
3
  //#region src/runtime/live-server.ts
4
4
  const GENERATION_KEY = "connection:generation";
@@ -42,16 +42,18 @@ function createLiveDurableObject() {
42
42
  if (previous) {
43
43
  const active = [...previous.subscriptions.values()].filter((sub) => sub.active);
44
44
  for (const subscription of previous.subscriptions.values()) subscription.active = false;
45
- await previous.stream.close().catch(() => {});
45
+ previous.abort.abort();
46
46
  await Promise.all(active.map((sub) => this.unregisterTopic(message.streamId, message.connectionId, sub)));
47
47
  }
48
48
  const generation = (await this.state.storage.get(GENERATION_KEY) ?? 0) + 1;
49
49
  await this.state.storage.put(GENERATION_KEY, generation);
50
+ const abort = new AbortController();
50
51
  return eventStream(async (stream) => {
51
52
  const subscriptions = previous?.owner === message.owner ? previous.subscriptions : /* @__PURE__ */ new Map();
52
53
  for (const subscription of subscriptions.values()) subscription.active = false;
53
54
  this.connection = {
54
55
  stream,
56
+ abort,
55
57
  owner: message.owner,
56
58
  generation,
57
59
  subscriptions,
@@ -59,17 +61,22 @@ function createLiveDurableObject() {
59
61
  queued: 0,
60
62
  limits: message.limits
61
63
  };
62
- await stream.comment("connected");
63
- await stream.closed;
64
- if (this.connection?.generation === generation) {
65
- const active = [...this.connection.subscriptions.values()].filter((sub) => sub.active);
66
- this.connection = null;
64
+ try {
65
+ await stream.comment("connected");
66
+ await stream.closed;
67
+ } finally {
68
+ const active = [...subscriptions.values()].filter((sub) => sub.active && sub.generation === generation);
69
+ for (const sub of active) sub.active = false;
70
+ if (this.connection?.generation === generation) this.connection = null;
67
71
  await Promise.all(active.map((sub) => this.unregisterTopic(message.streamId, message.connectionId, sub)));
68
72
  }
69
- }, { keepAlive: {
70
- intervalMs: 15e3,
71
- comment: "keep-alive"
72
- } });
73
+ }, {
74
+ signal: abort.signal,
75
+ keepAlive: {
76
+ intervalMs: 15e3,
77
+ comment: "keep-alive"
78
+ }
79
+ });
73
80
  }
74
81
  async control(message) {
75
82
  const connection = this.connection;
@@ -174,8 +181,8 @@ function createLiveDurableObject() {
174
181
  continue;
175
182
  }
176
183
  if (connection.queued >= connection.limits.maxQueuedEventsPerConnection) {
177
- await connection.stream.close().catch(() => {});
178
- this.connection = null;
184
+ connection.abort.abort();
185
+ if (this.connection === connection) this.connection = null;
179
186
  return new Response("connection queue full", { status: 410 });
180
187
  }
181
188
  const event = {
@@ -193,7 +200,7 @@ function createLiveDurableObject() {
193
200
  data: event
194
201
  })).catch(() => {
195
202
  if (this.connection === activeConnection) this.connection = null;
196
- connection.stream.close().catch(() => {});
203
+ connection.abort.abort();
197
204
  }).finally(() => {
198
205
  connection.queued--;
199
206
  });
@@ -275,7 +282,8 @@ function createLiveDurableObject() {
275
282
  if (outcome.status === "rejected") throw outcome.reason;
276
283
  const response = outcome.value;
277
284
  const items = batch[index][1];
278
- if (!response || response.status === 410 || response.status === 404) {
285
+ if (!response) continue;
286
+ if (response.status === 410 || response.status === 404) {
279
287
  await this.state.storage.delete(items.map((item) => item.key));
280
288
  continue;
281
289
  }
@@ -316,7 +324,8 @@ function createLiveDurableObject() {
316
324
  if (outcome.status === "rejected") throw outcome.reason;
317
325
  const response = outcome.value;
318
326
  const items = batch[index][1];
319
- if (!response || response.status === 410 || response.status === 404) {
327
+ if (!response) continue;
328
+ if (response.status === 410 || response.status === 404) {
320
329
  staleKeys.push(...items.map((item) => item.key));
321
330
  continue;
322
331
  }
@@ -1,3 +1,3 @@
1
1
  /// <reference types="@cloudflare/workers-types" />
2
- import { _ as __getLiveBindingName, a as LiveControlErrorCode, c as LiveControlOptions, d as LiveHookContext, f as LiveLimits, g as LiveSubscribeHookContext, h as LiveStreamOptions, i as LiveControlError, l as LiveControlRequest, m as LiveStream, n as LiveConnectHookContext, o as LiveControlOperation, p as LivePublishOptions, r as LiveConnectOptions, s as LiveControlOperationResult, t as LiveClientEvent, u as LiveControlResponse, v as __setLiveBindingName, y as defineLiveStream } from "../live-CKiJilLr.mjs";
2
+ import { _ as __getLiveBindingName, a as LiveControlErrorCode, c as LiveControlOptions, d as LiveHookContext, f as LiveLimits, g as LiveSubscribeHookContext, h as LiveStreamOptions, i as LiveControlError, l as LiveControlRequest, m as LiveStream, n as LiveConnectHookContext, o as LiveControlOperation, p as LivePublishOptions, r as LiveConnectOptions, s as LiveControlOperationResult, t as LiveClientEvent, u as LiveControlResponse, v as __setLiveBindingName, y as defineLiveStream } from "../live-Chw1eIMv.mjs";
3
3
  export { LiveClientEvent, LiveConnectHookContext, LiveConnectOptions, LiveControlError, LiveControlErrorCode, LiveControlOperation, LiveControlOperationResult, LiveControlOptions, LiveControlRequest, LiveControlResponse, LiveHookContext, LiveLimits, LivePublishOptions, LiveStream, LiveStreamOptions, LiveSubscribeHookContext, __getLiveBindingName, __setLiveBindingName, defineLiveStream };