void 0.27.0 → 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-l-FM7Ioq.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-Dn2vw-SG.mjs → auth-B6iOCjKI.mjs} +23 -56
- package/dist/{auth-link-vz9Z2kmG.mjs → auth-link-DWr6Afao.mjs} +10 -10
- package/dist/{auth-migrations-BwHgeEsD.mjs → auth-migrations-Cgs0k6lS.mjs} +28 -5
- package/dist/{auth-router-DvsCUVw4.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-D6we0VjO.mjs → build-cmd-Cr3FJxv0.mjs} +5 -5
- package/dist/{cache-CZRdzKx1.mjs → cache-D0Tt28cn.mjs} +5 -5
- package/dist/{cancel-deploy-CQ3NnMvf.mjs → cancel-deploy-CJKvk7AN.mjs} +4 -4
- package/dist/{cf-access-TWNzXltp.mjs → cf-access-BM9G0lhO.mjs} +4 -3
- package/dist/{cf-access-BcIBSKqG.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 +41 -15
- 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-DlDJuY0s.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-BfPBHHm-.mjs → connect-nukQSoEO.mjs} +8 -8
- package/dist/{create-project-BdXEFKal.mjs → create-project-D4APeBwX.mjs} +7 -7
- package/dist/{create-project-qFDC45zg.mjs → create-project-DL7YXpjj.mjs} +1 -1
- package/dist/{db-Xs80hcaA.mjs → db-27RztQLy.mjs} +173 -263
- package/dist/{delete-d2vuou3j.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-BsDUBAvt.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-_lGAHOhp.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-C74QepDE.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-DaDdBbSS.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-0bTe_lID.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-DaBGmaXC.mjs → init-ZWOJvc-Z.mjs} +179 -388
- package/dist/isr-config-DPjXM8J2.mjs +194 -0
- package/dist/{link-C6fjafep.mjs → link-UEc7bnF4.mjs} +8 -8
- package/dist/{list-BTFBlqKl.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-GKcNUmtI.mjs → login-CZ2Cqa-D.mjs} +11 -11
- package/dist/login-DhK7o1oJ.mjs +2 -0
- package/dist/{logs-BiMSULmc.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-DOBhIaIg.mjs → operator-args-UnE8Y2eK.mjs} +27 -26
- package/dist/{operator-auth-BEZ_u0Cz.mjs → operator-auth-Cr2zCc-J.mjs} +2 -2
- package/dist/{operator-client-DbDv4vtE.mjs → operator-client-C-ROjk1I.mjs} +4 -4
- package/dist/{operator-cmd-BT4hgavL.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-DUeXY9Om.mjs → platform-args-C6Mb_I3a.mjs} +34 -58
- package/dist/platform-args-Cm7x-fot.mjs +2 -0
- package/dist/{platform-auth-config-CkSx3usH.mjs → platform-auth-config-CJmNkFT2.mjs} +10 -11
- package/dist/{platform-auth-protection-BJimB_p9.mjs → platform-auth-protection-D5wvsI-Y.mjs} +36 -26
- package/dist/{platform-auth-recovery-BU6izFAU.mjs → platform-auth-recovery-D_0I3n-1.mjs} +8 -9
- package/dist/{platform-cmd-BbmJiq5O.mjs → platform-cmd-Cuj4oUVo.mjs} +1 -1
- package/dist/{platform-cmd-BbY1dWiM.mjs → platform-cmd-DxxZO6e5.mjs} +15 -15
- package/dist/{platform-discovery-DIYz8V63.mjs → platform-discovery-CHhNs8Nn.mjs} +1 -1
- package/dist/{platform-domain-CHVS6cV0.mjs → platform-domain-zLXnW1G_.mjs} +5 -5
- package/dist/{platform-lifecycle-DzCwqhFq.mjs → platform-lifecycle-DOW-wLfx.mjs} +1398 -2043
- package/dist/{platform-lifecycle-ByAlpkhV.mjs → platform-lifecycle-_gfnjUBr.mjs} +1 -1
- package/dist/{platform-management-CBOT4BSM.mjs → platform-management-CYrLvTGH.mjs} +1 -1
- package/dist/{platform-management-CuuVDhyt.mjs → platform-management-t7HKy4-U.mjs} +632 -124
- package/dist/{platform-plans-config-CN-heS4q.mjs → platform-plans-config-CNH6zbPX.mjs} +15 -11
- package/dist/{platform-recovery-CskSJgLh.mjs → platform-recovery-DeucI7A9.mjs} +6 -9
- package/dist/{platform-registry-Cjv2Qf0r.mjs → platform-registry-B9mWX9LO.mjs} +13 -18
- package/dist/{platform-setup-BBxRxmFC.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-DaoRrn-8.mjs → project-cmd-Dq75AXzy.mjs} +19 -19
- package/dist/{project-paths-GgcMozYz.mjs → project-paths-DMvEeSau.mjs} +9 -14
- package/dist/{project-BAm2aB6Q.mjs → project-rqDnVsJN.mjs} +8 -4
- package/dist/{project-team-Q_lCA7Io.mjs → project-team-B3_QcStG.mjs} +6 -6
- package/dist/{project-token-BArgK9o1.mjs → project-token-CvsRvv2I.mjs} +5 -5
- package/dist/{project-tsconfig-CVJhNMxs.mjs → project-tsconfig-bveqhlYA.mjs} +3 -5
- package/dist/{project-zero-trust-KO9Hu2Pq.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-C7Oeoh5u.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-DVAtrLAl.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-BvtB7IjY.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/durable-state.md +24 -0
- package/docs/guide/platform/administration/access.md +4 -0
- package/docs/guide/platform/administration/connected-apps.md +55 -0
- package/docs/guide/platform/installation/credentials.md +3 -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/database.md +9 -3
- package/docs/reference/cli/platform-installation.md +1 -1
- package/docs/reference/cli/setup.md +2 -0
- package/package.json +13 -16
- package/skills/void/SKILL.md +1 -0
- package/dist/auth-LMJcNESe.mjs +0 -2
- package/dist/cf-build-output-H9a97vME.mjs +0 -2
- package/dist/cf-user-agent-lKblH3zU.mjs +0 -17
- package/dist/client-tso2OfcG.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-Bqe1PYBw.mjs +0 -10458
- package/dist/deploy-VsWsVQkw.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-DfQYVfGY.mjs +0 -2
- package/dist/login-mx_ydhmp.mjs +0 -2
- package/dist/migrate-BHp07yJE.mjs +0 -2
- package/dist/operator-cmd-CwBB-1yb.mjs +0 -2
- package/dist/pages/head-client.d.mts +0 -13
- package/dist/pages/head-client.mjs +0 -2
- package/dist/platform-args-D4E1PjVw.mjs +0 -2
- package/dist/prepare-DRUV-g3X.mjs +0 -2
- package/dist/project-DedqCp59.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
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as join } from "./dist-
|
|
2
|
-
import { c as normalizePlatformApiUrl } from "./platform-registry-
|
|
3
|
-
import { t as cfAccessHeaders } from "./cf-access-
|
|
4
|
-
import {
|
|
5
|
-
import { a as getApiUrl } from "./auth-
|
|
6
|
-
import {
|
|
7
|
-
import { n as readPlatformDiscoveryResponse } from "./platform-discovery-
|
|
1
|
+
import { a as join } from "./dist-ipQi0Q8y.mjs";
|
|
2
|
+
import { c as normalizePlatformApiUrl } from "./platform-registry-B9mWX9LO.mjs";
|
|
3
|
+
import { t as cfAccessHeaders } from "./cf-access-BM9G0lhO.mjs";
|
|
4
|
+
import { r as isCloudflareAccessChallenge, t as ensurePlatformAccessToken } from "./cf-access-CWP4avfP.mjs";
|
|
5
|
+
import { a as getApiUrl } from "./auth-B6iOCjKI.mjs";
|
|
6
|
+
import { r as getPackageDir } from "./agents-CuNtT0D_.mjs";
|
|
7
|
+
import { n as readPlatformDiscoveryResponse } from "./platform-discovery-CHhNs8Nn.mjs";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { stripVTControlCharacters } from "node:util";
|
|
10
10
|
//#region src/cli/platform-errors.ts
|
|
@@ -84,19 +84,6 @@ function formatPlatformApiError(action, status, body, permission) {
|
|
|
84
84
|
}
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/cli/client.ts
|
|
87
|
-
/**
|
|
88
|
-
* Current CLI version. Sent as `X-Void-CLI-Version` on every platform
|
|
89
|
-
* request so the platform's CLI-version gate can refuse stale CLIs
|
|
90
|
-
* cleanly (HTTP 426 + `cli_outdated`) instead of letting a wire
|
|
91
|
-
* mismatch surface as an opaque parse error.
|
|
92
|
-
*
|
|
93
|
-
* Resolved once per process. Returns `null` when package.json can't be
|
|
94
|
-
* read or has no `version` string — the ctor then OMITS the header
|
|
95
|
-
* entirely. We deliberately do NOT send a placeholder string like
|
|
96
|
-
* "unknown": the platform treats present-but-unparseable headers as a
|
|
97
|
-
* stale-CLI signal and would 426 the request, bricking the CLI on any
|
|
98
|
-
* packaging error. Missing-header is the documented pass-through path.
|
|
99
|
-
*/
|
|
100
87
|
function readCliVersion() {
|
|
101
88
|
try {
|
|
102
89
|
const pkgPath = join(getPackageDir(), "package.json");
|
|
@@ -108,7 +95,7 @@ function readCliVersion() {
|
|
|
108
95
|
}
|
|
109
96
|
const VOID_CLI_VERSION = readCliVersion();
|
|
110
97
|
/** The oldest Void platform release this CLI supports. */
|
|
111
|
-
const MIN_PLATFORM_VERSION = "0.
|
|
98
|
+
const MIN_PLATFORM_VERSION = "0.28.0";
|
|
112
99
|
const RELEASE_VERSION = /^(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;
|
|
113
100
|
/**
|
|
114
101
|
* Version checks keyed by platform base URL. Every outcome (pass, inconclusive,
|
|
@@ -191,27 +178,6 @@ function isHeadersTimeoutError(error) {
|
|
|
191
178
|
function isPreflightRejection(error) {
|
|
192
179
|
return error instanceof PlatformApiError && ([401, 403].includes(error.status) && !!parsePlatformErrorBody(error.body)?.error || isCliOutdatedError(error));
|
|
193
180
|
}
|
|
194
|
-
/**
|
|
195
|
-
* Retry contract for the deploy POST's transport phase.
|
|
196
|
-
*
|
|
197
|
-
* - Only `fetch` rejections (`TypeError` — no HTTP response) are retried.
|
|
198
|
-
* A Response of any status means the server answered; surface it
|
|
199
|
-
* verbatim rather than replay a request it may have accepted.
|
|
200
|
-
* - A headers timeout is retried too. Every attempt sends the same
|
|
201
|
-
* idempotency key, so once an earlier request has created its deployment,
|
|
202
|
-
* a receipt-aware platform answers the retry with that deployment's
|
|
203
|
-
* receipt and the CLI follows it to the real result.
|
|
204
|
-
* - A rejected fetch does NOT prove the request never arrived — the
|
|
205
|
-
* connection may have dropped after delivery. Arbitration is left to
|
|
206
|
-
* the server's precheck, the only atomic (project-locked) verdict: if
|
|
207
|
-
* an earlier attempt or a concurrent deploy is still in flight, the
|
|
208
|
-
* replay is rejected with 409 and surfaced as a deploy conflict
|
|
209
|
-
* naming the deployment id. Receipt-aware platforms additionally bind
|
|
210
|
-
* the stable invocation key to the accepted artifact, so an accepted
|
|
211
|
-
* request can be recovered without creating another execution. Older
|
|
212
|
-
* platforms retain their concurrency guard. No client-side deployment
|
|
213
|
-
* lookup may authorize replay or identify an unrelated conflicting row.
|
|
214
|
-
*/
|
|
215
181
|
const DEPLOY_POST_MAX_RETRIES = 3;
|
|
216
182
|
const DEPLOY_POST_BACKOFF_MS = [
|
|
217
183
|
1e3,
|
|
@@ -260,16 +226,11 @@ var PlatformClient = class {
|
|
|
260
226
|
* Only login uses it, so users can still sign in to an older platform.
|
|
261
227
|
*/
|
|
262
228
|
constructor(token, options) {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
} else {
|
|
267
|
-
this.baseUrl = normalizePlatformApiUrl(options?.apiUrl ?? getApiUrl(options?.root));
|
|
268
|
-
this.cliLog = options?.cliLog;
|
|
269
|
-
this.checkPlatformVersion = options?.checkPlatformVersion !== false;
|
|
270
|
-
}
|
|
229
|
+
this.baseUrl = normalizePlatformApiUrl(options?.apiUrl ?? getApiUrl(options?.root));
|
|
230
|
+
this.cliLog = options?.cliLog;
|
|
231
|
+
this.checkPlatformVersion = options?.checkPlatformVersion !== false;
|
|
271
232
|
this.apiUrl = this.baseUrl;
|
|
272
|
-
|
|
233
|
+
ensurePlatformAccessToken(this.baseUrl);
|
|
273
234
|
this.accessHeaders = cfAccessHeaders(process.env, this.baseUrl);
|
|
274
235
|
this.authHeaders = {
|
|
275
236
|
Authorization: `Bearer ${token}`,
|
|
@@ -318,7 +279,7 @@ var PlatformClient = class {
|
|
|
318
279
|
}
|
|
319
280
|
}
|
|
320
281
|
async send(url, options) {
|
|
321
|
-
if (!this.accessHeaders["CF-Access-Client-Id"])
|
|
282
|
+
if (!this.accessHeaders["CF-Access-Client-Id"]) ensurePlatformAccessToken(this.baseUrl);
|
|
322
283
|
const send = () => {
|
|
323
284
|
const currentAccessHeaders = cfAccessHeaders(process.env, this.baseUrl);
|
|
324
285
|
const accessHeaders = this.accessHeaders["CF-Access-Client-Id"] ? this.accessHeaders : Object.keys(currentAccessHeaders).length > 0 ? currentAccessHeaders : this.accessHeaders;
|
|
@@ -342,36 +303,41 @@ var PlatformClient = class {
|
|
|
342
303
|
ensurePlatformAccessToken(this.baseUrl, true, false, first.accessHeaders["cf-access-token"]);
|
|
343
304
|
return send().response;
|
|
344
305
|
}
|
|
306
|
+
/** Sends an authenticated request and throws `PlatformApiError` unless it succeeds. */
|
|
307
|
+
async call(url, action, options = {}) {
|
|
308
|
+
const { method, body, permission } = options;
|
|
309
|
+
const res = await this.request(url, {
|
|
310
|
+
...method !== void 0 && { method },
|
|
311
|
+
headers: body === void 0 ? { ...this.authHeaders } : {
|
|
312
|
+
"Content-Type": "application/json",
|
|
313
|
+
...this.authHeaders
|
|
314
|
+
},
|
|
315
|
+
...body !== void 0 && { body: JSON.stringify(body) }
|
|
316
|
+
});
|
|
317
|
+
if (!res.ok) await throwPlatformApiError(action, res, permission);
|
|
318
|
+
return res;
|
|
319
|
+
}
|
|
320
|
+
async json(url, action, options) {
|
|
321
|
+
return (await this.call(url, action, options)).json();
|
|
322
|
+
}
|
|
345
323
|
async startIdentityLink(connectionId) {
|
|
346
|
-
const
|
|
324
|
+
const result = await this.json(`${this.baseUrl}/auth/link`, "Failed to link login method", {
|
|
347
325
|
method: "POST",
|
|
348
|
-
|
|
349
|
-
...this.authHeaders,
|
|
350
|
-
"Content-Type": "application/json"
|
|
351
|
-
},
|
|
352
|
-
body: JSON.stringify({ connectionId })
|
|
326
|
+
body: { connectionId }
|
|
353
327
|
});
|
|
354
|
-
if (!response.ok) await throwPlatformApiError("Failed to link login method", response);
|
|
355
|
-
const result = await response.json();
|
|
356
328
|
const url = new URL(result.url);
|
|
357
329
|
if (url.origin !== this.baseUrl || url.pathname !== "/auth/link" || url.username || url.password) throw new Error("auth: Invalid account-link URL from platform.");
|
|
358
330
|
return result;
|
|
359
331
|
}
|
|
360
332
|
async whoami() {
|
|
361
|
-
|
|
362
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch user info", res);
|
|
363
|
-
return res.json();
|
|
333
|
+
return this.json(`${this.baseUrl}/me`, "Failed to fetch user info");
|
|
364
334
|
}
|
|
365
335
|
async listProjects() {
|
|
366
|
-
|
|
367
|
-
if (!res.ok) await throwPlatformApiError("Failed to list projects", res);
|
|
368
|
-
return res.json();
|
|
336
|
+
return this.json(`${this.baseUrl}/projects`, "Failed to list projects");
|
|
369
337
|
}
|
|
370
338
|
/** A lightweight project list for interactive linking. */
|
|
371
339
|
async listProjectChoices() {
|
|
372
|
-
|
|
373
|
-
if (!res.ok) await throwPlatformApiError("Failed to list project choices", res);
|
|
374
|
-
return res.json();
|
|
340
|
+
return this.json(`${this.baseUrl}/projects/choices`, "Failed to list project choices");
|
|
375
341
|
}
|
|
376
342
|
/** Resolve one known project without loading account-wide deployment and traffic summaries. */
|
|
377
343
|
async getProject(projectId) {
|
|
@@ -382,186 +348,118 @@ var PlatformClient = class {
|
|
|
382
348
|
}
|
|
383
349
|
/** Resolve a slug through the current platform contract. */
|
|
384
350
|
async findProjectBySlug(slug) {
|
|
385
|
-
|
|
386
|
-
url.searchParams.set("slug", slug);
|
|
387
|
-
const res = await this.request(url.toString(), { headers: { ...this.authHeaders } });
|
|
388
|
-
if (!res.ok) await throwPlatformApiError("Failed to resolve project", res);
|
|
389
|
-
return (await res.json()).project;
|
|
351
|
+
return (await this.json(`${this.baseUrl}/projects/resolve?${new URLSearchParams({ slug })}`, "Failed to resolve project")).project;
|
|
390
352
|
}
|
|
391
353
|
async listProjectTokens(projectId) {
|
|
392
|
-
|
|
393
|
-
if (!res.ok) await throwPlatformApiError("Failed to list project tokens", res, "owner");
|
|
394
|
-
return res.json();
|
|
354
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/tokens`, "Failed to list project tokens", { permission: "owner" });
|
|
395
355
|
}
|
|
396
356
|
async getProjectZeroTrust(projectId) {
|
|
397
|
-
|
|
398
|
-
if (!res.ok) await throwPlatformApiError("Failed to inspect project Zero Trust", res, "read");
|
|
399
|
-
return res.json();
|
|
357
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/zero-trust`, "Failed to inspect project Zero Trust", { permission: "read" });
|
|
400
358
|
}
|
|
401
359
|
async setProjectZeroTrust(projectId, protectedProject) {
|
|
402
|
-
|
|
360
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/zero-trust`, "Failed to update project Zero Trust", {
|
|
403
361
|
method: "PUT",
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
...this.authHeaders
|
|
407
|
-
},
|
|
408
|
-
body: JSON.stringify({ protected: protectedProject })
|
|
362
|
+
body: { protected: protectedProject },
|
|
363
|
+
permission: "settings"
|
|
409
364
|
});
|
|
410
|
-
if (!res.ok) await throwPlatformApiError("Failed to update project Zero Trust", res, "settings");
|
|
411
|
-
return res.json();
|
|
412
365
|
}
|
|
413
366
|
async reconcileProjectZeroTrust(projectId) {
|
|
414
|
-
|
|
367
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/zero-trust/reconcile`, "Failed to reconcile project Zero Trust", {
|
|
415
368
|
method: "POST",
|
|
416
|
-
|
|
369
|
+
permission: "settings"
|
|
417
370
|
});
|
|
418
|
-
if (!res.ok) await throwPlatformApiError("Failed to reconcile project Zero Trust", res, "settings");
|
|
419
|
-
return res.json();
|
|
420
371
|
}
|
|
421
372
|
async createProjectToken(projectId, input) {
|
|
422
|
-
|
|
373
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/tokens`, "Failed to create project token", {
|
|
423
374
|
method: "POST",
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
"Content-Type": "application/json"
|
|
427
|
-
},
|
|
428
|
-
body: JSON.stringify(input)
|
|
375
|
+
body: input,
|
|
376
|
+
permission: "owner"
|
|
429
377
|
});
|
|
430
|
-
if (!res.ok) await throwPlatformApiError("Failed to create project token", res, "owner");
|
|
431
|
-
return res.json();
|
|
432
378
|
}
|
|
433
379
|
async listProjectMembers(projectId) {
|
|
434
|
-
const
|
|
435
|
-
if (!res.ok) await throwPlatformApiError("Failed to list project members", res, "read");
|
|
436
|
-
const body = await res.json();
|
|
380
|
+
const body = await this.json(`${this.baseUrl}/projects/${projectId}/members`, "Failed to list project members", { permission: "read" });
|
|
437
381
|
return {
|
|
438
382
|
members: body.members,
|
|
439
383
|
...body.warnings ? { warnings: body.warnings } : {}
|
|
440
384
|
};
|
|
441
385
|
}
|
|
442
386
|
async listProjectInvitations(projectId) {
|
|
443
|
-
|
|
444
|
-
if (!res.ok) await throwPlatformApiError("Failed to list project invitations", res, "members");
|
|
445
|
-
return (await res.json()).invitations;
|
|
387
|
+
return (await this.json(`${this.baseUrl}/projects/${projectId}/invitations`, "Failed to list project invitations", { permission: "members" })).invitations;
|
|
446
388
|
}
|
|
447
389
|
async inviteProjectMember(projectId, email, role) {
|
|
448
|
-
|
|
390
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/invitations`, "Failed to invite project member", {
|
|
449
391
|
method: "POST",
|
|
450
|
-
|
|
451
|
-
"Content-Type": "application/json",
|
|
452
|
-
...this.authHeaders
|
|
453
|
-
},
|
|
454
|
-
body: JSON.stringify({
|
|
392
|
+
body: {
|
|
455
393
|
email,
|
|
456
394
|
role
|
|
457
|
-
}
|
|
395
|
+
},
|
|
396
|
+
permission: "members"
|
|
458
397
|
});
|
|
459
|
-
if (!res.ok) await throwPlatformApiError("Failed to invite project member", res, "members");
|
|
460
|
-
return res.json();
|
|
461
398
|
}
|
|
462
399
|
async renewProjectToken(projectId, credentialId, expiresInDays) {
|
|
463
|
-
|
|
400
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/tokens/${encodeURIComponent(credentialId)}/renew`, "Failed to renew project token", {
|
|
464
401
|
method: "POST",
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
"Content-Type": "application/json"
|
|
468
|
-
},
|
|
469
|
-
body: JSON.stringify(expiresInDays ? { expiresInDays } : {})
|
|
402
|
+
body: expiresInDays ? { expiresInDays } : {},
|
|
403
|
+
permission: "owner"
|
|
470
404
|
});
|
|
471
|
-
if (!res.ok) await throwPlatformApiError("Failed to renew project token", res, "owner");
|
|
472
|
-
return res.json();
|
|
473
405
|
}
|
|
474
406
|
async updateProjectMemberRole(projectId, userId, role) {
|
|
475
|
-
|
|
407
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/members/${encodeURIComponent(userId)}`, "Failed to change project member role", {
|
|
476
408
|
method: "PATCH",
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
...this.authHeaders
|
|
480
|
-
},
|
|
481
|
-
body: JSON.stringify({ role })
|
|
409
|
+
body: { role },
|
|
410
|
+
permission: "members"
|
|
482
411
|
});
|
|
483
|
-
if (!res.ok) await throwPlatformApiError("Failed to change project member role", res, "members");
|
|
484
|
-
return res.json();
|
|
485
412
|
}
|
|
486
413
|
async revokeProjectToken(projectId, credentialId) {
|
|
487
|
-
|
|
414
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/tokens/${encodeURIComponent(credentialId)}`, "Failed to revoke project token", {
|
|
488
415
|
method: "DELETE",
|
|
489
|
-
|
|
416
|
+
permission: "owner"
|
|
490
417
|
});
|
|
491
|
-
if (!res.ok) await throwPlatformApiError("Failed to revoke project token", res, "owner");
|
|
492
|
-
return res.json();
|
|
493
418
|
}
|
|
494
419
|
async removeProjectMember(projectId, userId) {
|
|
495
|
-
|
|
420
|
+
await this.call(`${this.baseUrl}/projects/${projectId}/members/${encodeURIComponent(userId)}`, "Failed to remove project member", {
|
|
496
421
|
method: "DELETE",
|
|
497
|
-
|
|
422
|
+
permission: "members"
|
|
498
423
|
});
|
|
499
|
-
if (!res.ok) await throwPlatformApiError("Failed to remove project member", res, "members");
|
|
500
424
|
}
|
|
501
425
|
async revokeProjectInvitation(projectId, invitationId) {
|
|
502
|
-
|
|
426
|
+
await this.call(`${this.baseUrl}/projects/${projectId}/invitations/${encodeURIComponent(invitationId)}`, "Failed to revoke project invitation", {
|
|
503
427
|
method: "DELETE",
|
|
504
|
-
|
|
428
|
+
permission: "members"
|
|
505
429
|
});
|
|
506
|
-
if (!res.ok) await throwPlatformApiError("Failed to revoke project invitation", res, "members");
|
|
507
430
|
}
|
|
508
431
|
async leaveProject(projectId) {
|
|
509
|
-
|
|
510
|
-
method: "POST",
|
|
511
|
-
headers: { ...this.authHeaders }
|
|
512
|
-
});
|
|
513
|
-
if (!res.ok) await throwPlatformApiError("Failed to leave project", res);
|
|
432
|
+
await this.call(`${this.baseUrl}/projects/${projectId}/leave`, "Failed to leave project", { method: "POST" });
|
|
514
433
|
}
|
|
515
434
|
async listPendingProjectInvitations() {
|
|
516
|
-
|
|
517
|
-
if (!res.ok) await throwPlatformApiError("Failed to list pending project invitations", res);
|
|
518
|
-
return (await res.json()).invitations;
|
|
435
|
+
return (await this.json(`${this.baseUrl}/me/project-invitations`, "Failed to list pending project invitations")).invitations;
|
|
519
436
|
}
|
|
520
437
|
async respondToProjectInvitation(invitationId, action) {
|
|
521
|
-
|
|
522
|
-
method: "POST",
|
|
523
|
-
headers: { ...this.authHeaders }
|
|
524
|
-
});
|
|
525
|
-
if (!res.ok) await throwPlatformApiError(`Failed to ${action} project invitation`, res);
|
|
438
|
+
await this.call(`${this.baseUrl}/project-invitations/${encodeURIComponent(invitationId)}/${action}`, `Failed to ${action} project invitation`, { method: "POST" });
|
|
526
439
|
}
|
|
527
440
|
async listDeployments(projectId) {
|
|
528
|
-
|
|
529
|
-
if (!res.ok) await throwPlatformApiError("Failed to list deployments", res, "read");
|
|
530
|
-
return res.json();
|
|
441
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/deployments`, "Failed to list deployments", { permission: "read" });
|
|
531
442
|
}
|
|
532
443
|
async rollback(projectId, deploymentId, options) {
|
|
533
444
|
const body = { deploymentId };
|
|
534
445
|
if (options?.allowDestructive && options.allowDestructive.length > 0) body.allowDestructive = options.allowDestructive;
|
|
535
|
-
|
|
446
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/rollback`, "Rollback failed", {
|
|
536
447
|
method: "POST",
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
...this.authHeaders
|
|
540
|
-
},
|
|
541
|
-
body: JSON.stringify(body)
|
|
448
|
+
body,
|
|
449
|
+
permission: "deploy"
|
|
542
450
|
});
|
|
543
|
-
if (!res.ok) await throwPlatformApiError("Rollback failed", res, "deploy");
|
|
544
|
-
return res.json();
|
|
545
451
|
}
|
|
546
452
|
async cancelDeployment(projectId, deploymentId) {
|
|
547
|
-
|
|
453
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/deployments/${deploymentId}/cancel`, "Cancel deployment failed", {
|
|
548
454
|
method: "POST",
|
|
549
|
-
|
|
455
|
+
permission: "deploy"
|
|
550
456
|
});
|
|
551
|
-
if (!res.ok) await throwPlatformApiError("Cancel deployment failed", res, "deploy");
|
|
552
|
-
return res.json();
|
|
553
457
|
}
|
|
554
458
|
async createProject(slug) {
|
|
555
|
-
|
|
459
|
+
return this.json(`${this.baseUrl}/projects`, "Failed to create project", {
|
|
556
460
|
method: "POST",
|
|
557
|
-
|
|
558
|
-
"Content-Type": "application/json",
|
|
559
|
-
...this.authHeaders
|
|
560
|
-
},
|
|
561
|
-
body: JSON.stringify({ slug })
|
|
461
|
+
body: { slug }
|
|
562
462
|
});
|
|
563
|
-
if (!res.ok) await throwPlatformApiError("Failed to create project", res);
|
|
564
|
-
return res.json();
|
|
565
463
|
}
|
|
566
464
|
async preflight(projectId, assetManifest, hasWorker) {
|
|
567
465
|
const total = Object.keys(assetManifest).length;
|
|
@@ -596,12 +494,6 @@ var PlatformClient = class {
|
|
|
596
494
|
};
|
|
597
495
|
}
|
|
598
496
|
}
|
|
599
|
-
/**
|
|
600
|
-
* Request presigned R2 PUT URLs for a batch of assets. Each entry carries
|
|
601
|
-
* both `blake3` (storage key) and `md5` (wire-level integrity primitive)
|
|
602
|
-
* so the platform can sign a PUT URL that R2 enforces against the bytes
|
|
603
|
-
* the CLI is about to upload. See design doc 0068 for the full protocol.
|
|
604
|
-
*/
|
|
605
497
|
async requestUploadUrls(projectId, assets) {
|
|
606
498
|
const url = `${this.baseUrl}/projects/${projectId}/deploy/upload-urls`;
|
|
607
499
|
this.cliLog?.info("upload_urls_post", {
|
|
@@ -626,12 +518,6 @@ var PlatformClient = class {
|
|
|
626
518
|
if (!res.ok) await throwPlatformApiError("Failed to request upload URLs", res, "deploy");
|
|
627
519
|
return (await res.json()).urls;
|
|
628
520
|
}
|
|
629
|
-
/**
|
|
630
|
-
* Manifest-only (direct-to-R2) deploy. POSTs a JSON body containing the
|
|
631
|
-
* deploy manifest, asset manifest (no asset bytes), and any worker module
|
|
632
|
-
* bytes (base64-encoded). Streams an NDJSON response that the caller can
|
|
633
|
-
* apply with the existing `applyDeployEvent` machinery.
|
|
634
|
-
*/
|
|
635
521
|
async *finalizeDeploy(projectId, payload) {
|
|
636
522
|
const url = `${this.baseUrl}/projects/${projectId}/deploy`;
|
|
637
523
|
yield* this.streamDeployRequest(url, projectId, {
|
|
@@ -644,10 +530,6 @@ var PlatformClient = class {
|
|
|
644
530
|
body: JSON.stringify(payload)
|
|
645
531
|
});
|
|
646
532
|
}
|
|
647
|
-
/**
|
|
648
|
-
* POST + NDJSON-stream-reader used by `finalizeDeploy()`. Captures
|
|
649
|
-
* `cf-ray` + `cf-cache-status` for postmortem correlation.
|
|
650
|
-
*/
|
|
651
533
|
async *streamDeployRequest(url, projectId, init) {
|
|
652
534
|
const cliLog = this.cliLog;
|
|
653
535
|
cliLog?.info("deploy_post", { url });
|
|
@@ -857,152 +739,97 @@ var PlatformClient = class {
|
|
|
857
739
|
throw new DeploymentObservationTimeoutError(deploymentId);
|
|
858
740
|
}
|
|
859
741
|
async listSecrets(projectId) {
|
|
860
|
-
|
|
861
|
-
if (!res.ok) await throwPlatformApiError("Failed to list secrets", res, "configure");
|
|
862
|
-
return res.json();
|
|
742
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/secrets`, "Failed to list secrets", { permission: "configure" });
|
|
863
743
|
}
|
|
864
744
|
async setSecret(projectId, name, value) {
|
|
865
|
-
|
|
745
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/secrets/${encodeURIComponent(name)}`, "Failed to set secret", {
|
|
866
746
|
method: "PUT",
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
...this.authHeaders
|
|
870
|
-
},
|
|
871
|
-
body: JSON.stringify({ value })
|
|
747
|
+
body: { value },
|
|
748
|
+
permission: "configure"
|
|
872
749
|
});
|
|
873
|
-
if (!res.ok) await throwPlatformApiError("Failed to set secret", res, "configure");
|
|
874
|
-
return res.json();
|
|
875
750
|
}
|
|
876
751
|
async deleteProject(projectId) {
|
|
877
|
-
|
|
752
|
+
return this.json(`${this.baseUrl}/projects/${projectId}`, "Failed to delete project", {
|
|
878
753
|
method: "DELETE",
|
|
879
|
-
|
|
754
|
+
permission: "owner"
|
|
880
755
|
});
|
|
881
|
-
if (!res.ok) await throwPlatformApiError("Failed to delete project", res, "owner");
|
|
882
|
-
return res.json();
|
|
883
756
|
}
|
|
884
757
|
async getMigrationStatus(projectId, dialect) {
|
|
885
758
|
const url = new URL(`${this.baseUrl}/projects/${projectId}/migrations`);
|
|
886
759
|
if (dialect) url.searchParams.set("dialect", dialect);
|
|
887
|
-
|
|
888
|
-
if (!res.ok) await throwPlatformApiError("Failed to get migration status", res, "read");
|
|
889
|
-
return res.json();
|
|
760
|
+
return this.json(url, "Failed to get migration status", { permission: "read" });
|
|
890
761
|
}
|
|
891
762
|
async applyRemoteMigrations(projectId, migrations) {
|
|
892
|
-
|
|
763
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/migrations/apply`, "Failed to apply remote migrations", {
|
|
893
764
|
method: "POST",
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
...this.authHeaders
|
|
897
|
-
},
|
|
898
|
-
body: JSON.stringify({ migrations })
|
|
765
|
+
body: { migrations },
|
|
766
|
+
permission: "configure"
|
|
899
767
|
});
|
|
900
|
-
if (!res.ok) await throwPlatformApiError("Failed to apply remote migrations", res, "configure");
|
|
901
|
-
return res.json();
|
|
902
768
|
}
|
|
903
769
|
async renameMigrations(projectId, renames) {
|
|
904
|
-
|
|
770
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/migrations/rename`, "Failed to rename remote migrations", {
|
|
905
771
|
method: "POST",
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
...this.authHeaders
|
|
909
|
-
},
|
|
910
|
-
body: JSON.stringify({ renames })
|
|
772
|
+
body: { renames },
|
|
773
|
+
permission: "configure"
|
|
911
774
|
});
|
|
912
|
-
if (!res.ok) await throwPlatformApiError("Failed to rename remote migrations", res, "configure");
|
|
913
|
-
return res.json();
|
|
914
775
|
}
|
|
915
776
|
async addDomain(projectId, hostname) {
|
|
916
|
-
|
|
777
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/domains`, "Failed to add domain", {
|
|
917
778
|
method: "POST",
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
...this.authHeaders
|
|
921
|
-
},
|
|
922
|
-
body: JSON.stringify({ hostname })
|
|
779
|
+
body: { hostname },
|
|
780
|
+
permission: "settings"
|
|
923
781
|
});
|
|
924
|
-
if (!res.ok) await throwPlatformApiError("Failed to add domain", res, "settings");
|
|
925
|
-
return res.json();
|
|
926
782
|
}
|
|
927
783
|
async listDomains(projectId) {
|
|
928
|
-
|
|
929
|
-
if (!res.ok) await throwPlatformApiError("Failed to list domains", res, "read");
|
|
930
|
-
return res.json();
|
|
784
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/domains`, "Failed to list domains", { permission: "read" });
|
|
931
785
|
}
|
|
932
786
|
async getDomainStatus(projectId, domainId) {
|
|
933
|
-
|
|
934
|
-
if (!res.ok) await throwPlatformApiError("Failed to get domain status", res, "read");
|
|
935
|
-
return res.json();
|
|
787
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/domains/${domainId}`, "Failed to get domain status", { permission: "read" });
|
|
936
788
|
}
|
|
937
789
|
async removeDomain(projectId, domainId) {
|
|
938
|
-
|
|
790
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/domains/${domainId}`, "Failed to remove domain", {
|
|
939
791
|
method: "DELETE",
|
|
940
|
-
|
|
792
|
+
permission: "settings"
|
|
941
793
|
});
|
|
942
|
-
if (!res.ok) await throwPlatformApiError("Failed to remove domain", res, "settings");
|
|
943
|
-
return res.json();
|
|
944
794
|
}
|
|
945
795
|
async deleteSecret(projectId, name) {
|
|
946
|
-
|
|
796
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/secrets/${encodeURIComponent(name)}`, "Failed to delete secret", {
|
|
947
797
|
method: "DELETE",
|
|
948
|
-
|
|
798
|
+
permission: "configure"
|
|
949
799
|
});
|
|
950
|
-
if (!res.ok) await throwPlatformApiError("Failed to delete secret", res, "configure");
|
|
951
|
-
return res.json();
|
|
952
800
|
}
|
|
953
801
|
async getResources(projectId) {
|
|
954
|
-
|
|
955
|
-
if (!res.ok) await throwPlatformApiError("Failed to get resources", res, "read");
|
|
956
|
-
return res.json();
|
|
802
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/resources`, "Failed to get resources", { permission: "read" });
|
|
957
803
|
}
|
|
958
804
|
async createPrerenderToken(projectId) {
|
|
959
|
-
|
|
805
|
+
return (await this.json(`${this.baseUrl}/projects/${projectId}/prerender-token`, "Failed to create prerender token", {
|
|
960
806
|
method: "POST",
|
|
961
|
-
|
|
962
|
-
});
|
|
963
|
-
if (!res.ok) await throwPlatformApiError("Failed to create prerender token", res, "deploy");
|
|
964
|
-
return (await res.json()).token;
|
|
807
|
+
permission: "deploy"
|
|
808
|
+
})).token;
|
|
965
809
|
}
|
|
966
810
|
async provisionDatabase(projectId, connectionString) {
|
|
967
|
-
|
|
811
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/database`, "Failed to provision database", {
|
|
968
812
|
method: "POST",
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
...this.authHeaders
|
|
972
|
-
},
|
|
973
|
-
body: JSON.stringify({ connectionString })
|
|
813
|
+
body: { connectionString },
|
|
814
|
+
permission: "configure"
|
|
974
815
|
});
|
|
975
|
-
if (!res.ok) await throwPlatformApiError("Failed to provision database", res, "configure");
|
|
976
|
-
return res.json();
|
|
977
816
|
}
|
|
978
817
|
async setDatabaseUrl(projectId, connectionString) {
|
|
979
|
-
|
|
818
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/database-url`, "Failed to update database URL", {
|
|
980
819
|
method: "PUT",
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
...this.authHeaders
|
|
984
|
-
},
|
|
985
|
-
body: JSON.stringify({ connectionString })
|
|
820
|
+
body: { connectionString },
|
|
821
|
+
permission: "configure"
|
|
986
822
|
});
|
|
987
|
-
if (!res.ok) await throwPlatformApiError("Failed to update database URL", res, "configure");
|
|
988
|
-
return res.json();
|
|
989
823
|
}
|
|
990
824
|
async getDatabaseUrl(projectId) {
|
|
991
|
-
|
|
992
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch database URL", res, "owner");
|
|
993
|
-
return res.json();
|
|
825
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/database-url`, "Failed to fetch database URL", { permission: "owner" });
|
|
994
826
|
}
|
|
995
827
|
async purgeCache(projectId) {
|
|
996
|
-
|
|
828
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/revalidate`, "Cache purge failed", {
|
|
997
829
|
method: "POST",
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
...this.authHeaders
|
|
1001
|
-
},
|
|
1002
|
-
body: JSON.stringify({ all: true })
|
|
830
|
+
body: { all: true },
|
|
831
|
+
permission: "deploy"
|
|
1003
832
|
});
|
|
1004
|
-
if (!res.ok) await throwPlatformApiError("Cache purge failed", res, "deploy");
|
|
1005
|
-
return res.json();
|
|
1006
833
|
}
|
|
1007
834
|
async getLogs(projectId, since, limit = 200, deploymentId, level) {
|
|
1008
835
|
const params = new URLSearchParams({
|
|
@@ -1011,9 +838,7 @@ var PlatformClient = class {
|
|
|
1011
838
|
});
|
|
1012
839
|
if (deploymentId) params.set("deploymentId", deploymentId);
|
|
1013
840
|
if (level && level !== "all") params.set("level", level);
|
|
1014
|
-
|
|
1015
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch logs", res, "read");
|
|
1016
|
-
return (await res.json()).data;
|
|
841
|
+
return (await this.json(`${this.baseUrl}/projects/${projectId}/logs?${params}`, "Failed to fetch logs", { permission: "read" })).data;
|
|
1017
842
|
}
|
|
1018
843
|
async getRequests(projectId, since, limit = 200, status) {
|
|
1019
844
|
const params = new URLSearchParams({
|
|
@@ -1021,50 +846,32 @@ var PlatformClient = class {
|
|
|
1021
846
|
limit: String(limit)
|
|
1022
847
|
});
|
|
1023
848
|
if (status && status !== "all") params.set("status", status);
|
|
1024
|
-
|
|
1025
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch requests", res, "read");
|
|
1026
|
-
return (await res.json()).data;
|
|
849
|
+
return (await this.json(`${this.baseUrl}/projects/${projectId}/requests?${params}`, "Failed to fetch requests", { permission: "read" })).data;
|
|
1027
850
|
}
|
|
1028
851
|
async listBuilds(projectId, limit = 20) {
|
|
1029
852
|
const params = new URLSearchParams({ limit: String(limit) });
|
|
1030
|
-
|
|
1031
|
-
if (!res.ok) await throwPlatformApiError("Failed to list builds", res, "read");
|
|
1032
|
-
return (await res.json()).builds;
|
|
853
|
+
return (await this.json(`${this.baseUrl}/projects/${projectId}/builds?${params}`, "Failed to list builds", { permission: "read" })).builds;
|
|
1033
854
|
}
|
|
1034
855
|
async getBuildLogs(projectId, buildId, since = 0) {
|
|
1035
856
|
const params = new URLSearchParams({ since: String(since) });
|
|
1036
|
-
|
|
1037
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch build logs", res, "read");
|
|
1038
|
-
return res.json();
|
|
857
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/builds/${buildId}/logs?${params}`, "Failed to fetch build logs", { permission: "read" });
|
|
1039
858
|
}
|
|
1040
859
|
async getGithubInstallUrl() {
|
|
1041
|
-
|
|
1042
|
-
if (!res.ok) await throwPlatformApiError("Failed to get GitHub install URL", res);
|
|
1043
|
-
return res.json();
|
|
860
|
+
return this.json(`${this.baseUrl}/github/install-url`, "Failed to get GitHub install URL");
|
|
1044
861
|
}
|
|
1045
862
|
async listGithubInstallations() {
|
|
1046
|
-
|
|
1047
|
-
if (!res.ok) await throwPlatformApiError("Failed to list GitHub installations", res);
|
|
1048
|
-
return res.json();
|
|
863
|
+
return this.json(`${this.baseUrl}/github/installations`, "Failed to list GitHub installations");
|
|
1049
864
|
}
|
|
1050
865
|
async connectGithub(projectId, body) {
|
|
1051
|
-
|
|
866
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/github`, "Failed to connect GitHub repository", {
|
|
1052
867
|
method: "POST",
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
...this.authHeaders
|
|
1056
|
-
},
|
|
1057
|
-
body: JSON.stringify(body)
|
|
868
|
+
body,
|
|
869
|
+
permission: "settings"
|
|
1058
870
|
});
|
|
1059
|
-
if (!res.ok) await throwPlatformApiError("Failed to connect GitHub repository", res, "settings");
|
|
1060
|
-
return res.json();
|
|
1061
871
|
}
|
|
1062
872
|
/**
|
|
1063
|
-
* Start the per-repo connect
|
|
1064
|
-
*
|
|
1065
|
-
* with either `?connect_grant=<signed>` (proof of per-repo access) or
|
|
1066
|
-
* `?error=repo_not_accessible`. Mirrors {@link getGithubLinkUrl} but carries
|
|
1067
|
-
* the installation + repo the grant is scoped to.
|
|
873
|
+
* Start the per-repo connect authorization for a non-owner org member. The
|
|
874
|
+
* callback carries `?connect_grant=<signed>` or `?error=repo_not_accessible`.
|
|
1068
875
|
*/
|
|
1069
876
|
async getGithubConnectAuthorizeUrl(redirect, codeChallenge, installationId, repoFullName) {
|
|
1070
877
|
const params = new URLSearchParams({
|
|
@@ -1074,34 +881,23 @@ var PlatformClient = class {
|
|
|
1074
881
|
installationId,
|
|
1075
882
|
repoFullName
|
|
1076
883
|
});
|
|
1077
|
-
|
|
1078
|
-
if (!res.ok) await throwPlatformApiError("Failed to start GitHub connect authorization", res);
|
|
1079
|
-
return res.json();
|
|
884
|
+
return this.json(`${this.baseUrl}/github/connect-authorize-url?${params}`, "Failed to start GitHub connect authorization");
|
|
1080
885
|
}
|
|
1081
886
|
async getGithubConnection(projectId) {
|
|
1082
|
-
|
|
1083
|
-
if (!res.ok) await throwPlatformApiError("Failed to get GitHub connection", res, "read");
|
|
1084
|
-
return res.json();
|
|
887
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/github`, "Failed to get GitHub connection", { permission: "read" });
|
|
1085
888
|
}
|
|
1086
889
|
async updateGithubConnection(projectId, body) {
|
|
1087
|
-
|
|
890
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/github`, "Failed to update GitHub connection", {
|
|
1088
891
|
method: "PATCH",
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
...this.authHeaders
|
|
1092
|
-
},
|
|
1093
|
-
body: JSON.stringify(body)
|
|
892
|
+
body,
|
|
893
|
+
permission: "settings"
|
|
1094
894
|
});
|
|
1095
|
-
if (!res.ok) await throwPlatformApiError("Failed to update GitHub connection", res, "settings");
|
|
1096
|
-
return res.json();
|
|
1097
895
|
}
|
|
1098
896
|
async deleteGithubConnection(projectId) {
|
|
1099
|
-
|
|
897
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/github`, "Failed to disconnect GitHub repository", {
|
|
1100
898
|
method: "DELETE",
|
|
1101
|
-
|
|
899
|
+
permission: "settings"
|
|
1102
900
|
});
|
|
1103
|
-
if (!res.ok) await throwPlatformApiError("Failed to disconnect GitHub repository", res, "settings");
|
|
1104
|
-
return res.json();
|
|
1105
901
|
}
|
|
1106
902
|
async getGithubLinkUrl(redirect, codeChallenge) {
|
|
1107
903
|
const params = new URLSearchParams({
|
|
@@ -1109,24 +905,16 @@ var PlatformClient = class {
|
|
|
1109
905
|
code_challenge: codeChallenge,
|
|
1110
906
|
code_challenge_method: "S256"
|
|
1111
907
|
});
|
|
1112
|
-
|
|
1113
|
-
if (!res.ok) await throwPlatformApiError("Failed to start GitHub link", res);
|
|
1114
|
-
return res.json();
|
|
908
|
+
return this.json(`${this.baseUrl}/github/link-url?${params}`, "Failed to start GitHub link");
|
|
1115
909
|
}
|
|
1116
910
|
async completeGithubLink(linkCode, codeVerifier) {
|
|
1117
|
-
|
|
911
|
+
return this.json(`${this.baseUrl}/github/link/complete`, "Failed to complete GitHub link", {
|
|
1118
912
|
method: "POST",
|
|
1119
|
-
|
|
1120
|
-
"Content-Type": "application/json",
|
|
1121
|
-
...this.authHeaders
|
|
1122
|
-
},
|
|
1123
|
-
body: JSON.stringify({
|
|
913
|
+
body: {
|
|
1124
914
|
link_code: linkCode,
|
|
1125
915
|
code_verifier: codeVerifier
|
|
1126
|
-
}
|
|
916
|
+
}
|
|
1127
917
|
});
|
|
1128
|
-
if (!res.ok) await throwPlatformApiError("Failed to complete GitHub link", res);
|
|
1129
|
-
return res.json();
|
|
1130
918
|
}
|
|
1131
919
|
async getGithubJoinUrl(redirect, codeChallenge) {
|
|
1132
920
|
const params = new URLSearchParams({
|
|
@@ -1134,135 +922,93 @@ var PlatformClient = class {
|
|
|
1134
922
|
code_challenge: codeChallenge,
|
|
1135
923
|
code_challenge_method: "S256"
|
|
1136
924
|
});
|
|
1137
|
-
|
|
1138
|
-
if (!res.ok) await throwPlatformApiError("Failed to start GitHub join", res);
|
|
1139
|
-
return res.json();
|
|
925
|
+
return this.json(`${this.baseUrl}/github/join-url?${params}`, "Failed to start GitHub join");
|
|
1140
926
|
}
|
|
1141
927
|
async completeGithubJoin(joinCode, codeVerifier) {
|
|
1142
|
-
|
|
928
|
+
return this.json(`${this.baseUrl}/github/join/complete`, "Failed to complete GitHub join", {
|
|
1143
929
|
method: "POST",
|
|
1144
|
-
|
|
1145
|
-
"Content-Type": "application/json",
|
|
1146
|
-
...this.authHeaders
|
|
1147
|
-
},
|
|
1148
|
-
body: JSON.stringify({
|
|
930
|
+
body: {
|
|
1149
931
|
join_code: joinCode,
|
|
1150
932
|
code_verifier: codeVerifier
|
|
1151
|
-
}
|
|
933
|
+
}
|
|
1152
934
|
});
|
|
1153
|
-
if (!res.ok) await throwPlatformApiError("Failed to complete GitHub join", res);
|
|
1154
|
-
return res.json();
|
|
1155
935
|
}
|
|
1156
936
|
async getEmailUsage(projectId) {
|
|
1157
|
-
|
|
1158
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch email usage", res, "read");
|
|
1159
|
-
return res.json();
|
|
937
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/usage`, "Failed to fetch email usage", { permission: "read" });
|
|
1160
938
|
}
|
|
1161
939
|
async getEmailLogs(projectId, limit) {
|
|
1162
940
|
const url = new URL(`${this.baseUrl}/projects/${projectId}/email/logs`);
|
|
1163
941
|
if (limit !== void 0) url.searchParams.set("limit", String(limit));
|
|
1164
|
-
|
|
1165
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch email logs", res, "read");
|
|
1166
|
-
return res.json();
|
|
942
|
+
return this.json(url, "Failed to fetch email logs", { permission: "read" });
|
|
1167
943
|
}
|
|
1168
944
|
async getEmailOperation(projectId, operationId) {
|
|
1169
|
-
|
|
1170
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch email operation", res, "read");
|
|
1171
|
-
return res.json();
|
|
945
|
+
return this.json(`${this.baseUrl}/projects/${encodeURIComponent(projectId)}/email/operations/${encodeURIComponent(operationId)}`, "Failed to fetch email operation", { permission: "read" });
|
|
1172
946
|
}
|
|
1173
947
|
async listEmailDestinations(projectId) {
|
|
1174
|
-
|
|
1175
|
-
if (!res.ok) await throwPlatformApiError("Failed to list email destinations", res, "read");
|
|
1176
|
-
return res.json();
|
|
948
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/destinations`, "Failed to list email destinations", { permission: "read" });
|
|
1177
949
|
}
|
|
1178
950
|
async addEmailDestination(projectId, address) {
|
|
1179
|
-
const res = await this.
|
|
951
|
+
const res = await this.call(`${this.baseUrl}/projects/${projectId}/email/destinations`, "Failed to add email destination", {
|
|
1180
952
|
method: "POST",
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
...this.authHeaders
|
|
1184
|
-
},
|
|
1185
|
-
body: JSON.stringify({ address })
|
|
953
|
+
body: { address },
|
|
954
|
+
permission: "settings"
|
|
1186
955
|
});
|
|
1187
|
-
if (!res.ok) await throwPlatformApiError("Failed to add email destination", res, "settings");
|
|
1188
956
|
return {
|
|
1189
957
|
...await res.json(),
|
|
1190
958
|
created: res.status === 201
|
|
1191
959
|
};
|
|
1192
960
|
}
|
|
1193
961
|
async removeEmailDestination(projectId, destinationId) {
|
|
1194
|
-
|
|
962
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/destinations/${destinationId}`, "Failed to remove email destination", {
|
|
1195
963
|
method: "DELETE",
|
|
1196
|
-
|
|
964
|
+
permission: "settings"
|
|
1197
965
|
});
|
|
1198
|
-
if (!res.ok) await throwPlatformApiError("Failed to remove email destination", res, "settings");
|
|
1199
|
-
return res.json();
|
|
1200
966
|
}
|
|
1201
967
|
/** Installation email settings the CLI reads before starting a credential flow. */
|
|
1202
968
|
async getEmailSettings(projectId) {
|
|
1203
|
-
|
|
1204
|
-
if (!res.ok) await throwPlatformApiError("Failed to read email settings", res, "read");
|
|
1205
|
-
return res.json();
|
|
969
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/settings`, "Failed to read email settings", { permission: "read" });
|
|
1206
970
|
}
|
|
1207
971
|
async listEmailDomains(projectId) {
|
|
1208
|
-
|
|
1209
|
-
if (!res.ok) await throwPlatformApiError("Failed to list email domains", res, "read");
|
|
1210
|
-
return res.json();
|
|
972
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/domains`, "Failed to list email domains", { permission: "read" });
|
|
1211
973
|
}
|
|
1212
974
|
/** Submit a scoped token once; later operations address the domain without it. */
|
|
1213
975
|
async addEmailDomain(projectId, input) {
|
|
1214
|
-
|
|
976
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/domains`, "Failed to add email domain", {
|
|
1215
977
|
method: "POST",
|
|
1216
|
-
|
|
1217
|
-
"Content-Type": "application/json",
|
|
1218
|
-
...this.authHeaders
|
|
1219
|
-
},
|
|
1220
|
-
body: JSON.stringify({
|
|
978
|
+
body: {
|
|
1221
979
|
domain: input.domain,
|
|
1222
980
|
...input.apiToken !== void 0 ? { apiToken: input.apiToken } : {},
|
|
1223
981
|
...input.attemptId !== void 0 ? { attemptId: input.attemptId } : {}
|
|
1224
|
-
}
|
|
982
|
+
},
|
|
983
|
+
permission: "settings"
|
|
1225
984
|
});
|
|
1226
|
-
if (!res.ok) await throwPlatformApiError("Failed to add email domain", res, "settings");
|
|
1227
|
-
return res.json();
|
|
1228
985
|
}
|
|
1229
986
|
async getEmailDomain(projectId, domain) {
|
|
1230
|
-
|
|
1231
|
-
if (!res.ok) await throwPlatformApiError("Failed to fetch email domain status", res, "read");
|
|
1232
|
-
return res.json();
|
|
987
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/domains/${encodeURIComponent(domain)}`, "Failed to fetch email domain status", { permission: "read" });
|
|
1233
988
|
}
|
|
1234
989
|
/** Rotates the shared zone connection secret. */
|
|
1235
990
|
async rotateEmailDomainSecret(projectId, domain, attemptId) {
|
|
1236
|
-
|
|
991
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/domains/${encodeURIComponent(domain)}/rotate-secret`, "Failed to rotate email connection secret", {
|
|
1237
992
|
method: "POST",
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
...this.authHeaders
|
|
1241
|
-
},
|
|
1242
|
-
body: JSON.stringify({ attemptId })
|
|
993
|
+
body: { attemptId },
|
|
994
|
+
permission: "settings"
|
|
1243
995
|
});
|
|
1244
|
-
if (!res.ok) await throwPlatformApiError("Failed to rotate email connection secret", res, "settings");
|
|
1245
|
-
return res.json();
|
|
1246
996
|
}
|
|
1247
997
|
async syncEmailDomain(projectId, domain) {
|
|
1248
|
-
|
|
998
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/domains/${encodeURIComponent(domain)}/sync`, "Failed to sync email domain", {
|
|
1249
999
|
method: "POST",
|
|
1250
|
-
|
|
1000
|
+
permission: "settings"
|
|
1251
1001
|
});
|
|
1252
|
-
if (!res.ok) await throwPlatformApiError("Failed to sync email domain", res, "settings");
|
|
1253
|
-
return res.json();
|
|
1254
1002
|
}
|
|
1255
1003
|
async removeEmailDomain(projectId, domain) {
|
|
1256
|
-
|
|
1004
|
+
return this.json(`${this.baseUrl}/projects/${projectId}/email/domains/${encodeURIComponent(domain)}`, "Failed to remove email domain", {
|
|
1257
1005
|
method: "DELETE",
|
|
1258
|
-
|
|
1006
|
+
permission: "settings"
|
|
1259
1007
|
});
|
|
1260
|
-
if (!res.ok) await throwPlatformApiError("Failed to remove email domain", res, "settings");
|
|
1261
|
-
return res.json();
|
|
1262
1008
|
}
|
|
1263
1009
|
};
|
|
1264
1010
|
function sleep(ms) {
|
|
1265
1011
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1266
1012
|
}
|
|
1267
1013
|
//#endregion
|
|
1268
|
-
export { isExpiredTokenError as a,
|
|
1014
|
+
export { isExpiredTokenError as a, platformErrorMessage as c, isCliOutdatedError as i, PlatformApiError as n, isHeadersTimeoutError as o, PlatformClient as r, parsePlatformErrorBody as s, MIN_PLATFORM_VERSION as t };
|