void 0.10.13 → 0.20.1
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 +6 -0
- package/{skills/void/docs/node_modules/void/node_modules/pglite-server/LICENSE.md → LICENSE} +1 -1
- package/README.md +34 -8
- package/dist/{auth-qgMlYp7Z.d.mts → auth-DkcFflXV.d.mts} +10 -11
- package/dist/auth-W9WII-mN.mjs +630 -0
- package/dist/{auth-cmd-BqsdZJp5.mjs → auth-cmd-CAH62yDU.mjs} +4 -3
- package/dist/{auth-migrations-BTZ-ATvQ.mjs → auth-migrations-9vif1uj8.mjs} +53 -12
- package/dist/{better-auth-shared-BQooDxbw.mjs → better-auth-shared-CYw1T3k4.mjs} +7 -10
- package/dist/{better-auth-shared-DealXecJ.d.mts → better-auth-shared-DSCeohOK.d.mts} +10 -5
- package/dist/{build-cmd-Bujrv5q-.mjs → build-cmd-CJvZvPQO.mjs} +6 -4
- package/dist/{cache-C11V8Fxq.mjs → cache-BlNeQjuP.mjs} +9 -5
- package/dist/{cancel-deploy-fwFYF04b.mjs → cancel-deploy-CmlAZ9P6.mjs} +3 -2
- package/dist/cf-access-AJ1ehiFR.mjs +42 -0
- package/dist/cf-access-DsSsZUPr.mjs +67 -0
- package/dist/cli/cli.d.mts +1 -1
- package/dist/cli/cli.mjs +1735 -165
- package/dist/cli/env-schema-probe.d.mts +48 -61
- package/dist/cli/env-schema-probe.mjs +10 -58
- package/dist/{client-Gb71-XkG.mjs → client-Clirrol3.mjs} +120 -463
- package/dist/cloudflare-auth-B1QtTO1b.mjs +217 -0
- package/dist/cloudflare-cmd-B6_OZx2V.mjs +62 -0
- package/dist/cloudflare-connect-j5D4hhrG.mjs +56 -0
- package/dist/cloudflare-operations-CPTpRW6d.mjs +566 -0
- package/dist/{config-qHGgPuWT.mjs → config-BQFq7QvD.mjs} +75 -41
- package/dist/{config-CutEMNGJ.mjs → config-NOG_U1aK.mjs} +10 -15
- package/dist/connect-C04Wdy_h.mjs +79 -0
- package/dist/{create-project-DsYvl3TB.mjs → create-project-ChGZ1DFd.mjs} +26 -16
- package/dist/database-provider.d.mts +21 -0
- package/dist/database-provider.mjs +6 -0
- package/dist/{db-C0i0sYMS.mjs → db-D2d_mUsB.mjs} +612 -117
- package/dist/{delete-mh6p-zkQ.mjs → delete-D8GigDk8.mjs} +9 -6
- package/dist/{deploy-jBJT1fUT.mjs → deploy-iXZ3F0N6.mjs} +3252 -1995
- package/dist/dev-inbox-DkgRWLkW.mjs +307 -0
- package/dist/{discover-CJHyvYfR.mjs → discover-xvfrgJeo.mjs} +3 -3
- package/dist/{magic-string.es-ZQjdJFFn.mjs → dist-BR1quN_w.mjs} +570 -216
- package/dist/{dist-DaKKDf8D.mjs → dist-BrsS7cai.mjs} +17 -2
- package/dist/{dist-BuiRJkTd.mjs → dist-m40_XgNh.mjs} +48 -33
- package/dist/{domain-DiaNQbrl.mjs → domain-B1VmoSr0.mjs} +41 -4
- package/dist/dotenv-VQxupEUv.mjs +181 -0
- package/dist/edge.d.mts +2 -0
- package/dist/edge.mjs +2 -0
- package/dist/email-Ce6SQq-i.mjs +182 -0
- package/dist/email-uKyQYUVY.mjs +1016 -0
- package/dist/{entry-D7yy4xVH.mjs → entry-DU3oDoQ3.mjs} +2 -2
- package/dist/env-BcQzYgoG.mjs +73 -0
- package/dist/env-D4Emu-M_.mjs +95 -0
- package/dist/env-helpers-CyKtOBpj.d.mts +22 -0
- package/dist/env-public-D_6u46fX.d.mts +135 -0
- package/dist/{env-types-QBj-ndax.mjs → env-types-BNPhro-M.mjs} +2 -2
- package/dist/{env-validation-Dea3v3ej.mjs → env-validation-ENpMy6Ez.mjs} +68 -122
- package/dist/{gen-BzXf3Jh2.mjs → gen-DI2YwdBM.mjs} +70 -15
- package/dist/generate-RTK8_kK1.mjs +47 -0
- package/dist/{github-cmd-DKcGUNsj.mjs → github-cmd-xItS5Zwf.mjs} +39 -31
- package/dist/{handler-Cjh8uM3Y.d.mts → handler-D1hLsObx.d.mts} +124 -122
- package/dist/{head-nmvOgFjd.d.mts → head-Do8P4puT.d.mts} +9 -8
- package/dist/{headers-ChAADPQu.mjs → headers-D8QfRX9Y.mjs} +12 -10
- package/dist/inbound-2d0zi2yS.mjs +706 -0
- package/dist/inbound-afAcWeQ9.d.mts +363 -0
- package/dist/index.d.mts +61 -34
- package/dist/index.mjs +1012 -293
- package/dist/{init-7JCAcKNQ.mjs → init-BD-9THgn.mjs} +329 -271
- package/dist/link-RMdgjF1v.mjs +52 -0
- package/dist/{list-CPwFDZ_c.mjs → list-3F52R_yO.mjs} +37 -5
- package/dist/{runner-kapo9aPs.mjs → local-d1-D2I6Ox5F.mjs} +116 -6
- package/dist/{login-BT3H8PN3.mjs → login-pV69H-ZO.mjs} +17 -15
- package/dist/{logs-Bt313ax7.mjs → logs-DFHHD6wE.mjs} +16 -2
- package/dist/mime-BJD7d_qL.mjs +1216 -0
- package/dist/neon-DHwd2zvC.mjs +54 -0
- package/dist/{node-pRg81HqV.mjs → node-Dk3H2jmU.mjs} +29 -8
- package/dist/operator-cmd-DYWRbWUA.mjs +348 -0
- package/dist/{agents-CtgBYqld.mjs → output-tFQLLj26.mjs} +676 -211
- package/dist/{package-json-Cx1osYo6.mjs → package-json-CPoWX79C.mjs} +1 -1
- package/dist/pages/client.d.mts +43 -41
- package/dist/pages/client.mjs +40 -33
- package/dist/pages/head-client.d.mts +10 -12
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/index.d.mts +37 -14
- package/dist/pages/index.mjs +5 -5
- package/dist/pages/islands-plugin.d.mts +25 -27
- package/dist/pages/islands-plugin.mjs +6 -4
- package/dist/pages/prefetch.d.mts +6 -7
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +2 -1
- package/dist/pages/serialize.d.mts +7 -8
- package/dist/platform-cmd-DxJ2FRwR.mjs +123 -0
- package/dist/platform-domain-ChvbJkdy.mjs +228 -0
- package/dist/platform-lifecycle-DN4MzJF_.mjs +4450 -0
- package/dist/platform-management-Db2PXw0B.mjs +698 -0
- package/dist/platform-recovery-C_YO-tIs.mjs +99 -0
- package/dist/{plugin-inference-DMeavIJ6.mjs → plugin-inference-BDRfZngg.mjs} +35 -19
- package/dist/prepare-BfJvFUtJ.mjs +14 -0
- package/dist/{prepare-BvvgAz-3.mjs → prepare-CBetXvsN.mjs} +15 -24
- package/dist/{preset-BjyR3lzz.mjs → preset-lAy0B0BQ.mjs} +25 -212
- package/dist/{project-cmd-D_w-4w5B.mjs → project-cmd-Mo0V9yKS.mjs} +25 -12
- package/dist/{project-paths-BQd7OmIo.mjs → project-paths-SK8nMHPp.mjs} +3 -1
- package/dist/{project-tsconfig-B-QtXjLQ.mjs → project-tsconfig-Ql2XsSQp.mjs} +2 -2
- package/dist/{protocol-Bnb0LFp3.d.mts → protocol-C-pqYJjE.d.mts} +3 -4
- package/dist/{provision-CPx2ZxsH.mjs → provision-Blnstcm2.mjs} +78 -45
- package/dist/r2-conditions-D1Wk8i7b.mjs +30 -0
- package/dist/{requests-B8sZxaFM.mjs → requests-BcKOVpRg.mjs} +5 -3
- package/dist/{resolve-project-BBMtLLV9.mjs → resolve-project--Vxawf7z.mjs} +2 -2
- package/dist/rollback-Bx85-0xh.mjs +166 -0
- package/dist/{rolldown-runtime-DJK8HYOj.mjs → rolldown-runtime-rQ84J-ij.mjs} +1 -1
- package/dist/{route-types-z1jtHEi_.mjs → route-types-Da-DpyUp.mjs} +77 -25
- package/dist/routes-stub.d.mts +22 -23
- package/dist/runner-mysql-7BPUNGmL.mjs +61 -0
- package/dist/{runner-pg-CHM76xuC.mjs → runner-pg-BkEza-dX.mjs} +18 -6
- package/dist/runtime/ai.d.mts +21 -14
- package/dist/runtime/ai.mjs +5 -4
- package/dist/runtime/auth-client-react.d.mts +3 -5
- package/dist/runtime/auth-client-solid.d.mts +3 -5
- package/dist/runtime/auth-client-svelte.d.mts +3 -5
- package/dist/runtime/auth-client-vue.d.mts +3 -5
- package/dist/runtime/auth-client.d.mts +3 -5
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.d.mts +10 -0
- package/dist/runtime/better-auth-mysql.mjs +49 -0
- package/dist/runtime/better-auth-pg.d.mts +8 -9
- package/dist/runtime/better-auth-pg.mjs +2 -2
- package/dist/runtime/better-auth.d.mts +8 -9
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/client-react.d.mts +1 -1
- package/dist/runtime/client-solid.d.mts +1 -1
- package/dist/runtime/client-svelte.d.mts +1 -1
- package/dist/runtime/client-vue.d.mts +1 -1
- package/dist/runtime/client.d.mts +1 -1
- package/dist/runtime/db-mysql.d.mts +2 -0
- package/dist/runtime/db-mysql.mjs +1 -0
- package/dist/runtime/db.d.mts +10 -11
- package/dist/runtime/durable.d.mts +47 -0
- package/dist/runtime/durable.mjs +146 -0
- package/dist/runtime/email/testing.d.mts +112 -0
- package/dist/runtime/email/testing.mjs +283 -0
- package/dist/runtime/email.d.mts +30 -0
- package/dist/runtime/email.mjs +573 -0
- package/dist/runtime/env-helpers.d.mts +2 -2
- package/dist/runtime/env-helpers.mjs +5 -42
- package/dist/runtime/env-public-client.d.mts +10 -11
- package/dist/runtime/env-public-client.mjs +1 -1
- package/dist/runtime/env-public.d.mts +2 -2
- package/dist/runtime/env-public.mjs +104 -49
- package/dist/runtime/env.d.mts +19 -18
- package/dist/runtime/env.mjs +15 -2
- package/dist/runtime/fetch-stream.d.mts +20 -21
- package/dist/runtime/fetch.d.mts +15 -16
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/isr.d.mts +21 -22
- package/dist/runtime/isr.mjs +26 -8
- package/dist/runtime/kv.d.mts +9 -10
- package/dist/runtime/live-client.d.mts +5 -7
- package/dist/runtime/live-client.mjs +9 -7
- package/dist/runtime/live-server.d.mts +4 -5
- package/dist/runtime/live.d.mts +22 -24
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/log.d.mts +16 -17
- package/dist/runtime/migration-handler-mysql.d.mts +4 -0
- package/dist/runtime/migration-handler-mysql.mjs +81 -0
- package/dist/runtime/migration-handler-pg.d.mts +2 -4
- package/dist/runtime/migration-handler.d.mts +5 -6
- package/dist/runtime/migration-handler.mjs +4 -3
- package/dist/runtime/queues.d.mts +3 -4
- package/dist/runtime/queues.mjs +2 -1
- package/dist/runtime/remote/binding-handler.d.mts +10 -12
- package/dist/runtime/remote/binding-handler.mjs +24 -3
- package/dist/runtime/remote/index.d.mts +5 -6
- package/dist/runtime/remote/index.mjs +21 -18
- package/dist/runtime/response.d.mts +10 -11
- package/dist/runtime/sandbox.d.mts +56 -55
- package/dist/runtime/sandbox.mjs +57 -49
- package/dist/runtime/schema-mysql.d.mts +1 -0
- package/dist/runtime/schema-mysql.mjs +2 -0
- package/dist/runtime/seed.d.mts +14 -9
- package/dist/runtime/sse-client.d.mts +6 -7
- package/dist/runtime/sse.d.mts +11 -12
- package/dist/runtime/storage.d.mts +3 -4
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +12 -12
- package/dist/runtime/ws-server.mjs +32 -4
- package/dist/runtime/ws.d.mts +19 -21
- package/dist/{scan-ChWt4pX1.mjs → scan-BMH4rzlv.mjs} +42 -19
- package/dist/{scan-NU4xKGci.mjs → scan-CpK-57ug.mjs} +5 -4
- package/dist/{secret-Dt32J6RI.mjs → secret-ByhJ9AMl.mjs} +62 -5
- package/dist/{skills-CLjN0uUO.mjs → skills-Q46GZMO-.mjs} +6 -4
- package/dist/sqlite-validation-BzKMWnO4.mjs +25 -0
- package/dist/{standard-schema-DJ0HW7QP.d.mts → standard-schema-Fo_vCAZh.d.mts} +6 -6
- package/dist/{subcommand-prompt-BzV8iQZo.mjs → subcommand-prompt-WfySCQ7S.mjs} +67 -48
- package/dist/sveltekit.d.mts +12 -11
- package/dist/sveltekit.mjs +1 -1
- package/dist/types-BAp5AEBU.d.mts +79 -0
- package/dist/types-CKWnYgfy.d.mts +1 -0
- package/dist/{validate-Cw_RLeTj.mjs → validate-tBBN_dXH.mjs} +4 -3
- package/dist/wrangler--imS8n0d.mjs +1796 -0
- package/dist/{yarn-pnp-DJn3SAHF.mjs → yarn-pnp-DxSInkzL.mjs} +1 -1
- package/package.json +79 -65
- package/schema.json +22 -3
- package/skills/void/SKILL.md +59 -2
- package/skills/void/docs/guide/ai.md +32 -14
- package/skills/void/docs/guide/app-types.md +6 -6
- package/skills/void/docs/guide/auth.md +14 -16
- package/skills/void/docs/guide/database/d1.md +6 -0
- package/skills/void/docs/guide/database/mysql.md +60 -0
- package/skills/void/docs/guide/database/postgresql.md +14 -9
- package/skills/void/docs/guide/database.md +39 -26
- package/skills/void/docs/guide/deployment.md +99 -25
- package/skills/void/docs/guide/durable-state.md +140 -0
- package/skills/void/docs/guide/edge/headers.md +5 -5
- package/skills/void/docs/guide/edge/prerendering.md +2 -0
- package/skills/void/docs/guide/edge/revalidation.md +21 -6
- package/skills/void/docs/guide/edge/rewrites.md +18 -14
- package/skills/void/docs/guide/edge/static-assets.md +12 -10
- package/skills/void/docs/guide/email.md +640 -0
- package/skills/void/docs/guide/env-migration.md +109 -0
- package/skills/void/docs/guide/env-vars.md +70 -248
- package/skills/void/docs/guide/index.md +15 -17
- package/skills/void/docs/guide/jobs.md +8 -5
- package/skills/void/docs/guide/live.md +7 -15
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +8 -4
- package/skills/void/docs/guide/pages-routing/islands.md +3 -3
- package/skills/void/docs/guide/pages-routing/loaders.md +6 -4
- package/skills/void/docs/guide/pages-routing/overview.md +7 -7
- package/skills/void/docs/guide/platform-administration.md +212 -0
- package/skills/void/docs/guide/platform-development.md +264 -0
- package/skills/void/docs/guide/queues.md +10 -10
- package/skills/void/docs/guide/quickstart.md +46 -67
- package/skills/void/docs/guide/remote-dev.md +8 -6
- package/skills/void/docs/guide/sandboxes.md +33 -16
- package/skills/void/docs/guide/self-hosted-platform.md +553 -0
- package/skills/void/docs/guide/server-routing.md +5 -5
- package/skills/void/docs/guide/sse.md +4 -4
- package/skills/void/docs/guide/ssg.md +5 -3
- package/skills/void/docs/guide/storage.md +2 -2
- package/skills/void/docs/guide/websockets.md +15 -7
- package/skills/void/docs/index.md +3 -3
- package/skills/void/docs/integrations/agents.md +6 -64
- package/skills/void/docs/integrations/cloudflare.md +165 -146
- package/skills/void/docs/integrations/frameworks/analog.md +4 -4
- package/skills/void/docs/integrations/frameworks/astro.md +5 -5
- package/skills/void/docs/integrations/frameworks/nuxt.md +5 -5
- package/skills/void/docs/integrations/frameworks/overview.md +3 -3
- package/skills/void/docs/integrations/frameworks/react-router.md +3 -3
- package/skills/void/docs/integrations/frameworks/sveltekit.md +3 -3
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +2 -2
- package/skills/void/docs/integrations/nodejs-bun-deno.md +11 -4
- package/skills/void/docs/reference/api.md +42 -6
- package/skills/void/docs/reference/cli.md +665 -160
- package/skills/void/docs/reference/config.md +67 -27
- package/skills/void/docs/reference/resource-inference.md +13 -9
- package/skills/void/docs/reference/structure.md +9 -11
- package/AGENT_PROMPT.md +0 -19
- package/dist/cf-access-Bqw81xAf.mjs +0 -22
- package/dist/env-CZy5MorI.mjs +0 -299
- package/dist/env-helpers-z4stu8uc.d.mts +0 -52
- package/dist/env-mask-Dd47NbR6.mjs +0 -90
- package/dist/env-public-BfiLcMBk.d.mts +0 -140
- package/dist/link-CdGHSIy-.mjs +0 -45
- package/dist/mcp-DoM3_nhd.mjs +0 -377
- package/dist/project-paths-GpziKeQQ.d.mts +0 -25
- package/dist/providers-BNKRacMr.d.mts +0 -7
- package/dist/proxy-D-3_D-Gl.mjs +0 -5
- package/dist/rollback-CkvTFXx5.mjs +0 -90
- package/dist/runtime/isr-cache.d.mts +0 -207
- package/dist/runtime/isr-cache.mjs +0 -523
- package/dist/types-lLjNE9Qp.d.mts +0 -51
- package/getting-started-prompt.txt +0 -28
- package/skills/void/command/void.md +0 -7
- package/skills/void/docs/integrations/auth-providers.md +0 -0
- package/skills/void/docs/integrations/payment-processors.md +0 -0
- package/skills/void/docs/node_modules/@iconify/vue/README.md +0 -408
- package/skills/void/docs/node_modules/@iconify/vue/offline/readme.md +0 -5
- package/skills/void/docs/node_modules/@voidzero-dev/vitepress-theme/README.md +0 -103
- package/skills/void/docs/node_modules/oxc-minify/README.md +0 -78
- package/skills/void/docs/node_modules/reka-ui/README.md +0 -80
- package/skills/void/docs/node_modules/vitepress/README.md +0 -28
- package/skills/void/docs/node_modules/vitepress/template/api-examples.md +0 -49
- package/skills/void/docs/node_modules/vitepress/template/index.md +0 -28
- package/skills/void/docs/node_modules/vitepress/template/markdown-examples.md +0 -85
- package/skills/void/docs/node_modules/vitepress-plugin-group-icons/README.md +0 -101
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +0 -19
- package/skills/void/docs/node_modules/void/CLAUDE.md +0 -221
- package/skills/void/docs/node_modules/void/README.md +0 -90
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/CHANGELOG.md +0 -685
- package/skills/void/docs/node_modules/void/node_modules/@clack/prompts/README.md +0 -396
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/sandbox/README.md +0 -219
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/vite-plugin/README.md +0 -37
- package/skills/void/docs/node_modules/void/node_modules/@cloudflare/workers-types/README.md +0 -135
- package/skills/void/docs/node_modules/void/node_modules/@electric-sql/pglite/README.md +0 -189
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/CHANGELOG.md +0 -143
- package/skills/void/docs/node_modules/void/node_modules/@hono/oauth-providers/README.md +0 -1272
- package/skills/void/docs/node_modules/void/node_modules/@napi-rs/keyring/README.md +0 -19
- package/skills/void/docs/node_modules/void/node_modules/@types/better-sqlite3/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@types/node/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@types/pg/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@types/proper-lockfile/README.md +0 -51
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/README.md +0 -22
- package/skills/void/docs/node_modules/void/node_modules/@typescript/native-preview/vendor/vscode-jsonrpc/README.md +0 -69
- package/skills/void/docs/node_modules/void/node_modules/@void/md/README.md +0 -153
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/engine-javascript/README.md +0 -9
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@shikijs/transformers/README.md +0 -9
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/@types/node/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/CHANGELOG.md +0 -24
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/gray-matter/README.md +0 -565
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-exit/README.md +0 -127
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-anchor/README.md +0 -600
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-attrs/README.md +0 -386
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-container/README.md +0 -95
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-emoji/README.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/markdown-it-footnote/README.md +0 -135
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathslash/README.md +0 -64
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/shiki/README.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/tinyglobby/README.md +0 -25
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/AGENTS.md +0 -16
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/README.md +0 -220
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/build.md +0 -21
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/check.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/create.md +0 -70
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/fmt.md +0 -20
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/index.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/lint.md +0 -26
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/pack.md +0 -17
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/run.md +0 -364
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/staged.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/config/test.md +0 -18
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +0 -145
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/build.md +0 -40
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/cache.md +0 -107
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/check.md +0 -60
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ci.md +0 -62
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/commit-hooks.md +0 -60
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/create.md +0 -341
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/dev.md +0 -24
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/docker.md +0 -175
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/env.md +0 -167
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/fmt.md +0 -41
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/github-actions-cache.md +0 -165
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/ide-integration.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/implode.md +0 -23
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/index.md +0 -134
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/install.md +0 -199
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/lint.md +0 -50
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate-rules.md +0 -347
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/migrate.md +0 -197
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/monorepo.md +0 -176
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/pack.md +0 -69
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/run.md +0 -356
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/test.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/troubleshooting.md +0 -108
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/upgrade.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/vpx.md +0 -66
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/guide/why.md +0 -39
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/index.md +0 -12
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/docs/team.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/templates/generator/README.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vite-plus/templates/monorepo/README.md +0 -29
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/vue/README.md +0 -58
- package/skills/void/docs/node_modules/void/node_modules/arktype/README.md +0 -165
- package/skills/void/docs/node_modules/void/node_modules/better-auth/LICENSE.md +0 -20
- package/skills/void/docs/node_modules/void/node_modules/better-auth/README.md +0 -32
- package/skills/void/docs/node_modules/void/node_modules/better-sqlite3/README.md +0 -99
- package/skills/void/docs/node_modules/void/node_modules/blake3-jit/README.md +0 -108
- package/skills/void/docs/node_modules/void/node_modules/drizzle-arktype/README.md +0 -51
- package/skills/void/docs/node_modules/void/node_modules/drizzle-kit/README.md +0 -79
- package/skills/void/docs/node_modules/void/node_modules/drizzle-orm/README.md +0 -44
- package/skills/void/docs/node_modules/void/node_modules/drizzle-valibot/README.md +0 -51
- package/skills/void/docs/node_modules/void/node_modules/drizzle-zod/README.md +0 -65
- package/skills/void/docs/node_modules/void/node_modules/es-module-lexer/README.md +0 -403
- package/skills/void/docs/node_modules/void/node_modules/estree-walker/README.md +0 -48
- package/skills/void/docs/node_modules/void/node_modules/hono/README.md +0 -85
- package/skills/void/docs/node_modules/void/node_modules/ignore/README.md +0 -452
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/CHANGELOG.md +0 -76
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/LICENSE.md +0 -21
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/README.md +0 -364
- package/skills/void/docs/node_modules/void/node_modules/jsonc-parser/SECURITY.md +0 -41
- package/skills/void/docs/node_modules/void/node_modules/magic-string/README.md +0 -325
- package/skills/void/docs/node_modules/void/node_modules/ofetch/README.md +0 -398
- package/skills/void/docs/node_modules/void/node_modules/pathslash/README.md +0 -64
- package/skills/void/docs/node_modules/void/node_modules/pg/README.md +0 -96
- package/skills/void/docs/node_modules/void/node_modules/pglite-server/README.md +0 -135
- package/skills/void/docs/node_modules/void/node_modules/picocolors/README.md +0 -21
- package/skills/void/docs/node_modules/void/node_modules/proper-lockfile/CHANGELOG.md +0 -108
- package/skills/void/docs/node_modules/void/node_modules/proper-lockfile/README.md +0 -183
- package/skills/void/docs/node_modules/void/node_modules/tinyglobby/README.md +0 -25
- package/skills/void/docs/node_modules/void/node_modules/valibot/LICENSE.md +0 -9
- package/skills/void/docs/node_modules/void/node_modules/valibot/README.md +0 -94
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/AGENTS.md +0 -16
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/README.md +0 -220
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/build.md +0 -21
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/check.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/create.md +0 -70
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/fmt.md +0 -20
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/index.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/lint.md +0 -26
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/pack.md +0 -17
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/run.md +0 -364
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/staged.md +0 -15
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/config/test.md +0 -18
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/automatic-data-tracking.md +0 -145
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/build.md +0 -40
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/cache.md +0 -107
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/check.md +0 -60
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ci.md +0 -62
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/commit-hooks.md +0 -60
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/create.md +0 -341
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/dev.md +0 -24
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/docker.md +0 -175
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/env.md +0 -167
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/fmt.md +0 -41
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/github-actions-cache.md +0 -165
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/ide-integration.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/implode.md +0 -23
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/index.md +0 -134
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/install.md +0 -199
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/lint.md +0 -50
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate-rules.md +0 -347
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/migrate.md +0 -197
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/monorepo.md +0 -176
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/pack.md +0 -69
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/run.md +0 -356
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/test.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/troubleshooting.md +0 -108
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/upgrade.md +0 -101
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/vpx.md +0 -66
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/guide/why.md +0 -39
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/index.md +0 -12
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/docs/team.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/templates/generator/README.md +0 -35
- package/skills/void/docs/node_modules/void/node_modules/vite-plus/templates/monorepo/README.md +0 -29
- package/skills/void/docs/node_modules/void/node_modules/wrangler/README.md +0 -63
- package/skills/void/docs/node_modules/void/node_modules/zod/README.md +0 -191
- package/skills/void/docs/node_modules/void/skills/migrate-vite-cloudflare-to-void/SKILL.md +0 -175
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +0 -76
- package/skills/void/docs/node_modules/void/skills/void/command/void.md +0 -7
- package/skills/void/docs/node_modules/void/test/e2e/README.md +0 -85
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
2
|
import { Sandbox, SandboxOptions } from "@cloudflare/sandbox";
|
|
3
|
-
|
|
4
3
|
//#region src/runtime/sandbox.d.ts
|
|
5
|
-
declare const DEFAULT_SANDBOX_ID = "default";
|
|
6
|
-
declare const DEFAULT_SANDBOX_BINDING = "SANDBOX";
|
|
7
|
-
declare const SANDBOX_USAGE_QUEUE_BINDING = "USAGE_EVENTS_QUEUE";
|
|
8
|
-
declare const SANDBOX_GATE_BINDING = "__VOID_PROXY";
|
|
9
|
-
declare const HEARTBEAT_MS: number;
|
|
10
|
-
type VoidSandboxOptions = SandboxOptions & {
|
|
4
|
+
export declare const DEFAULT_SANDBOX_ID = "default";
|
|
5
|
+
export declare const DEFAULT_SANDBOX_BINDING = "SANDBOX";
|
|
6
|
+
export declare const SANDBOX_USAGE_QUEUE_BINDING = "USAGE_EVENTS_QUEUE";
|
|
7
|
+
export declare const SANDBOX_GATE_BINDING = "__VOID_PROXY";
|
|
8
|
+
export declare const HEARTBEAT_MS: number;
|
|
9
|
+
export type VoidSandboxOptions = SandboxOptions & {
|
|
11
10
|
binding?: string;
|
|
12
11
|
};
|
|
13
|
-
type SandboxUsageEvent = Readonly<{
|
|
12
|
+
export type SandboxUsageEvent = Readonly<{
|
|
14
13
|
requests: 0;
|
|
15
14
|
responseBytes: 0;
|
|
16
15
|
userId?: string;
|
|
@@ -20,28 +19,33 @@ type SandboxUsageEvent = Readonly<{
|
|
|
20
19
|
sandboxInstanceId: string;
|
|
21
20
|
}>;
|
|
22
21
|
/**
|
|
23
|
-
* Thrown by `getSandbox()` when the platform gate denies a new acquire because
|
|
24
|
-
* the user has hit a concurrency or runtime budget cap. Surface this to the
|
|
25
|
-
* caller so they can render a friendly error; do not retry transparently.
|
|
26
|
-
*/
|
|
27
|
-
declare class SandboxLimitError extends Error {
|
|
22
|
+
* Thrown by `getSandbox()` when the platform gate denies a new acquire because
|
|
23
|
+
* the user has hit a concurrency or runtime budget cap. Surface this to the
|
|
24
|
+
* caller so they can render a friendly error; do not retry transparently.
|
|
25
|
+
*/
|
|
26
|
+
export declare class SandboxLimitError extends Error {
|
|
28
27
|
override readonly name = "SandboxLimitError";
|
|
29
28
|
readonly reason: "concurrency" | "runtime_budget";
|
|
30
29
|
constructor(reason: "concurrency" | "runtime_budget", message?: string);
|
|
31
30
|
}
|
|
32
|
-
|
|
31
|
+
/** Managed platform Sandbox is unavailable or its activation gate cannot be verified. */
|
|
32
|
+
export declare class SandboxUnavailableError extends Error {
|
|
33
|
+
override readonly name = "SandboxUnavailableError";
|
|
34
|
+
constructor(message?: string);
|
|
35
|
+
}
|
|
36
|
+
export declare function __setSandboxBindingName(bindingName: string): void;
|
|
33
37
|
/**
|
|
34
|
-
* Sandbox variant that participates in Void platform metering: it records
|
|
35
|
-
* container runtime seconds into DO storage, emits periodic heartbeats to
|
|
36
|
-
* the usage queue, and notifies the gate when the container stops.
|
|
37
|
-
*
|
|
38
|
-
* Generated code from `void inference` wires user `Sandbox` subclasses to
|
|
39
|
-
* extend this class on platform deploys so per-tenant accounting works
|
|
40
|
-
* without user opt-in. On local dev (no usage-queue / gate bindings), all
|
|
41
|
-
* overrides degrade to no-ops and the sandbox behaves like the upstream
|
|
42
|
-
* `Sandbox` class.
|
|
43
|
-
*/
|
|
44
|
-
declare class VoidPlatformSandbox<Env = unknown> extends Sandbox<Env> {
|
|
38
|
+
* Sandbox variant that participates in Void platform metering: it records
|
|
39
|
+
* container runtime seconds into DO storage, emits periodic heartbeats to
|
|
40
|
+
* the usage queue, and notifies the gate when the container stops.
|
|
41
|
+
*
|
|
42
|
+
* Generated code from `void inference` wires user `Sandbox` subclasses to
|
|
43
|
+
* extend this class on platform deploys so per-tenant accounting works
|
|
44
|
+
* without user opt-in. On local dev (no usage-queue / gate bindings), all
|
|
45
|
+
* overrides degrade to no-ops and the sandbox behaves like the upstream
|
|
46
|
+
* `Sandbox` class.
|
|
47
|
+
*/
|
|
48
|
+
export declare class VoidPlatformSandbox<Env = unknown> extends Sandbox<Env> {
|
|
45
49
|
override onStart(): Promise<void>;
|
|
46
50
|
override alarm(alarmProps?: AlarmInvocationInfo): Promise<void>;
|
|
47
51
|
override onStop(): Promise<void>;
|
|
@@ -49,36 +53,33 @@ declare class VoidPlatformSandbox<Env = unknown> extends Sandbox<Env> {
|
|
|
49
53
|
private flushFinal;
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
|
-
* Resolve the platform-provided sandbox stub for the given id, optionally
|
|
53
|
-
* coordinating with the platform gate to enforce per-user concurrency and
|
|
54
|
-
* runtime budgets.
|
|
55
|
-
*
|
|
56
|
-
* When the gate binding (`__VOID_PROXY` by default) is present AND the
|
|
57
|
-
* platform's `__PROJECT_ID` + `__VOID_PROXY_TOKEN` identity vars are
|
|
58
|
-
* available, we POST to `https://gate/sandbox/acquire` with the HMAC-signed
|
|
59
|
-
* body the shared proxy auth middleware expects. A `409` response means the
|
|
60
|
-
* user has exceeded a budget — we throw `SandboxLimitError` so the caller
|
|
61
|
-
* can render a clear message. Any other non-OK status (or a thrown transport
|
|
62
|
-
* error from the service binding)
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* The
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*/
|
|
79
|
-
declare function getSandbox<T extends Sandbox = Sandbox>(id?: string, options?: VoidSandboxOptions): Promise<T>;
|
|
80
|
-
declare const sandbox: {
|
|
56
|
+
* Resolve the platform-provided sandbox stub for the given id, optionally
|
|
57
|
+
* coordinating with the platform gate to enforce per-user concurrency and
|
|
58
|
+
* runtime budgets.
|
|
59
|
+
*
|
|
60
|
+
* When the gate binding (`__VOID_PROXY` by default) is present AND the
|
|
61
|
+
* platform's `__PROJECT_ID` + `__VOID_PROXY_TOKEN` identity vars are
|
|
62
|
+
* available, we POST to `https://gate/sandbox/acquire` with the HMAC-signed
|
|
63
|
+
* body the shared proxy auth middleware expects. A `409` response means the
|
|
64
|
+
* user has exceeded a budget — we throw `SandboxLimitError` so the caller
|
|
65
|
+
* can render a clear message. Any other non-OK status (or a thrown transport
|
|
66
|
+
* error from the service binding) fails closed before returning a usable
|
|
67
|
+
* managed stub.
|
|
68
|
+
*
|
|
69
|
+
* When all reserved platform identity bindings are absent, this is a native
|
|
70
|
+
* Cloudflare or local deployment and returns the upstream stub directly.
|
|
71
|
+
*
|
|
72
|
+
* The stub is constructed BEFORE calling the gate so we can pass its opaque,
|
|
73
|
+
* namespace-specific Durable Object id (`stub.id.toString()`) as `sandboxId`.
|
|
74
|
+
* The same id is available as `ctx.id.toString()` inside lifecycle hooks, so
|
|
75
|
+
* acquire, heartbeat, and release use one globally unique instance identity
|
|
76
|
+
* even when separate projects or deployments both request the name `default`.
|
|
77
|
+
* Constructing the stub does NOT start a container — that only happens on
|
|
78
|
+
* the first method call against the stub.
|
|
79
|
+
*/
|
|
80
|
+
export declare function getSandbox<T extends Sandbox = Sandbox>(id?: string, options?: VoidSandboxOptions): Promise<T>;
|
|
81
|
+
export declare const sandbox: {
|
|
81
82
|
get: typeof getSandbox;
|
|
82
83
|
};
|
|
83
84
|
//#endregion
|
|
84
|
-
export {
|
|
85
|
+
export { Sandbox, type SandboxOptions };
|
package/dist/runtime/sandbox.mjs
CHANGED
|
@@ -6,7 +6,7 @@ const DEFAULT_SANDBOX_ID = "default";
|
|
|
6
6
|
const DEFAULT_SANDBOX_BINDING = "SANDBOX";
|
|
7
7
|
const SANDBOX_USAGE_QUEUE_BINDING = "USAGE_EVENTS_QUEUE";
|
|
8
8
|
const SANDBOX_GATE_BINDING = "__VOID_PROXY";
|
|
9
|
-
const HEARTBEAT_MS =
|
|
9
|
+
const HEARTBEAT_MS = 3e5;
|
|
10
10
|
/**
|
|
11
11
|
* Thrown by `getSandbox()` when the platform gate denies a new acquire because
|
|
12
12
|
* the user has hit a concurrency or runtime budget cap. Surface this to the
|
|
@@ -20,6 +20,13 @@ var SandboxLimitError = class extends Error {
|
|
|
20
20
|
this.reason = reason;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
+
/** Managed platform Sandbox is unavailable or its activation gate cannot be verified. */
|
|
24
|
+
var SandboxUnavailableError = class extends Error {
|
|
25
|
+
name = "SandboxUnavailableError";
|
|
26
|
+
constructor(message = "Managed Sandbox is unavailable on this Void platform.") {
|
|
27
|
+
super(message);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
23
30
|
let sandboxBindingName = DEFAULT_SANDBOX_BINDING;
|
|
24
31
|
function __setSandboxBindingName(bindingName) {
|
|
25
32
|
sandboxBindingName = bindingName;
|
|
@@ -35,7 +42,7 @@ function getUsageContext() {
|
|
|
35
42
|
};
|
|
36
43
|
}
|
|
37
44
|
function getSandboxInstanceId(ctx) {
|
|
38
|
-
return ctx.id.
|
|
45
|
+
return ctx.id.toString();
|
|
39
46
|
}
|
|
40
47
|
/**
|
|
41
48
|
* Flush the accumulated runtime delta to the usage queue. No-op when the
|
|
@@ -60,20 +67,16 @@ async function emitRuntimeSeconds(ctx, sandboxRuntimeSeconds) {
|
|
|
60
67
|
console.error("[void/sandbox] failed to emit usage event:", error);
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
* AI/ISR convention without changing the on-the-wire contract.
|
|
74
|
-
*/
|
|
75
|
-
function resolveGateIdentity() {
|
|
76
|
-
const runtimeEnv = getRawRuntimeEnv();
|
|
70
|
+
function isManagedPlatformSandbox(runtimeEnv) {
|
|
71
|
+
return [
|
|
72
|
+
SANDBOX_GATE_BINDING,
|
|
73
|
+
"__PROJECT_ID",
|
|
74
|
+
"__VOID_PROXY_TOKEN",
|
|
75
|
+
"__VOID_USER_ID",
|
|
76
|
+
"__VOID_PROJECT_SLUG"
|
|
77
|
+
].some((binding) => runtimeEnv[binding] !== void 0);
|
|
78
|
+
}
|
|
79
|
+
function resolveGateIdentity(runtimeEnv = getRawRuntimeEnv()) {
|
|
77
80
|
const gate = runtimeEnv[SANDBOX_GATE_BINDING];
|
|
78
81
|
if (!gate) return null;
|
|
79
82
|
const projectId = runtimeEnv.__PROJECT_ID;
|
|
@@ -85,6 +88,30 @@ function resolveGateIdentity() {
|
|
|
85
88
|
aiToken
|
|
86
89
|
};
|
|
87
90
|
}
|
|
91
|
+
async function acquireManagedSandbox(sandboxId, runtimeEnv = getRawRuntimeEnv()) {
|
|
92
|
+
if (!isManagedPlatformSandbox(runtimeEnv)) return;
|
|
93
|
+
const identity = resolveGateIdentity(runtimeEnv);
|
|
94
|
+
if (!identity) throw new SandboxUnavailableError("Managed Sandbox activation could not verify the platform identity bindings.");
|
|
95
|
+
let response;
|
|
96
|
+
try {
|
|
97
|
+
response = await identity.gate.fetch("https://gate/sandbox/acquire", {
|
|
98
|
+
method: "POST",
|
|
99
|
+
headers: { "content-type": "application/json" },
|
|
100
|
+
body: JSON.stringify({
|
|
101
|
+
projectId: identity.projectId,
|
|
102
|
+
aiToken: identity.aiToken,
|
|
103
|
+
sandboxId
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
} catch {
|
|
107
|
+
throw new SandboxUnavailableError("Managed Sandbox activation could not reach the platform gate.");
|
|
108
|
+
}
|
|
109
|
+
if (response.status === 409) {
|
|
110
|
+
const body = await response.json().catch(() => ({}));
|
|
111
|
+
throw new SandboxLimitError(body.reason === "concurrency" || body.reason === "runtime_budget" ? body.reason : "concurrency");
|
|
112
|
+
}
|
|
113
|
+
if (!response.ok) throw new SandboxUnavailableError(`Managed Sandbox activation was rejected by the platform gate (HTTP ${response.status}).`);
|
|
114
|
+
}
|
|
88
115
|
/**
|
|
89
116
|
* Release notification to the gate so it can drop the active lease counter.
|
|
90
117
|
* Returns the in-flight fetch as a Promise (errors swallowed) so callers can
|
|
@@ -144,6 +171,7 @@ function notifyGateRefresh(ctx) {
|
|
|
144
171
|
*/
|
|
145
172
|
var VoidPlatformSandbox = class extends Sandbox {
|
|
146
173
|
async onStart() {
|
|
174
|
+
await acquireManagedSandbox(getSandboxInstanceId(this.ctx), this.env);
|
|
147
175
|
const now = Date.now();
|
|
148
176
|
const stored = await this.ctx.storage.get([STORAGE_KEY_START_TS, STORAGE_KEY_LAST_FLUSH_TS]);
|
|
149
177
|
const orphanedAnchor = stored.get(STORAGE_KEY_LAST_FLUSH_TS) ?? stored.get(STORAGE_KEY_START_TS);
|
|
@@ -206,50 +234,30 @@ var VoidPlatformSandbox = class extends Sandbox {
|
|
|
206
234
|
* body the shared proxy auth middleware expects. A `409` response means the
|
|
207
235
|
* user has exceeded a budget — we throw `SandboxLimitError` so the caller
|
|
208
236
|
* can render a clear message. Any other non-OK status (or a thrown transport
|
|
209
|
-
* error from the service binding)
|
|
210
|
-
*
|
|
211
|
-
* access entirely.
|
|
237
|
+
* error from the service binding) fails closed before returning a usable
|
|
238
|
+
* managed stub.
|
|
212
239
|
*
|
|
213
|
-
* When
|
|
214
|
-
*
|
|
215
|
-
* return the stub directly.
|
|
240
|
+
* When all reserved platform identity bindings are absent, this is a native
|
|
241
|
+
* Cloudflare or local deployment and returns the upstream stub directly.
|
|
216
242
|
*
|
|
217
|
-
* The stub is constructed BEFORE calling the gate so we can
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* `ctx.id.name` reports inside the DO, leaking the lease until TTL.
|
|
243
|
+
* The stub is constructed BEFORE calling the gate so we can pass its opaque,
|
|
244
|
+
* namespace-specific Durable Object id (`stub.id.toString()`) as `sandboxId`.
|
|
245
|
+
* The same id is available as `ctx.id.toString()` inside lifecycle hooks, so
|
|
246
|
+
* acquire, heartbeat, and release use one globally unique instance identity
|
|
247
|
+
* even when separate projects or deployments both request the name `default`.
|
|
223
248
|
* Constructing the stub does NOT start a container — that only happens on
|
|
224
249
|
* the first method call against the stub.
|
|
225
250
|
*/
|
|
226
251
|
async function getSandbox(id = DEFAULT_SANDBOX_ID, options) {
|
|
227
252
|
const { binding = sandboxBindingName, ...sandboxOptions } = options ?? {};
|
|
228
|
-
const
|
|
253
|
+
const namespace = requireRuntimeBinding(binding);
|
|
254
|
+
const stub = getSandbox$1(namespace, id, {
|
|
229
255
|
normalizeId: true,
|
|
230
256
|
...sandboxOptions
|
|
231
257
|
});
|
|
232
|
-
|
|
233
|
-
const identity = resolveGateIdentity();
|
|
234
|
-
if (identity) try {
|
|
235
|
-
const res = await identity.gate.fetch("https://gate/sandbox/acquire", {
|
|
236
|
-
method: "POST",
|
|
237
|
-
headers: { "content-type": "application/json" },
|
|
238
|
-
body: JSON.stringify({
|
|
239
|
-
projectId: identity.projectId,
|
|
240
|
-
aiToken: identity.aiToken,
|
|
241
|
-
sandboxId
|
|
242
|
-
})
|
|
243
|
-
});
|
|
244
|
-
if (res.status === 409) {
|
|
245
|
-
const body = await res.json().catch(() => ({}));
|
|
246
|
-
throw new SandboxLimitError(body.reason === "concurrency" || body.reason === "runtime_budget" ? body.reason : "concurrency");
|
|
247
|
-
}
|
|
248
|
-
} catch (error) {
|
|
249
|
-
if (error instanceof SandboxLimitError) throw error;
|
|
250
|
-
}
|
|
258
|
+
await acquireManagedSandbox(stub.id.toString());
|
|
251
259
|
return stub;
|
|
252
260
|
}
|
|
253
261
|
const sandbox = { get: getSandbox };
|
|
254
262
|
//#endregion
|
|
255
|
-
export { DEFAULT_SANDBOX_BINDING, DEFAULT_SANDBOX_ID, HEARTBEAT_MS, SANDBOX_GATE_BINDING, SANDBOX_USAGE_QUEUE_BINDING, Sandbox, SandboxLimitError, VoidPlatformSandbox, __setSandboxBindingName, getSandbox, sandbox };
|
|
263
|
+
export { DEFAULT_SANDBOX_BINDING, DEFAULT_SANDBOX_ID, HEARTBEAT_MS, SANDBOX_GATE_BINDING, SANDBOX_USAGE_QUEUE_BINDING, Sandbox, SandboxLimitError, SandboxUnavailableError, VoidPlatformSandbox, __setSandboxBindingName, getSandbox, sandbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "drizzle-orm/mysql-core";
|
package/dist/runtime/seed.d.mts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
+
import { MySql2Database } from "drizzle-orm/mysql2";
|
|
1
2
|
import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
2
3
|
import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
|
|
3
|
-
|
|
4
4
|
//#region src/runtime/seed.d.ts
|
|
5
|
-
type SqliteSeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = {
|
|
5
|
+
export type SqliteSeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = {
|
|
6
6
|
dialect: "sqlite";
|
|
7
7
|
db: BetterSQLite3Database<TSchema>;
|
|
8
8
|
schema: TSchema;
|
|
9
9
|
};
|
|
10
|
-
type PostgresSeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = {
|
|
10
|
+
export type PostgresSeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = {
|
|
11
11
|
dialect: "postgresql";
|
|
12
12
|
db: NodePgDatabase<TSchema>;
|
|
13
13
|
schema: TSchema;
|
|
14
14
|
};
|
|
15
|
+
export type MySqlSeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = {
|
|
16
|
+
dialect: "mysql";
|
|
17
|
+
db: MySql2Database<TSchema>;
|
|
18
|
+
schema: TSchema;
|
|
19
|
+
};
|
|
15
20
|
type DrizzleTableForDialect<TDialect extends string> = {
|
|
16
21
|
readonly _: {
|
|
17
22
|
readonly config: {
|
|
@@ -22,9 +27,9 @@ type DrizzleTableForDialect<TDialect extends string> = {
|
|
|
22
27
|
type SchemaHasTableDialect<TSchema extends Record<string, unknown>, TDialect extends string> = [Extract<TSchema[keyof TSchema], DrizzleTableForDialect<TDialect>>] extends [never] ? false : true;
|
|
23
28
|
type SchemaHasSqliteTables<TSchema extends Record<string, unknown>> = SchemaHasTableDialect<TSchema, "sqlite">;
|
|
24
29
|
type SchemaHasPostgresTables<TSchema extends Record<string, unknown>> = SchemaHasTableDialect<TSchema, "pg">;
|
|
25
|
-
type
|
|
26
|
-
type
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
type SchemaHasMySqlTables<TSchema extends Record<string, unknown>> = SchemaHasTableDialect<TSchema, "mysql">;
|
|
31
|
+
type FallbackSeedContext<TSchema extends Record<string, unknown>> = SchemaHasSqliteTables<TSchema> extends false ? SchemaHasPostgresTables<TSchema> extends false ? SchemaHasMySqlTables<TSchema> extends false ? SqliteSeedContext<TSchema> | PostgresSeedContext<TSchema> | MySqlSeedContext<TSchema> : never : never : never;
|
|
32
|
+
export type SeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = (SchemaHasSqliteTables<TSchema> extends true ? SqliteSeedContext<TSchema> : never) | (SchemaHasPostgresTables<TSchema> extends true ? PostgresSeedContext<TSchema> : never) | (SchemaHasMySqlTables<TSchema> extends true ? MySqlSeedContext<TSchema> : never) | FallbackSeedContext<TSchema>;
|
|
33
|
+
export type SeedFn<TSchema extends Record<string, unknown> = Record<string, never>> = (context: SeedContext<TSchema>) => void | Promise<void>;
|
|
34
|
+
export declare function defineSeed<TSchema extends Record<string, unknown> = Record<string, never>>(seed: SeedFn<TSchema>): SeedFn<TSchema>;
|
|
35
|
+
//#endregion
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
//#region src/runtime/sse-client.d.ts
|
|
2
|
-
type SseClientEvent<T = unknown> = {
|
|
2
|
+
export type SseClientEvent<T = unknown> = {
|
|
3
3
|
data: T;
|
|
4
4
|
event: string;
|
|
5
5
|
id: string;
|
|
6
6
|
raw: MessageEvent;
|
|
7
7
|
};
|
|
8
|
-
type SseEventMap = Record<string, unknown>;
|
|
9
|
-
type SseClient<Events extends SseEventMap = SseEventMap> = {
|
|
8
|
+
export type SseEventMap = Record<string, unknown>;
|
|
9
|
+
export type SseClient<Events extends SseEventMap = SseEventMap> = {
|
|
10
10
|
on<Name extends Extract<keyof Events, string>>(event: Name, handler: (event: SseClientEvent<Events[Name]>) => void): () => void;
|
|
11
11
|
on<T = unknown>(event: string, handler: (event: SseClientEvent<T>) => void): () => void;
|
|
12
12
|
onError(handler: (event: Event) => void): () => void;
|
|
13
13
|
close(): void;
|
|
14
14
|
};
|
|
15
|
-
type ConnectEventStreamOptions = {
|
|
15
|
+
export type ConnectEventStreamOptions = {
|
|
16
16
|
withCredentials?: boolean;
|
|
17
17
|
events?: Array<string>;
|
|
18
18
|
parse?: "json" | "text" | ((data: string) => unknown);
|
|
19
19
|
};
|
|
20
|
-
declare function connectEventStream<Events extends SseEventMap = SseEventMap>(url: string | URL, options?: ConnectEventStreamOptions): SseClient<Events>;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { ConnectEventStreamOptions, SseClient, SseClientEvent, SseEventMap, connectEventStream };
|
|
20
|
+
export declare function connectEventStream<Events extends SseEventMap = SseEventMap>(url: string | URL, options?: ConnectEventStreamOptions): SseClient<Events>;
|
|
21
|
+
//#endregion
|
package/dist/runtime/sse.d.mts
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
//#region src/runtime/sse.d.ts
|
|
2
|
-
type SseMessage = {
|
|
2
|
+
export type SseMessage = {
|
|
3
3
|
data?: unknown;
|
|
4
4
|
event?: string;
|
|
5
5
|
id?: string;
|
|
6
6
|
retry?: number;
|
|
7
7
|
};
|
|
8
|
-
type SseTextMessage = Omit<SseMessage, "data"> & {
|
|
8
|
+
export type SseTextMessage = Omit<SseMessage, "data"> & {
|
|
9
9
|
data?: string;
|
|
10
10
|
};
|
|
11
|
-
type SseStream = {
|
|
11
|
+
export type SseStream = {
|
|
12
12
|
readonly signal: AbortSignal;
|
|
13
13
|
readonly closed: Promise<void>;
|
|
14
14
|
send(message: SseMessage): Promise<void>;
|
|
15
15
|
comment(text?: string): Promise<void>;
|
|
16
16
|
close(): Promise<void>;
|
|
17
17
|
};
|
|
18
|
-
type SseKeepAliveOptions = boolean | {
|
|
18
|
+
export type SseKeepAliveOptions = boolean | {
|
|
19
19
|
intervalMs?: number;
|
|
20
20
|
comment?: string;
|
|
21
21
|
};
|
|
22
|
-
type EventStreamOptions = {
|
|
22
|
+
export type EventStreamOptions = {
|
|
23
23
|
headers?: HeadersInit;
|
|
24
24
|
keepAlive?: SseKeepAliveOptions;
|
|
25
25
|
signal?: AbortSignal;
|
|
26
26
|
};
|
|
27
|
-
declare class SseStreamClosedError extends Error {
|
|
27
|
+
export declare class SseStreamClosedError extends Error {
|
|
28
28
|
constructor(message?: string);
|
|
29
29
|
}
|
|
30
|
-
declare function formatSse(message: SseMessage): string;
|
|
31
|
-
declare function formatSseText(message: SseTextMessage): string;
|
|
32
|
-
declare function getLastEventId(request: Request): string | null;
|
|
33
|
-
declare function eventStream(start: (stream: SseStream) => void | Promise<void>, options?: EventStreamOptions): Response;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { EventStreamOptions, SseKeepAliveOptions, SseMessage, SseStream, SseStreamClosedError, SseTextMessage, eventStream, formatSse, formatSseText, getLastEventId };
|
|
30
|
+
export declare function formatSse(message: SseMessage): string;
|
|
31
|
+
export declare function formatSseText(message: SseTextMessage): string;
|
|
32
|
+
export declare function getLastEventId(request: Request): string | null;
|
|
33
|
+
export declare function eventStream(start: (stream: SseStream) => void | Promise<void>, options?: EventStreamOptions): Response;
|
|
34
|
+
//#endregion
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
//#region src/runtime/storage.d.ts
|
|
2
2
|
/** Create a storage client for a specific R2Bucket instance. */
|
|
3
|
-
declare function createStorage(bucket: R2Bucket): R2Bucket;
|
|
3
|
+
export declare function createStorage(bucket: R2Bucket): R2Bucket;
|
|
4
4
|
/** Default storage client — resolves `STORAGE` from the active runtime environment. */
|
|
5
|
-
declare const storage: R2Bucket;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { createStorage, storage };
|
|
5
|
+
export declare const storage: R2Bucket;
|
|
6
|
+
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { D as runValidation, E as ValidatorSlots, T as HandlerInput } from "../handler-
|
|
1
|
+
import { D as runValidation, E as ValidatorSlots, T as HandlerInput } from "../handler-D1hLsObx.mjs";
|
|
2
2
|
export { HandlerInput, ValidatorSlots, runValidation };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { n as AuthState } from "../auth-
|
|
2
|
-
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv } from "../better-auth-shared-
|
|
1
|
+
import { n as AuthState } from "../auth-DkcFflXV.mjs";
|
|
2
|
+
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv } from "../better-auth-shared-DSCeohOK.mjs";
|
|
3
3
|
import { AnyWebSocketDefinition } from "./ws.mjs";
|
|
4
|
-
|
|
5
4
|
//#region src/runtime/ws-server.d.ts
|
|
6
|
-
type WebSocketRouteMeta = {
|
|
5
|
+
export type WebSocketRouteMeta = {
|
|
7
6
|
pattern: string;
|
|
8
7
|
params: Array<string>;
|
|
9
8
|
className: string;
|
|
10
9
|
bindingName: string;
|
|
11
10
|
};
|
|
12
|
-
type WebSocketDurableObjectInstance = {
|
|
11
|
+
export type WebSocketDurableObjectInstance = {
|
|
13
12
|
fetch(request: Request): Promise<Response>;
|
|
14
13
|
webSocketMessage(webSocket: WebSocket, message: string | ArrayBuffer | ArrayBufferView): Promise<void>;
|
|
15
14
|
webSocketClose(webSocket: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
16
15
|
};
|
|
17
|
-
type WebSocketDurableObjectClass = {
|
|
16
|
+
export type WebSocketDurableObjectClass = {
|
|
18
17
|
new (state: DurableObjectState, env: Record<string, unknown>): WebSocketDurableObjectInstance;
|
|
19
18
|
};
|
|
20
19
|
type ResolveVoidAuthState = (request: Request, env: VoidAuthEnv, runtime: VoidAuthRuntimeOptions) => Promise<AuthState | null>;
|
|
21
|
-
declare function buildWebSocketInstanceId(route: Pick<WebSocketRouteMeta, "params">, params: Record<string, string>): string;
|
|
22
|
-
declare function createWebSocketDurableObject(definition: AnyWebSocketDefinition, route: WebSocketRouteMeta, authRuntime?: VoidAuthRuntimeOptions, resolveAuthState?: ResolveVoidAuthState): WebSocketDurableObjectClass;
|
|
23
|
-
|
|
24
|
-
declare function
|
|
25
|
-
|
|
26
|
-
export
|
|
20
|
+
export declare function buildWebSocketInstanceId(route: Pick<WebSocketRouteMeta, "params">, params: Record<string, string>): string;
|
|
21
|
+
export declare function createWebSocketDurableObject(definition: AnyWebSocketDefinition, route: WebSocketRouteMeta, authRuntime?: VoidAuthRuntimeOptions, resolveAuthState?: ResolveVoidAuthState): WebSocketDurableObjectClass;
|
|
22
|
+
/** Keep a removed WebSocket Durable Object class deployable without deleting its storage. */
|
|
23
|
+
export declare function createWebSocketTombstoneDurableObject(className: string): WebSocketDurableObjectClass;
|
|
24
|
+
export declare function handleWebSocketUpgrade(request: Request, env: Record<string, unknown>, routes: Array<WebSocketRouteMeta>): Promise<Response | null>;
|
|
25
|
+
export declare function forwardWebSocketRequest(request: Request, env: Record<string, unknown>, route: WebSocketRouteMeta): Promise<Response>;
|
|
26
|
+
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { authContext } from "./auth.mjs";
|
|
2
|
+
import { withRuntimeEnv } from "./env.mjs";
|
|
2
3
|
//#region src/runtime/ws-server.ts
|
|
3
4
|
function matchRoute(pattern, pathname) {
|
|
4
5
|
const patternSegments = pattern.split("/").filter(Boolean);
|
|
@@ -170,7 +171,10 @@ function createWebSocketDurableObject(definition, route, authRuntime, resolveAut
|
|
|
170
171
|
this.state = state;
|
|
171
172
|
this.env = env;
|
|
172
173
|
}
|
|
173
|
-
|
|
174
|
+
fetch(request) {
|
|
175
|
+
return withRuntimeEnv(this.env, () => this.handleFetch(request));
|
|
176
|
+
}
|
|
177
|
+
async handleFetch(request) {
|
|
174
178
|
const params = getRouteMatch(request, route) ?? {};
|
|
175
179
|
const roomId = buildWebSocketInstanceId(route, params);
|
|
176
180
|
const authState = authRuntime && resolveAuthState ? await resolveAuthState(request, this.env, authRuntime) : null;
|
|
@@ -226,7 +230,10 @@ function createWebSocketDurableObject(definition, route, authRuntime, resolveAut
|
|
|
226
230
|
const ctx = createSocketContext(this.state, this.env, request, fakeSocket, stored, definition.messages.server);
|
|
227
231
|
return withAuthState(authState, () => definition.onRequest(ctx));
|
|
228
232
|
}
|
|
229
|
-
|
|
233
|
+
webSocketMessage(webSocket, message) {
|
|
234
|
+
return withRuntimeEnv(this.env, () => this.handleWebSocketMessage(webSocket, message));
|
|
235
|
+
}
|
|
236
|
+
async handleWebSocketMessage(webSocket, message) {
|
|
230
237
|
const stored = getStoredConnection(webSocket);
|
|
231
238
|
const raw = parseIncomingMessage(message);
|
|
232
239
|
let parsed;
|
|
@@ -250,7 +257,10 @@ function createWebSocketDurableObject(definition, route, authRuntime, resolveAut
|
|
|
250
257
|
await withAuthState(stored.authState ?? null, () => definition.onMessage?.(ctx, result.value));
|
|
251
258
|
}
|
|
252
259
|
}
|
|
253
|
-
|
|
260
|
+
webSocketClose(webSocket, code, reason, wasClean) {
|
|
261
|
+
return withRuntimeEnv(this.env, () => this.handleWebSocketClose(webSocket, code, reason, wasClean));
|
|
262
|
+
}
|
|
263
|
+
async handleWebSocketClose(webSocket, code, reason, wasClean) {
|
|
254
264
|
const stored = getStoredConnection(webSocket);
|
|
255
265
|
const request = new Request(`https://void.local${route.pattern}`);
|
|
256
266
|
if (definition.__kind === "room") {
|
|
@@ -272,6 +282,24 @@ function createWebSocketDurableObject(definition, route, authRuntime, resolveAut
|
|
|
272
282
|
}
|
|
273
283
|
return VoidWebSocketDurableObject;
|
|
274
284
|
}
|
|
285
|
+
/** Keep a removed WebSocket Durable Object class deployable without deleting its storage. */
|
|
286
|
+
function createWebSocketTombstoneDurableObject(className) {
|
|
287
|
+
return class VoidWebSocketTombstoneDurableObject {
|
|
288
|
+
state;
|
|
289
|
+
env;
|
|
290
|
+
constructor(state, env) {
|
|
291
|
+
this.state = state;
|
|
292
|
+
this.env = env;
|
|
293
|
+
}
|
|
294
|
+
async fetch() {
|
|
295
|
+
return new Response(`WebSocket route ${className} has been removed.`, { status: 410 });
|
|
296
|
+
}
|
|
297
|
+
async webSocketMessage(webSocket) {
|
|
298
|
+
webSocket.close(1012, "WebSocket route removed");
|
|
299
|
+
}
|
|
300
|
+
async webSocketClose() {}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
275
303
|
function getStub(env, route, params) {
|
|
276
304
|
const binding = env[route.bindingName];
|
|
277
305
|
if (!binding) return null;
|
|
@@ -295,4 +323,4 @@ async function forwardWebSocketRequest(request, env, route) {
|
|
|
295
323
|
return stub.fetch(request);
|
|
296
324
|
}
|
|
297
325
|
//#endregion
|
|
298
|
-
export { buildWebSocketInstanceId, createWebSocketDurableObject, forwardWebSocketRequest, handleWebSocketUpgrade };
|
|
326
|
+
export { buildWebSocketInstanceId, createWebSocketDurableObject, createWebSocketTombstoneDurableObject, forwardWebSocketRequest, handleWebSocketUpgrade };
|