void 0.21.9 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/{account-cmd-DZZGK80W.mjs → account-cmd-C84Ee8cO.mjs} +5 -5
- package/dist/{scan-ClYmX3sa.mjs → application-analysis-BVsVqc11.mjs} +135 -18
- package/dist/application-routing-B7QEjqSR.mjs +27 -0
- package/dist/{auth-CZuiVsFh.mjs → auth-CCjt0hcq.mjs} +1 -1
- package/dist/{auth-DLNN0D3Z.mjs → auth-CSkdO2Bb.mjs} +4 -47
- package/dist/{auth-link-B_CeugBw.mjs → auth-link-CioEg6uY.mjs} +5 -5
- package/dist/{auth-router-BgEFRuvZ.mjs → auth-router-BsR981d4.mjs} +5 -5
- package/dist/{better-auth-shared-rsBGBvWJ.mjs → better-auth-shared-hy6RPh9W.mjs} +13 -2
- package/dist/{build-cmd-Dpt0jd-x.mjs → build-cmd-LzvNJORH.mjs} +19 -7
- package/dist/{cache-7_UeZdTk.mjs → cache-C4MvnrMH.mjs} +4 -4
- package/dist/{cancel-deploy-D23R1RXT.mjs → cancel-deploy-abUxpP2n.mjs} +4 -4
- package/dist/{cf-build-output-CGT03qCD.mjs → cf-build-output-BPqOT964.mjs} +141 -63
- package/dist/cf-build-output-_0HNWysu.mjs +2 -0
- package/dist/cli/cli.mjs +114 -460
- package/dist/cli/cloudflare-operation-process.mjs +1103 -0
- package/dist/cli/env-schema-probe.d.mts +2 -1
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-Cu7jWiF1.mjs +2 -0
- package/dist/{client-QTl6ko_D.mjs → client-RV8NVeB8.mjs} +165 -21
- package/dist/{cloudflare-auth-C4_GPZr0.mjs → cloudflare-auth-Qdc7tw8F.mjs} +41 -43
- package/dist/{cloudflare-cmd-bSmZ1d5L.mjs → cloudflare-cmd-BcrVyTmJ.mjs} +9 -10
- package/dist/cloudflare-config-Bktvwtpf.mjs +182 -0
- package/dist/{cloudflare-connect-jAwacxxP.mjs → cloudflare-connect-B8uPZ4nx.mjs} +4 -4
- package/dist/{cloudflare-operations-BipGMJ5O.mjs → cloudflare-operations-AiWashgg.mjs} +1 -1
- package/dist/{cloudflare-operations-sMZXpk_S.mjs → cloudflare-operations-fxHb-byx.mjs} +118 -203
- package/dist/{preset-UHj9ARyP.mjs → cloudflare-process-B-wekeR6.mjs} +93 -6
- package/dist/{config-CF69HgXc.d.mts → config-BMHb8RCj.d.mts} +2 -2
- package/dist/{config-CafTW6Cz.mjs → config-Br_JZD6u.mjs} +2 -7
- package/dist/config-C_XRIPx2.mjs +89 -0
- package/dist/{config-s7Xj7tPb.mjs → config-CyQ-wVd7.mjs} +1 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{config-write-BSduPMY8.mjs → config-write-B1f88wJA.mjs} +1 -1
- package/dist/{connect-BsUSRzln.mjs → connect-Bd4kJd9U.mjs} +6 -6
- package/dist/{create-project-BniEV0OW.mjs → create-project-Boczwj5r.mjs} +1 -1
- package/dist/{create-project-DBfFSZKY.mjs → create-project-bMf6ffLZ.mjs} +9 -5
- package/dist/{db-hRrvZaq_.mjs → db-8uG64XLl.mjs} +26 -26
- package/dist/{delete-D6dZ9B6B.mjs → delete-NvbiyeJf.mjs} +4 -4
- package/dist/{deploy-WaAQez1O.mjs → deploy-DzAIwqNU.mjs} +944 -607
- package/dist/{deploy-DDz7c8LK.mjs → deploy-bjXdFCtn.mjs} +1 -1
- package/dist/{dist-BR1quN_w.mjs → dist-AoCzRTJE.mjs} +226 -60
- package/dist/{dist-C5fND3R0.mjs → dist-BuDuKZJv.mjs} +1 -1
- package/dist/{dist-Dn6nn2IU.mjs → dist-CTBk70IR.mjs} +42 -42
- package/dist/{domain-Dmhvb2oU.mjs → domain-y5Tvydvo.mjs} +5 -5
- package/dist/{email-DFi-s2t4.mjs → email-B3umsW75.mjs} +15 -30
- package/dist/{env-Csi-tMbT.mjs → env-BS6qYHDb.mjs} +6 -6
- package/dist/{env-public-D_6u46fX.d.mts → env-public-BX_r8HR6.d.mts} +2 -1
- package/dist/{env-validation-BB4GkLxn.mjs → env-validation-BPn7vk-V.mjs} +18 -71
- package/dist/{env-validation-BXge7uyK.mjs → env-validation-DbTg7-ar.mjs} +1 -1
- package/dist/{fetch-CXDChK7B.mjs → fetch-BIZJh7vR.mjs} +2 -2
- package/dist/{fetch-stream-AOByI7Ki.mjs → fetch-stream-IvCYKyQL.mjs} +24 -4
- package/dist/{gen-Dz3X1Qab.mjs → gen-B580--vC.mjs} +5 -5
- package/dist/gen-BVaUUumi.mjs +2 -0
- package/dist/{github-cmd-BED3_9JD.mjs → github-cmd-v45BdfKX.mjs} +6 -8
- package/dist/{handler-BXJTXd02.d.mts → handler-CZ4nAylQ.d.mts} +2 -1
- package/dist/{headers-BOg_velo.mjs → headers-DWi2IXWx.mjs} +1 -1
- package/dist/help-DofyZuY7.mjs +2 -0
- package/dist/{help-DC7gdz7L.mjs → help-daGKjXGk.mjs} +268 -666
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +305 -1490
- package/dist/info-B97bTX9N.mjs +113 -0
- package/dist/{init-WO0JlPx8.mjs → init-Bvy7zrBo.mjs} +51 -20
- package/dist/limits-Bq5LG8Id.d.mts +27 -0
- package/dist/limits-Cjuk2VPm.mjs +68 -0
- package/dist/{link-CsHOinF7.mjs → link-CDqqCjFl.mjs} +5 -5
- package/dist/{list-CDb-4bZ1.mjs → list-CZj0dzKY.mjs} +5 -5
- package/dist/{live-CKiJilLr.d.mts → live-Chw1eIMv.d.mts} +1 -1
- package/dist/{local-d1-CC8sKFGu.mjs → local-d1-2CMnpuW_.mjs} +2 -2
- package/dist/login-DYt_An22.mjs +2 -0
- package/dist/{login-DvqXsfGs.mjs → login-UZKFM_u7.mjs} +5 -5
- package/dist/{logs-BdfiOezj.mjs → logs-CUZ6t9t3.mjs} +5 -5
- package/dist/migrate-8_2u55MD.mjs +2 -0
- package/dist/{migrate-B8KuoYsO.mjs → migrate-DHul7PRV.mjs} +5 -4
- package/dist/{node-BM43oz4G.mjs → node-BkyRWRx8.mjs} +2 -2
- package/dist/operator-args-CLgKGlwU.mjs +690 -0
- package/dist/{operator-cmd-03819ATr.mjs → operator-cmd-DBA6dl0m.mjs} +69 -23
- package/dist/output-Dm_A4Tbv.mjs +81 -0
- package/dist/pages/client.d.mts +34 -2
- package/dist/pages/client.mjs +59 -3
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +3 -3
- package/dist/pages/islands-plugin.d.mts +16 -6
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +2 -308
- package/dist/{parse-filename-DioPHiR9.mjs → parse-filename-CUbj-1MP.mjs} +35 -1
- package/dist/{output-CCH48AMM.mjs → picocolors-BTps1_gs.mjs} +2 -76
- package/dist/plan-D1Q5rf-r.mjs +2 -0
- package/dist/plan-NPpwZ_kc.mjs +58 -0
- package/dist/platform-args-BJdRtlLq.mjs +506 -0
- package/dist/platform-args-D3RXyR6h.mjs +2 -0
- package/dist/{platform-auth-config-z92h63q5.mjs → platform-auth-config-B56E9YP1.mjs} +4 -4
- package/dist/{platform-auth-protection-DeE3yr2R.mjs → platform-auth-protection-BDWO_aER.mjs} +3 -3
- package/dist/{platform-auth-recovery-o_340Ixx.mjs → platform-auth-recovery-1gg4CSRe.mjs} +4 -4
- package/dist/{platform-cmd-C4ZV3Vpy.mjs → platform-cmd-Bt-1w6pY.mjs} +1 -1
- package/dist/{platform-cmd-DNl8WosH.mjs → platform-cmd-DMcQStSc.mjs} +26 -5
- package/dist/{platform-domain-CU1JtJkW.mjs → platform-domain-BNkcz0OB.mjs} +36 -9
- package/dist/{platform-lifecycle-Bc047IeT.mjs → platform-lifecycle-9OyBALhH.mjs} +850 -276
- package/dist/{platform-lifecycle-Bs2qx1E3.mjs → platform-lifecycle-BE6C_jxh.mjs} +1 -1
- package/dist/{platform-management-CVpGI9Y5.mjs → platform-management-CjwLVQwN.mjs} +59 -11
- package/dist/{platform-management-C8tt6D8h.mjs → platform-management-CnyTdcWX.mjs} +1 -1
- package/dist/platform-plans-config-BNGKGr4P.mjs +359 -0
- package/dist/{platform-recovery-dvUaptLr.mjs → platform-recovery-D6KSpuFm.mjs} +2 -2
- package/dist/{plugin-inference-BMfKRSqE.mjs → plugin-inference-CXWnn79A.mjs} +174 -64
- package/dist/{prepare-DyZ-Yok5.mjs → prepare-B5Mkic5u.mjs} +3 -3
- package/dist/{prepare-C3kt3Rst.mjs → prepare-DOsL0CC9.mjs} +4 -20
- package/dist/prepare-cgvDMtSb.mjs +2 -0
- package/dist/{project-cmd-B44I8J_W.mjs → project-cmd-CNzrqvBv.mjs} +30 -16
- package/dist/{project-team-BkbYIsXN.mjs → project-team-DQOWPfQT.mjs} +4 -4
- package/dist/{project-token-C8xEEQnB.mjs → project-token-CTDYU0Cc.mjs} +4 -4
- package/dist/project-zero-trust-BNAkW-_0.mjs +63 -0
- package/dist/{protocol-ZH3jP4a7.d.mts → protocol-CjF_iI9X.d.mts} +2 -2
- package/dist/protocol-U7bfjHmA.mjs +331 -0
- package/dist/{provision-DNtrtaVD.mjs → provision-C4ORE7G7.mjs} +1 -1
- package/dist/{provision-BhreDAOS.mjs → provision-CJFgTZY8.mjs} +111 -215
- package/dist/{requests-DFyhBMaf.mjs → requests-MhxYnau8.mjs} +4 -4
- package/dist/resource-name-C7LVpcRm.mjs +11 -0
- package/dist/{rollback-DHHxXZiS.mjs → rollback-CJ6iSDoU.mjs} +5 -5
- package/dist/route-url-CG7U-cRN.mjs +15 -0
- package/dist/{runner-B8wXwWlo.mjs → runner-CXA9Fh8h.mjs} +1 -1
- package/dist/{runner-p-dMs2UN.mjs → runner-Ol0TNjk6.mjs} +2 -2
- package/dist/runtime/ai.d.mts +12 -8
- package/dist/runtime/ai.mjs +84 -17
- package/dist/runtime/better-auth-mysql.mjs +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/client-react.mjs +2 -2
- package/dist/runtime/client-solid.mjs +2 -2
- package/dist/runtime/client-svelte.mjs +2 -2
- package/dist/runtime/client-vue.mjs +2 -2
- package/dist/runtime/client.mjs +2 -2
- package/dist/runtime/durable.d.mts +3 -1
- package/dist/runtime/durable.mjs +4 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/kv.mjs +0 -1
- package/dist/runtime/limits.d.mts +2 -0
- package/dist/runtime/limits.mjs +2 -0
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +25 -16
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/migration-handler.mjs +62 -42
- package/dist/runtime/route-url.d.mts +4 -0
- package/dist/runtime/route-url.mjs +2 -0
- package/dist/runtime/routing.d.mts +180 -0
- package/dist/runtime/routing.mjs +1082 -0
- package/dist/runtime/sandbox-container.d.mts +3 -0
- package/dist/runtime/sandbox-container.mjs +2 -0
- package/dist/runtime/sandbox.d.mts +4 -32
- package/dist/runtime/sandbox.mjs +151 -75
- package/dist/runtime/sse.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +4 -2
- package/dist/runtime/ws-server.mjs +27 -2
- package/dist/runtime/ws.d.mts +2 -2
- package/dist/runtime/ws.mjs +8 -6
- package/dist/sandbox-XZAqzFlG.d.mts +52 -0
- package/dist/sandbox-container-Bo0eiFKz.d.mts +73 -0
- package/dist/sandbox-container-C6ItmVuN.mjs +281 -0
- package/dist/{scan-4tfN-PSn.mjs → scan-C7okrLyM.mjs} +4 -35
- package/dist/{secret-DN9sSNiV.mjs → secret-Dli5fP0B.mjs} +6 -6
- package/dist/{skills-O6FUaizK.mjs → skills-D1II1Juz.mjs} +1 -1
- package/dist/{sse-BaC1jXko.mjs → sse-CQNaDFFV.mjs} +6 -3
- package/dist/{subcommand-prompt-BuGYkAkC.mjs → subcommand-prompt-CY1C4fvl.mjs} +2 -2
- package/dist/validate-Dq_L3s0S.mjs +2 -0
- package/dist/{validate-CIUwFpjB.mjs → validate-ctOrgiS3.mjs} +2 -1
- package/dist/{wrangler-BymcxrRa.mjs → wrangler-7K-bW_DL.mjs} +14 -235
- package/dist/{ws-BwcqizuH.d.mts → ws-CL1w7GXU.d.mts} +13 -2
- package/package.json +48 -33
- package/sandbox.Dockerfile +4 -0
- package/schema.json +10 -22
- package/skills/migrate-vite-cloudflare-to-void/SKILL.md +34 -157
- package/skills/void/SKILL.md +50 -133
- package/skills/void/docs/guide/ai.md +94 -84
- package/skills/void/docs/guide/app-types.md +3 -32
- package/skills/void/docs/guide/auth.md +12 -116
- package/skills/void/docs/guide/database/d1.md +9 -54
- package/skills/void/docs/guide/database/mysql.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +5 -26
- package/skills/void/docs/guide/database.md +23 -75
- package/skills/void/docs/guide/deployment.md +27 -113
- package/skills/void/docs/guide/durable-state.md +43 -18
- package/skills/void/docs/guide/edge/headers.md +3 -47
- package/skills/void/docs/guide/edge/prerendering.md +5 -20
- package/skills/void/docs/guide/edge/redirects.md +11 -64
- package/skills/void/docs/guide/edge/revalidation.md +6 -19
- package/skills/void/docs/guide/edge/rewrites.md +56 -284
- package/skills/void/docs/guide/edge/static-assets.md +23 -72
- package/skills/void/docs/guide/email/domains.md +112 -0
- package/skills/void/docs/guide/email/receiving.md +139 -0
- package/skills/void/docs/guide/email/sending.md +231 -0
- package/skills/void/docs/guide/email.md +13 -619
- package/skills/void/docs/guide/env-migration.md +11 -11
- package/skills/void/docs/guide/env-vars.md +9 -29
- package/skills/void/docs/guide/index.md +0 -15
- package/skills/void/docs/guide/jobs.md +3 -18
- package/skills/void/docs/guide/kv.md +5 -11
- package/skills/void/docs/guide/live.md +5 -56
- package/skills/void/docs/guide/pages-routing/actions-and-forms.md +78 -125
- package/skills/void/docs/guide/pages-routing/head.md +10 -10
- package/skills/void/docs/guide/pages-routing/islands.md +6 -36
- package/skills/void/docs/guide/pages-routing/layouts.md +6 -128
- package/skills/void/docs/guide/pages-routing/loaders.md +3 -19
- package/skills/void/docs/guide/pages-routing/markdown.md +13 -171
- package/skills/void/docs/guide/pages-routing/overview.md +7 -17
- package/skills/void/docs/guide/pages-routing/view-transitions.md +1 -1
- package/skills/void/docs/guide/platform/administration/access.md +1 -4
- package/skills/void/docs/guide/platform/administration/email.md +35 -8
- package/skills/void/docs/guide/platform/administration/operations.md +26 -4
- package/skills/void/docs/guide/platform/administration/plans.md +126 -0
- package/skills/void/docs/guide/platform/administration/projects.md +5 -2
- package/skills/void/docs/guide/platform/administration/zero-trust.md +189 -0
- package/skills/void/docs/guide/platform/development/local.md +2 -2
- package/skills/void/docs/guide/platform/development/runtime.md +3 -13
- package/skills/void/docs/guide/platform/development/schema-ci.md +0 -58
- package/skills/void/docs/guide/platform/installation/credentials.md +6 -4
- package/skills/void/docs/guide/platform/installation/domains.md +31 -3
- package/skills/void/docs/guide/platform/installation/first-deployment.md +6 -0
- package/skills/void/docs/guide/platform/installation/maintenance.md +3 -1
- package/skills/void/docs/guide/platform/installation/prerequisites.md +21 -16
- package/skills/void/docs/guide/platform/installation/setup.md +9 -5
- package/skills/void/docs/guide/platform/installation/uninstall.md +17 -2
- package/skills/void/docs/guide/platform-administration.md +2 -0
- package/skills/void/docs/guide/queues.md +7 -9
- package/skills/void/docs/guide/quickstart.md +38 -37
- package/skills/void/docs/guide/remote-dev.md +4 -9
- package/skills/void/docs/guide/sandboxes.md +78 -41
- package/skills/void/docs/guide/server-routing.md +9 -72
- package/skills/void/docs/guide/sse.md +4 -18
- package/skills/void/docs/guide/ssg.md +3 -15
- package/skills/void/docs/guide/ssr.md +14 -62
- package/skills/void/docs/guide/storage.md +9 -4
- package/skills/void/docs/guide/type-safety.md +3 -14
- package/skills/void/docs/guide/typed-fetch.md +3 -7
- package/skills/void/docs/guide/websockets.md +68 -40
- package/skills/void/docs/integrations/agents.md +3 -3
- package/skills/void/docs/integrations/cloudflare.md +85 -316
- package/skills/void/docs/integrations/frameworks/analog.md +5 -64
- package/skills/void/docs/integrations/frameworks/astro.md +4 -73
- package/skills/void/docs/integrations/frameworks/nuxt.md +5 -62
- package/skills/void/docs/integrations/frameworks/overview.md +11 -54
- package/skills/void/docs/integrations/frameworks/react-router.md +5 -60
- package/skills/void/docs/integrations/frameworks/sveltekit.md +6 -65
- package/skills/void/docs/integrations/frameworks/tanstack-start.md +4 -62
- package/skills/void/docs/integrations/nodejs-bun-deno.md +5 -69
- package/skills/void/docs/reference/api/auth.md +156 -0
- package/skills/void/docs/reference/api/client.md +87 -0
- package/skills/void/docs/reference/api/database.md +95 -0
- package/skills/void/docs/reference/api/durable.md +46 -0
- package/skills/void/docs/reference/api/env.md +50 -0
- package/skills/void/docs/reference/api/handlers.md +254 -0
- package/skills/void/docs/reference/api/pages.md +241 -0
- package/skills/void/docs/reference/api/plugin.md +39 -0
- package/skills/void/docs/reference/api/resources.md +109 -0
- package/skills/void/docs/reference/api/rewrites.md +76 -0
- package/skills/void/docs/reference/api/types.md +92 -0
- package/skills/void/docs/reference/api.md +56 -1218
- package/skills/void/docs/reference/cli/auth.md +88 -0
- package/skills/void/docs/reference/cli/database.md +128 -0
- package/skills/void/docs/reference/cli/deploy.md +85 -0
- package/skills/void/docs/reference/cli/domains.md +41 -0
- package/skills/void/docs/reference/cli/email.md +129 -0
- package/skills/void/docs/reference/cli/generate.md +116 -0
- package/skills/void/docs/reference/cli/github.md +189 -0
- package/skills/void/docs/reference/cli/platform-config.md +92 -0
- package/skills/void/docs/reference/cli/platform-email.md +81 -0
- package/skills/void/docs/reference/cli/platform-installation.md +127 -0
- package/skills/void/docs/reference/cli/platform-operations.md +90 -0
- package/skills/void/docs/reference/cli/platform-users.md +89 -0
- package/skills/void/docs/reference/cli/platform-zero-trust.md +45 -0
- package/skills/void/docs/reference/cli/platform.md +70 -0
- package/skills/void/docs/reference/cli/project.md +214 -0
- package/skills/void/docs/reference/cli/secrets.md +76 -0
- package/skills/void/docs/reference/cli/setup.md +70 -0
- package/skills/void/docs/reference/cli.md +33 -1621
- package/skills/void/docs/reference/config.md +26 -32
- package/skills/void/docs/reference/resource-inference.md +3 -58
- package/skills/void/docs/reference/structure.md +14 -41
- package/dist/canonical-json-DuDiiUsQ.mjs +0 -13
- package/dist/cli/cf-compat.mjs +0 -968
- package/dist/client-4cDVv7BO.mjs +0 -2
- package/dist/gen-Vnv2f65C.mjs +0 -2
- package/dist/help-DQMfeKMz.mjs +0 -2
- package/dist/login-DFQk7rbW.mjs +0 -2
- package/dist/migrate-TsHGBnDA.mjs +0 -2
- package/dist/plan-BEZ8VJW0.mjs +0 -256
- package/dist/plan-DpuOr14e.mjs +0 -2
- package/dist/prepare-BZXkjdNe.mjs +0 -2
- package/dist/validate-EKmJWxmy.mjs +0 -2
- /package/dist/cli/{cf-compat.d.mts → cloudflare-operation-process.d.mts} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
+
import { a as SandboxInstance, c as SandboxProcessWire, i as SandboxExecOptions, l as validateSandboxOptions, n as SandboxCapability, o as SandboxNativeContainer, r as SandboxContainer, s as SandboxOptions, t as DEFAULT_SANDBOX_INACTIVITY_TIMEOUT_MS } from "../sandbox-container-Bo0eiFKz.mjs";
|
|
3
|
+
export { DEFAULT_SANDBOX_INACTIVITY_TIMEOUT_MS, SandboxCapability, SandboxContainer, SandboxExecOptions, SandboxInstance, SandboxNativeContainer, SandboxOptions, SandboxProcessWire, validateSandboxOptions };
|
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export declare const SANDBOX_SERVICE_BINDING = "__VOID_SANDBOX";
|
|
7
|
-
export type VoidSandboxOptions = SandboxOptions & {
|
|
8
|
-
binding?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare class SandboxLimitError extends Error {
|
|
11
|
-
override readonly name = "SandboxLimitError";
|
|
12
|
-
readonly reason: "concurrency" | "runtime_budget";
|
|
13
|
-
constructor(reason: "concurrency" | "runtime_budget", message?: string);
|
|
14
|
-
}
|
|
15
|
-
export declare class SandboxUnavailableError extends Error {
|
|
16
|
-
override readonly name = "SandboxUnavailableError";
|
|
17
|
-
constructor(message?: string);
|
|
18
|
-
}
|
|
19
|
-
export declare function __setSandboxBindingName(bindingName: string): void;
|
|
20
|
-
/**
|
|
21
|
-
* Retained for generated native/local Worker entries. Managed deployments host
|
|
22
|
-
* the platform-owned Sandbox class in a separate Worker and never use this DO.
|
|
23
|
-
*/
|
|
24
|
-
export declare class VoidPlatformSandbox<Env = unknown> extends Sandbox<Env> {
|
|
25
|
-
override onStart(): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
/** Resolve an isolated Sandbox on the current deployment. Starts on first use. */
|
|
28
|
-
export declare function getSandbox<T extends Sandbox = Sandbox>(id?: string, options?: VoidSandboxOptions): Promise<T>;
|
|
29
|
-
export declare const sandbox: {
|
|
30
|
-
get: typeof getSandbox;
|
|
31
|
-
};
|
|
32
|
-
//#endregion
|
|
33
|
-
export { Sandbox, type SandboxOptions };
|
|
2
|
+
import { i as SandboxExecOptions, s as SandboxOptions } from "../sandbox-container-Bo0eiFKz.mjs";
|
|
3
|
+
import { a as SandboxFiles, c as SandboxUnavailableError, d as __setSandboxBindingName, f as getSandbox, i as SandboxClient, l as VoidPlatformSandbox, n as DEFAULT_SANDBOX_ID, o as SandboxLimitError, p as sandbox, r as SANDBOX_SERVICE_BINDING, s as SandboxProcess, t as DEFAULT_SANDBOX_BINDING, u as VoidSandboxOptions } from "../sandbox-XZAqzFlG.mjs";
|
|
4
|
+
export * from "@cloudflare/sandbox";
|
|
5
|
+
export { DEFAULT_SANDBOX_BINDING, DEFAULT_SANDBOX_ID, SANDBOX_SERVICE_BINDING, SandboxClient, type SandboxExecOptions, SandboxFiles, SandboxLimitError, type SandboxOptions, SandboxProcess, SandboxUnavailableError, VoidPlatformSandbox, VoidSandboxOptions, __setSandboxBindingName, getSandbox, sandbox };
|
package/dist/runtime/sandbox.mjs
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { a as getRawRuntimeEnv } from "../env-raw-Cx8ElDdj.mjs";
|
|
2
2
|
import { a as requireRuntimeBinding } from "../env-D5liuQYR.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as limitOperation, t as UsageLimit } from "../limits-Cjuk2VPm.mjs";
|
|
4
|
+
import { n as SandboxContainer, r as validateSandboxOptions } from "../sandbox-container-C6ItmVuN.mjs";
|
|
5
|
+
export * from "@cloudflare/sandbox";
|
|
4
6
|
//#region src/runtime/sandbox.ts
|
|
5
7
|
const DEFAULT_SANDBOX_ID = "default";
|
|
6
8
|
const DEFAULT_SANDBOX_BINDING = "SANDBOX";
|
|
7
9
|
const SANDBOX_SERVICE_BINDING = "__VOID_SANDBOX";
|
|
8
|
-
var SandboxLimitError = class extends
|
|
10
|
+
var SandboxLimitError = class extends UsageLimit {
|
|
9
11
|
name = "SandboxLimitError";
|
|
10
|
-
reason;
|
|
11
12
|
constructor(reason, message) {
|
|
12
|
-
super(
|
|
13
|
-
|
|
13
|
+
super({
|
|
14
|
+
resource: "sandbox",
|
|
15
|
+
reason,
|
|
16
|
+
message: message ?? `Sandbox limit reached: ${reason}`
|
|
17
|
+
});
|
|
14
18
|
}
|
|
15
19
|
};
|
|
16
20
|
var SandboxUnavailableError = class extends Error {
|
|
@@ -29,96 +33,168 @@ function rethrowSandboxError(error) {
|
|
|
29
33
|
if (message.includes("VOID_SANDBOX_unavailable")) throw new SandboxUnavailableError();
|
|
30
34
|
throw error;
|
|
31
35
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
36
|
+
function encodeOptions(value) {
|
|
37
|
+
if (!value || typeof value !== "object") return {
|
|
38
|
+
options: value,
|
|
39
|
+
finish() {}
|
|
40
|
+
};
|
|
41
|
+
const { signal, ...options } = value;
|
|
42
|
+
if (!signal) return {
|
|
43
|
+
options,
|
|
44
|
+
finish() {}
|
|
45
|
+
};
|
|
46
|
+
signal.throwIfAborted();
|
|
47
|
+
let closed = false;
|
|
48
|
+
let remove;
|
|
49
|
+
let finish;
|
|
50
|
+
const abort = new ReadableStream({
|
|
51
|
+
start(controller) {
|
|
52
|
+
const listener = () => finish();
|
|
53
|
+
remove = () => signal.removeEventListener("abort", listener);
|
|
54
|
+
finish = () => {
|
|
55
|
+
remove();
|
|
56
|
+
if (!closed) {
|
|
57
|
+
closed = true;
|
|
58
|
+
controller.close();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
signal.addEventListener("abort", listener, { once: true });
|
|
62
|
+
},
|
|
63
|
+
cancel() {
|
|
64
|
+
closed = true;
|
|
65
|
+
remove();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
options: {
|
|
70
|
+
...options,
|
|
71
|
+
abort
|
|
72
|
+
},
|
|
73
|
+
finish
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function client(capability) {
|
|
77
|
+
const call = async (operation, args) => {
|
|
34
78
|
try {
|
|
35
|
-
return
|
|
79
|
+
return await capability.invoke(operation, args);
|
|
36
80
|
} catch (error) {
|
|
37
81
|
rethrowSandboxError(error);
|
|
38
82
|
}
|
|
39
83
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
45
|
-
}
|
|
46
|
-
|
|
84
|
+
const callWithOptions = async (operation, args, index) => {
|
|
85
|
+
const encoded = encodeOptions(args[index]);
|
|
86
|
+
args[index] = encoded.options;
|
|
87
|
+
try {
|
|
88
|
+
return await call(operation, args);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
encoded.finish();
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const files = new Proxy(Object.create(null), { get(_target, method) {
|
|
95
|
+
if (typeof method !== "string" || method === "then") return;
|
|
96
|
+
return (...args) => {
|
|
97
|
+
const index = method === "writeFile" || method === "rename" ? 3 : 2;
|
|
98
|
+
return limitOperation(() => callWithOptions("files", [method, ...args], index));
|
|
99
|
+
};
|
|
47
100
|
} });
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
101
|
+
const execute = async (argv, options) => {
|
|
102
|
+
const wire = await callWithOptions("exec", [argv, options], 1);
|
|
103
|
+
let exitCode;
|
|
104
|
+
let output;
|
|
105
|
+
const process = {
|
|
106
|
+
pid: wire.pid,
|
|
107
|
+
isPty: wire.isPty,
|
|
108
|
+
stdin: wire.stdin,
|
|
109
|
+
stdout: wire.stdout,
|
|
110
|
+
stderr: wire.stderr,
|
|
111
|
+
get exitCode() {
|
|
112
|
+
return exitCode ??= limitOperation(async () => {
|
|
113
|
+
try {
|
|
114
|
+
return await wire.capability.invoke("exitCode", []);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
rethrowSandboxError(error);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
output() {
|
|
121
|
+
return output ??= limitOperation(async () => {
|
|
122
|
+
try {
|
|
123
|
+
return await Promise.all([
|
|
124
|
+
wire.stdout ? new Response(wire.stdout).arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0),
|
|
125
|
+
wire.stderr ? new Response(wire.stderr).arrayBuffer() : /* @__PURE__ */ new ArrayBuffer(0),
|
|
126
|
+
process.exitCode.match({
|
|
127
|
+
ok: (code) => code,
|
|
128
|
+
limited: (limit) => {
|
|
129
|
+
throw limit;
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
]).then(([stdout, stderr, exitCode]) => ({
|
|
133
|
+
stdout,
|
|
134
|
+
stderr,
|
|
135
|
+
exitCode
|
|
136
|
+
}));
|
|
137
|
+
} catch (error) {
|
|
138
|
+
rethrowSandboxError(error);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
kill: async (signal) => {
|
|
143
|
+
await wire.capability.invoke("kill", [signal]);
|
|
144
|
+
},
|
|
145
|
+
resize: async (cols, rows) => {
|
|
146
|
+
await wire.capability.invoke("resize", [cols, rows]);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return process;
|
|
150
|
+
};
|
|
151
|
+
return {
|
|
152
|
+
files,
|
|
153
|
+
exec: (argv, options) => limitOperation(() => execute(argv, options)),
|
|
154
|
+
run: (argv, options) => limitOperation(async () => {
|
|
155
|
+
return (await execute(argv, options)).output().match({
|
|
156
|
+
ok: (result) => result,
|
|
157
|
+
limited: (limit) => {
|
|
158
|
+
throw limit;
|
|
159
|
+
}
|
|
61
160
|
});
|
|
161
|
+
}),
|
|
162
|
+
fetch: (port, request) => limitOperation(async () => await call("fetch", [port, request])),
|
|
163
|
+
running: async () => await call("running", []),
|
|
164
|
+
destroy: async () => {
|
|
165
|
+
await call("destroy", []);
|
|
62
166
|
}
|
|
63
|
-
|
|
64
|
-
const session = value;
|
|
65
|
-
return new Proxy({ id: session.id }, { get(target, property) {
|
|
66
|
-
if (property === "id") return target.id;
|
|
67
|
-
if (typeof property !== "string" || property === "then") return;
|
|
68
|
-
return (...args) => call(session.capability, property, args);
|
|
69
|
-
} });
|
|
70
|
-
}
|
|
71
|
-
return value;
|
|
72
|
-
}
|
|
73
|
-
function prepareManagedArgs(operation, args) {
|
|
74
|
-
if (operation !== "startProcess") return args;
|
|
75
|
-
const [command, options, ...rest] = args;
|
|
76
|
-
if (!options || typeof options !== "object" || Array.isArray(options)) return args;
|
|
77
|
-
const onStart = options.onStart;
|
|
78
|
-
if (typeof onStart !== "function") return args;
|
|
79
|
-
return [
|
|
80
|
-
command,
|
|
81
|
-
{
|
|
82
|
-
...options,
|
|
83
|
-
onStart: (process) => onStart(decodeManagedResult(process))
|
|
84
|
-
},
|
|
85
|
-
...rest
|
|
86
|
-
];
|
|
87
|
-
}
|
|
167
|
+
};
|
|
88
168
|
}
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
var VoidPlatformSandbox = class extends Sandbox {
|
|
94
|
-
async onStart() {
|
|
169
|
+
/** Generated local/native DO. Managed execution uses the trusted controller. */
|
|
170
|
+
var VoidPlatformSandbox = class extends SandboxContainer {
|
|
171
|
+
async beforeStart() {
|
|
95
172
|
const env = this.env;
|
|
96
173
|
if (env.__PROJECT_ID !== void 0 || env.__VOID_PROXY !== void 0) throw new SandboxUnavailableError("Managed Sandboxes require the platform Sandbox controller. Redeploy this application.");
|
|
97
|
-
await super.onStart();
|
|
98
174
|
}
|
|
99
175
|
};
|
|
100
|
-
/** Resolve
|
|
101
|
-
async function getSandbox(id = DEFAULT_SANDBOX_ID, options) {
|
|
102
|
-
const { binding = sandboxBindingName, ...sandboxOptions } = options
|
|
103
|
-
|
|
104
|
-
|
|
176
|
+
/** Resolve a container by name. Starts on the first command, file or port operation. */
|
|
177
|
+
async function getSandbox(id = DEFAULT_SANDBOX_ID, options = {}) {
|
|
178
|
+
const { binding = sandboxBindingName, normalizeId = true, ...sandboxOptions } = options;
|
|
179
|
+
if (typeof normalizeId !== "boolean") throw new TypeError("Sandbox normalizeId must be a boolean.");
|
|
180
|
+
validateSandboxOptions(sandboxOptions);
|
|
181
|
+
if (typeof id !== "string" || id.length === 0 || id.length > 63) throw new TypeError("Sandbox id must contain between 1 and 63 characters.");
|
|
182
|
+
if (normalizeId) id = id.toLowerCase();
|
|
183
|
+
const env = getRawRuntimeEnv();
|
|
184
|
+
const service = env[SANDBOX_SERVICE_BINDING];
|
|
105
185
|
if (service) {
|
|
106
186
|
if (binding !== sandboxBindingName) throw new SandboxUnavailableError(`Managed Sandbox binding ${binding} is unavailable.`);
|
|
107
187
|
try {
|
|
108
|
-
return
|
|
109
|
-
normalizeId: true,
|
|
110
|
-
...sandboxOptions
|
|
111
|
-
}));
|
|
188
|
+
return client(await service.getSandbox(id, sandboxOptions));
|
|
112
189
|
} catch (error) {
|
|
113
190
|
rethrowSandboxError(error);
|
|
114
191
|
}
|
|
115
192
|
}
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
193
|
+
if (env.__PROJECT_ID !== void 0 || env.__VOID_PROXY !== void 0) throw new SandboxUnavailableError("This deployment has no managed Sandbox controller. Redeploy this application.");
|
|
194
|
+
const stub = requireRuntimeBinding(binding).getByName(id);
|
|
195
|
+
await stub.configure(sandboxOptions);
|
|
196
|
+
return client(stub);
|
|
121
197
|
}
|
|
122
198
|
const sandbox = { get: getSandbox };
|
|
123
199
|
//#endregion
|
|
124
|
-
export { DEFAULT_SANDBOX_BINDING, DEFAULT_SANDBOX_ID, SANDBOX_SERVICE_BINDING,
|
|
200
|
+
export { DEFAULT_SANDBOX_BINDING, DEFAULT_SANDBOX_ID, SANDBOX_SERVICE_BINDING, SandboxLimitError, SandboxUnavailableError, VoidPlatformSandbox, __setSandboxBindingName, getSandbox, sandbox };
|
package/dist/runtime/sse.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getLastEventId, i as formatSseText, n as eventStream, r as formatSse, t as SseStreamClosedError } from "../sse-
|
|
1
|
+
import { a as getLastEventId, i as formatSseText, n as eventStream, r as formatSse, t as SseStreamClosedError } from "../sse-CQNaDFFV.mjs";
|
|
2
2
|
export { SseStreamClosedError, eventStream, formatSse, formatSseText, getLastEventId };
|
|
@@ -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-CZ4nAylQ.mjs";
|
|
2
2
|
export { HandlerInput, ValidatorSlots, runValidation };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { n as AuthState } from "../auth-DkcFflXV.mjs";
|
|
2
2
|
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv } from "../better-auth-shared-BVkjZ3vM.mjs";
|
|
3
|
-
import { t as AnyWebSocketDefinition } from "../ws-
|
|
3
|
+
import { f as WebSocketInstanceKey, t as AnyWebSocketDefinition } from "../ws-CL1w7GXU.mjs";
|
|
4
4
|
//#region src/runtime/ws-server.d.ts
|
|
5
5
|
export type WebSocketRouteMeta = {
|
|
6
|
+
name?: string;
|
|
7
|
+
key?: WebSocketInstanceKey;
|
|
6
8
|
pattern: string;
|
|
7
9
|
params: Array<string>;
|
|
8
10
|
className: string;
|
|
@@ -17,7 +19,7 @@ export type WebSocketDurableObjectClass = {
|
|
|
17
19
|
new (state: DurableObjectState, env: Record<string, unknown>): WebSocketDurableObjectInstance;
|
|
18
20
|
};
|
|
19
21
|
type ResolveVoidAuthState = (request: Request, env: VoidAuthEnv, runtime: VoidAuthRuntimeOptions) => Promise<AuthState | null>;
|
|
20
|
-
export declare function buildWebSocketInstanceId(route: Pick<WebSocketRouteMeta, "params">, params: Record<string, string>): string;
|
|
22
|
+
export declare function buildWebSocketInstanceId(route: Pick<WebSocketRouteMeta, "params" | "key">, params: Record<string, string>): string;
|
|
21
23
|
export declare function createWebSocketDurableObject(definition: AnyWebSocketDefinition, route: WebSocketRouteMeta, authRuntime?: VoidAuthRuntimeOptions, resolveAuthState?: ResolveVoidAuthState): WebSocketDurableObjectClass;
|
|
22
24
|
/** Keep a removed WebSocket Durable Object class deployable without deleting its storage. */
|
|
23
25
|
export declare function createWebSocketTombstoneDurableObject(className: string): WebSocketDurableObjectClass;
|
|
@@ -48,7 +48,14 @@ function getRouteMatch(request, route) {
|
|
|
48
48
|
return match.matched ? match.params : null;
|
|
49
49
|
}
|
|
50
50
|
function buildWebSocketInstanceId(route, params) {
|
|
51
|
+
if (route.key) {
|
|
52
|
+
const key = route.key({ params });
|
|
53
|
+
if (typeof key !== "string") throw new Error("ws: key must return a string synchronously.");
|
|
54
|
+
return key;
|
|
55
|
+
}
|
|
51
56
|
if (route.params.length === 0) return "default";
|
|
57
|
+
const entries = route.params.map((name) => [name, params[name] ?? ""]);
|
|
58
|
+
if (entries.length > 1 && entries.some(([, value]) => value.includes("&"))) return `v2:${JSON.stringify(entries)}`;
|
|
52
59
|
return route.params.map((name) => `${name}=${params[name] ?? ""}`).join("&");
|
|
53
60
|
}
|
|
54
61
|
async function validateSchema(schema, value) {
|
|
@@ -92,6 +99,16 @@ function getStoredConnection(webSocket) {
|
|
|
92
99
|
authState: null
|
|
93
100
|
};
|
|
94
101
|
}
|
|
102
|
+
function completeWebSocketClose(webSocket, code, reason) {
|
|
103
|
+
if (webSocket.readyState === 3) return;
|
|
104
|
+
if ([
|
|
105
|
+
1004,
|
|
106
|
+
1005,
|
|
107
|
+
1006,
|
|
108
|
+
1015
|
|
109
|
+
].includes(code)) webSocket.close();
|
|
110
|
+
else webSocket.close(code, reason);
|
|
111
|
+
}
|
|
95
112
|
function setStoredConnection(webSocket, data) {
|
|
96
113
|
webSocket.serializeAttachment?.(data);
|
|
97
114
|
}
|
|
@@ -164,6 +181,11 @@ function assertDefinition(definition) {
|
|
|
164
181
|
}
|
|
165
182
|
function createWebSocketDurableObject(definition, route, authRuntime, resolveAuthState) {
|
|
166
183
|
assertDefinition(definition);
|
|
184
|
+
if (definition.name !== route.name) throw new Error("ws: name must be statically discoverable in the route definition. Run void info to inspect this route.");
|
|
185
|
+
const instanceRoute = {
|
|
186
|
+
...route,
|
|
187
|
+
key: definition.key
|
|
188
|
+
};
|
|
167
189
|
class VoidWebSocketDurableObject {
|
|
168
190
|
state;
|
|
169
191
|
env;
|
|
@@ -176,7 +198,7 @@ function createWebSocketDurableObject(definition, route, authRuntime, resolveAut
|
|
|
176
198
|
}
|
|
177
199
|
async handleFetch(request) {
|
|
178
200
|
const params = getRouteMatch(request, route) ?? {};
|
|
179
|
-
const roomId = buildWebSocketInstanceId(
|
|
201
|
+
const roomId = buildWebSocketInstanceId(instanceRoute, params);
|
|
180
202
|
const authState = authRuntime && resolveAuthState ? await resolveAuthState(request, this.env, authRuntime) : null;
|
|
181
203
|
const user = authState?.user ?? null;
|
|
182
204
|
if (request.headers.get("upgrade")?.toLowerCase() === "websocket") {
|
|
@@ -261,6 +283,7 @@ function createWebSocketDurableObject(definition, route, authRuntime, resolveAut
|
|
|
261
283
|
return withRuntimeEnv(this.env, () => this.handleWebSocketClose(webSocket, code, reason, wasClean));
|
|
262
284
|
}
|
|
263
285
|
async handleWebSocketClose(webSocket, code, reason, wasClean) {
|
|
286
|
+
completeWebSocketClose(webSocket, code, reason);
|
|
264
287
|
const stored = getStoredConnection(webSocket);
|
|
265
288
|
const request = new Request(`https://void.local${route.pattern}`);
|
|
266
289
|
if (definition.__kind === "room") {
|
|
@@ -297,7 +320,9 @@ function createWebSocketTombstoneDurableObject(className) {
|
|
|
297
320
|
async webSocketMessage(webSocket) {
|
|
298
321
|
webSocket.close(1012, "WebSocket route removed");
|
|
299
322
|
}
|
|
300
|
-
async webSocketClose() {
|
|
323
|
+
async webSocketClose(webSocket, code, reason) {
|
|
324
|
+
completeWebSocketClose(webSocket, code, reason);
|
|
325
|
+
}
|
|
301
326
|
};
|
|
302
327
|
}
|
|
303
328
|
function getStub(env, route, params) {
|
package/dist/runtime/ws.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RoomDefinition, c as VoidSocket, d as WebSocketConnection, f as
|
|
2
|
-
export { AnyWebSocketDefinition, ConnectCommonOptions, RoomContext, RoomController, RoomDefinition, SocketContext, SocketDefinition, VoidSocket, VoidSocketCloseEvent, WebSocketBaseContext, WebSocketConnection, connect, defineRoom, defineWebSocket };
|
|
1
|
+
import { a as RoomDefinition, c as VoidSocket, d as WebSocketConnection, f as WebSocketInstanceKey, h as defineWebSocket, i as RoomController, l as VoidSocketCloseEvent, m as defineRoom, n as ConnectCommonOptions, o as SocketContext, p as connect, r as RoomContext, s as SocketDefinition, t as AnyWebSocketDefinition, u as WebSocketBaseContext } from "../ws-CL1w7GXU.mjs";
|
|
2
|
+
export { AnyWebSocketDefinition, ConnectCommonOptions, RoomContext, RoomController, RoomDefinition, SocketContext, SocketDefinition, VoidSocket, VoidSocketCloseEvent, WebSocketBaseContext, WebSocketConnection, WebSocketInstanceKey, connect, defineRoom, defineWebSocket };
|
package/dist/runtime/ws.mjs
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
+
import { t as isResourceName } from "../resource-name-C7LVpcRm.mjs";
|
|
2
|
+
import { t as interpolateRouteParams } from "../route-url-CG7U-cRN.mjs";
|
|
1
3
|
//#region src/runtime/ws.ts
|
|
2
4
|
function defineRoom(definition) {
|
|
5
|
+
assertResourceName(definition.name);
|
|
3
6
|
return {
|
|
4
7
|
...definition,
|
|
5
8
|
__kind: "room"
|
|
6
9
|
};
|
|
7
10
|
}
|
|
8
11
|
function defineWebSocket(definition) {
|
|
12
|
+
assertResourceName(definition.name);
|
|
9
13
|
return {
|
|
10
14
|
...definition,
|
|
11
15
|
__kind: "socket"
|
|
12
16
|
};
|
|
13
17
|
}
|
|
18
|
+
function assertResourceName(name) {
|
|
19
|
+
if (name !== void 0 && !isResourceName(name)) throw new Error("ws: name must contain a word starting with a letter.");
|
|
20
|
+
}
|
|
14
21
|
var VoidSocket = class {
|
|
15
22
|
url;
|
|
16
23
|
options;
|
|
@@ -89,14 +96,9 @@ function resolveBaseUrl(baseURL) {
|
|
|
89
96
|
if (!location) throw new Error("ws: connect() requires a browser-like runtime or an explicit \"baseURL\".");
|
|
90
97
|
return new URL(location.href);
|
|
91
98
|
}
|
|
92
|
-
function interpolateParams(path, params) {
|
|
93
|
-
let resolved = path;
|
|
94
|
-
if (params) for (const [key, value] of Object.entries(params)) resolved = resolved.replace(`:${key}`, encodeURIComponent(value));
|
|
95
|
-
return resolved;
|
|
96
|
-
}
|
|
97
99
|
function connect(path, options = {}) {
|
|
98
100
|
const base = resolveBaseUrl(options.baseURL);
|
|
99
|
-
const resolvedPath =
|
|
101
|
+
const resolvedPath = interpolateRouteParams(path, options.params);
|
|
100
102
|
const url = new URL(resolvedPath, base);
|
|
101
103
|
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
102
104
|
return new VoidSocket(url.toString(), options);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { n as LimitOperation, r as UsageLimit } from "./limits-Bq5LG8Id.mjs";
|
|
2
|
+
import { i as SandboxExecOptions, r as SandboxContainer, s as SandboxOptions } from "./sandbox-container-Bo0eiFKz.mjs";
|
|
3
|
+
import { Files } from "@cloudflare/sandbox";
|
|
4
|
+
//#region src/runtime/sandbox.d.ts
|
|
5
|
+
declare const DEFAULT_SANDBOX_ID = "default";
|
|
6
|
+
declare const DEFAULT_SANDBOX_BINDING = "SANDBOX";
|
|
7
|
+
declare const SANDBOX_SERVICE_BINDING = "__VOID_SANDBOX";
|
|
8
|
+
type VoidSandboxOptions = SandboxOptions & {
|
|
9
|
+
binding?: string;
|
|
10
|
+
normalizeId?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type SandboxProcess = {
|
|
13
|
+
pid: number;
|
|
14
|
+
isPty: boolean;
|
|
15
|
+
stdin: WritableStream | null;
|
|
16
|
+
stdout: ReadableStream | null;
|
|
17
|
+
stderr: ReadableStream | null;
|
|
18
|
+
readonly exitCode: LimitOperation<number>;
|
|
19
|
+
output(): LimitOperation<ExecOutput>;
|
|
20
|
+
kill(signal?: number): Promise<void>;
|
|
21
|
+
resize(cols: number, rows: number): Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
type SandboxFiles = { [K in keyof Files]: Files[K] extends ((...args: infer A) => Promise<infer R>) ? (...args: A) => LimitOperation<R> : never; };
|
|
24
|
+
type SandboxClient = {
|
|
25
|
+
exec(argv: Array<string>, options?: SandboxExecOptions): LimitOperation<SandboxProcess>;
|
|
26
|
+
run(argv: Array<string>, options?: SandboxExecOptions): LimitOperation<ExecOutput>;
|
|
27
|
+
files: SandboxFiles;
|
|
28
|
+
fetch(port: number, request: Request): LimitOperation<Response>;
|
|
29
|
+
running(): Promise<boolean>;
|
|
30
|
+
destroy(): Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
declare class SandboxLimitError extends UsageLimit {
|
|
33
|
+
override readonly name = "SandboxLimitError";
|
|
34
|
+
readonly reason: "concurrency" | "runtime_budget";
|
|
35
|
+
constructor(reason: "concurrency" | "runtime_budget", message?: string);
|
|
36
|
+
}
|
|
37
|
+
declare class SandboxUnavailableError extends Error {
|
|
38
|
+
override readonly name = "SandboxUnavailableError";
|
|
39
|
+
constructor(message?: string);
|
|
40
|
+
}
|
|
41
|
+
declare function __setSandboxBindingName(bindingName: string): void;
|
|
42
|
+
/** Generated local/native DO. Managed execution uses the trusted controller. */
|
|
43
|
+
declare class VoidPlatformSandbox<Env = unknown> extends SandboxContainer<Env> {
|
|
44
|
+
protected override beforeStart(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
/** Resolve a container by name. Starts on the first command, file or port operation. */
|
|
47
|
+
declare function getSandbox(id?: string, options?: VoidSandboxOptions): Promise<SandboxClient>;
|
|
48
|
+
declare const sandbox: {
|
|
49
|
+
get: typeof getSandbox;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { SandboxFiles as a, SandboxUnavailableError as c, __setSandboxBindingName as d, getSandbox as f, SandboxClient as i, VoidPlatformSandbox as l, DEFAULT_SANDBOX_ID as n, SandboxLimitError as o, sandbox as p, SANDBOX_SERVICE_BINDING as r, SandboxProcess as s, DEFAULT_SANDBOX_BINDING as t, VoidSandboxOptions as u };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { DurableObject } from "cloudflare:workers";
|
|
2
|
+
//#region src/runtime/sandbox-container.d.ts
|
|
3
|
+
type SandboxInstance = "lite" | "standard-1" | "standard-2" | "standard-3" | "standard-4";
|
|
4
|
+
type SandboxOptions = {
|
|
5
|
+
inactivityTimeoutMs?: number;
|
|
6
|
+
enableInternet?: boolean;
|
|
7
|
+
labels?: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
type SandboxExecOptions = ContainerExecOptions & {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
pty?: boolean | {
|
|
12
|
+
cols?: number;
|
|
13
|
+
rows?: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
type SandboxCapability = {
|
|
17
|
+
invoke(operation: string, args: Array<unknown>): Promise<unknown>;
|
|
18
|
+
};
|
|
19
|
+
type SandboxProcessWire = {
|
|
20
|
+
capability: SandboxCapability;
|
|
21
|
+
pid: number;
|
|
22
|
+
isPty: boolean;
|
|
23
|
+
stdin: WritableStream | null;
|
|
24
|
+
stdout: ReadableStream | null;
|
|
25
|
+
stderr: ReadableStream | null;
|
|
26
|
+
};
|
|
27
|
+
type SandboxNativeContainer = Omit<Container, "start" | "exec"> & {
|
|
28
|
+
readonly images: Record<string, string>;
|
|
29
|
+
start(options: {
|
|
30
|
+
image: string;
|
|
31
|
+
instance: SandboxInstance;
|
|
32
|
+
enableInternet: boolean;
|
|
33
|
+
labels?: Record<string, string>;
|
|
34
|
+
entrypoint?: Array<string>;
|
|
35
|
+
}): void;
|
|
36
|
+
exec(argv: Array<string>, options?: SandboxExecOptions): Promise<ExecProcess & {
|
|
37
|
+
isPty?: boolean;
|
|
38
|
+
resize(cols: number, rows: number): void;
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
declare const DEFAULT_SANDBOX_INACTIVITY_TIMEOUT_MS: number;
|
|
42
|
+
declare function validateSandboxOptions(options: SandboxOptions): void;
|
|
43
|
+
/** Shared native execution, used by local Workers and the trusted platform controller. */
|
|
44
|
+
declare class SandboxContainer<Env = unknown> extends DurableObject<Env> {
|
|
45
|
+
#private;
|
|
46
|
+
protected instanceType: SandboxInstance;
|
|
47
|
+
protected starting: boolean;
|
|
48
|
+
constructor(ctx: DurableObjectState, env: Env);
|
|
49
|
+
protected get container(): SandboxNativeContainer;
|
|
50
|
+
configure(options: SandboxOptions): Promise<void>;
|
|
51
|
+
protected get inactivityTimeoutMs(): number;
|
|
52
|
+
protected beforeStart(): Promise<void>;
|
|
53
|
+
protected afterStart(): Promise<void>;
|
|
54
|
+
protected beforeUse(): Promise<void>;
|
|
55
|
+
protected stopped(): Promise<void>;
|
|
56
|
+
protected processContext(_exitCode: Promise<number>): unknown;
|
|
57
|
+
protected waitForProcessExit(exitCode: Promise<number>, _context?: unknown): Promise<number>;
|
|
58
|
+
/** Native abort listeners must be detached as soon as a process exits. */
|
|
59
|
+
protected execProcess(argv: Array<string>, options?: SandboxExecOptions): Promise<ExecProcess & {
|
|
60
|
+
isPty?: boolean;
|
|
61
|
+
resize(cols: number, rows: number): void;
|
|
62
|
+
}>;
|
|
63
|
+
protected initializationOutput(argv: Array<string>, options: SandboxExecOptions, timeoutMs: number): Promise<ExecOutput>;
|
|
64
|
+
protected initialize(): Promise<void>;
|
|
65
|
+
protected get entrypoint(): Array<string> | undefined;
|
|
66
|
+
protected get image(): string;
|
|
67
|
+
protected ensureRunning(): Promise<void>;
|
|
68
|
+
private setup;
|
|
69
|
+
destroy(): Promise<void>;
|
|
70
|
+
invoke(operation: string, args: Array<unknown>): Promise<unknown>;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { SandboxInstance as a, SandboxProcessWire as c, SandboxExecOptions as i, validateSandboxOptions as l, SandboxCapability as n, SandboxNativeContainer as o, SandboxContainer as r, SandboxOptions as s, DEFAULT_SANDBOX_INACTIVITY_TIMEOUT_MS as t };
|