void 0.22.0 → 0.24.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.
- package/AGENTS_TEMPLATE.md +1 -1
- package/README.md +5 -1
- package/dist/{account-cmd-CjyxcGkM.mjs → account-cmd-vJhh5lrb.mjs} +5 -5
- package/dist/{scan-ClYmX3sa.mjs → application-analysis-BVsVqc11.mjs} +135 -18
- package/dist/application-routing-B7QEjqSR.mjs +27 -0
- package/dist/{auth-DLNN0D3Z.mjs → auth-CQkSDS50.mjs} +26 -96
- package/dist/auth-DX3JURcX.mjs +2 -0
- package/dist/{auth-link-BLO4ptzo.mjs → auth-link-D75t9wO2.mjs} +5 -5
- package/dist/{auth-router-ZUg9MF_U.mjs → auth-router-ClfhL1J7.mjs} +7 -7
- package/dist/{better-auth-shared-rsBGBvWJ.mjs → better-auth-shared-hy6RPh9W.mjs} +13 -2
- package/dist/{build-cmd-BxR5FROK.mjs → build-cmd-zMi1iFnS.mjs} +21 -9
- package/dist/{cache-D0sWhgKI.mjs → cache-ZtQmyxVV.mjs} +5 -5
- package/dist/{cancel-deploy-D4NUqFbi.mjs → cancel-deploy-Box0kkEV.mjs} +5 -5
- package/dist/{cf-access-P0iZnu0q.mjs → cf-access-BGe5sWXF.mjs} +4 -48
- package/dist/{cf-access-DRsQRe6k.mjs → cf-access-TWNzXltp.mjs} +3 -11
- package/dist/{cf-build-output-BJ6yGEIS.mjs → cf-build-output-BPqOT964.mjs} +2 -1
- package/dist/cf-build-output-_0HNWysu.mjs +2 -0
- package/dist/cli/cli.mjs +89 -461
- package/dist/cli/{cf-compat.mjs → cloudflare-operation-process.mjs} +454 -424
- package/dist/cli/env-schema-probe.d.mts +2 -1
- package/dist/cli/env-schema-probe.mjs +4 -4
- package/dist/client-B9UBI03V.mjs +2 -0
- package/dist/{client-BTZ3XkrB.mjs → client-DKAsFA4X.mjs} +161 -24
- package/dist/{cloudflare-auth-DQkqoMYa.mjs → cloudflare-auth-Qdc7tw8F.mjs} +41 -38
- package/dist/{cloudflare-cmd-BKlfGHAy.mjs → cloudflare-cmd-CmY8dGkd.mjs} +6 -6
- package/dist/cloudflare-config-Bktvwtpf.mjs +182 -0
- package/dist/{cloudflare-connect-Ctmrw579.mjs → cloudflare-connect-IiR3ZieC.mjs} +4 -4
- package/dist/{cloudflare-operations-BT6OWFBk.mjs → cloudflare-operations-BCdXSsmo.mjs} +1 -1
- package/dist/{cloudflare-operations-B9tzgjmf.mjs → cloudflare-operations-DzH-A966.mjs} +116 -172
- package/dist/{preset-UHj9ARyP.mjs → cloudflare-process-B-wekeR6.mjs} +93 -6
- package/dist/{config-VavjpDnp.d.mts → config-BMHb8RCj.d.mts} +1 -0
- package/dist/config-C_XRIPx2.mjs +89 -0
- package/dist/config-entry.d.mts +1 -1
- package/dist/{connect-Dg-WkW-C.mjs → connect-B-usTnlF.mjs} +9 -9
- package/dist/{create-project-l9J7pbtm.mjs → create-project-CYOOAYcn.mjs} +12 -12
- package/dist/{create-project-DdoqwFLF.mjs → create-project-FWbf5Olo.mjs} +1 -1
- package/dist/{db-gp2sCXyN.mjs → db-Ck2eZ2iB.mjs} +26 -26
- package/dist/{delete-TTedbH6B.mjs → delete-sK56qtzZ.mjs} +5 -5
- package/dist/{deploy-CH-o2CaZ.mjs → deploy-gCVaiJbS.mjs} +984 -616
- package/dist/{deploy-B19L2Bra.mjs → deploy-irP5q0-x.mjs} +1 -1
- package/dist/{domain-JRF59P_r.mjs → domain-DFfQE8jg.mjs} +6 -6
- package/dist/{email-Bo6G9LOZ.mjs → email-CdnhUHvJ.mjs} +15 -30
- package/dist/{env-BYOrWQnv.mjs → env-DmGdHi5i.mjs} +8 -8
- package/dist/{env-public-BxU_0yTL.d.mts → env-public-BX_r8HR6.d.mts} +1 -1
- package/dist/{env-types-C2_bIk_b.mjs → env-types-D5kds_OZ.mjs} +1 -1
- package/dist/{env-validation-BB4GkLxn.mjs → env-validation-C_8tPdhs.mjs} +20 -73
- package/dist/{env-validation-BXge7uyK.mjs → env-validation-zZOCcQVZ.mjs} +1 -1
- package/dist/{fetch-CXDChK7B.mjs → fetch-BIZJh7vR.mjs} +2 -2
- package/dist/{fetch-stream-AOByI7Ki.mjs → fetch-stream-IvCYKyQL.mjs} +24 -4
- package/dist/{gen-sCtlCOdA.mjs → gen-CshAkukR.mjs} +4 -4
- package/dist/gen-DvQTWzDU.mjs +2 -0
- package/dist/{github-cmd-0-7PexDq.mjs → github-cmd-DftuEvIt.mjs} +13 -13
- package/dist/{handler-HEcZsaij.d.mts → handler-CZ4nAylQ.d.mts} +1 -1
- package/dist/{headers-DWi2IXWx.mjs → headers-2rKda9Y6.mjs} +1 -1
- package/dist/{help-GKtwl07I.mjs → help-Dotbf6iz.mjs} +236 -750
- package/dist/help-mabuIV98.mjs +2 -0
- package/dist/{inbound-aVHEUhKo.mjs → inbound-fRkqcXaC.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +299 -1517
- package/dist/info-B97bTX9N.mjs +113 -0
- package/dist/{init-FZx3Elvz.mjs → init-BTQEZZGJ.mjs} +61 -27
- package/dist/limits-Bq5LG8Id.d.mts +27 -0
- package/dist/limits-Cjuk2VPm.mjs +68 -0
- package/dist/{link-BrQfb_CU.mjs → link-B46sYH0K.mjs} +6 -6
- package/dist/{list-D44jmIAM.mjs → list-BnPrIsU_.mjs} +6 -6
- package/dist/{live-CKJlvlNp.d.mts → live-Chw1eIMv.d.mts} +1 -1
- package/dist/{local-d1-Bg9OzEEO.mjs → local-d1-2CMnpuW_.mjs} +2 -2
- package/dist/log-vqY3pqwI.mjs +29 -0
- package/dist/{login-CAsAsQ-_.mjs → login-BuiMyUrx.mjs} +8 -8
- package/dist/login-DIy9Sb-U.mjs +2 -0
- package/dist/{logs-BjKvFnVM.mjs → logs-CZG9d-ic.mjs} +10 -11
- package/dist/migrate-BCiJ8w0f.mjs +2 -0
- package/dist/{migrate-BPITvDJN.mjs → migrate-q4_njtaW.mjs} +4 -3
- package/dist/{node-Dt7z256D.mjs → node-BkyRWRx8.mjs} +1 -1
- package/dist/operator-args-B3BTmSoi.mjs +697 -0
- package/dist/{operator-auth-8KnOVXVd.mjs → operator-auth-7erYc6Lt.mjs} +2 -2
- package/dist/{operator-client-DUwumHpQ.mjs → operator-client-CpHjTd0t.mjs} +3 -3
- package/dist/{operator-cmd-BK5CCiT9.mjs → operator-cmd-DGqPJUD3.mjs} +70 -24
- package/dist/{output-Dm_A4Tbv.mjs → output-CbM85T4k.mjs} +18 -10
- package/dist/pages/client.d.mts +34 -2
- package/dist/pages/client.mjs +59 -3
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +2 -2
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +2 -308
- package/dist/{parse-filename-DioPHiR9.mjs → parse-filename-CUbj-1MP.mjs} +35 -1
- package/dist/plan-D1Q5rf-r.mjs +2 -0
- package/dist/plan-NPpwZ_kc.mjs +58 -0
- package/dist/platform-args-3k8X9-H_.mjs +514 -0
- package/dist/platform-args-DdnM6WIf.mjs +2 -0
- package/dist/{platform-auth-config-BlN8xTdD.mjs → platform-auth-config-DDrxUy4m.mjs} +6 -6
- package/dist/{platform-auth-protection-7d5aV2Jg.mjs → platform-auth-protection-BLadnnct.mjs} +8 -8
- package/dist/{platform-auth-recovery-Dxij8ZbR.mjs → platform-auth-recovery-CmCzX2Fl.mjs} +6 -6
- package/dist/{platform-cmd-B3hwKrFK.mjs → platform-cmd-DMDEc9uS.mjs} +29 -8
- package/dist/{platform-cmd-E0FuL212.mjs → platform-cmd-pMTRhvYs.mjs} +1 -1
- package/dist/{platform-domain-D6Xcy9ZX.mjs → platform-domain-Di6EYrQl.mjs} +5 -5
- package/dist/{platform-lifecycle-k0E0xoxx.mjs → platform-lifecycle-BBoNzojY.mjs} +1541 -572
- package/dist/{platform-lifecycle-DMh_qrry.mjs → platform-lifecycle-BFdSi9Qt.mjs} +1 -1
- package/dist/{platform-management-Brz_BDiT.mjs → platform-management-CWOQOWXm.mjs} +10 -7
- package/dist/{platform-management-DOtss0BN.mjs → platform-management-DG47jys8.mjs} +1 -1
- package/dist/platform-plans-config-Vl9BP3H4.mjs +359 -0
- package/dist/{platform-recovery-BvtcXON5.mjs → platform-recovery-BJnQJEtQ.mjs} +4 -4
- package/dist/{platform-registry-QBa4DK32.mjs → platform-registry-DkPPXfp_.mjs} +2 -2
- package/dist/{plugin-inference-BMfKRSqE.mjs → plugin-inference-CXWnn79A.mjs} +174 -64
- package/dist/{prepare-C-6YZyyg.mjs → prepare-CBLT3CHH.mjs} +3 -3
- package/dist/prepare-CnjcTV2s.mjs +2 -0
- package/dist/{prepare-CRhJbVrG.mjs → prepare-DnaKBi--.mjs} +5 -21
- package/dist/{project-C0Fqu05O.mjs → project-DKG5Ra8p.mjs} +15 -82
- package/dist/project-DsblYifa.mjs +2 -0
- package/dist/{project-cmd-BZLCqOqw.mjs → project-cmd-DxnXstAq.mjs} +19 -19
- package/dist/{project-team-BvgM0WoX.mjs → project-team-BmHcaALJ.mjs} +5 -5
- package/dist/{project-token-l5DqK6Az.mjs → project-token-GionZlBI.mjs} +5 -5
- package/dist/{project-zero-trust-v6Mvpp8y.mjs → project-zero-trust-JLCjVQA7.mjs} +5 -5
- package/dist/prompts-2TGE6oXx.mjs +2 -0
- package/dist/prompts-BNUoTiaf.mjs +2044 -0
- package/dist/{protocol-BBa6cstI.d.mts → protocol-CjF_iI9X.d.mts} +2 -2
- package/dist/protocol-U7bfjHmA.mjs +331 -0
- package/dist/{provision-Fr9pRqce.mjs → provision-CVku1JFU.mjs} +1 -1
- package/dist/{provision-C4IGqkBf.mjs → provision-CaoxO_U7.mjs} +90 -199
- package/dist/{requests-DN-BbNiM.mjs → requests-BOjIVAeF.mjs} +5 -5
- package/dist/resource-name-C7LVpcRm.mjs +11 -0
- package/dist/{rollback-D7rzSaZM.mjs → rollback-CwR3pLj3.mjs} +6 -6
- package/dist/route-url-CG7U-cRN.mjs +15 -0
- package/dist/{runner-B8wXwWlo.mjs → runner-CXA9Fh8h.mjs} +1 -1
- package/dist/{runner-p-dMs2UN.mjs → runner-Ol0TNjk6.mjs} +2 -2
- package/dist/runtime/ai.d.mts +12 -8
- package/dist/runtime/ai.mjs +87 -22
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.mjs +2 -2
- package/dist/runtime/client-solid.mjs +2 -2
- package/dist/runtime/client-svelte.mjs +2 -2
- package/dist/runtime/client-vue.mjs +2 -2
- package/dist/runtime/client.mjs +2 -2
- package/dist/runtime/durable.d.mts +3 -1
- package/dist/runtime/durable.mjs +4 -1
- package/dist/runtime/email/testing.mjs +2 -2
- package/dist/runtime/email.mjs +1 -1
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/kv.mjs +0 -1
- package/dist/runtime/limits.d.mts +2 -0
- package/dist/runtime/limits.mjs +2 -0
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +25 -16
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/migration-handler.mjs +62 -42
- package/dist/runtime/remote/index.mjs +2 -2
- package/dist/runtime/route-url.d.mts +4 -0
- package/dist/runtime/route-url.mjs +2 -0
- package/dist/runtime/routing.d.mts +180 -0
- package/dist/runtime/routing.mjs +1082 -0
- package/dist/runtime/sandbox-container.d.mts +1 -1
- package/dist/runtime/sandbox-container.mjs +1 -1
- package/dist/runtime/sandbox.d.mts +3 -3
- package/dist/runtime/sandbox.mjs +75 -45
- package/dist/runtime/sse.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +4 -2
- package/dist/runtime/ws-server.mjs +27 -2
- package/dist/runtime/ws.d.mts +2 -2
- package/dist/runtime/ws.mjs +8 -6
- package/dist/{sandbox-qpNBT8a3.d.mts → sandbox-XZAqzFlG.d.mts} +11 -8
- package/dist/{sandbox-container-DdNEBfCc.d.mts → sandbox-container-Bo0eiFKz.d.mts} +2 -1
- package/dist/{sandbox-container-4fdqLnyb.mjs → sandbox-container-C6ItmVuN.mjs} +4 -2
- package/dist/{scan-4tfN-PSn.mjs → scan-C7okrLyM.mjs} +4 -35
- package/dist/{secret-BOtOl_cb.mjs → secret-ByWJWBUG.mjs} +7 -7
- package/dist/{skills-D1II1Juz.mjs → skills-C1PlclPt.mjs} +1 -1
- package/dist/{sse-BaC1jXko.mjs → sse-CQNaDFFV.mjs} +6 -3
- package/dist/{subcommand-prompt-CY1C4fvl.mjs → subcommand-prompt-klFCfcor.mjs} +40 -32
- package/dist/validate-Dq_L3s0S.mjs +2 -0
- package/dist/{validate-CIUwFpjB.mjs → validate-ctOrgiS3.mjs} +2 -1
- package/dist/{wrangler-DQF1vKyf.mjs → wrangler-7K-bW_DL.mjs} +8 -239
- package/dist/{ws-BoY7vQML.d.mts → ws-CL1w7GXU.d.mts} +13 -2
- package/package.json +16 -10
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +34 -157
- package/skills/void/SKILL.md +55 -135
- package/skills/void/docs/guide/ai.md +94 -84
- package/skills/void/docs/guide/app-types.md +3 -32
- package/skills/void/docs/guide/auth.md +12 -116
- package/skills/void/docs/guide/database/d1.md +9 -54
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +5 -26
- package/skills/void/docs/guide/database.md +23 -75
- package/skills/void/docs/guide/deployment.md +48 -112
- package/skills/void/docs/guide/durable-state.md +43 -18
- package/skills/void/docs/guide/edge/headers.md +4 -48
- package/skills/void/docs/guide/edge/prerendering.md +5 -20
- package/skills/void/docs/guide/edge/redirects.md +11 -64
- package/skills/void/docs/guide/edge/revalidation.md +5 -18
- package/skills/void/docs/guide/edge/rewrites.md +56 -284
- package/skills/void/docs/guide/edge/static-assets.md +22 -72
- package/skills/void/docs/guide/email/domains.md +116 -0
- package/skills/void/docs/guide/email/receiving.md +139 -0
- package/skills/void/docs/guide/email/sending.md +231 -0
- package/skills/void/docs/guide/email.md +13 -619
- package/skills/void/docs/guide/env-migration.md +11 -11
- package/skills/void/docs/guide/env-vars.md +9 -29
- package/skills/void/docs/guide/index.md +0 -15
- package/skills/void/docs/guide/jobs.md +3 -18
- package/skills/void/docs/guide/kv.md +5 -11
- package/skills/void/docs/guide/live.md +5 -56
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +78 -125
- package/skills/void/docs/guide/pages-routing/head.md +10 -10
- package/skills/void/docs/guide/pages-routing/islands.md +6 -36
- package/skills/void/docs/guide/pages-routing/layouts.md +6 -128
- package/skills/void/docs/guide/pages-routing/loaders.md +3 -19
- package/skills/void/docs/guide/pages-routing/markdown.md +13 -171
- package/skills/void/docs/guide/pages-routing/overview.md +7 -17
- package/skills/void/docs/guide/pages-routing/view-transitions.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +1 -4
- package/skills/void/docs/guide/platform/administration/email.md +35 -8
- package/skills/void/docs/guide/platform/administration/operations.md +26 -4
- package/skills/void/docs/guide/platform/administration/plans.md +126 -0
- package/skills/void/docs/guide/platform/administration/projects.md +5 -2
- package/skills/void/docs/guide/platform/administration/zero-trust.md +49 -160
- package/skills/void/docs/guide/platform/development/runtime.md +3 -13
- package/skills/void/docs/guide/platform/development/schema-ci.md +0 -58
- package/skills/void/docs/guide/platform/installation/ci.md +1 -1
- package/skills/void/docs/guide/platform/installation/credentials.md +15 -6
- package/skills/void/docs/guide/platform/installation/domains.md +35 -2
- package/skills/void/docs/guide/platform/installation/first-deployment.md +4 -2
- package/skills/void/docs/guide/platform/installation/maintenance.md +15 -1
- package/skills/void/docs/guide/platform/installation/prerequisites.md +24 -18
- package/skills/void/docs/guide/platform/installation/setup.md +88 -14
- package/skills/void/docs/guide/platform-administration.md +1 -0
- package/skills/void/docs/guide/queues.md +7 -9
- package/skills/void/docs/guide/quickstart.md +38 -37
- package/skills/void/docs/guide/remote-dev.md +5 -10
- package/skills/void/docs/guide/sandboxes.md +29 -21
- package/skills/void/docs/guide/server-routing.md +9 -72
- package/skills/void/docs/guide/sse.md +4 -18
- package/skills/void/docs/guide/ssg.md +3 -15
- package/skills/void/docs/guide/ssr.md +14 -62
- package/skills/void/docs/guide/storage.md +9 -4
- package/skills/void/docs/guide/type-safety.md +3 -14
- package/skills/void/docs/guide/typed-fetch.md +3 -7
- package/skills/void/docs/guide/websockets.md +68 -40
- package/skills/void/docs/integrations/agents.md +3 -3
- package/skills/void/docs/integrations/cloudflare.md +85 -316
- package/skills/void/docs/integrations/frameworks/analog.md +5 -64
- package/skills/void/docs/integrations/frameworks/astro.md +4 -73
- package/skills/void/docs/integrations/frameworks/nuxt.md +5 -62
- package/skills/void/docs/integrations/frameworks/overview.md +11 -54
- package/skills/void/docs/integrations/frameworks/react-router.md +5 -60
- package/skills/void/docs/integrations/frameworks/sveltekit.md +6 -65
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +4 -62
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -69
- package/skills/void/docs/reference/api/auth.md +156 -0
- package/skills/void/docs/reference/api/client.md +87 -0
- package/skills/void/docs/reference/api/database.md +95 -0
- package/skills/void/docs/reference/api/durable.md +46 -0
- package/skills/void/docs/reference/api/env.md +50 -0
- package/skills/void/docs/reference/api/handlers.md +254 -0
- package/skills/void/docs/reference/api/pages.md +241 -0
- package/skills/void/docs/reference/api/plugin.md +39 -0
- package/skills/void/docs/reference/api/resources.md +109 -0
- package/skills/void/docs/reference/api/rewrites.md +76 -0
- package/skills/void/docs/reference/api/types.md +92 -0
- package/skills/void/docs/reference/api.md +56 -1218
- package/skills/void/docs/reference/cli/auth.md +89 -0
- package/skills/void/docs/reference/cli/database.md +128 -0
- package/skills/void/docs/reference/cli/deploy.md +105 -0
- package/skills/void/docs/reference/cli/domains.md +41 -0
- package/skills/void/docs/reference/cli/email.md +129 -0
- package/skills/void/docs/reference/cli/generate.md +116 -0
- package/skills/void/docs/reference/cli/github.md +189 -0
- package/skills/void/docs/reference/cli/platform-config.md +92 -0
- package/skills/void/docs/reference/cli/platform-email.md +81 -0
- package/skills/void/docs/reference/cli/platform-installation.md +142 -0
- package/skills/void/docs/reference/cli/platform-operations.md +90 -0
- package/skills/void/docs/reference/cli/platform-users.md +89 -0
- package/skills/void/docs/reference/cli/platform-zero-trust.md +59 -0
- package/skills/void/docs/reference/cli/platform.md +70 -0
- package/skills/void/docs/reference/cli/project.md +214 -0
- package/skills/void/docs/reference/cli/secrets.md +76 -0
- package/skills/void/docs/reference/cli/setup.md +70 -0
- package/skills/void/docs/reference/cli.md +32 -1682
- package/skills/void/docs/reference/config.md +12 -18
- package/skills/void/docs/reference/resource-inference.md +3 -58
- package/skills/void/docs/reference/structure.md +14 -41
- package/dist/auth-CZuiVsFh.mjs +0 -2
- package/dist/canonical-json-DuDiiUsQ.mjs +0 -13
- package/dist/client-Czz8o5jP.mjs +0 -2
- package/dist/dist-BuDuKZJv.mjs +0 -2
- package/dist/dist-CTBk70IR.mjs +0 -1310
- package/dist/gen-CNJ62MM7.mjs +0 -2
- package/dist/help-CmZzxUba.mjs +0 -2
- package/dist/log-ChfPKsVd.mjs +0 -26
- package/dist/login-CGcRKEoi.mjs +0 -2
- package/dist/migrate-CYfbKkXh.mjs +0 -2
- package/dist/plan-BEZ8VJW0.mjs +0 -256
- package/dist/plan-DpuOr14e.mjs +0 -2
- package/dist/prepare-Bm3iq-u4.mjs +0 -2
- package/dist/project-BuUwfj6f.mjs +0 -2
- package/dist/validate-EKmJWxmy.mjs +0 -2
- /package/dist/cli/{cf-compat.d.mts → cloudflare-operation-process.d.mts} +0 -0
package/dist/runtime/ai.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as cfAccessHeaders } from "../cf-access-
|
|
1
|
+
import { t as cfAccessHeaders } from "../cf-access-TWNzXltp.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 = {
|
|
@@ -26,8 +27,6 @@ const PROVIDER_KEY_MAP = {
|
|
|
26
27
|
};
|
|
27
28
|
//#endregion
|
|
28
29
|
//#region src/runtime/ai.ts
|
|
29
|
-
const PROXY_URL = "https://proxy.void.cloud/ai";
|
|
30
|
-
const STAGING_PROXY_URL = "https://proxy.staging.void.cloud/ai";
|
|
31
30
|
const VOID_FILE_MARKER = "__voidFile";
|
|
32
31
|
const PROVIDER_AUTH_DEFAULTS = {
|
|
33
32
|
"google-ai-studio": {
|
|
@@ -238,8 +237,8 @@ function resolveProviderKey(provider, runtimeEnv, options) {
|
|
|
238
237
|
}
|
|
239
238
|
function getProxyUrl(runtimeEnv) {
|
|
240
239
|
const custom = runtimeEnv.__VOID_PROXY_URL;
|
|
241
|
-
if (typeof custom === "string" && custom.length > 0) return custom + "/ai";
|
|
242
|
-
|
|
240
|
+
if (typeof custom === "string" && custom.length > 0) return custom.replace(/\/+$/, "") + "/ai";
|
|
241
|
+
throw new Error("ai: No connected platform proxy is available. Run `void connect <url>` first.");
|
|
243
242
|
}
|
|
244
243
|
function providerAuthDefaults(provider) {
|
|
245
244
|
return PROVIDER_AUTH_DEFAULTS[provider] ?? {
|
|
@@ -315,6 +314,8 @@ function makeServiceBindingBackend(proxy, runtimeEnv) {
|
|
|
315
314
|
...body
|
|
316
315
|
})
|
|
317
316
|
});
|
|
317
|
+
const limit = await limitFromResponse(res, "ai");
|
|
318
|
+
if (limit) throw limit;
|
|
318
319
|
if (options.throwOnError !== false && !res.ok) {
|
|
319
320
|
const text = await res.text();
|
|
320
321
|
throw new Error(`ai: Proxy request failed with ${res.status}: '${text}'.`);
|
|
@@ -395,6 +396,8 @@ function makeHttpBackend(token, projectId, runtimeEnv) {
|
|
|
395
396
|
}),
|
|
396
397
|
redirect: "manual"
|
|
397
398
|
});
|
|
399
|
+
const limit = await limitFromResponse(res, "ai");
|
|
400
|
+
if (limit) throw limit;
|
|
398
401
|
if (options.throwOnError !== false && !res.ok) {
|
|
399
402
|
const text = await res.text();
|
|
400
403
|
throw new Error(`ai: Proxy request failed with ${res.status}: '${text}'.`);
|
|
@@ -434,11 +437,24 @@ function makeHttpBackend(token, projectId, runtimeEnv) {
|
|
|
434
437
|
};
|
|
435
438
|
}
|
|
436
439
|
function makeDirectBackend(directAi, runtimeEnv, gatewayId) {
|
|
440
|
+
const run = async (model, inputs, options) => {
|
|
441
|
+
const opts = options ?? {};
|
|
442
|
+
const response = await directAi.run(model, inputs, {
|
|
443
|
+
...opts,
|
|
444
|
+
returnRawResponse: true
|
|
445
|
+
});
|
|
446
|
+
if (!(response instanceof Response)) return response;
|
|
447
|
+
const limit = await limitFromResponse(response, "ai");
|
|
448
|
+
if (limit) throw limit;
|
|
449
|
+
if (opts.returnRawResponse || opts.websocket) return response;
|
|
450
|
+
if (!response.ok) throw new Error(`ai: Request failed with ${response.status}: '${await response.text()}'.`);
|
|
451
|
+
return isJsonMediaType(mediaTypeFromContentType(response.headers.get("content-type"))) ? response.json() : response.body;
|
|
452
|
+
};
|
|
437
453
|
return {
|
|
438
|
-
run
|
|
454
|
+
run,
|
|
439
455
|
async image(model, inputs, options) {
|
|
440
456
|
const { runOptions } = splitImageOptions(options);
|
|
441
|
-
return responseFromResult(await
|
|
457
|
+
return responseFromResult(await run(model, inputs, runOptions));
|
|
442
458
|
},
|
|
443
459
|
async providerFetch(provider, path, init, options) {
|
|
444
460
|
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 +490,71 @@ let _backend;
|
|
|
474
490
|
function backend() {
|
|
475
491
|
return _backend ??= resolveBackend();
|
|
476
492
|
}
|
|
493
|
+
/** Normalize provider 429 responses and binding quota failures before they reach callers. */
|
|
494
|
+
function aiOperation(execute, rawStream = false) {
|
|
495
|
+
return limitOperation(async () => {
|
|
496
|
+
const value = await execute();
|
|
497
|
+
if (value instanceof Response) {
|
|
498
|
+
const limit = await limitFromResponse(value, "ai");
|
|
499
|
+
if (limit) throw limit;
|
|
500
|
+
}
|
|
501
|
+
return value;
|
|
502
|
+
}, classifyAiLimit, (value, limited) => {
|
|
503
|
+
if (value instanceof Response && value.body && value.headers.get("content-type")?.includes("text/event-stream")) return new Response(streamResponse(value.body, limited).body, value);
|
|
504
|
+
if (rawStream && value instanceof ReadableStream) return streamResponse(value, limited).body;
|
|
505
|
+
return value;
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
function classifyAiLimit(error) {
|
|
509
|
+
if (error instanceof UsageLimit) return error;
|
|
510
|
+
const e = error;
|
|
511
|
+
return e && (e.status === 429 || e.statusCode === 429 || e.response?.status === 429) ? new UsageLimit({
|
|
512
|
+
resource: "ai",
|
|
513
|
+
reason: "rate_limit",
|
|
514
|
+
message: "AI usage limit exceeded."
|
|
515
|
+
}) : null;
|
|
516
|
+
}
|
|
517
|
+
/** Streaming failures after headers are sent end with an explicit terminal SSE event. */
|
|
518
|
+
function streamResponse(body, limited) {
|
|
519
|
+
const reader = body.getReader();
|
|
520
|
+
return new Response(new ReadableStream({
|
|
521
|
+
async pull(controller) {
|
|
522
|
+
try {
|
|
523
|
+
const chunk = await reader.read();
|
|
524
|
+
if (chunk.done) controller.close();
|
|
525
|
+
else controller.enqueue(chunk.value);
|
|
526
|
+
} catch (error) {
|
|
527
|
+
const limit = classifyAiLimit(error);
|
|
528
|
+
let data = { message: "Generation was interrupted. Please try again." };
|
|
529
|
+
if (limit) {
|
|
530
|
+
data = await limit.response().json();
|
|
531
|
+
try {
|
|
532
|
+
const fallback = await limited(limit);
|
|
533
|
+
if (fallback instanceof Response) data = readUsageLimit(await fallback.json().catch(() => null)) ?? data;
|
|
534
|
+
} catch {}
|
|
535
|
+
}
|
|
536
|
+
controller.enqueue(new TextEncoder().encode(`event: ${limit ? "void:limit" : "void:error"}\ndata: ${JSON.stringify(data)}\n\n`));
|
|
537
|
+
controller.close();
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
cancel(reason) {
|
|
541
|
+
return reader.cancel(reason);
|
|
542
|
+
}
|
|
543
|
+
}), { headers: {
|
|
544
|
+
"content-type": "text/event-stream",
|
|
545
|
+
"cache-control": "no-cache"
|
|
546
|
+
} });
|
|
547
|
+
}
|
|
477
548
|
const ai = new Proxy({}, { get(_, prop) {
|
|
478
|
-
if (prop === "stream") return
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
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;
|
|
549
|
+
if (prop === "stream") return (model, inputs, options) => aiOperation(async () => new Response(await backend().run(model, {
|
|
550
|
+
...inputs,
|
|
551
|
+
stream: true
|
|
552
|
+
}, options), { headers: {
|
|
553
|
+
"content-type": "text/event-stream",
|
|
554
|
+
"cache-control": "no-cache"
|
|
555
|
+
} }));
|
|
556
|
+
if (prop === "provider") return (provider, options) => ({ fetch: (path, init) => aiOperation(() => backend().providerFetch(provider, path, init, options)) });
|
|
557
|
+
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
558
|
} });
|
|
494
559
|
//#endregion
|
|
495
560
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
3
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
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-
|
|
3
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
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-
|
|
3
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
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-
|
|
3
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
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 };
|
package/dist/runtime/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as FetchError } from "../fetch-error-Dj3crt0e.mjs";
|
|
2
|
-
import { t as fetch } from "../fetch-
|
|
3
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
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>;
|
package/dist/runtime/durable.mjs
CHANGED
|
@@ -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,7 +1,7 @@
|
|
|
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";
|
|
4
|
-
import {
|
|
3
|
+
import { y as registerEmailSink } from "../../dev-inbox-P0u4tM8Y.mjs";
|
|
4
|
+
import { i as createMessageProxy, n as MAX_INBOUND_HEADERS, t as MAX_INBOUND_BYTES } from "../../inbound-fRkqcXaC.mjs";
|
|
5
5
|
//#region src/runtime/email/testing.ts
|
|
6
6
|
/**
|
|
7
7
|
* Test harnesses for void/email.
|
package/dist/runtime/email.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as normalizeEmail, n as MimeError, r as buildMime } from "../mime-D5Nmdzf7.mjs";
|
|
2
2
|
import { a as DEV_INBOX_ENV_VAR, b as serializeCapturedMessage, c as DEV_INBOX_TOKEN_ENV_VAR, d as captureMessage, h as hasActiveSink, i as DEV_INBOX_CAPTURE_URL, p as dispatchToSinks } from "../dev-inbox-P0u4tM8Y.mjs";
|
|
3
3
|
import { a as getRawRuntimeEnv } from "../env-raw-Cx8ElDdj.mjs";
|
|
4
|
-
import { a as defineEmail, c as parseEmail, i as createMessageProxy, l as replyEmail, o as enactEmailActions, r as ParseEmailError, s as isForwardableEmailMessage } from "../inbound-
|
|
4
|
+
import { a as defineEmail, c as parseEmail, i as createMessageProxy, l as replyEmail, o as enactEmailActions, r as ParseEmailError, s as isForwardableEmailMessage } from "../inbound-fRkqcXaC.mjs";
|
|
5
5
|
//#region src/runtime/email.ts
|
|
6
6
|
const VALID_SLUG = /^[a-z0-9](?:[a-z0-9-]{0,54}[a-z0-9])?$/;
|
|
7
7
|
function makeError(code, message, cause) {
|
|
@@ -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-
|
|
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 };
|
package/dist/runtime/fetch.mjs
CHANGED
|
@@ -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-
|
|
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 };
|
package/dist/runtime/kv.mjs
CHANGED
|
@@ -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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as eventStream } from "../sse-
|
|
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
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
}, {
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
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
|
|
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
|
}
|
package/dist/runtime/live.d.mts
CHANGED
|
@@ -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-
|
|
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 };
|