void 0.26.1 → 0.28.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 +3 -1
- package/dist/{account-cmd-CfUXh_nU.mjs → account-cmd-Ci00cncT.mjs} +5 -5
- package/dist/{agents-B_pX_HmQ.mjs → agents-CuNtT0D_.mjs} +5 -2
- package/dist/{application-analysis-DKy02UY0.mjs → application-analysis-D72ZQfMZ.mjs} +118 -135
- package/dist/{application-routing-DQyUh_5S.mjs → application-routing-Dy589Vgn.mjs} +1 -2
- package/dist/atomic-write-Dq6R0BPN.mjs +18 -0
- package/dist/{auth-B5_tZLxT.mjs → auth-B6iOCjKI.mjs} +23 -56
- package/dist/{auth-link-D5RmKnzh.mjs → auth-link-DWr6Afao.mjs} +10 -10
- package/dist/{auth-migrations-BwHgeEsD.mjs → auth-migrations-Cgs0k6lS.mjs} +28 -5
- package/dist/{auth-router-Bap-pvbn.mjs → auth-router-DP14wVkZ.mjs} +4 -4
- package/dist/auth-wn6F8dB8.mjs +2 -0
- package/dist/base64-DVrOndmI.mjs +16 -0
- package/dist/{better-auth-shared-CPvWD3nG.d.mts → better-auth-shared-B74NJIus.d.mts} +8 -13
- package/dist/{better-auth-shared-DPpj8zxc.mjs → better-auth-shared-CMXlZG7W.mjs} +56 -68
- package/dist/{build-cmd-B58c8iS8.mjs → build-cmd-Cr3FJxv0.mjs} +5 -5
- package/dist/{cache-Bo52trKF.mjs → cache-D0Tt28cn.mjs} +5 -5
- package/dist/{cancel-deploy-BZNz3Q26.mjs → cancel-deploy-CJKvk7AN.mjs} +4 -4
- package/dist/{cf-access-TWNzXltp.mjs → cf-access-BM9G0lhO.mjs} +4 -3
- package/dist/{cf-access-ngGqZpHZ.mjs → cf-access-CWP4avfP.mjs} +3 -7
- package/dist/cf-build-output-2u583yJK.mjs +2 -0
- package/dist/{cf-build-output-DjvB_872.mjs → cf-build-output-Bc8i3dzE.mjs} +2 -2
- package/dist/cf-user-agent-ChjQp2MU.mjs +33 -0
- package/dist/cli/cli.mjs +198 -311
- package/dist/cli/cloudflare-operation-process.mjs +46 -14
- package/dist/cli/env-schema-probe.d.mts +5 -43
- package/dist/cli/env-schema-probe.mjs +14 -80
- package/dist/client-C1BjRn3g.mjs +2 -0
- package/dist/{client-C2Prx_Bi.mjs → client-DM9Kcf4e.mjs} +161 -415
- package/dist/{cloudflare-auth-CuxfF6OA.mjs → cloudflare-auth-CqFBDo52.mjs} +12 -39
- package/dist/{cloudflare-cmd-lHqNlJGW.mjs → cloudflare-cmd-CTrn-lXJ.mjs} +6 -5
- package/dist/{cloudflare-config-BmhBv3HV.mjs → cloudflare-config-DV60XFFK.mjs} +16 -28
- package/dist/{cloudflare-connect-2G3rL2rP.mjs → cloudflare-connect-BosmCNlq.mjs} +3 -3
- package/dist/{cloudflare-operations-CwI1bChl.mjs → cloudflare-operations-BKdSfNBN.mjs} +26 -34
- package/dist/{cloudflare-operations-BlYLlowZ.mjs → cloudflare-operations-Ds-lX3Ts.mjs} +1 -1
- package/dist/{cloudflare-process-2-TfIEzB.mjs → cloudflare-process-CeDWJRhj.mjs} +12 -7
- package/dist/collect-NUlJMpLY.mjs +2 -0
- package/dist/{collect-DiTn9yr6.mjs → collect-xjffdCdk.mjs} +1 -1
- package/dist/{config-CSa15FvD.d.mts → config-7qoq2p9v.d.mts} +2 -2
- package/dist/{config-CLYAosnQ.mjs → config-BEm9vRvS.mjs} +11 -5
- package/dist/{config-DiowPT80.mjs → config-Bx_1SpnO.mjs} +87 -177
- package/dist/config-CNnrSMYm.mjs +2 -0
- package/dist/{config-DPByhVck.mjs → config-D0GY5ItR.mjs} +1 -1
- package/dist/config-entry.d.mts +1 -1
- package/dist/{connect-X0MUA1gk.mjs → connect-nukQSoEO.mjs} +8 -8
- package/dist/{create-project-DxiyW6iX.mjs → create-project-D4APeBwX.mjs} +7 -7
- package/dist/{create-project-iwkbqiBU.mjs → create-project-DL7YXpjj.mjs} +1 -1
- package/dist/{db-XnVMHzoV.mjs → db-27RztQLy.mjs} +173 -263
- package/dist/{delete-esYlMiSJ.mjs → delete-BbsZFZIw.mjs} +5 -5
- package/dist/deploy-B06EQq4t.mjs +6009 -0
- package/dist/deploy-Db2ALnQP.mjs +3 -0
- package/dist/deploy-managed-static-CGswbcay.mjs +2277 -0
- package/dist/deploy-transport-BiicfoQW.mjs +180 -0
- package/dist/deploy.d.mts +10 -0
- package/dist/deploy.mjs +82 -0
- package/dist/dev-inbox-Rd6j_8vM.mjs +217 -0
- package/dist/discover-CTUiSsfG.mjs +2 -0
- package/dist/{discover-CkCYv9T_.mjs → discover-D2PGT63u.mjs} +2 -2
- package/dist/{dist-BVqXeR_h.mjs → dist-ipQi0Q8y.mjs} +2 -3
- package/dist/{domain-CbbBWhWE.mjs → domain-Bfq9n03H.mjs} +7 -22
- package/dist/{dotenv-BfU6eqFt.mjs → dotenv-CNazY3-w.mjs} +4 -16
- package/dist/{email-d_Aux1vM.mjs → email-BcjSyAL0.mjs} +4 -20
- package/dist/{email-CpuT42g7.mjs → email-DIwaQU4P.mjs} +99 -191
- package/dist/email-cloudflare-CH053RxK.mjs +1096 -0
- package/dist/email-protocol-D9nTvhCp.mjs +82 -0
- package/dist/{entry-CMAkqBmU.mjs → entry-ehmBvs5w.mjs} +2 -2
- package/dist/{env-BxocywBB.mjs → env-BJjULvL0.mjs} +2 -2
- package/dist/{env-DMA3cXZt.mjs → env-BhdWMrNy.mjs} +2 -13
- package/dist/{env-w9jOyGZn.mjs → env-C6ipBLp3.mjs} +8 -8
- package/dist/{env-public-DR7ZM6d-.d.mts → env-public-CCdykygU.d.mts} +6 -23
- package/dist/{env-raw-jZpP5n47.mjs → env-raw-Cklzcde3.mjs} +3 -20
- package/dist/{env-types-CwXgeMgL.mjs → env-types-DS2_y4X8.mjs} +2 -2
- package/dist/{env-validation-CrVNjsPm.mjs → env-validation-CTn-HhG1.mjs} +1 -1
- package/dist/env-validation-cE0zcmzO.mjs +486 -0
- package/dist/{gen-DtkQhvQg.mjs → gen-CnN1Xidx.mjs} +131 -253
- package/dist/gen-F8pSZnhc.mjs +2 -0
- package/dist/{generate-GDbL7sUr.mjs → generate-Dat0UTry.mjs} +38 -4
- package/dist/generate-Rii9klHB.mjs +2 -0
- package/dist/generated-wrangler-config-DeWj5F9Y.mjs +18 -0
- package/dist/{github-cmd-D_FsOFxq.mjs → github-cmd-BdkU4Nhe.mjs} +27 -71
- package/dist/{handler-BHAn2fZJ.mjs → handler-BZ1t7-Rv.mjs} +2 -2
- package/dist/{handler-CNAwjRcW.d.mts → handler-_PqY82xe.d.mts} +1 -1
- package/dist/{headers-DlfR78Nu.mjs → headers-Di1FsD3e.mjs} +26 -81
- package/dist/{help-CVFBTmBx.mjs → help-Bug7pyK_.mjs} +18 -10
- package/dist/help-s9q7LTcu.mjs +2 -0
- package/dist/{inbound-PfQDLXc5.mjs → inbound-DmkTQeWp.mjs} +71 -222
- package/dist/{inbound-CH5Mksyy.d.mts → inbound-brj2-TM5.d.mts} +19 -58
- package/dist/index.d.mts +2 -18
- package/dist/index.mjs +200 -496
- package/dist/{info-PYWwkWyt.mjs → info-CujPwtMe.mjs} +5 -5
- package/dist/{init-Bw-fRKGp.mjs → init-ZWOJvc-Z.mjs} +179 -388
- package/dist/isr-config-DPjXM8J2.mjs +194 -0
- package/dist/{link-DlPG8iX3.mjs → link-UEc7bnF4.mjs} +8 -8
- package/dist/{list-2GN7_ueV.mjs → list-CuWeOnzk.mjs} +6 -17
- package/dist/{live-CgQuTpqD.mjs → live-BxLX-JqJ.mjs} +19 -17
- package/dist/{live-Du8jXwOW.d.mts → live-DJONVlQK.d.mts} +1 -1
- package/dist/load-user-env-DD5qveNU.mjs +49 -0
- package/dist/{local-d1-ga5O_idV.mjs → local-d1-BM3p74mm.mjs} +6 -6
- package/dist/{login-D-Q4xw3Q.mjs → login-CZ2Cqa-D.mjs} +11 -11
- package/dist/login-DhK7o1oJ.mjs +2 -0
- package/dist/{logs-rd8J-OFh.mjs → logs-TihRcLTk.mjs} +5 -5
- package/dist/migrate-BgT-hmu8.mjs +2 -0
- package/dist/{migrate-NLsjBbuM.mjs → migrate-uFwojusJ.mjs} +69 -21
- package/dist/migration-handler-Cg0Y4EPu.mjs +470 -0
- package/dist/{migration-handler-DM4clYj5.d.mts → migration-handler-CwlEQUoo.d.mts} +17 -26
- package/dist/{mime-DxCznlJq.mjs → mime-srOklVVv.mjs} +92 -395
- package/dist/{node-DJicPvPj.mjs → node-DoKbo1SZ.mjs} +8 -24
- package/dist/{operator-args-BNsW5gfp.mjs → operator-args-UnE8Y2eK.mjs} +27 -26
- package/dist/{operator-auth-AzVLbrr3.mjs → operator-auth-Cr2zCc-J.mjs} +2 -2
- package/dist/{operator-client-BQtzyG-g.mjs → operator-client-C-ROjk1I.mjs} +4 -4
- package/dist/{operator-cmd-B6f6Cg9Z.mjs → operator-cmd-C5lCctnc.mjs} +8 -8
- package/dist/operator-cmd-Cjk5DiRx.mjs +2 -0
- package/dist/{output-C50ag2r3.mjs → output-FNHKw5Ac.mjs} +36 -5
- package/dist/{package-json-DXfiT1jV.mjs → package-json-BjYqR-So.mjs} +1 -1
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/client.mjs +91 -5
- package/dist/pages/index.d.mts +1 -2
- package/dist/pages/index.mjs +6 -6
- package/dist/pages/islands-plugin.mjs +5 -83
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +1 -1
- package/dist/pages/serialize.mjs +1 -1
- package/dist/{platform-args-BoZkWQnJ.mjs → platform-args-C6Mb_I3a.mjs} +34 -58
- package/dist/platform-args-Cm7x-fot.mjs +2 -0
- package/dist/{platform-auth-config-n603OANg.mjs → platform-auth-config-CJmNkFT2.mjs} +10 -11
- package/dist/{platform-auth-protection-zxDr0hWW.mjs → platform-auth-protection-D5wvsI-Y.mjs} +36 -26
- package/dist/{platform-auth-recovery-tw9lgtgE.mjs → platform-auth-recovery-D_0I3n-1.mjs} +8 -9
- package/dist/{platform-cmd-C00YM14r.mjs → platform-cmd-Cuj4oUVo.mjs} +1 -1
- package/dist/{platform-cmd-B8-bCb7t.mjs → platform-cmd-DxxZO6e5.mjs} +17 -16
- package/dist/{platform-discovery-BC0HCKYt.mjs → platform-discovery-CHhNs8Nn.mjs} +1 -1
- package/dist/{platform-domain-p0kobLV8.mjs → platform-domain-zLXnW1G_.mjs} +5 -5
- package/dist/{platform-lifecycle-D_QEY32D.mjs → platform-lifecycle-DOW-wLfx.mjs} +1398 -2043
- package/dist/{platform-lifecycle-vFqtNPPa.mjs → platform-lifecycle-_gfnjUBr.mjs} +1 -1
- package/dist/{platform-management-oi-SvI3f.mjs → platform-management-CYrLvTGH.mjs} +1 -1
- package/dist/{platform-management-BdYblvvE.mjs → platform-management-t7HKy4-U.mjs} +632 -124
- package/dist/{platform-plans-config-CjiFv5J4.mjs → platform-plans-config-CNH6zbPX.mjs} +15 -11
- package/dist/{platform-recovery-PvNS9Nl2.mjs → platform-recovery-DeucI7A9.mjs} +6 -9
- package/dist/{platform-registry-P387v42A.mjs → platform-registry-B9mWX9LO.mjs} +18 -19
- package/dist/{platform-setup-DVe42Ws7.mjs → platform-setup-CTf6MMT9.mjs} +19 -26
- package/dist/{plugin-inference-BlQbOL0P.mjs → plugin-inference-DsARdQKE.mjs} +18 -33
- package/dist/{prepare-Dq9hTIbo.mjs → prepare-C4zfwks4.mjs} +3 -3
- package/dist/{prepare-Do96654b.mjs → prepare-CSH9dKTI.mjs} +11 -13
- package/dist/prepare-dr9uxQSV.mjs +2 -0
- package/dist/{prerender-render-Ct20jftc.mjs → prerender-render-Bfsumdkv.mjs} +8 -2
- package/dist/prerender-render.d.mts +2 -0
- package/dist/prerender-render.mjs +2 -2
- package/dist/project-DiiOBZPF.mjs +2 -0
- package/dist/{project-cmd-ti8_yTcA.mjs → project-cmd-Dq75AXzy.mjs} +19 -19
- package/dist/{project-paths-GgcMozYz.mjs → project-paths-DMvEeSau.mjs} +9 -14
- package/dist/{project-DQstYTxO.mjs → project-rqDnVsJN.mjs} +8 -4
- package/dist/{project-team-CDPE1Tsg.mjs → project-team-B3_QcStG.mjs} +6 -6
- package/dist/{project-token-CkZ1cN0Z.mjs → project-token-CvsRvv2I.mjs} +5 -5
- package/dist/{project-tsconfig-CVJhNMxs.mjs → project-tsconfig-bveqhlYA.mjs} +3 -5
- package/dist/{project-zero-trust-DdjLR61k.mjs → project-zero-trust-D1ICiwN_.mjs} +5 -5
- package/dist/{protocol-BPZaNqBo.d.mts → protocol-4H7V_3Os.d.mts} +1 -1
- package/dist/{protocol-CfaUwNs8.mjs → protocol-RNP0u7UY.mjs} +9 -3
- package/dist/{provision-BfaLiWbj.mjs → provision-DDh7ITVS.mjs} +118 -865
- package/dist/{requests-DFAqyYy8.mjs → requests-3CL3BuZh.mjs} +4 -4
- package/dist/resolve-project-B9Hr0D3n.mjs +2 -0
- package/dist/resolve-project-C_Cu7E8a.mjs +48 -0
- package/dist/{rollback-BKYXBduI.mjs → rollback-Ce1d_0J9.mjs} +7 -17
- package/dist/{route-types-CbtsIeFn.mjs → route-types-IrBuwJ7u.mjs} +35 -70
- package/dist/routing-assets-VkrKIbxE.mjs +139 -0
- package/dist/{runner-9wjsSZx-.mjs → runner-B5huK2eC.mjs} +1 -1
- package/dist/{runner-DMBKSrRk.mjs → runner-DcVDrzuR.mjs} +7 -28
- package/dist/{runner-mysql-CEzKtmFb.mjs → runner-mysql-CCtyI0p6.mjs} +4 -3
- package/dist/runner-mysql-CaJq-hd6.mjs +2 -0
- package/dist/runner-pg-BJhFZZG4.mjs +2 -0
- package/dist/{runner-pg-DV8p_zjA.mjs → runner-pg-CPd-CB_F.mjs} +1 -1
- package/dist/runtime/ai.mjs +9 -22
- package/dist/runtime/better-auth-mysql.d.mts +2 -5
- package/dist/runtime/better-auth-mysql.mjs +6 -31
- package/dist/runtime/better-auth-pg.d.mts +2 -5
- package/dist/runtime/better-auth-pg.mjs +6 -32
- package/dist/runtime/better-auth.d.mts +2 -4
- package/dist/runtime/better-auth.mjs +9 -19
- package/dist/runtime/db.mjs +1 -1
- package/dist/runtime/durable.d.mts +16 -0
- package/dist/runtime/durable.mjs +26 -2
- package/dist/runtime/email/testing.d.mts +1 -1
- package/dist/runtime/email/testing.mjs +9 -23
- package/dist/runtime/email-protocol.d.mts +12 -0
- package/dist/runtime/email-protocol.mjs +2 -70
- package/dist/runtime/email.d.mts +1 -1
- package/dist/runtime/email.mjs +79 -221
- package/dist/runtime/env-public.d.mts +1 -1
- package/dist/runtime/env-public.mjs +12 -38
- package/dist/runtime/env.d.mts +1 -12
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/live-client.d.mts +1 -1
- package/dist/runtime/live-server.mjs +1 -16
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/migration-handler-mysql.d.mts +2 -2
- package/dist/runtime/migration-handler-mysql.mjs +3 -2
- package/dist/runtime/migration-handler-pg.d.mts +2 -2
- package/dist/runtime/migration-handler-pg.mjs +1 -1
- package/dist/runtime/migration-handler.d.mts +2 -2
- package/dist/runtime/migration-handler.mjs +2 -470
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/remote/binding-handler.mjs +62 -62
- package/dist/runtime/remote/index.mjs +16 -77
- package/dist/runtime/routing.d.mts +1 -4
- package/dist/runtime/routing.mjs +82 -218
- package/dist/runtime/sandbox-container.d.mts +2 -2
- package/dist/runtime/sandbox-container.mjs +2 -2
- package/dist/runtime/sandbox.d.mts +2 -2
- package/dist/runtime/sandbox.mjs +13 -6
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +2 -3
- package/dist/runtime/ws-server.mjs +6 -28
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/{sandbox-container-Bo0eiFKz.d.mts → sandbox-container-ChQRum-j.d.mts} +3 -1
- package/dist/{sandbox-container-C6ItmVuN.mjs → sandbox-container-DBKIqDEK.mjs} +12 -1
- package/dist/{sandbox-C5LFoJMf.d.mts → sandbox-q3waMc2T.d.mts} +1 -1
- package/dist/{scan-C3uDzz6J.mjs → scan-C0BMdmEd.mjs} +84 -7
- package/dist/{secret-BAt2KMmO.mjs → secret-B5J8bBsI.mjs} +62 -80
- package/dist/{serialize-BPvnNQuA.mjs → serialize-BtQyaYoC.mjs} +10 -4
- package/dist/{skills-BgVMvQdy.mjs → skills-BJsan98C.mjs} +2 -2
- package/dist/{subcommand-prompt-BSlnD1fI.mjs → subcommand-prompt-gQ-NDA-u.mjs} +38 -43
- package/dist/sveltekit.mjs +1 -1
- package/dist/validate-C9xtFOYR.mjs +2 -0
- package/dist/{validate-C9qJArv7.mjs → validate-CheZGRE7.mjs} +4 -8
- package/dist/version-metadata-DIrqEHQo.mjs +73 -0
- package/dist/{wrangler-D9KTuqnv.mjs → wrangler-BYs07Rxy.mjs} +119 -378
- package/dist/{ws-CChrrAU-.d.mts → ws-aKVYB-fA.d.mts} +1 -1
- package/dist/yarn-pnp-DLbEFMT0.mjs +92 -0
- package/docs/guide/auth.md +2 -0
- package/docs/guide/database/postgresql.md +2 -0
- package/docs/guide/database.md +2 -0
- package/docs/guide/deployment.md +2 -2
- package/docs/guide/durable-state.md +24 -0
- package/docs/guide/platform/administration/access.md +5 -1
- package/docs/guide/platform/administration/connected-apps.md +55 -0
- package/docs/guide/platform/installation/credentials.md +3 -1
- package/docs/guide/platform/installation/first-deployment.md +1 -1
- package/docs/guide/project-collaboration.md +1 -1
- package/docs/guide/quickstart.md +2 -0
- package/docs/guide/sandboxes.md +2 -0
- package/docs/reference/api/deploy.md +23 -0
- package/docs/reference/api/pages.md +2 -0
- package/docs/reference/api.md +2 -1
- package/docs/reference/cli/auth.md +1 -1
- package/docs/reference/cli/database.md +9 -3
- package/docs/reference/cli/deploy.md +1 -1
- package/docs/reference/cli/platform-installation.md +1 -1
- package/docs/reference/cli/setup.md +2 -0
- package/package.json +14 -17
- package/skills/void/SKILL.md +4 -2
- package/dist/auth-BgX2qYSY.mjs +0 -2
- package/dist/cf-build-output-H9a97vME.mjs +0 -2
- package/dist/client-By4JjMw_.mjs +0 -2
- package/dist/collect-DLyFDiKW.mjs +0 -2
- package/dist/config-5r-YpMC-.mjs +0 -2
- package/dist/config-B_ggY-IO.mjs +0 -89
- package/dist/config-BtSFvXZx.mjs +0 -2
- package/dist/config-write-AHGesphx.mjs +0 -61
- package/dist/deploy-BsEvnlJl.mjs +0 -10455
- package/dist/deploy-C1d-YTfp.mjs +0 -2
- package/dist/dev-inbox-CK-UuPob.mjs +0 -297
- package/dist/discover-EDUf6JJw.mjs +0 -2
- package/dist/dist-_UUlL6bg.mjs +0 -2
- package/dist/env-validation-Dxdx_5wo.mjs +0 -951
- package/dist/gen-dA9hW7AV.mjs +0 -2
- package/dist/head-client-DzmJGN4C.mjs +0 -90
- package/dist/help-DzKUrQvk.mjs +0 -2
- package/dist/login-Dc-wuTDq.mjs +0 -2
- package/dist/migrate-BHp07yJE.mjs +0 -2
- package/dist/operator-cmd-Cwn50lOV.mjs +0 -2
- package/dist/pages/head-client.d.mts +0 -13
- package/dist/pages/head-client.mjs +0 -2
- package/dist/platform-args-DYgITk0D.mjs +0 -2
- package/dist/prepare-DRUV-g3X.mjs +0 -2
- package/dist/project-BiaPQ7ur.mjs +0 -2
- package/dist/provision-Wu9ZBk9L.mjs +0 -2
- package/dist/resolve-project-BIeYs9Cw.mjs +0 -2
- package/dist/resolve-project-CP8rZs_p.mjs +0 -28
- package/dist/runner-mysql-CkFqZ6CE.mjs +0 -2
- package/dist/runner-pg-BGYRFdRp.mjs +0 -2
- package/dist/runtime/env-helpers.d.mts +0 -2
- package/dist/runtime/env-helpers.mjs +0 -2
- package/dist/validate-BJr9LfXy.mjs +0 -2
- package/dist/yarn-pnp-CUX_iTPA.mjs +0 -188
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { a as join, c as resolve, n as dirname } from "./dist-ipQi0Q8y.mjs";
|
|
2
|
+
import { i as voidWarn } from "./log-vqY3pqwI.mjs";
|
|
3
|
+
import { n as readGeneratedWranglerConfigFile } from "./generated-wrangler-config-DeWj5F9Y.mjs";
|
|
4
|
+
import { n as scanWranglerDotenvKeys } from "./dotenv-CNazY3-w.mjs";
|
|
5
|
+
import { a as isClientEnvKey, i as findReservedEnvKeys, n as LOCAL_ENV_FILE, o as loadLocalEnv, r as findLegacyEnvFiles, s as reservedEnvKeysMessage } from "./env-BJjULvL0.mjs";
|
|
6
|
+
import { t as findEnvFile } from "./env-types-DS2_y4X8.mjs";
|
|
7
|
+
import { t as loadUserEnvFile } from "./load-user-env-DD5qveNU.mjs";
|
|
8
|
+
import { l as resolveCloudflareOperationArgv, n as decodeCloudflareOperationResult, r as encodeCloudflareOperation } from "./cloudflare-process-CeDWJRhj.mjs";
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
10
|
+
import { spawn } from "node:child_process";
|
|
11
|
+
import { parseRootWranglerConfig, readWranglerTopLevelString } from "@void/deploy-cloudflare";
|
|
12
|
+
//#region src/cli/env-validation.ts
|
|
13
|
+
/** Env-schema validation for `void env check`, `void secret`, and both deploy paths. */
|
|
14
|
+
/**
|
|
15
|
+
* Validate plaintext while it is still available to `void secret put/sync`.
|
|
16
|
+
* Existing remote values remain unreadable and are validated again at worker boot.
|
|
17
|
+
*/
|
|
18
|
+
async function validateSecretValues(root, entries) {
|
|
19
|
+
const envFile = findEnvFile(root);
|
|
20
|
+
if (!envFile) throw new Error("secret: env.ts is required before setting production values.");
|
|
21
|
+
const schema = (await loadSchema(envFile))?._getRegisteredSchema();
|
|
22
|
+
if (!schema) throw new Error("secret: env.ts did not register a schema with defineEnv().");
|
|
23
|
+
for (const { name, value } of entries) {
|
|
24
|
+
if (isClientEnvKey(name)) throw new Error(`secret: ${name} is client-exposed. Set it in the build shell or give it a schema default.`);
|
|
25
|
+
const validator = schema[name];
|
|
26
|
+
if (!validator) throw new Error(`secret: ${name} is not declared in env.ts.`);
|
|
27
|
+
const result = validator["~standard"].validate(value);
|
|
28
|
+
if ((result instanceof Promise ? await result : result).issues) throw new Error(`secret: ${name} failed env.ts validation.`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Load the registered schema by importing the user's env.ts. */
|
|
32
|
+
async function loadSchema(envFile) {
|
|
33
|
+
await loadUserEnvFile(envFile);
|
|
34
|
+
const mod = await import("./runtime/env-public.mjs");
|
|
35
|
+
if (!mod._hasRegisteredSchema()) return null;
|
|
36
|
+
return mod;
|
|
37
|
+
}
|
|
38
|
+
function emptyReport() {
|
|
39
|
+
return {
|
|
40
|
+
valid: true,
|
|
41
|
+
missing: [],
|
|
42
|
+
invalid: [],
|
|
43
|
+
values: /* @__PURE__ */ new Map()
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validate local development against `.env` + the shell, or production
|
|
48
|
+
* against the build shell + remote secret names. `.env` is never a
|
|
49
|
+
* production source.
|
|
50
|
+
*/
|
|
51
|
+
async function validateProdEnv(root, options) {
|
|
52
|
+
const legacyFiles = findLegacyEnvFiles(root);
|
|
53
|
+
if (legacyFiles.length > 0) throw new Error(`env: only .env is supported for local development. Remove ${legacyFiles.join(", ")} and follow the env migration guide.`);
|
|
54
|
+
const reservedInDotenv = options.productionOnly ? [] : findReservedEnvKeys(scanWranglerDotenvKeys(join(root, LOCAL_ENV_FILE)));
|
|
55
|
+
if (reservedInDotenv.length > 0) throw new Error(`env: ${reservedEnvKeysMessage(".env", reservedInDotenv)}`);
|
|
56
|
+
const envFile = findEnvFile(root);
|
|
57
|
+
if (!envFile) return {
|
|
58
|
+
hasSchema: false,
|
|
59
|
+
report: emptyReport()
|
|
60
|
+
};
|
|
61
|
+
const mod = await loadSchema(envFile);
|
|
62
|
+
if (!mod) return {
|
|
63
|
+
hasSchema: false,
|
|
64
|
+
report: emptyReport()
|
|
65
|
+
};
|
|
66
|
+
const reservedInSchema = findReservedEnvKeys(Object.keys(mod._getRegisteredSchema() ?? {}));
|
|
67
|
+
if (reservedInSchema.length > 0) throw new Error(`env: ${reservedEnvKeysMessage("env.ts", reservedInSchema)}`);
|
|
68
|
+
const local = options.productionOnly ? {} : loadLocalEnv(root, { onWarn: (message) => voidWarn(message) });
|
|
69
|
+
const shell = options.productionOnly ? Object.fromEntries(Object.entries(process.env).filter(([key]) => isClientEnvKey(key))) : process.env;
|
|
70
|
+
const merged = {
|
|
71
|
+
...local,
|
|
72
|
+
...shell
|
|
73
|
+
};
|
|
74
|
+
const report = await mod.validateAllEnv(merged);
|
|
75
|
+
const remoteSet = new Set(options.remoteSecrets ?? []);
|
|
76
|
+
if (remoteSet.size > 0 && report.missing.length > 0) {
|
|
77
|
+
report.missing = report.missing.filter((key) => isClientEnvKey(key) || !remoteSet.has(key));
|
|
78
|
+
if (report.missing.length === 0 && report.invalid.length === 0) report.valid = true;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
hasSchema: true,
|
|
82
|
+
report
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function formatEnvReport(report) {
|
|
86
|
+
const lines = [];
|
|
87
|
+
if (report.missing.length > 0) {
|
|
88
|
+
lines.push("Missing required env vars:");
|
|
89
|
+
for (const key of report.missing) lines.push(` • ${key}`);
|
|
90
|
+
}
|
|
91
|
+
if (report.invalid.length > 0) {
|
|
92
|
+
if (lines.length > 0) lines.push("");
|
|
93
|
+
lines.push("Invalid env vars:");
|
|
94
|
+
for (const { key, messages } of report.invalid) lines.push(` • ${key}: ${messages.join("; ")}`);
|
|
95
|
+
}
|
|
96
|
+
return lines.join("\n");
|
|
97
|
+
}
|
|
98
|
+
/** Convenience: fetch remote secret names from the platform. */
|
|
99
|
+
async function fetchRemoteSecretNames(client, projectId) {
|
|
100
|
+
try {
|
|
101
|
+
return (await client.listSecrets(projectId)).map((s) => s.name);
|
|
102
|
+
} catch {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A key is required when its validator rejects `undefined`. Do not judge by `""`:
|
|
108
|
+
* a bare `z.string()` accepts it but is still required. Validators are user code,
|
|
109
|
+
* so call this inside {@link withSchemaBoundary}.
|
|
110
|
+
*/
|
|
111
|
+
async function requiredSchemaKeys(schema) {
|
|
112
|
+
const required = /* @__PURE__ */ new Set();
|
|
113
|
+
for (const [key, validator] of Object.entries(schema)) {
|
|
114
|
+
const resultMaybe = validator["~standard"].validate(void 0);
|
|
115
|
+
if ((resultMaybe instanceof Promise ? await resultMaybe : resultMaybe).issues) required.add(key);
|
|
116
|
+
}
|
|
117
|
+
return required;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The remote secret names could not be read, so the gate fails closed. Messages never
|
|
121
|
+
* include provider output: the child inherits `process.env` and can echo a value.
|
|
122
|
+
*/
|
|
123
|
+
var SelfHostSecretListError = class extends Error {
|
|
124
|
+
name = "SelfHostSecretListError";
|
|
125
|
+
};
|
|
126
|
+
/** The Worker has not been deployed yet, so its secrets cannot be listed. */
|
|
127
|
+
var SelfHostFirstDeployError = class extends SelfHostSecretListError {
|
|
128
|
+
name = "SelfHostFirstDeployError";
|
|
129
|
+
};
|
|
130
|
+
/** Required keys are missing or shipped values are invalid. */
|
|
131
|
+
var SelfHostEnvValidationError = class extends Error {
|
|
132
|
+
name = "SelfHostEnvValidationError";
|
|
133
|
+
};
|
|
134
|
+
/** env.ts or a validator threw. The original error is dropped: it can embed a value. */
|
|
135
|
+
var SelfHostSchemaError = class extends Error {
|
|
136
|
+
name = "SelfHostSchemaError";
|
|
137
|
+
reason;
|
|
138
|
+
constructor(message, reason) {
|
|
139
|
+
super(message);
|
|
140
|
+
this.reason = reason;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
function selfHostSchemaFailureMessage(reason) {
|
|
144
|
+
switch (reason) {
|
|
145
|
+
case "schema-load-failed": return "env: the project env schema could not be loaded (reason: schema-load-failed). Check that env.ts evaluates without error, then run the deploy again.";
|
|
146
|
+
case "schema-validation-error": return "env: an env schema validator raised an error while checking production values (reason: schema-validation-error). Re-run the validator locally to see its own diagnostics.";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/** Replace any error from user code with a values-free {@link SelfHostSchemaError}. */
|
|
150
|
+
async function withSchemaBoundary(reason, fn) {
|
|
151
|
+
try {
|
|
152
|
+
return await fn();
|
|
153
|
+
} catch {
|
|
154
|
+
throw new SelfHostSchemaError(selfHostSchemaFailureMessage(reason), reason);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** Imports the user's env.ts, so callers run it in the env-schema probe child. */
|
|
158
|
+
async function deriveSelfHostSchemaFacts(root) {
|
|
159
|
+
const envFile = findEnvFile(root);
|
|
160
|
+
if (envFile == null) return {
|
|
161
|
+
hasSchema: false,
|
|
162
|
+
serverKeys: [],
|
|
163
|
+
requiredKeys: []
|
|
164
|
+
};
|
|
165
|
+
const mod = await withSchemaBoundary("schema-load-failed", () => loadSchema(envFile));
|
|
166
|
+
if (!mod) return {
|
|
167
|
+
hasSchema: false,
|
|
168
|
+
serverKeys: [],
|
|
169
|
+
requiredKeys: []
|
|
170
|
+
};
|
|
171
|
+
const schema = mod._getRegisteredSchema() ?? {};
|
|
172
|
+
return {
|
|
173
|
+
hasSchema: true,
|
|
174
|
+
serverKeys: Object.keys(schema).filter((key) => !isClientEnvKey(key)),
|
|
175
|
+
requiredKeys: [...await withSchemaBoundary("schema-validation-error", () => requiredSchemaKeys(schema))].filter((key) => !isClientEnvKey(key))
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Build the gate context from the emitted vars. The caller has already rejected
|
|
180
|
+
* server keys emitted as plaintext vars, so a required key here is only absent or not.
|
|
181
|
+
*/
|
|
182
|
+
function deriveSelfHostEnvContextFromVars(emittedVars, facts) {
|
|
183
|
+
if (!facts.hasSchema) return {
|
|
184
|
+
hasSchema: false,
|
|
185
|
+
absentRequired: [],
|
|
186
|
+
invalidKeys: []
|
|
187
|
+
};
|
|
188
|
+
return {
|
|
189
|
+
hasSchema: true,
|
|
190
|
+
absentRequired: facts.requiredKeys.filter((key) => !Object.hasOwn(emittedVars, key)),
|
|
191
|
+
invalidKeys: []
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Follow the CF plugin's deploy pointer (`.wrangler/deploy/config.json`) to the
|
|
196
|
+
* generated config. Returns a fail-closed reason instead of throwing.
|
|
197
|
+
*/
|
|
198
|
+
function readGeneratedWranglerConfig(root) {
|
|
199
|
+
const deployConfigPath = join(root, ".wrangler", "deploy", "config.json");
|
|
200
|
+
if (!existsSync(deployConfigPath)) return {
|
|
201
|
+
ok: false,
|
|
202
|
+
reason: `the CF plugin's deploy pointer at ${deployConfigPath} was not written by the build.`
|
|
203
|
+
};
|
|
204
|
+
let redirectedPath;
|
|
205
|
+
try {
|
|
206
|
+
const parsed = JSON.parse(readFileSync(deployConfigPath, "utf-8"));
|
|
207
|
+
if (typeof parsed.configPath !== "string" || parsed.configPath.length === 0) return {
|
|
208
|
+
ok: false,
|
|
209
|
+
reason: `${deployConfigPath} has no "configPath" pointer.`
|
|
210
|
+
};
|
|
211
|
+
redirectedPath = resolve(dirname(deployConfigPath), parsed.configPath);
|
|
212
|
+
} catch {
|
|
213
|
+
return {
|
|
214
|
+
ok: false,
|
|
215
|
+
reason: `${deployConfigPath} is not valid JSON.`
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
if (!existsSync(redirectedPath)) return {
|
|
219
|
+
ok: false,
|
|
220
|
+
reason: `generated wrangler config ${redirectedPath} does not exist.`
|
|
221
|
+
};
|
|
222
|
+
try {
|
|
223
|
+
return {
|
|
224
|
+
ok: true,
|
|
225
|
+
config: readGeneratedWranglerConfigFile(redirectedPath)
|
|
226
|
+
};
|
|
227
|
+
} catch {
|
|
228
|
+
return {
|
|
229
|
+
ok: false,
|
|
230
|
+
reason: `generated wrangler config ${redirectedPath} is not valid JSON/JSONC.`
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/** Read the `vars` the build emitted into the generated Worker config. */
|
|
235
|
+
function readEmittedWorkerVars(root) {
|
|
236
|
+
const resolved = readGeneratedWranglerConfig(root);
|
|
237
|
+
if (!resolved.ok) return resolved;
|
|
238
|
+
const vars = resolved.config.vars;
|
|
239
|
+
if (vars === void 0) return {
|
|
240
|
+
ok: true,
|
|
241
|
+
vars: {}
|
|
242
|
+
};
|
|
243
|
+
if (vars === null || typeof vars !== "object" || Array.isArray(vars)) return {
|
|
244
|
+
ok: false,
|
|
245
|
+
reason: "the generated wrangler config has a malformed \"vars\" field (expected an object)."
|
|
246
|
+
};
|
|
247
|
+
return {
|
|
248
|
+
ok: true,
|
|
249
|
+
vars
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Validate the emitted vars and return the failing key names. `validateAllEnv` reports
|
|
254
|
+
* a rejected `""` or `null` as missing, so a missing key that was shipped counts as
|
|
255
|
+
* invalid; a key that was not shipped is left for the remote-secret check. Runs user
|
|
256
|
+
* validators, so callers run it in the env-schema probe child.
|
|
257
|
+
*/
|
|
258
|
+
async function computeInvalidEmittedKeys(root, emittedVars) {
|
|
259
|
+
const envFile = findEnvFile(root);
|
|
260
|
+
if (envFile == null) return [];
|
|
261
|
+
const mod = await withSchemaBoundary("schema-load-failed", () => loadSchema(envFile));
|
|
262
|
+
if (!mod) return [];
|
|
263
|
+
const report = await withSchemaBoundary("schema-validation-error", () => mod.validateAllEnv(emittedVars));
|
|
264
|
+
const invalid = new Set(report.invalid.map((entry) => entry.key));
|
|
265
|
+
for (const key of report.missing) if (Object.hasOwn(emittedVars, key)) invalid.add(key);
|
|
266
|
+
return Array.from(invalid).sort((a, b) => a.localeCompare(b));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Fail unless every required key is shipped or set as a remote secret, and no shipped
|
|
270
|
+
* value is invalid. Lists remote secrets only when a required key is absent.
|
|
271
|
+
*/
|
|
272
|
+
async function dischargeSelfHostEnvContext(context, options) {
|
|
273
|
+
if (!context.hasSchema) return;
|
|
274
|
+
const remote = context.absentRequired.length > 0 ? new Set(await listSelfHostSecretNames(options, context.absentRequired)) : /* @__PURE__ */ new Set();
|
|
275
|
+
const missing = context.absentRequired.filter((key) => !remote.has(key));
|
|
276
|
+
if (missing.length > 0 || context.invalidKeys.length > 0) throw selfHostEnvError(missing, context.invalidKeys);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Fail closed when the config pins a different account than the deploy, since the
|
|
280
|
+
* list could then read another account's secrets. Returns the account to pin.
|
|
281
|
+
*/
|
|
282
|
+
function reconcileSelfHostAccount(configPath, requestedAccountId) {
|
|
283
|
+
const configAccountId = readWranglerTopLevelString(parseRootWranglerConfig(configPath), "account_id");
|
|
284
|
+
if (configAccountId && requestedAccountId && configAccountId !== requestedAccountId) throw new SelfHostSecretListError(`env: Cloudflare account mismatch — "${configPath}" pins account_id ${JSON.stringify(configAccountId)} but the deploy targets ${JSON.stringify(requestedAccountId)}. wrangler resolves the config's account_id before CLOUDFLARE_ACCOUNT_ID, so \`wrangler secret list\` would consult ${JSON.stringify(configAccountId)} while the deploy expects ${JSON.stringify(requestedAccountId)} — a same-named secret there could falsely pass this preflight. Reconcile them (correct or remove the config's account_id, or deploy to the pinned account) and retry.`);
|
|
285
|
+
return configAccountId ?? requestedAccountId;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The list resolves the Worker from the config's `name`. If project code changed it
|
|
289
|
+
* after the deploy pinned it, the list would read another Worker's secrets.
|
|
290
|
+
*/
|
|
291
|
+
function reconcileSelfHostWorkerName(configPath, pinnedWorkerName) {
|
|
292
|
+
const configName = readWranglerTopLevelString(parseRootWranglerConfig(configPath), "name");
|
|
293
|
+
if (configName && pinnedWorkerName && configName !== pinnedWorkerName) throw new SelfHostSecretListError(`env: Cloudflare worker name mismatch — "${configPath}" declares name ${JSON.stringify(configName)} but the deploy pinned ${JSON.stringify(pinnedWorkerName)}. wrangler resolves the worker name from the config's \`name\`, so \`wrangler secret list\` would consult ${JSON.stringify(configName)} while the deploy ships ${JSON.stringify(pinnedWorkerName)} — a same-named secret there could falsely pass this preflight. The config's name was changed after it was pinned; rebuild from a clean checkout, then rerun.`);
|
|
294
|
+
}
|
|
295
|
+
/** Shown instead of validator messages, which can embed the rejected value. */
|
|
296
|
+
const SELF_HOST_INVALID_REASON = "failed schema validation";
|
|
297
|
+
function selfHostEnvError(missingKeys, invalidKeys) {
|
|
298
|
+
const sortNames = (names) => [...names].sort((a, b) => a.localeCompare(b));
|
|
299
|
+
const missing = sortNames(missingKeys);
|
|
300
|
+
const invalid = sortNames(invalidKeys);
|
|
301
|
+
const lines = [];
|
|
302
|
+
if (missing.length > 0) {
|
|
303
|
+
lines.push("Missing required env vars:");
|
|
304
|
+
for (const key of missing) lines.push(` • ${key}`);
|
|
305
|
+
}
|
|
306
|
+
if (invalid.length > 0) {
|
|
307
|
+
if (lines.length > 0) lines.push("");
|
|
308
|
+
lines.push("Invalid env vars:");
|
|
309
|
+
for (const key of invalid) lines.push(` • ${key} (${SELF_HOST_INVALID_REASON})`);
|
|
310
|
+
}
|
|
311
|
+
if (missing.length > 0) lines.push("", "Set each missing production secret with `void secret put <NAME>`.");
|
|
312
|
+
return new SelfHostEnvValidationError(lines.join("\n"));
|
|
313
|
+
}
|
|
314
|
+
function firstDeployMessage(missingKeys) {
|
|
315
|
+
const sorted = [...missingKeys].sort((a, b) => a.localeCompare(b));
|
|
316
|
+
const names = sorted.length > 0 ? sorted : ["<NAME>"];
|
|
317
|
+
return [
|
|
318
|
+
"This Worker has not been deployed yet, so its remote secrets could not be listed.",
|
|
319
|
+
"",
|
|
320
|
+
"Required production secrets still unset locally:",
|
|
321
|
+
...sorted.map((key) => ` • ${key}`),
|
|
322
|
+
"",
|
|
323
|
+
"Bootstrap them on the draft Worker before deploying:",
|
|
324
|
+
...names.map((key) => ` void secret put ${key}`)
|
|
325
|
+
].join("\n");
|
|
326
|
+
}
|
|
327
|
+
function secretListOperation(configPath) {
|
|
328
|
+
return {
|
|
329
|
+
type: "secret.list",
|
|
330
|
+
configPath
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function secretListFailureMessage(reason, detail) {
|
|
334
|
+
const base = "env: `wrangler secret list` could not confirm the remote secrets";
|
|
335
|
+
switch (reason) {
|
|
336
|
+
case "spawn-error": return `${base} (reason: spawn-error) — the wrangler process could not be started. Check that wrangler is installed and the pinned config path is valid.`;
|
|
337
|
+
case "signal": return `${base} (reason: signal) — the process was terminated by ${detail.signal ?? "a signal"} before completing.`;
|
|
338
|
+
case "nonzero-exit": return `${base} (reason: nonzero-exit, status ${detail.exitCode ?? "unknown"}). Run \`void secret list\` to retry through Void and see the Cloudflare diagnostics.`;
|
|
339
|
+
case "malformed-output": return `${base} (reason: malformed-output) — \`wrangler secret list --format=json\` did not return the expected JSON array of secret objects.`;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function secretListError(reason, detail = {}) {
|
|
343
|
+
return new SelfHostSecretListError(secretListFailureMessage(reason, detail));
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Run the list and parse it strictly: any failure throws rather than reading as
|
|
347
|
+
* "no secrets". Runner and provider text is never surfaced, since it can embed values.
|
|
348
|
+
*/
|
|
349
|
+
async function fetchSelfHostSecretNames(run, configPath, missingKeys) {
|
|
350
|
+
let result;
|
|
351
|
+
try {
|
|
352
|
+
result = await Promise.resolve(run(secretListOperation(configPath)));
|
|
353
|
+
} catch {
|
|
354
|
+
throw secretListError("spawn-error");
|
|
355
|
+
}
|
|
356
|
+
if (result.error != null && result.error !== "") throw secretListError("spawn-error");
|
|
357
|
+
if (result.signal != null) throw secretListError("signal", { signal: String(result.signal) });
|
|
358
|
+
if (typeof result.status !== "number" || result.status !== 0) {
|
|
359
|
+
const exitCode = typeof result.status === "number" ? result.status : void 0;
|
|
360
|
+
if (Number.isSafeInteger(result.status) && result.status > 0 && ([10007, 10090].includes(result.errorCode ?? 0) || result.failure === "not-found")) throw new SelfHostFirstDeployError(firstDeployMessage(missingKeys));
|
|
361
|
+
throw secretListError("nonzero-exit", { exitCode });
|
|
362
|
+
}
|
|
363
|
+
const parsed = result.data;
|
|
364
|
+
if (!Array.isArray(parsed)) throw secretListError("malformed-output");
|
|
365
|
+
const names = [];
|
|
366
|
+
for (const member of parsed) {
|
|
367
|
+
const name = member !== null && typeof member === "object" && !Array.isArray(member) ? member.name : void 0;
|
|
368
|
+
if (typeof name !== "string" || name.length === 0) throw secretListError("malformed-output");
|
|
369
|
+
names.push(name);
|
|
370
|
+
}
|
|
371
|
+
return names;
|
|
372
|
+
}
|
|
373
|
+
/** List the pinned Worker's remote secret names after checking the config's identity. */
|
|
374
|
+
async function listSelfHostSecretNames(options, missingKeys = []) {
|
|
375
|
+
reconcileSelfHostWorkerName(options.configPath, options.workerName);
|
|
376
|
+
const effectiveAccountId = reconcileSelfHostAccount(options.configPath, options.accountId);
|
|
377
|
+
return fetchSelfHostSecretNames(options.runWrangler ?? createDefaultSecretListRunner(options.root, { accountId: effectiveAccountId }), options.configPath, missingKeys);
|
|
378
|
+
}
|
|
379
|
+
/** A hung list must not hang the deploy. */
|
|
380
|
+
const SECRET_LIST_TIMEOUT_MS = 12e4;
|
|
381
|
+
/**
|
|
382
|
+
* Default {@link RunSecretList}: spawn the Cloudflare operation process without a
|
|
383
|
+
* shell. A timeout SIGKILLs a hung child; anything but a clean exit 0 fails closed.
|
|
384
|
+
*/
|
|
385
|
+
function createDefaultSecretListRunner(root, options) {
|
|
386
|
+
const launcher = options?.launcher ?? resolveCloudflareOperationArgv();
|
|
387
|
+
const timeoutMs = options?.timeoutMs ?? SECRET_LIST_TIMEOUT_MS;
|
|
388
|
+
const [command, ...prefix] = launcher;
|
|
389
|
+
return (args) => new Promise((resolvePromise) => {
|
|
390
|
+
const child = spawn(command, [...prefix, ...encodeCloudflareOperation(args)], {
|
|
391
|
+
cwd: root,
|
|
392
|
+
shell: false,
|
|
393
|
+
env: secretListEnv(options?.accountId),
|
|
394
|
+
stdio: [
|
|
395
|
+
"ignore",
|
|
396
|
+
"pipe",
|
|
397
|
+
"pipe"
|
|
398
|
+
],
|
|
399
|
+
windowsHide: true
|
|
400
|
+
});
|
|
401
|
+
let stdout = "";
|
|
402
|
+
let stderr = "";
|
|
403
|
+
let settled = false;
|
|
404
|
+
let timedOut = false;
|
|
405
|
+
let killFallbackTimer;
|
|
406
|
+
child.stdout?.setEncoding("utf-8");
|
|
407
|
+
child.stderr?.setEncoding("utf-8");
|
|
408
|
+
child.stdout?.on("data", (chunk) => {
|
|
409
|
+
stdout += chunk;
|
|
410
|
+
});
|
|
411
|
+
child.stderr?.on("data", (chunk) => {
|
|
412
|
+
stderr += chunk;
|
|
413
|
+
});
|
|
414
|
+
const settle = (result) => {
|
|
415
|
+
if (settled) return;
|
|
416
|
+
settled = true;
|
|
417
|
+
clearTimeout(commandTimer);
|
|
418
|
+
clearTimeout(killFallbackTimer);
|
|
419
|
+
resolvePromise(decodeCloudflareOperationResult(result));
|
|
420
|
+
};
|
|
421
|
+
const timeoutNote = `env: wrangler secret list exceeded the ${timeoutMs}ms timeout`;
|
|
422
|
+
const commandTimer = setTimeout(() => {
|
|
423
|
+
timedOut = true;
|
|
424
|
+
try {
|
|
425
|
+
child.kill("SIGKILL");
|
|
426
|
+
} catch {}
|
|
427
|
+
killFallbackTimer = setTimeout(() => {
|
|
428
|
+
settle({
|
|
429
|
+
stdout,
|
|
430
|
+
stderr: [stderr, timeoutNote].filter(Boolean).join("\n"),
|
|
431
|
+
status: -1,
|
|
432
|
+
signal: "SIGKILL",
|
|
433
|
+
error: "timed out and termination could not be confirmed"
|
|
434
|
+
});
|
|
435
|
+
}, 5e3);
|
|
436
|
+
}, timeoutMs);
|
|
437
|
+
child.on("error", (error) => {
|
|
438
|
+
settle({
|
|
439
|
+
stdout,
|
|
440
|
+
stderr,
|
|
441
|
+
status: -1,
|
|
442
|
+
signal: null,
|
|
443
|
+
error: error.message
|
|
444
|
+
});
|
|
445
|
+
});
|
|
446
|
+
child.on("close", (code, signal) => {
|
|
447
|
+
settle({
|
|
448
|
+
stdout,
|
|
449
|
+
stderr: timedOut ? [stderr, timeoutNote].filter(Boolean).join("\n") : stderr,
|
|
450
|
+
status: typeof code === "number" ? code : -1,
|
|
451
|
+
signal: signal ?? (timedOut ? "SIGKILL" : null)
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Child env for the default runner: drops the CF Access credentials (Void API only),
|
|
458
|
+
* forces sanitized logs, and pins the account. Ambient transport env such as
|
|
459
|
+
* `CLOUDFLARE_API_BASE_URL` is kept so a staging or FedRAMP endpoint still applies.
|
|
460
|
+
* Windows env keys are case-insensitive, so there every case variant is removed.
|
|
461
|
+
*/
|
|
462
|
+
function secretListEnv(accountId, platform) {
|
|
463
|
+
const env = { ...process.env };
|
|
464
|
+
const caseInsensitive = (platform ?? process.platform) === "win32";
|
|
465
|
+
const scrub = (name) => {
|
|
466
|
+
if (!caseInsensitive) {
|
|
467
|
+
delete env[name];
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
const lower = name.toLowerCase();
|
|
471
|
+
for (const key of Object.keys(env)) if (key.toLowerCase() === lower) delete env[key];
|
|
472
|
+
};
|
|
473
|
+
scrub("CF_ACCESS_CLIENT_ID");
|
|
474
|
+
scrub("CF_ACCESS_CLIENT_SECRET");
|
|
475
|
+
scrub("VOID_ACCESS_CREDENTIALS");
|
|
476
|
+
scrub("VOID_ACCESS_ORIGIN");
|
|
477
|
+
scrub("WRANGLER_LOG_SANITIZE");
|
|
478
|
+
env.WRANGLER_LOG_SANITIZE = "true";
|
|
479
|
+
if (accountId) {
|
|
480
|
+
scrub("CLOUDFLARE_ACCOUNT_ID");
|
|
481
|
+
env.CLOUDFLARE_ACCOUNT_ID = accountId;
|
|
482
|
+
}
|
|
483
|
+
return env;
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
export { validateSecretValues as _, computeInvalidEmittedKeys as a, deriveSelfHostSchemaFacts as c, formatEnvReport as d, listSelfHostSecretNames as f, validateProdEnv as g, selfHostSchemaFailureMessage as h, SelfHostSecretListError as i, dischargeSelfHostEnvContext as l, secretListEnv as m, SelfHostFirstDeployError as n, createDefaultSecretListRunner as o, readEmittedWorkerVars as p, SelfHostSchemaError as r, deriveSelfHostEnvContextFromVars as s, SelfHostEnvValidationError as t, fetchRemoteSecretNames as u };
|