void 0.20.2 → 0.21.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/README.md +2 -2
- package/dist/agents-gni4eqBu.mjs +111 -0
- package/dist/auth-3sGB0zJ1.mjs +22 -0
- package/dist/{auth-DPl6kck4.mjs → auth-B9_D6ygs.mjs} +6 -241
- package/dist/auth-CAw7zHqj.mjs +2 -0
- package/dist/auth-client-BWBT8HLp.mjs +6 -0
- package/dist/auth-client-Bawdj38n.d.mts +7 -0
- package/dist/auth-client-react-7GFffu8R.d.mts +7 -0
- package/dist/auth-client-react-CMLwT2xI.mjs +6 -0
- package/dist/auth-client-solid-DyTFL4cq.d.mts +7 -0
- package/dist/auth-client-solid-UoreJWZG.mjs +6 -0
- package/dist/auth-client-svelte-Cv_WvrRk.mjs +6 -0
- package/dist/auth-client-svelte-zetW0KIH.d.mts +7 -0
- package/dist/auth-client-vue-CFk7Xbv3.mjs +6 -0
- package/dist/auth-client-vue-bChShbQP.d.mts +7 -0
- package/dist/{auth-cmd-gniL2fNt.mjs → auth-cmd-MkBG2u1f.mjs} +5 -5
- package/dist/{auth-link-NZdjCmSc.mjs → auth-link-Devmv96E.mjs} +5 -5
- package/dist/{better-auth-shared-DSCeohOK.d.mts → better-auth-shared-BoVwA5Vm.d.mts} +1 -6
- package/dist/{better-auth-shared-CYw1T3k4.mjs → better-auth-shared-syGYYmnY.mjs} +1 -1
- package/dist/{build-cmd-sI18tX_O.mjs → build-cmd-DsBGwtfs.mjs} +6 -4
- package/dist/{cache-IHn5MwBC.mjs → cache-BMw8eMyF.mjs} +6 -4
- package/dist/{cancel-deploy-C5qTOdLi.mjs → cancel-deploy-B3_s9NIN.mjs} +5 -3
- package/dist/cf-access-rAZxzMkL.mjs +181 -0
- package/dist/cf-build-output-CTdlo6Rt.mjs +520 -0
- package/dist/cli/cf-compat.d.mts +1 -0
- package/dist/cli/cf-compat.mjs +934 -0
- package/dist/cli/cli.mjs +61 -38
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-DAAivdid.mjs +2 -0
- package/dist/{client-dHfSJvAN.mjs → client-PdAJ-F0t.mjs} +148 -89
- package/dist/{cloudflare-auth-6M5llVPC.mjs → cloudflare-auth-BCmTc1X_.mjs} +13 -44
- package/dist/{cloudflare-cmd-4RPGN3KB.mjs → cloudflare-cmd-D6PrKn7o.mjs} +4 -7
- package/dist/{cloudflare-connect-t1UU5svD.mjs → cloudflare-connect-DloREDlc.mjs} +6 -6
- package/dist/cloudflare-operations-BHNJVDbN.mjs +2 -0
- package/dist/{cloudflare-operations-BzWnlC1_.mjs → cloudflare-operations-CPEdHYhM.mjs} +37 -39
- package/dist/cloudflare-user-output-Q-k0QoNQ.mjs +20 -0
- package/dist/collect-DAUItMDS.mjs +2 -0
- package/dist/collect-DXHNWHcT.mjs +48 -0
- package/dist/config--T87TD8T.mjs +2 -0
- package/dist/{config-NOG_U1aK.mjs → config-BSe70f4T.mjs} +4 -6
- package/dist/config-DDIFxQYx.mjs +2 -0
- package/dist/{config-uNGuFsI2.mjs → config-Dxr6cTXn.mjs} +22 -37
- package/dist/config-DywxBLQC.d.mts +185 -0
- package/dist/config-entry.d.mts +6 -0
- package/dist/config-entry.mjs +7 -0
- package/dist/config-uP7ZDtVZ.mjs +21 -0
- package/dist/config-write-y3CBI_ux.mjs +60 -0
- package/dist/{connect-Bfk31O_8.mjs → connect-BvC9kolB.mjs} +8 -6
- package/dist/{create-project-Bk9Z0-Jg.mjs → create-project-C9lQhRzj.mjs} +9 -25
- package/dist/create-project-CI-17RVJ.mjs +2 -0
- package/dist/database-provider-Cx525bwX.mjs +6 -0
- package/dist/database-provider.mjs +1 -5
- package/dist/{db-BkRoptAt.mjs → db-R7IQgOv5.mjs} +48 -44
- package/dist/{delete-DouASY9P.mjs → delete-CghI_NXn.mjs} +6 -4
- package/dist/deploy-CYPymbtG.mjs +2 -0
- package/dist/{deploy-DTaWUS1S.mjs → deploy-H968Lo4T.mjs} +765 -197
- package/dist/discover-BBzDZe_o.mjs +2 -0
- package/dist/{discover-xvfrgJeo.mjs → discover-C4O6YxVS.mjs} +3 -8
- package/dist/{dist-BrsS7cai.mjs → dist-4WkAWhWx.mjs} +1 -15
- package/dist/{dist-m40_XgNh.mjs → dist-Bn8Kodjp.mjs} +1 -1
- package/dist/dist-C5fND3R0.mjs +2 -0
- package/dist/dist-D7-nEOXi.mjs +2 -0
- package/dist/{output-B0cfNSx5.mjs → dist-Dn6nn2IU.mjs} +3 -926
- package/dist/{domain-1RhhOVrC.mjs → domain-CITt8lC-.mjs} +7 -5
- package/dist/{route-types-Da-DpyUp.mjs → drizzle-Beb2Am5S.mjs} +1 -280
- package/dist/{email-Ce6SQq-i.mjs → email-C5kaZXzJ.mjs} +2 -2
- package/dist/{email-C-lGh51B.mjs → email-_8VmyX7V.mjs} +14 -12
- package/dist/{entry-DU3oDoQ3.mjs → entry-DdRFGK0y.mjs} +2 -2
- package/dist/{env-DJHsPE7Z.mjs → env-DV4r3nHz.mjs} +9 -7
- package/dist/{env-DBKmK4vc.mjs → env-DX_v-Q-v.mjs} +1 -1
- package/dist/env-Yz4HcvHs.mjs +78 -0
- package/dist/env-helpers--wFmQ_5Q.mjs +136 -0
- package/dist/{env-types-BNPhro-M.mjs → env-types-CWDtqHgw.mjs} +6 -2
- package/dist/{env-validation-CF6KvTRf.mjs → env-validation-BsFEXps5.mjs} +19 -28
- package/dist/env-validation-DIDGM7h4.mjs +2 -0
- package/dist/fetch-CXDChK7B.mjs +18 -0
- package/dist/fetch-_SeGZao9.d.mts +57 -0
- package/dist/fetch-stream-AOByI7Ki.mjs +81 -0
- package/dist/fetch-stream-Bjf0hoZb.d.mts +49 -0
- package/dist/gen-BBiIZw6g.mjs +2 -0
- package/dist/{gen-B_wPnVTK.mjs → gen-CFOEEc-t.mjs} +13 -11
- package/dist/{generate-RTK8_kK1.mjs → generate-C0VY6RVf.mjs} +2 -2
- package/dist/{github-cmd-PW7ZnWTp.mjs → github-cmd-jYjha2LO.mjs} +18 -22
- package/dist/{handler-D1hLsObx.d.mts → handler-BXJTXd02.d.mts} +6 -1
- package/dist/handler-DghKr6dU.mjs +150 -0
- package/dist/head-D_QRR5Yd.mjs +112 -0
- package/dist/head-client-DzmJGN4C.mjs +90 -0
- package/dist/{headers-BAHwgHdW.mjs → headers-B_HBMgi0.mjs} +2 -2
- package/dist/{help-CwOX-zmI.mjs → help-C46mnlUS.mjs} +17 -12
- package/dist/help-CS_nAsWu.mjs +2 -0
- package/dist/index.d.mts +2 -20
- package/dist/index.mjs +116 -60
- package/dist/{init-BWZ7q5Z4.mjs → init-CSXmvxKu.mjs} +49 -50
- package/dist/{link-Rmvu2Wl_.mjs → link-DxMOALXk.mjs} +7 -5
- package/dist/{list-DEE2S6mY.mjs → list-0wQs0oYg.mjs} +7 -5
- package/dist/live-CB1y5IuC.mjs +411 -0
- package/dist/live-CKiJilLr.d.mts +105 -0
- package/dist/local-d1-DzykTWY8.mjs +104 -0
- package/dist/{login-Uvferzmm.mjs → login-CKk5NX4d.mjs} +6 -11
- package/dist/login-Ch9cgWRF.mjs +2 -0
- package/dist/{logs-27FenuiC.mjs → logs-hxWBSoej.mjs} +6 -4
- package/dist/migrate-CLty4mZR.mjs +2 -0
- package/dist/migrate-DcW8F2W8.mjs +285 -0
- package/dist/migration-handler-DM4clYj5.d.mts +51 -0
- package/dist/{neon-DHwd2zvC.mjs → neon-n74ta1Pr.mjs} +1 -1
- package/dist/{node-Ez5KW5rn.mjs → node-Cupyf7-s.mjs} +6 -6
- package/dist/{operator-auth-B3e08unv.mjs → operator-auth-BkVgJqv-.mjs} +2 -2
- package/dist/{operator-client-LUZnlnYk.mjs → operator-client-A0iex2yi.mjs} +2 -1
- package/dist/{operator-cmd-CjOTmAYE.mjs → operator-cmd-BEUYhaHB.mjs} +6 -6
- package/dist/output-urU86XeT.mjs +146 -0
- package/dist/{package-json-CPoWX79C.mjs → package-json-iCbMg5XF.mjs} +1 -1
- package/dist/pages/client.d.mts +5 -2
- package/dist/pages/client.mjs +5 -3
- package/dist/pages/head-client.mjs +1 -89
- package/dist/pages/head.mjs +1 -111
- package/dist/pages/index.d.mts +2 -3
- package/dist/pages/index.mjs +7 -7
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/prefetch.d.mts +2 -30
- package/dist/pages/prefetch.mjs +1 -89
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +3 -3
- package/dist/pages/serialize.d.mts +2 -9
- package/dist/pages/serialize.mjs +1 -13
- package/dist/plan-BEZ8VJW0.mjs +256 -0
- package/dist/plan-DpuOr14e.mjs +2 -0
- package/dist/{platform-auth-config-DrbQXXiW.mjs → platform-auth-config-Df6yVw-e.mjs} +6 -6
- package/dist/{platform-auth-protection-Bhtvp0B_.mjs → platform-auth-protection-Jb0yftay.mjs} +7 -5
- package/dist/{platform-auth-recovery-CeOKGVeJ.mjs → platform-auth-recovery-DmRyIfW0.mjs} +6 -5
- package/dist/platform-cmd-C9Vt7m-d.mjs +2 -0
- package/dist/{platform-cmd-BFhieCdV.mjs → platform-cmd-DRxCOTwy.mjs} +8 -5
- package/dist/{platform-domain-C74PULqV.mjs → platform-domain-IjiXgrXJ.mjs} +4 -3
- package/dist/{platform-lifecycle-BwAIgz-t.mjs → platform-lifecycle-BquAaU-5.mjs} +263 -56
- package/dist/platform-lifecycle-CuJIZNvA.mjs +2 -0
- package/dist/{platform-management-COogu_Se.mjs → platform-management-CCQKGsq4.mjs} +12 -7
- package/dist/platform-management-Cgyed0WY.mjs +2 -0
- package/dist/{platform-recovery-ewqLefp1.mjs → platform-recovery-DS8ih1SW.mjs} +3 -3
- package/dist/platform-registry-BJbgZLS1.mjs +431 -0
- package/dist/{plugin-inference-BDRfZngg.mjs → plugin-inference-DsvtJLll.mjs} +4 -4
- package/dist/prefetch-Bsc_Pb6c.mjs +90 -0
- package/dist/prefetch-Ce6la4EI.d.mts +31 -0
- package/dist/{prepare-blNRQvQl.mjs → prepare-CaUxODOU.mjs} +3 -2
- package/dist/prepare-D4CkM3_v.mjs +2 -0
- package/dist/{prepare-CtDJjoOj.mjs → prepare-pcWcxSCh.mjs} +13 -11
- package/dist/prerender-render-Cf_WDE9W.mjs +111 -0
- package/dist/prerender-render.mjs +1 -110
- package/dist/{preset-lAy0B0BQ.mjs → preset-Dowh9tTt.mjs} +16 -118
- package/dist/project-BEBFDFLz.mjs +2 -0
- package/dist/project-CWNIPoXc.mjs +209 -0
- package/dist/{project-cmd-DmZK9Hxf.mjs → project-cmd-2lN--YAX.mjs} +18 -16
- package/dist/{project-paths-SK8nMHPp.mjs → project-paths-CKQ-Q5JS.mjs} +47 -14
- package/dist/project-slug-23TpquG4.mjs +8 -0
- package/dist/project-slug-DofjTFd-.mjs +2 -0
- package/dist/{project-team-D8jOJMUJ.mjs → project-team-Dapn9HZn.mjs} +9 -5
- package/dist/{project-token-DA34bf-C.mjs → project-token-C90v9SJK.mjs} +6 -4
- package/dist/{project-tsconfig-Ql2XsSQp.mjs → project-tsconfig-CwfqUnVp.mjs} +2 -2
- package/dist/{protocol-C-pqYJjE.d.mts → protocol-ZH3jP4a7.d.mts} +1 -1
- package/dist/providers-BNKRacMr.d.mts +7 -0
- package/dist/provision-CNgEBkVA.mjs +3 -0
- package/dist/{provision-CSJOjjQk.mjs → provision-Cck2m3jJ.mjs} +11 -25
- package/dist/queues-BWKt1Xo4.d.mts +7 -0
- package/dist/{requests-CUExwGQQ.mjs → requests-CzX46I0i.mjs} +5 -3
- package/dist/resolve-project-BTotl8Nn.mjs +2 -0
- package/dist/{resolve-project--Vxawf7z.mjs → resolve-project-Xvis70DG.mjs} +2 -8
- package/dist/response-Tn7rU0MV.mjs +30 -0
- package/dist/{rollback-CDNGU1gr.mjs → rollback-BEeyc73H.mjs} +6 -4
- package/dist/{rolldown-runtime-rQ84J-ij.mjs → rolldown-runtime-DXIUcv95.mjs} +1 -10
- package/dist/route-types-Id82-veQ.mjs +280 -0
- package/dist/{local-d1-D2I6Ox5F.mjs → runner-BGVsGgkb.mjs} +6 -114
- package/dist/runner-CQs_cDSG.mjs +2 -0
- package/dist/runner-mysql-1o47achK.mjs +2 -0
- package/dist/{runner-mysql-7BPUNGmL.mjs → runner-mysql-BhwMk2Bm.mjs} +2 -9
- package/dist/{runner-pg-BkEza-dX.mjs → runner-pg-CJ_JeGF6.mjs} +2 -9
- package/dist/runner-pg-D7z01mQS.mjs +2 -0
- package/dist/runtime/ai.mjs +1 -1
- package/dist/runtime/auth-client-react.d.mts +2 -6
- package/dist/runtime/auth-client-react.mjs +1 -5
- package/dist/runtime/auth-client-solid.d.mts +2 -6
- package/dist/runtime/auth-client-solid.mjs +1 -5
- package/dist/runtime/auth-client-svelte.d.mts +2 -6
- package/dist/runtime/auth-client-svelte.mjs +1 -5
- package/dist/runtime/auth-client-vue.d.mts +2 -6
- package/dist/runtime/auth-client-vue.mjs +1 -5
- package/dist/runtime/auth-client.d.mts +2 -6
- package/dist/runtime/auth-client.mjs +1 -5
- package/dist/runtime/auth.mjs +1 -21
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.d.mts +3 -3
- package/dist/runtime/client-react.mjs +3 -3
- package/dist/runtime/client-solid.d.mts +3 -3
- package/dist/runtime/client-solid.mjs +3 -3
- package/dist/runtime/client-svelte.d.mts +3 -3
- package/dist/runtime/client-svelte.mjs +3 -3
- package/dist/runtime/client-vue.d.mts +3 -3
- package/dist/runtime/client-vue.mjs +3 -3
- package/dist/runtime/client.d.mts +3 -3
- package/dist/runtime/client.mjs +3 -3
- package/dist/runtime/db.mjs +1 -1
- package/dist/runtime/durable.mjs +1 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-helpers.mjs +1 -135
- package/dist/runtime/env-public-client.mjs +1 -1
- package/dist/runtime/env-public.mjs +2 -2
- package/dist/runtime/env.mjs +1 -77
- package/dist/runtime/fetch-stream.d.mts +2 -49
- package/dist/runtime/fetch-stream.mjs +2 -80
- package/dist/runtime/fetch.d.mts +2 -57
- package/dist/runtime/fetch.mjs +2 -17
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -149
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +2 -2
- package/dist/runtime/live.d.mts +2 -104
- package/dist/runtime/live.mjs +1 -410
- package/dist/runtime/migration-handler-mysql.d.mts +1 -1
- package/dist/runtime/migration-handler-pg.d.mts +1 -1
- package/dist/runtime/migration-handler.d.mts +2 -50
- package/dist/runtime/queues.d.mts +2 -6
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/remote/index.mjs +49 -8
- package/dist/runtime/response.mjs +1 -29
- package/dist/runtime/sandbox.d.mts +4 -56
- package/dist/runtime/sandbox.mjs +82 -221
- package/dist/runtime/sse.mjs +1 -171
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/validator.mjs +1 -71
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws-server.mjs +2 -2
- package/dist/runtime/ws.d.mts +2 -121
- package/dist/{scan-CpK-57ug.mjs → scan-DJbooZm2.mjs} +3 -3
- package/dist/{scan-BMH4rzlv.mjs → scan-DdDvRCU1.mjs} +8 -26
- package/dist/{secret-Bzzi2e9E.mjs → secret-wnTel5Yw.mjs} +8 -6
- package/dist/serialize-BPvnNQuA.mjs +14 -0
- package/dist/serialize-CfSwWfF2.d.mts +10 -0
- package/dist/{skills-C0RvGjeE.mjs → skills-B-690E7h.mjs} +3 -2
- package/dist/sse-BaC1jXko.mjs +172 -0
- package/dist/{subcommand-prompt-Bmyn5Rlc.mjs → subcommand-prompt-Gj3VzLIh.mjs} +2 -1
- package/dist/sveltekit.d.mts +2 -1
- package/dist/sveltekit.mjs +3 -2
- package/dist/validate-DqJ33oHj.mjs +2 -0
- package/dist/validate-qNhV00PD.mjs +180 -0
- package/dist/validator-BTOu0fB0.mjs +72 -0
- package/dist/{wrangler--imS8n0d.mjs → wrangler-D01qs6VB.mjs} +259 -71
- package/dist/ws-BwcqizuH.d.mts +122 -0
- package/dist/{yarn-pnp-DxSInkzL.mjs → yarn-pnp-CVEc3gE7.mjs} +1 -1
- package/package.json +19 -8
- package/skills/void/SKILL.md +7 -5
- package/skills/void/docs/guide/ai.md +3 -3
- package/skills/void/docs/guide/app-types.md +12 -11
- package/skills/void/docs/guide/auth.md +2 -2
- package/skills/void/docs/guide/database/d1.md +1 -1
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +3 -3
- package/skills/void/docs/guide/deployment.md +16 -16
- package/skills/void/docs/guide/durable-state.md +2 -2
- package/skills/void/docs/guide/edge/headers.md +3 -3
- package/skills/void/docs/guide/edge/prerendering.md +1 -1
- package/skills/void/docs/guide/edge/redirects.md +4 -4
- package/skills/void/docs/guide/edge/revalidation.md +6 -6
- package/skills/void/docs/guide/edge/rewrites.md +28 -27
- package/skills/void/docs/guide/edge/static-assets.md +1 -1
- package/skills/void/docs/guide/email.md +27 -25
- package/skills/void/docs/guide/env-migration.md +1 -1
- package/skills/void/docs/guide/index.md +1 -1
- package/skills/void/docs/guide/pages-routing/head.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +171 -0
- package/skills/void/docs/guide/platform/administration/email.md +121 -0
- package/skills/void/docs/guide/platform/administration/operations.md +97 -0
- package/skills/void/docs/guide/platform/administration/projects.md +56 -0
- package/skills/void/docs/guide/platform/development/local.md +119 -0
- package/skills/void/docs/guide/platform/development/runtime.md +124 -0
- package/skills/void/docs/guide/platform/development/schema-ci.md +95 -0
- package/skills/void/docs/guide/platform/installation/ci.md +58 -0
- package/skills/void/docs/guide/platform/installation/credentials.md +90 -0
- package/skills/void/docs/guide/platform/installation/domains.md +68 -0
- package/skills/void/docs/guide/platform/installation/first-deployment.md +82 -0
- package/skills/void/docs/guide/platform/installation/maintenance.md +137 -0
- package/skills/void/docs/guide/platform/installation/prerequisites.md +88 -0
- package/skills/void/docs/guide/platform/installation/setup.md +169 -0
- package/skills/void/docs/guide/platform/installation/uninstall.md +54 -0
- package/skills/void/docs/guide/platform-administration.md +6 -414
- package/skills/void/docs/guide/platform-development.md +5 -316
- package/skills/void/docs/guide/project-collaboration.md +1 -1
- package/skills/void/docs/guide/remote-dev.md +2 -2
- package/skills/void/docs/guide/sandboxes.md +10 -25
- package/skills/void/docs/guide/self-hosted-platform.md +11 -694
- package/skills/void/docs/guide/ssg.md +1 -1
- package/skills/void/docs/guide/websockets.md +1 -1
- package/skills/void/docs/integrations/cloudflare.md +86 -84
- package/skills/void/docs/integrations/frameworks/analog.md +14 -9
- package/skills/void/docs/integrations/frameworks/astro.md +14 -10
- package/skills/void/docs/integrations/frameworks/nuxt.md +14 -9
- package/skills/void/docs/integrations/frameworks/overview.md +35 -29
- package/skills/void/docs/integrations/frameworks/react-router.md +1 -1
- package/skills/void/docs/integrations/frameworks/sveltekit.md +33 -30
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +1 -1
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -5
- package/skills/void/docs/reference/api.md +55 -38
- package/skills/void/docs/reference/cli.md +60 -34
- package/skills/void/docs/reference/config.md +57 -34
- package/skills/void/docs/reference/resource-inference.md +10 -10
- package/skills/void/docs/reference/structure.md +2 -2
- package/dist/validate-tBBN_dXH.mjs +0 -505
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { a as dim, c as import_picocolors, o as ensureUtc, r as cliTitle, u as tablePrefix } from "./output-urU86XeT.mjs";
|
|
2
|
+
import { c as getToken } from "./auth-B9_D6ygs.mjs";
|
|
3
|
+
import { i as readDeploymentPlatform, o as readProjectConfig } from "./project-CWNIPoXc.mjs";
|
|
4
|
+
import { O as intro, P as outro, j as log } from "./dist-Dn6nn2IU.mjs";
|
|
5
|
+
import { n as PlatformClient } from "./client-PdAJ-F0t.mjs";
|
|
6
|
+
import { r as resolveProjectBySlug } from "./resolve-project-Xvis70DG.mjs";
|
|
5
7
|
//#region src/cli/list.ts
|
|
6
8
|
async function runListCommand(root, slug) {
|
|
7
9
|
console.log();
|
|
@@ -41,7 +43,7 @@ async function runListCommand(root, slug) {
|
|
|
41
43
|
}
|
|
42
44
|
async function showCloudflareDeployments(root, slug) {
|
|
43
45
|
if (slug) throw new Error("project: A project name selects a Void platform project and is not used for direct Cloudflare apps.");
|
|
44
|
-
const { readCloudflareWorkerStatus, resolveCloudflareOperationContext } = await import("./cloudflare-operations-
|
|
46
|
+
const { readCloudflareWorkerStatus, resolveCloudflareOperationContext } = await import("./cloudflare-operations-BHNJVDbN.mjs");
|
|
45
47
|
const status = await readCloudflareWorkerStatus(resolveCloudflareOperationContext(root));
|
|
46
48
|
if (status.versions.length === 0) {
|
|
47
49
|
outro(`No deployments for ${status.workerName}.`);
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { a as getRawRuntimeEnv } from "./env-raw-Cx8ElDdj.mjs";
|
|
2
|
+
import { i as getUser } from "./auth-3sGB0zJ1.mjs";
|
|
3
|
+
//#region src/runtime/live.ts
|
|
4
|
+
let liveBindingName = "VOID_LIVE";
|
|
5
|
+
const registeredStreamIds = /* @__PURE__ */ new Set();
|
|
6
|
+
const DEFAULT_LIMITS = {
|
|
7
|
+
maxSubscriptionsPerConnection: 256,
|
|
8
|
+
maxSubscriptionsPerTopic: 256,
|
|
9
|
+
maxOperationsPerControlRequest: 100,
|
|
10
|
+
maxQueuedEventsPerConnection: 100,
|
|
11
|
+
maxEncodedEventSize: 65536,
|
|
12
|
+
deliveryAttemptTimeoutMs: 1500
|
|
13
|
+
};
|
|
14
|
+
const MAX_SUBSCRIPTIONS_PER_TOPIC = 256;
|
|
15
|
+
function __setLiveBindingName(name) {
|
|
16
|
+
liveBindingName = assertBindingName(name);
|
|
17
|
+
}
|
|
18
|
+
function __getLiveBindingName() {
|
|
19
|
+
return liveBindingName;
|
|
20
|
+
}
|
|
21
|
+
function defineLiveStream(options) {
|
|
22
|
+
const streamId = assertStreamId(options.id);
|
|
23
|
+
const limits = resolveLiveLimits(options.limits);
|
|
24
|
+
if (registeredStreamIds.has(streamId)) throw new Error(`live: duplicate stream id "${streamId}".`);
|
|
25
|
+
registeredStreamIds.add(streamId);
|
|
26
|
+
async function resolveOwner(ctx, request, connectOptions) {
|
|
27
|
+
const resolvedUser = connectOptions && "user" in connectOptions ? connectOptions.user : getContextUser(ctx) ?? getUser();
|
|
28
|
+
const hookContext = {
|
|
29
|
+
request,
|
|
30
|
+
env: ctx.env,
|
|
31
|
+
user: resolvedUser ?? null,
|
|
32
|
+
owner: connectOptions?.owner ?? null
|
|
33
|
+
};
|
|
34
|
+
const owner = (connectOptions && "owner" in connectOptions ? connectOptions.owner : await options.identifyConnection?.(hookContext)) ?? defaultOwner(resolvedUser);
|
|
35
|
+
if (owner == null && !options.allowAnonymousControl) throw liveResponseError("FORBIDDEN", "live: anonymous control is not enabled.", 403);
|
|
36
|
+
assertOwner(owner);
|
|
37
|
+
return {
|
|
38
|
+
owner,
|
|
39
|
+
user: resolvedUser ?? null
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async function publishWithEnv(env, topic, data, publishOptions = {}) {
|
|
43
|
+
const binding = getLiveBinding(env);
|
|
44
|
+
assertTopic(topic);
|
|
45
|
+
assertOptionalString("type", publishOptions.type);
|
|
46
|
+
assertOptionalString("eventId", publishOptions.eventId);
|
|
47
|
+
assertJsonSerializable(data);
|
|
48
|
+
const topicKey = await topicDigest(streamId, topic);
|
|
49
|
+
const id = binding.idFromName(topicInstanceName(streamId, topicKey));
|
|
50
|
+
const response = await binding.get(id).fetch(internalUrl("/publish"), {
|
|
51
|
+
method: "POST",
|
|
52
|
+
body: JSON.stringify({
|
|
53
|
+
streamId,
|
|
54
|
+
topic,
|
|
55
|
+
topicKey,
|
|
56
|
+
data,
|
|
57
|
+
type: publishOptions.type,
|
|
58
|
+
eventId: publishOptions.eventId,
|
|
59
|
+
limits
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
const body = await response.text();
|
|
64
|
+
const parsed = parseLiveControlResponse(body);
|
|
65
|
+
if (parsed && !parsed.accepted) throw new Error(`${parsed.error.code}: ${parsed.error.message}`);
|
|
66
|
+
throw new Error(body || response.statusText);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
async connect(ctx, connectOptions) {
|
|
71
|
+
try {
|
|
72
|
+
const request = ctx.req.raw;
|
|
73
|
+
const connectionId = getConnectionId(request);
|
|
74
|
+
const { owner, user } = await resolveOwner(ctx, request, connectOptions);
|
|
75
|
+
const decision = await options.onConnect?.({
|
|
76
|
+
request,
|
|
77
|
+
env: ctx.env,
|
|
78
|
+
user,
|
|
79
|
+
owner,
|
|
80
|
+
connection: { id: connectionId }
|
|
81
|
+
});
|
|
82
|
+
if (decision instanceof Response) return decision;
|
|
83
|
+
const binding = getLiveBinding(ctx.env);
|
|
84
|
+
const id = binding.idFromName(connectionInstanceName(streamId, connectionId));
|
|
85
|
+
return binding.get(id).fetch(internalUrl("/connect"), {
|
|
86
|
+
method: "POST",
|
|
87
|
+
body: JSON.stringify({
|
|
88
|
+
streamId,
|
|
89
|
+
connectionId,
|
|
90
|
+
owner,
|
|
91
|
+
limits
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
} catch (error) {
|
|
95
|
+
return errorToResponse(error);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
async control(ctx, controlOptions) {
|
|
99
|
+
try {
|
|
100
|
+
const request = ctx.req.raw;
|
|
101
|
+
const body = await readControlRequest(request, limits);
|
|
102
|
+
const { owner, user } = await resolveOwner(ctx, request, controlOptions);
|
|
103
|
+
const authorized = [];
|
|
104
|
+
const results = [];
|
|
105
|
+
for (const entry of body.operations) {
|
|
106
|
+
if (!entry.ok) {
|
|
107
|
+
results[entry.index] = entry.result;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const { operation, index } = entry;
|
|
111
|
+
if (operation.kind === "unsubscribe") {
|
|
112
|
+
authorized.push({
|
|
113
|
+
operation,
|
|
114
|
+
index
|
|
115
|
+
});
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const decision = await options.onSubscribe?.({
|
|
119
|
+
request,
|
|
120
|
+
env: ctx.env,
|
|
121
|
+
user,
|
|
122
|
+
owner,
|
|
123
|
+
connection: { id: body.connectionId },
|
|
124
|
+
subscription: { id: operation.id },
|
|
125
|
+
topic: operation.topic,
|
|
126
|
+
lastEventId: operation.lastEventId
|
|
127
|
+
});
|
|
128
|
+
if (decision instanceof Response) {
|
|
129
|
+
results[index] = {
|
|
130
|
+
ok: false,
|
|
131
|
+
kind: "subscribe",
|
|
132
|
+
id: operation.id,
|
|
133
|
+
error: await responseToControlError(decision)
|
|
134
|
+
};
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
authorized.push({
|
|
138
|
+
operation,
|
|
139
|
+
index
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (authorized.length > 0) {
|
|
143
|
+
const binding = getLiveBinding(ctx.env);
|
|
144
|
+
const id = binding.idFromName(connectionInstanceName(streamId, body.connectionId));
|
|
145
|
+
const response = await binding.get(id).fetch(internalUrl("/control"), {
|
|
146
|
+
method: "POST",
|
|
147
|
+
body: JSON.stringify({
|
|
148
|
+
streamId,
|
|
149
|
+
connectionId: body.connectionId,
|
|
150
|
+
owner,
|
|
151
|
+
operations: authorized.map((entry) => entry.operation),
|
|
152
|
+
limits
|
|
153
|
+
})
|
|
154
|
+
});
|
|
155
|
+
const controlResponse = await response.json();
|
|
156
|
+
if (!controlResponse.accepted) return Response.json(controlResponse, { status: response.status });
|
|
157
|
+
for (const [resultIndex, result] of controlResponse.results.entries()) {
|
|
158
|
+
const operation = authorized[resultIndex];
|
|
159
|
+
if (operation) results[operation.index] = result;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
for (const entry of body.operations) {
|
|
163
|
+
if (!entry.ok) continue;
|
|
164
|
+
const { operation, index } = entry;
|
|
165
|
+
results[index] ??= {
|
|
166
|
+
ok: false,
|
|
167
|
+
kind: operation.kind,
|
|
168
|
+
id: operation.id,
|
|
169
|
+
error: {
|
|
170
|
+
code: "INTERNAL_ERROR",
|
|
171
|
+
message: "live: missing control result."
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return Response.json({
|
|
176
|
+
accepted: true,
|
|
177
|
+
connectionId: body.connectionId,
|
|
178
|
+
results
|
|
179
|
+
});
|
|
180
|
+
} catch (error) {
|
|
181
|
+
return errorToResponse(error);
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
publish(topic, data, publishOptions) {
|
|
185
|
+
let env;
|
|
186
|
+
try {
|
|
187
|
+
env = getRawRuntimeEnv();
|
|
188
|
+
} catch {
|
|
189
|
+
throw new Error("live: publish() was called outside a Void server runtime context. Pass an explicit env with stream.withEnv(env).publish(...).");
|
|
190
|
+
}
|
|
191
|
+
return publishWithEnv(env, topic, data, publishOptions);
|
|
192
|
+
},
|
|
193
|
+
withEnv(env) {
|
|
194
|
+
return { publish(topic, data, publishOptions) {
|
|
195
|
+
return publishWithEnv(env, topic, data, publishOptions);
|
|
196
|
+
} };
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
function defaultOwner(user) {
|
|
201
|
+
if (user && typeof user === "object" && "id" in user && typeof user.id === "string") return `user:${user.id}`;
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
function getContextUser(ctx) {
|
|
205
|
+
try {
|
|
206
|
+
return ctx.get("user");
|
|
207
|
+
} catch {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function parseLiveControlResponse(body) {
|
|
212
|
+
try {
|
|
213
|
+
const parsed = JSON.parse(body);
|
|
214
|
+
return typeof parsed === "object" && parsed !== null && "accepted" in parsed ? parsed : null;
|
|
215
|
+
} catch {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async function readControlRequest(request, limits) {
|
|
220
|
+
let body;
|
|
221
|
+
try {
|
|
222
|
+
body = await request.json();
|
|
223
|
+
} catch {
|
|
224
|
+
throw liveResponseError("BAD_REQUEST", "live: control request body must be JSON.", 400);
|
|
225
|
+
}
|
|
226
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) throw liveResponseError("BAD_REQUEST", "live: control request body must be an object.", 400);
|
|
227
|
+
const record = body;
|
|
228
|
+
const connectionId = assertConnectionId(record.connectionId);
|
|
229
|
+
if (!Array.isArray(record.operations)) throw liveResponseError("BAD_REQUEST", "live: operations must be an array.", 400);
|
|
230
|
+
if (record.operations.length > limits.maxOperationsPerControlRequest) throw liveResponseError("BAD_REQUEST", "live: too many operations in one control request.", 400);
|
|
231
|
+
return {
|
|
232
|
+
connectionId,
|
|
233
|
+
operations: record.operations.map(parseOperation)
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function parseOperation(value, index) {
|
|
237
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw liveResponseError("BAD_REQUEST", "live: operation must be an object.", 400);
|
|
238
|
+
const record = value;
|
|
239
|
+
if (record.kind === "subscribe") {
|
|
240
|
+
const id = parseBoundedString(record.id, 1, 256);
|
|
241
|
+
if (id == null) return invalidOperation(index, "subscribe", record.id, "INVALID_SUBSCRIPTION_ID");
|
|
242
|
+
const topic = parseBoundedString(record.topic, 1, 512);
|
|
243
|
+
if (topic == null) return invalidOperation(index, "subscribe", id, "INVALID_TOPIC");
|
|
244
|
+
let lastEventId;
|
|
245
|
+
if (record.lastEventId !== void 0) {
|
|
246
|
+
lastEventId = parseBoundedString(record.lastEventId, 0, 512) ?? void 0;
|
|
247
|
+
if (lastEventId === void 0) return invalidOperation(index, "subscribe", id, "BAD_REQUEST");
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
ok: true,
|
|
251
|
+
index,
|
|
252
|
+
operation: {
|
|
253
|
+
kind: "subscribe",
|
|
254
|
+
id,
|
|
255
|
+
topic,
|
|
256
|
+
...lastEventId !== void 0 && { lastEventId }
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
if (record.kind === "unsubscribe") {
|
|
261
|
+
const id = parseBoundedString(record.id, 1, 256);
|
|
262
|
+
if (id == null) return invalidOperation(index, "unsubscribe", record.id, "INVALID_SUBSCRIPTION_ID");
|
|
263
|
+
return {
|
|
264
|
+
ok: true,
|
|
265
|
+
index,
|
|
266
|
+
operation: {
|
|
267
|
+
kind: "unsubscribe",
|
|
268
|
+
id
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
throw liveResponseError("BAD_REQUEST", "live: operation kind is invalid.", 400);
|
|
273
|
+
}
|
|
274
|
+
function invalidOperation(index, kind, id, code) {
|
|
275
|
+
return {
|
|
276
|
+
ok: false,
|
|
277
|
+
index,
|
|
278
|
+
result: {
|
|
279
|
+
ok: false,
|
|
280
|
+
kind,
|
|
281
|
+
id: typeof id === "string" ? id : "",
|
|
282
|
+
error: {
|
|
283
|
+
code,
|
|
284
|
+
message: {
|
|
285
|
+
BAD_REQUEST: "live: invalid control operation.",
|
|
286
|
+
CONNECTION_CLOSED: "live: connection closed.",
|
|
287
|
+
CONNECTION_NOT_FOUND: "live: connection not found.",
|
|
288
|
+
FORBIDDEN: "Forbidden",
|
|
289
|
+
INVALID_SUBSCRIPTION_ID: "live: invalid subscription id.",
|
|
290
|
+
INVALID_TOPIC: "live: invalid topic.",
|
|
291
|
+
OWNER_MISMATCH: "live: owner mismatch.",
|
|
292
|
+
SUBSCRIPTION_LIMIT: "live: subscription limit reached.",
|
|
293
|
+
TOPIC_FULL: "live: topic subscription limit reached.",
|
|
294
|
+
PAYLOAD_TOO_LARGE: "live: payload too large.",
|
|
295
|
+
INTERNAL_ERROR: "live: internal error."
|
|
296
|
+
}[code]
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function getLiveBinding(env) {
|
|
302
|
+
if (typeof env !== "object" || env === null) throw new Error("live: Cloudflare env is unavailable.");
|
|
303
|
+
const binding = env[liveBindingName];
|
|
304
|
+
if (!binding) throw new Error(`live: Missing Durable Object binding "${liveBindingName}".`);
|
|
305
|
+
return binding;
|
|
306
|
+
}
|
|
307
|
+
function getConnectionId(request) {
|
|
308
|
+
return assertConnectionId(new URL(request.url).searchParams.get("connectionId"));
|
|
309
|
+
}
|
|
310
|
+
function assertStreamId(value) {
|
|
311
|
+
return assertBoundedString("stream id", value, 1, 128);
|
|
312
|
+
}
|
|
313
|
+
function assertBindingName(value) {
|
|
314
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(value)) throw new Error(`live: invalid Durable Object binding name "${value}".`);
|
|
315
|
+
return value;
|
|
316
|
+
}
|
|
317
|
+
function assertConnectionId(value) {
|
|
318
|
+
return assertBoundedString("connectionId", value, 16, 256);
|
|
319
|
+
}
|
|
320
|
+
function assertTopic(value) {
|
|
321
|
+
return assertBoundedString("topic", value, 1, 512);
|
|
322
|
+
}
|
|
323
|
+
function assertOwner(value) {
|
|
324
|
+
if (value !== null) assertBoundedString("owner", value, 1, 512);
|
|
325
|
+
}
|
|
326
|
+
function assertOptionalString(name, value) {
|
|
327
|
+
if (value !== void 0) assertBoundedString(name, value, 1, 512);
|
|
328
|
+
}
|
|
329
|
+
function resolveLiveLimits(input) {
|
|
330
|
+
const limits = { ...DEFAULT_LIMITS };
|
|
331
|
+
for (const key of Object.keys(limits)) {
|
|
332
|
+
const value = input?.[key];
|
|
333
|
+
if (value === void 0) continue;
|
|
334
|
+
if (!Number.isFinite(value) || !Number.isInteger(value) || value <= 0) throw new Error(`live: limits.${key} must be a positive finite integer.`);
|
|
335
|
+
limits[key] = value;
|
|
336
|
+
}
|
|
337
|
+
if (limits.maxSubscriptionsPerTopic > MAX_SUBSCRIPTIONS_PER_TOPIC) throw new Error(`live: limits.maxSubscriptionsPerTopic must be at most ${MAX_SUBSCRIPTIONS_PER_TOPIC}.`);
|
|
338
|
+
return limits;
|
|
339
|
+
}
|
|
340
|
+
function assertBoundedString(name, value, min, max) {
|
|
341
|
+
const parsed = parseBoundedString(value, min, max);
|
|
342
|
+
if (parsed == null) throw liveResponseError("BAD_REQUEST", `live: invalid ${name}.`, 400);
|
|
343
|
+
return parsed;
|
|
344
|
+
}
|
|
345
|
+
function parseBoundedString(value, min, max) {
|
|
346
|
+
if (typeof value !== "string" || value.length < min || value.length > max || /[\r\n]/.test(value) || value.includes("\0")) return null;
|
|
347
|
+
return value;
|
|
348
|
+
}
|
|
349
|
+
function assertJsonSerializable(value) {
|
|
350
|
+
try {
|
|
351
|
+
if (typeof JSON.stringify(value) !== "string") throw new Error("unsupported value");
|
|
352
|
+
} catch (error) {
|
|
353
|
+
throw new Error(`live: payload must be JSON-serializable. ${error instanceof Error ? error.message : String(error)}`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
async function topicDigest(streamId, topic) {
|
|
357
|
+
const bytes = new TextEncoder().encode(`${streamId}\u0000${topic}`);
|
|
358
|
+
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
359
|
+
const binary = String.fromCharCode(...new Uint8Array(digest));
|
|
360
|
+
return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
361
|
+
}
|
|
362
|
+
function connectionInstanceName(streamId, connectionId) {
|
|
363
|
+
return `live:${streamId}:connection:${connectionId}`;
|
|
364
|
+
}
|
|
365
|
+
function topicInstanceName(streamId, topicKey) {
|
|
366
|
+
return `live:${streamId}:topic:${topicKey}`;
|
|
367
|
+
}
|
|
368
|
+
function internalUrl(path) {
|
|
369
|
+
return `https://void.live${path}`;
|
|
370
|
+
}
|
|
371
|
+
var LiveResponseError = class extends Error {
|
|
372
|
+
code;
|
|
373
|
+
status;
|
|
374
|
+
constructor(code, message, status) {
|
|
375
|
+
super(message);
|
|
376
|
+
this.code = code;
|
|
377
|
+
this.status = status;
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
function liveResponseError(code, message, status) {
|
|
381
|
+
throw new LiveResponseError(code, message, status);
|
|
382
|
+
}
|
|
383
|
+
function errorToResponse(error) {
|
|
384
|
+
if (error instanceof LiveResponseError) return Response.json({
|
|
385
|
+
accepted: false,
|
|
386
|
+
error: {
|
|
387
|
+
code: error.code,
|
|
388
|
+
message: error.message
|
|
389
|
+
}
|
|
390
|
+
}, { status: error.status });
|
|
391
|
+
return Response.json({
|
|
392
|
+
accepted: false,
|
|
393
|
+
error: {
|
|
394
|
+
code: "INTERNAL_ERROR",
|
|
395
|
+
message: error instanceof Error ? error.message : String(error)
|
|
396
|
+
}
|
|
397
|
+
}, { status: 500 });
|
|
398
|
+
}
|
|
399
|
+
async function responseToControlError(response) {
|
|
400
|
+
const message = await response.text().catch(() => "") || response.statusText;
|
|
401
|
+
if (response.status === 403 || response.status === 401) return {
|
|
402
|
+
code: "FORBIDDEN",
|
|
403
|
+
message: message || "Forbidden"
|
|
404
|
+
};
|
|
405
|
+
return {
|
|
406
|
+
code: "BAD_REQUEST",
|
|
407
|
+
message: message || "Subscription rejected"
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
export { __setLiveBindingName as n, defineLiveStream as r, __getLiveBindingName as t };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { r as AuthUser } from "./auth-DkcFflXV.mjs";
|
|
2
|
+
import { a as CloudEnv, r as CloudContext } from "./handler-BXJTXd02.mjs";
|
|
3
|
+
//#region src/runtime/live.d.ts
|
|
4
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
type LiveControlRequest = {
|
|
6
|
+
connectionId: string;
|
|
7
|
+
operations: Array<LiveControlOperation>;
|
|
8
|
+
};
|
|
9
|
+
type LiveControlOperation = {
|
|
10
|
+
kind: "subscribe";
|
|
11
|
+
id: string;
|
|
12
|
+
topic: string;
|
|
13
|
+
lastEventId?: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "unsubscribe";
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
type LiveControlErrorCode = "BAD_REQUEST" | "CONNECTION_CLOSED" | "CONNECTION_NOT_FOUND" | "FORBIDDEN" | "INVALID_SUBSCRIPTION_ID" | "INVALID_TOPIC" | "OWNER_MISMATCH" | "SUBSCRIPTION_LIMIT" | "TOPIC_FULL" | "PAYLOAD_TOO_LARGE" | "INTERNAL_ERROR";
|
|
19
|
+
type LiveControlError = {
|
|
20
|
+
code: LiveControlErrorCode;
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
type LiveControlOperationResult = {
|
|
24
|
+
ok: true;
|
|
25
|
+
kind: "subscribe" | "unsubscribe";
|
|
26
|
+
id: string;
|
|
27
|
+
topic?: string;
|
|
28
|
+
} | {
|
|
29
|
+
ok: false;
|
|
30
|
+
kind: "subscribe" | "unsubscribe";
|
|
31
|
+
id: string;
|
|
32
|
+
error: LiveControlError;
|
|
33
|
+
};
|
|
34
|
+
type LiveControlResponse = {
|
|
35
|
+
accepted: true;
|
|
36
|
+
connectionId: string;
|
|
37
|
+
results: Array<LiveControlOperationResult>;
|
|
38
|
+
} | {
|
|
39
|
+
accepted: false;
|
|
40
|
+
error: LiveControlError;
|
|
41
|
+
};
|
|
42
|
+
type LiveClientEvent<Data = unknown> = {
|
|
43
|
+
subscriptionId: string;
|
|
44
|
+
topic: string;
|
|
45
|
+
type?: string;
|
|
46
|
+
eventId?: string;
|
|
47
|
+
data: Data;
|
|
48
|
+
};
|
|
49
|
+
type LivePublishOptions = {
|
|
50
|
+
type?: string;
|
|
51
|
+
eventId?: string;
|
|
52
|
+
};
|
|
53
|
+
type LiveConnectOptions = {
|
|
54
|
+
owner?: string | null;
|
|
55
|
+
user?: unknown;
|
|
56
|
+
};
|
|
57
|
+
type LiveControlOptions = LiveConnectOptions;
|
|
58
|
+
type LiveHookContext = {
|
|
59
|
+
request: Request;
|
|
60
|
+
env: CloudEnv["Bindings"];
|
|
61
|
+
user: AuthUser | unknown | null;
|
|
62
|
+
owner: string | null;
|
|
63
|
+
};
|
|
64
|
+
type LiveConnectHookContext = LiveHookContext & {
|
|
65
|
+
connection: {
|
|
66
|
+
id: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
type LiveSubscribeHookContext = LiveHookContext & {
|
|
70
|
+
connection: {
|
|
71
|
+
id: string;
|
|
72
|
+
};
|
|
73
|
+
subscription: {
|
|
74
|
+
id: string;
|
|
75
|
+
};
|
|
76
|
+
topic: string;
|
|
77
|
+
lastEventId?: string;
|
|
78
|
+
};
|
|
79
|
+
type LiveStreamOptions = {
|
|
80
|
+
id: string;
|
|
81
|
+
allowAnonymousControl?: boolean;
|
|
82
|
+
identifyConnection?: (ctx: LiveHookContext) => MaybePromise<string | null | undefined>;
|
|
83
|
+
onConnect?: (ctx: LiveConnectHookContext) => MaybePromise<Response | void>;
|
|
84
|
+
onSubscribe?: (ctx: LiveSubscribeHookContext) => MaybePromise<Response | void>;
|
|
85
|
+
limits?: Partial<LiveLimits>;
|
|
86
|
+
};
|
|
87
|
+
type LiveLimits = {
|
|
88
|
+
maxSubscriptionsPerConnection: number;
|
|
89
|
+
maxSubscriptionsPerTopic: number;
|
|
90
|
+
maxOperationsPerControlRequest: number;
|
|
91
|
+
maxQueuedEventsPerConnection: number;
|
|
92
|
+
maxEncodedEventSize: number;
|
|
93
|
+
deliveryAttemptTimeoutMs: number;
|
|
94
|
+
};
|
|
95
|
+
type LiveStream = {
|
|
96
|
+
connect(ctx: CloudContext, options?: LiveConnectOptions): Promise<Response>;
|
|
97
|
+
control(ctx: CloudContext, options?: LiveControlOptions): Promise<Response>;
|
|
98
|
+
publish(topic: string, data: unknown, options?: LivePublishOptions): Promise<void>;
|
|
99
|
+
withEnv(env: unknown): Pick<LiveStream, "publish">;
|
|
100
|
+
};
|
|
101
|
+
declare function __setLiveBindingName(name: string): void;
|
|
102
|
+
declare function __getLiveBindingName(): string;
|
|
103
|
+
declare function defineLiveStream(options: LiveStreamOptions): LiveStream;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { __getLiveBindingName as _, LiveControlErrorCode as a, LiveControlOptions as c, LiveHookContext as d, LiveLimits as f, LiveSubscribeHookContext as g, LiveStreamOptions as h, LiveControlError as i, LiveControlRequest as l, LiveStream as m, LiveConnectHookContext as n, LiveControlOperation as o, LivePublishOptions as p, LiveConnectOptions as r, LiveControlOperationResult as s, LiveClientEvent as t, LiveControlResponse as u, __setLiveBindingName as v, defineLiveStream as y };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { a as join, i as isAbsolute, u as resolve } from "./dist-4WkAWhWx.mjs";
|
|
2
|
+
import { v as readRootWranglerConfig } from "./wrangler-D01qs6VB.mjs";
|
|
3
|
+
import { r as getMiniflareDatabasePath } from "./runner-BGVsGgkb.mjs";
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
//#region src/local-d1.ts
|
|
7
|
+
const LOCAL_D1_STATE_FILE = "local-d1.json";
|
|
8
|
+
const VITE_CONFIG_NAMES = [
|
|
9
|
+
"vite.config.ts",
|
|
10
|
+
"vite.config.mts",
|
|
11
|
+
"vite.config.js",
|
|
12
|
+
"vite.config.mjs",
|
|
13
|
+
"vite.config.cts",
|
|
14
|
+
"vite.config.cjs"
|
|
15
|
+
];
|
|
16
|
+
function readConfiguredDatabaseId(root, bindingName) {
|
|
17
|
+
let rootConfig;
|
|
18
|
+
try {
|
|
19
|
+
rootConfig = readRootWranglerConfig(root);
|
|
20
|
+
} catch {
|
|
21
|
+
throw new Error(`db: cannot read malformed Wrangler configuration in ${root}.`);
|
|
22
|
+
}
|
|
23
|
+
if (!rootConfig) return;
|
|
24
|
+
const { configPath, config } = rootConfig;
|
|
25
|
+
const rawDatabases = config.d1_databases;
|
|
26
|
+
if (rawDatabases === void 0) return;
|
|
27
|
+
if (!Array.isArray(rawDatabases)) throw new Error(`db: cannot read ${configPath}: "d1_databases" must be an array.`);
|
|
28
|
+
if (rawDatabases.some((entry) => entry === null || typeof entry !== "object" || Array.isArray(entry) || typeof entry.binding !== "string" || entry.binding === "")) throw new Error(`db: cannot read ${configPath}: every "d1_databases" entry needs a non-empty binding.`);
|
|
29
|
+
const matches = rawDatabases.filter((entry) => entry !== null && typeof entry === "object" && !Array.isArray(entry) && entry.binding === bindingName);
|
|
30
|
+
if (matches.length > 1) throw new Error(`db: cannot select local D1 database: binding ${JSON.stringify(bindingName)} is declared ${matches.length} times in ${configPath}.`);
|
|
31
|
+
const match = matches[0];
|
|
32
|
+
if (!match) return;
|
|
33
|
+
for (const value of [
|
|
34
|
+
match.preview_database_id,
|
|
35
|
+
match.database_id,
|
|
36
|
+
match.binding
|
|
37
|
+
]) if (typeof value === "string" && value.length > 0) return value;
|
|
38
|
+
}
|
|
39
|
+
function statePath(root) {
|
|
40
|
+
return join(root, ".void", LOCAL_D1_STATE_FILE);
|
|
41
|
+
}
|
|
42
|
+
function hashFile(path) {
|
|
43
|
+
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
44
|
+
}
|
|
45
|
+
function findViteConfig(root) {
|
|
46
|
+
return VITE_CONFIG_NAMES.map((name) => join(root, name)).find(existsSync);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Record the persistence directory selected by voidPlugin({ persistTo }). The binding and
|
|
50
|
+
* database ID are deliberately not cached: CLI commands always reread Wrangler configuration.
|
|
51
|
+
*/
|
|
52
|
+
function writeLocalD1PersistState(root, persistTo) {
|
|
53
|
+
const path = statePath(root);
|
|
54
|
+
if (persistTo === void 0) {
|
|
55
|
+
rmSync(path, { force: true });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const projectRoot = resolve(root);
|
|
59
|
+
const viteConfigPath = findViteConfig(projectRoot);
|
|
60
|
+
const state = {
|
|
61
|
+
version: 1,
|
|
62
|
+
projectRoot,
|
|
63
|
+
persistRoot: isAbsolute(persistTo) ? persistTo : resolve(projectRoot, persistTo),
|
|
64
|
+
...viteConfigPath ? { viteConfig: {
|
|
65
|
+
path: viteConfigPath,
|
|
66
|
+
hash: hashFile(viteConfigPath)
|
|
67
|
+
} } : {}
|
|
68
|
+
};
|
|
69
|
+
mkdirSync(join(projectRoot, ".void"), { recursive: true });
|
|
70
|
+
writeFileSync(path, `${JSON.stringify(state, null, 2)}\n`);
|
|
71
|
+
}
|
|
72
|
+
function readLocalD1PersistState(root) {
|
|
73
|
+
const path = statePath(root);
|
|
74
|
+
if (!existsSync(path)) return;
|
|
75
|
+
let state;
|
|
76
|
+
try {
|
|
77
|
+
state = JSON.parse(readFileSync(path, "utf-8"));
|
|
78
|
+
} catch {
|
|
79
|
+
throw new Error(`db: local D1 state in ${path} is invalid. Run \`void dev\` to refresh it.`);
|
|
80
|
+
}
|
|
81
|
+
const projectRoot = resolve(root);
|
|
82
|
+
if (state.version !== 1 || state.projectRoot !== projectRoot || typeof state.persistRoot !== "string" || state.persistRoot.length === 0) throw new Error(`db: local D1 state in ${path} is stale. Run \`void dev\` to refresh it.`);
|
|
83
|
+
if (state.viteConfig) {
|
|
84
|
+
const { path: configPath, hash } = state.viteConfig;
|
|
85
|
+
if (!existsSync(configPath) || hashFile(configPath) !== hash) throw new Error("db: voidPlugin persistence configuration changed since the local D1 state was written. Run `void dev` to refresh it before using `void db`.");
|
|
86
|
+
}
|
|
87
|
+
return state;
|
|
88
|
+
}
|
|
89
|
+
function resolveLocalD1Target(root, options = {}) {
|
|
90
|
+
const projectRoot = resolve(root);
|
|
91
|
+
const bindingName = options.bindingName ?? "DB";
|
|
92
|
+
const state = options.readPersistState ? readLocalD1PersistState(projectRoot) : void 0;
|
|
93
|
+
const selectedPersistRoot = options.persistRoot ?? state?.persistRoot ?? options.defaultPersistRoot ?? join(projectRoot, ".void");
|
|
94
|
+
const persistRoot = isAbsolute(selectedPersistRoot) ? selectedPersistRoot : resolve(projectRoot, selectedPersistRoot);
|
|
95
|
+
const databaseId = readConfiguredDatabaseId(projectRoot, bindingName) ?? "local";
|
|
96
|
+
return {
|
|
97
|
+
bindingName,
|
|
98
|
+
databaseId,
|
|
99
|
+
persistRoot,
|
|
100
|
+
databasePath: getMiniflareDatabasePath(persistRoot, databaseId)
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
export { writeLocalD1PersistState as n, resolveLocalD1Target as t };
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { c as import_picocolors, i as createSpinner, r as cliTitle } from "./output-urU86XeT.mjs";
|
|
2
|
+
import { _ as saveToken, a as getApiUrl, c as getToken, g as savePlatformToken, h as runPlatformLogin, l as getTokenSource, m as runLogin, p as removeToken, u as isStagingMode } from "./auth-B9_D6ygs.mjs";
|
|
3
|
+
import { I as select, O as intro, P as outro, T as cancel, W as isCancel, j as log } from "./dist-Dn6nn2IU.mjs";
|
|
4
|
+
import { i as isExpiredTokenError, n as PlatformClient } from "./client-PdAJ-F0t.mjs";
|
|
5
5
|
//#region src/cli/login.ts
|
|
6
|
-
var login_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
-
promptForLoginToken: () => promptForLoginToken,
|
|
8
|
-
runLoginCommand: () => runLoginCommand,
|
|
9
|
-
selectPlatformLoginMethod: () => selectPlatformLoginMethod
|
|
10
|
-
});
|
|
11
6
|
async function selectPlatformLoginMethod(platform, requestedId) {
|
|
12
7
|
const providers = platform?.authenticationProviders ?? ["github", "google"];
|
|
13
8
|
const methods = platform?.authentication?.methods ?? providers.map((id) => ({
|
|
@@ -34,7 +29,7 @@ async function selectPlatformLoginMethod(platform, requestedId) {
|
|
|
34
29
|
return methods.find((method) => method.id === provider);
|
|
35
30
|
}
|
|
36
31
|
async function promptForLoginToken(root = process.cwd(), platform) {
|
|
37
|
-
const { id: provider, label: providerName } = await selectPlatformLoginMethod(platform ?? await import("./platform-cmd-
|
|
32
|
+
const { id: provider, label: providerName } = await selectPlatformLoginMethod(platform ?? await import("./platform-cmd-C9Vt7m-d.mjs").then(({ discoverPlatform }) => discoverPlatform(getApiUrl(root))));
|
|
38
33
|
const s = createSpinner();
|
|
39
34
|
s.start(`Opening browser for ${providerName} login...`);
|
|
40
35
|
try {
|
|
@@ -88,4 +83,4 @@ async function runLoginCommand(root = process.cwd()) {
|
|
|
88
83
|
outro(isStagingMode(root) ? "Staging token saved." : "Token saved.");
|
|
89
84
|
}
|
|
90
85
|
//#endregion
|
|
91
|
-
export {
|
|
86
|
+
export { runLoginCommand as n, selectPlatformLoginMethod as r, promptForLoginToken as t };
|