cf 1.0.0-beta.20 → 1.0.0-beta.21
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 +1 -1
- package/dist/_meta/commands.json +911 -751
- package/dist/_meta/schemas.json +401 -382
- package/dist/{abuse-reports-mKv00yPh.mjs → abuse-reports-CbUAnJxd.mjs} +1 -1
- package/dist/{access-CyRjTbhh.mjs → access-C-78DlxL.mjs} +1 -1
- package/dist/{accounts-BmF_YKvG.mjs → accounts-DEqQPxCz.mjs} +8 -15
- package/dist/{acm-BcIFiAb8.mjs → acm-jmhCq3Yh.mjs} +2 -3
- package/dist/{addressing-D6xVD7MM.mjs → addressing-BeYFpQvC.mjs} +12 -23
- package/dist/{agent-memory-Blldunhv.mjs → agent-memory-Chlovb7j.mjs} +5 -9
- package/dist/{ai-CU8tdTfC.mjs → ai-BndH3HYN.mjs} +2 -3
- package/dist/{ai-audit-Id3hq5pV.mjs → ai-audit-BUJ-70O_.mjs} +1 -1
- package/dist/{ai-gateway-BKeZ28CQ.mjs → ai-gateway-CCk7VKhL.mjs} +9 -15
- package/dist/{ai-search-DOiZEmn7.mjs → ai-search-BexET_wp.mjs} +6 -11
- package/dist/{ai-security-CioADDZi.mjs → ai-security-D4MxRlxX.mjs} +3 -5
- package/dist/{alerting-BzN1N3Se.mjs → alerting-rw8Oi3x7.mjs} +5 -9
- package/dist/{analytics-engine-CugCQfDe.mjs → analytics-engine-Bk7dQLcm.mjs} +1 -1
- package/dist/{analytics-Cte-DrzH.mjs → analytics-q-guNEOK.mjs} +1 -1
- package/dist/{api-security-CCs0g510.mjs → api-security-BDc6gkf1.mjs} +9 -17
- package/dist/{argo-BHBFZnmO.mjs → argo-CnLIqm0i.mjs} +1 -1
- package/dist/args-BAOHroBC.mjs +2 -0
- package/dist/{artifacts-BzAwvrCD.mjs → artifacts-Cil33dzV.mjs} +4 -7
- package/dist/{audit-logs-jWivEKCy.mjs → audit-logs--E2Eclb7.mjs} +1 -1
- package/dist/auth-B0lEsD_1.mjs +2 -0
- package/dist/{auth-BUQscD5b.mjs → auth-BcNLQji1.mjs} +1 -1
- package/dist/auth-BtZmY6sE.mjs +2 -0
- package/dist/{auth-token-T0aqYgl9.mjs → auth-token-aF5AVLlH.mjs} +1 -1
- package/dist/{autoconfig-CBdcYYf4.mjs → autoconfig-Dbp6J25P.mjs} +88 -88
- package/dist/{basin-catalog-_8w_4599.mjs → basin-catalog-dnVyzopm.mjs} +3 -5
- package/dist/{billing-Ce0WN0yw.mjs → billing-Fqp3jB2V.mjs} +2 -3
- package/dist/{blocks-CFAm0Ma3.mjs → blocks-BOQH-Won.mjs} +1 -1
- package/dist/{bot-management-DskcSr4B.mjs → bot-management-SEDgo1Xg.mjs} +1 -1
- package/dist/{botnet-feed-CmBm13-D.mjs → botnet-feed-DPqR4M0Y.mjs} +2 -3
- package/dist/{brand-protection-DTuFrsN0.mjs → brand-protection-B8vwKfM9.mjs} +2 -3
- package/dist/{browser-run-CXdzSOHa.mjs → browser-run-BybYDq3I.mjs} +3 -5
- package/dist/build-BqGmiORA.mjs +2 -0
- package/dist/build-CWlpWVBf.mjs +2 -0
- package/dist/{builds-_1u5Nx6f.mjs → builds-CvtOG-Gk.mjs} +8 -15
- package/dist/cache-Bme_d2Wx.mjs +36 -0
- package/dist/cf-fIBhEAxU.mjs +18 -0
- package/dist/chunk-DSGVRFIS-DHC6NOIj.mjs +2 -0
- package/dist/{chunk-2K52M2W5-iYNzknM1.mjs → chunk-XVBBSNW2-DfMyGS-l.mjs} +8 -8
- package/dist/{cli-DyhOdzMo.mjs → cli-CIKDqm-u.mjs} +3 -3
- package/dist/{client-side-security-DnnYaRsd.mjs → client-side-security-ZQeRoo1t.mjs} +2 -3
- package/dist/{cloud-connector-Ct6b6pz8.mjs → cloud-connector-BeunZlNV.mjs} +1 -1
- package/dist/{cloudflared-CHLpWU35.mjs → cloudflared-DbzoIouQ.mjs} +1 -1
- package/dist/{cloudforce-one-Rl6nCCm0.mjs → cloudforce-one-D20t9ojD.mjs} +26 -51
- package/dist/{command-BwgvUpNx.mjs → command-B3uWlw57.mjs} +1 -1
- package/dist/{command-DuLxEkGq.mjs → command-BGRucANI.mjs} +1 -1
- package/dist/{command-BONLLcyz.mjs → command-C6kE7BU0.mjs} +1 -1
- package/dist/{command-DOpykk8X.mjs → command-C9CNvZi_.mjs} +1 -1
- package/dist/{command-BRpBIju7.mjs → command-CQ5qHE7n.mjs} +1 -1
- package/dist/{command-CHGc-KZ7.mjs → command-CkZkTjIj.mjs} +1 -1
- package/dist/{command-BRXOUAGD.mjs → command-CqKRlHGv.mjs} +1 -1
- package/dist/{command-BwlIi3Bv.mjs → command-CtlD6MEi.mjs} +1 -1
- package/dist/{command-CXzje7qc.mjs → command-CzWWQv8j.mjs} +1 -1
- package/dist/{command-BMYi_gS-.mjs → command-DWWuXQV8.mjs} +1 -1
- package/dist/{command-CPDQPdss.mjs → command-DkwmylF2.mjs} +1 -1
- package/dist/{command-CMa807gY.mjs → command-MxFFWqMg.mjs} +1 -1
- package/dist/{command-BVO9UOuU.mjs → command-orlUsdgf.mjs} +1 -1
- package/dist/{command-CVoDyQnL.mjs → command-prWMAJbg.mjs} +1 -1
- package/dist/{command-0WS5I_JW.mjs → command-rUCxlpQI.mjs} +1 -1
- package/dist/command-resolution-DAQ4PWUt.mjs +2 -0
- package/dist/{completions-DMwrvK_S.mjs → completions-2Otv0HMd.mjs} +1 -1
- package/dist/{connector-interrupts-DyWilINb.mjs → connector-interrupts-Dfhxupmg.mjs} +1 -1
- package/dist/{connector-telemetry-events-BUW9qTOs.mjs → connector-telemetry-events-CLVpDTIa.mjs} +1 -1
- package/dist/{connector-telemetry-snapshots-Djs5QssR.mjs → connector-telemetry-snapshots-E_1tmNmQ.mjs} +1 -1
- package/dist/{connectors-e_cpzDEm.mjs → connectors-ChJpQFSl.mjs} +2 -3
- package/dist/{containers-CEH15JUu.mjs → containers-Cj5-9nUg.mjs} +6 -9
- package/dist/containers-CzAZfmnj.mjs +380 -0
- package/dist/{content-scan-B6Ahw9JA.mjs → content-scan-CIA_9PV8.mjs} +3 -5
- package/dist/{context-Sgba0fZP.mjs → context-DVh8Wyfs.mjs} +2 -2
- package/dist/{cps-uDD0SSJ-.mjs → cps-hJkqdsHx.mjs} +1 -1
- package/dist/{csam-scanner-BSUl7jGn.mjs → csam-scanner-cCVO3lNF.mjs} +1 -1
- package/dist/{custom-csrs-BDcXggph.mjs → custom-csrs-BrTWUZ0c.mjs} +2 -3
- package/dist/{custom-hostnames-UmIlwkwt.mjs → custom-hostnames-C4ft77oC.mjs} +4 -7
- package/dist/{custom-nameservers-D7kU6d--.mjs → custom-nameservers-BWfrZhD1.mjs} +2 -3
- package/dist/{custom-pages-CkhIQCfM.mjs → custom-pages-DqTMKtRc.mjs} +2 -3
- package/dist/{d1-myRLEAGs.mjs → d1-B58AA9PA.mjs} +3 -6
- package/dist/delegate-D7yYckA4.mjs +2 -0
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-BJqCpycz.mjs → deploy-CEROLAdh.mjs} +1 -1
- package/dist/deploy-context-Do89WayB.mjs +56 -0
- package/dist/{deploy-input-v2DryyLP.mjs → deploy-input-DyMuMsi5.mjs} +1 -1
- package/dist/{dev-S1PJi83q.mjs → dev-BaFS7kOM.mjs} +2 -2
- package/dist/{diagnostics-q65rcNIk.mjs → diagnostics-4gfYj7Pf.mjs} +2 -3
- package/dist/dialog-D5lus4M4.mjs +2 -0
- package/dist/discover-6kAmVMPp.mjs +2 -0
- package/dist/discover-C06Syc2B.mjs +2 -0
- package/dist/dist-BtzWfAjU.mjs +453 -0
- package/dist/dls-ClWVxTBg.mjs +16 -0
- package/dist/{dns-DhARjFQs.mjs → dns-CML-wxIt.mjs} +68 -68
- package/dist/{dns-firewall-BP6r9QG6.mjs → dns-firewall-CL0b3dJ1.mjs} +2 -3
- package/dist/{docs-CReGWDrw.mjs → docs-BeYBHwUN.mjs} +1 -1
- package/dist/{dotenv-Ck-6V1hm.mjs → dotenv-CmPRiXmU.mjs} +1 -1
- package/dist/{dry-run-BBjUQUhR.mjs → dry-run-gy0Hl9xo.mjs} +1 -1
- package/dist/{durable-objects-tOJy-5te.mjs → durable-objects-uZECeq_f.mjs} +1 -1
- package/dist/{email-auth-Bq9sq_2j.mjs → email-auth-CCNW798I.mjs} +1 -1
- package/dist/email-domains-1rD1d84O.mjs +12 -0
- package/dist/{email-routing-CYo4dp50.mjs → email-routing-CYv-LrbV.mjs} +4 -7
- package/dist/{email-security-CNtWET2d.mjs → email-security-CWEUYPYo.mjs} +16 -31
- package/dist/{email-sending-BvagNLRr.mjs → email-sending-DHSzCfJx.mjs} +3 -5
- package/dist/{errors-DpbAQQv8.mjs → errors-ol9sMqSe.mjs} +8 -8
- package/dist/{field-extractors-C9R3Qivh.mjs → field-extractors-CuBM_uO4.mjs} +2 -3
- package/dist/{firewall-DsgUY-Qv.mjs → firewall-SMIUSypF.mjs} +4 -7
- package/dist/flagship-D3v6iDdw.mjs +24 -0
- package/dist/{fraud-24l8dKyk.mjs → fraud-B2f7O15X.mjs} +1 -1
- package/dist/{google-tag-gateway-CAkudP5W.mjs → google-tag-gateway-BwOc62Gy.mjs} +1 -1
- package/dist/{gt-D6YemCLh.mjs → gt-BQkaDQDq.mjs} +1 -1
- package/dist/{healthchecks-CEGMe3lO.mjs → healthchecks-BQXHnihB.mjs} +3 -5
- package/dist/{hyperdrive-DLDaOU2O.mjs → hyperdrive-Bd6Yfje3.mjs} +2 -3
- package/dist/{iam-ChldOMSL.mjs → iam-qJPI1_aZ.mjs} +5 -9
- package/dist/{images-Ba9tS5wT.mjs → images-goHZJOxy.mjs} +6 -11
- package/dist/index.mjs +1 -1
- package/dist/init-CVx0Ya1E.mjs +43 -0
- package/dist/{intel-DbLRah4Y.mjs → intel-CwiqwJI9.mjs} +18 -21
- package/dist/interactive-CHcvofEp.mjs +2 -0
- package/dist/{interactive-d_lFnSev.mjs → interactive-D4E8PdaW.mjs} +31 -31
- package/dist/interactive-wQM7Blhm.mjs +2 -0
- package/dist/internal-5cnlw9mH.mjs +4 -0
- package/dist/{ips-BGyzyQLL.mjs → ips-KBxmXhvO.mjs} +1 -1
- package/dist/{k2-BVQ3MqEl.mjs → k2-KhIP5NFT.mjs} +2 -3
- package/dist/kv-CCem2sEY.mjs +12 -0
- package/dist/{lazy-command-D0I6itZs.mjs → lazy-command-BMhD5ffF.mjs} +1 -1
- package/dist/{leaked-credential-checks-Dga83Qy3.mjs → leaked-credential-checks-BkPZiwE2.mjs} +3 -5
- package/dist/live-BhHzxFna.mjs +4 -0
- package/dist/{load-balancers-D9cB6of8.mjs → load-balancers-17GBXdju.mjs} +5 -9
- package/dist/local-CAs8RWYW.mjs +2 -0
- package/dist/{local-B7ZJ78al.mjs → local-CSH3UMpD.mjs} +1 -1
- package/dist/{local-runtime-DB545Gqq.mjs → local-runtime-KOFLRZeZ.mjs} +1 -1
- package/dist/log-BWdaOGOW.mjs +66 -0
- package/dist/log-DZfik9Jk.mjs +2 -0
- package/dist/login-BTiflOun.mjs +2 -0
- package/dist/login-Buhvx6Fi.mjs +5 -0
- package/dist/{logpush-Ccmr0Y_I.mjs → logpush-BCCUxa4J.mjs} +3 -5
- package/dist/{logs-CZBMuuBC.mjs → logs-4CwupKRG.mjs} +2 -3
- package/dist/{magic-cloud-networking-BwOxZVql.mjs → magic-cloud-networking-Xy6SC-V-.mjs} +4 -7
- package/dist/{magic-network-monitoring-Cx5kKdbk.mjs → magic-network-monitoring-B8pRZp2g.mjs} +3 -5
- package/dist/{magic-transit-BJwg3sVK.mjs → magic-transit-CwfO3OOX.mjs} +36 -67
- package/dist/managed-defense-CtFLuvuB.mjs +18 -0
- package/dist/{managed-transforms-C-HMtesC.mjs → managed-transforms-Hto8OCBS.mjs} +2 -3
- package/dist/{mcp-bGKgzz6F.mjs → mcp-SQ0MAVUJ.mjs} +3 -5
- package/dist/{mesh-DeQIll19.mjs → mesh-C8A6tVqA.mjs} +3 -5
- package/dist/{migrate-B6HsPeFh.mjs → migrate-Dufxsb_F.mjs} +1 -1
- package/dist/{monetization-B-TIrpA5.mjs → monetization-CYVaCAe9.mjs} +3 -5
- package/dist/{network-BrjykU-I.mjs → network-CJBTdEM3.mjs} +5 -9
- package/dist/{network-interconnects-I06kbxIl.mjs → network-interconnects-CKlNFj3i.mjs} +3 -5
- package/dist/{o11y-Ba0Fa98_.mjs → o11y-5x2Q8CWm.mjs} +8 -15
- package/dist/{oauth-BH-uQd3C.mjs → oauth-BN6_FpYp.mjs} +1 -1
- package/dist/oauth-D_A8AcIS.mjs +4 -0
- package/dist/{oauth-clients-Dd5gvDqf.mjs → oauth-clients-qKXg8ZH3.mjs} +3 -5
- package/dist/{oauth-scopes-CXpH3Syj.mjs → oauth-scopes-Ct1jDyC5.mjs} +1 -1
- package/dist/{organization-DKPqwe3j.mjs → organization-lBQSeqS1.mjs} +3 -5
- package/dist/{organizations-Cq4iy-Yr.mjs → organizations-DEX8Er3g.mjs} +1 -1
- package/dist/{origin-post-quantum-encryption-DSB1sbYV.mjs → origin-post-quantum-encryption-DUsxVGCs.mjs} +1 -1
- package/dist/output-BJEgbI0G.mjs +2 -0
- package/dist/package-BqSbnt6u.mjs +2 -0
- package/dist/{page-rules-CDWTYaf7.mjs → page-rules-BMt6nt03.mjs} +2 -3
- package/dist/{pages-Dgtm51Uj.mjs → pages-Jxa92ECz.mjs} +7 -13
- package/dist/{pay-per-crawl-CHenxdhv.mjs → pay-per-crawl-Cv0044CZ.mjs} +3 -5
- package/dist/{pay-per-use-Bd5l0hBi.mjs → pay-per-use-DGEeG-dC.mjs} +2 -3
- package/dist/{pipelines-GsyD6nUM.mjs → pipelines-CEC78A3w.mjs} +5 -9
- package/dist/{precursor-mO-Zua09.mjs → precursor-Ba0Ejhzt.mjs} +1 -1
- package/dist/previews-DnZbUTym.mjs +6 -0
- package/dist/progress-CtGsPOpV.mjs +2 -0
- package/dist/prompt-YrI7ltMa.mjs +4 -0
- package/dist/{queues-D8cAr2lB.mjs → queues-Chq997uj.mjs} +6 -11
- package/dist/{r2-CJiJbG6b.mjs → r2-BFgZDs-F.mjs} +17 -33
- package/dist/{radar-PUZ_PCZ8.mjs → radar-DJdDzLJw.mjs} +1 -1
- package/dist/{raw-fetch-DSdFjojI.mjs → raw-fetch-BE3QgdTE.mjs} +1 -1
- package/dist/ready-Cok0aqke.mjs +4 -0
- package/dist/{realtime-X6uQsldp.mjs → realtime-BHWWCiKp.mjs} +10 -19
- package/dist/{registrar-BqZdUTss.mjs → registrar-9Y-1IQ0n.mjs} +1 -1
- package/dist/{registrar-sandbox-CmM3e1QN.mjs → registrar-sandbox-DTS1kRnb.mjs} +1 -1
- package/dist/{registry-D0tMkLv6.mjs → registry-Bm-GgDC3.mjs} +1 -1
- package/dist/{reporting-DFVz98Xg.mjs → reporting-D5RbKQJf.mjs} +1 -1
- package/dist/request-headers-KhW_hy36.mjs +2 -0
- package/dist/{request-tracers-BC1u2WDU.mjs → request-tracers-wxWCjmHo.mjs} +1 -1
- package/dist/{resource-sharing-CdEn5Iex.mjs → resource-sharing-BGoaVvJa.mjs} +5 -9
- package/dist/rolldown-runtime-BNtqjh-B.mjs +2 -0
- package/dist/{rules-B663VetJ.mjs → rules-Cd3EjhdF.mjs} +3 -5
- package/dist/{rulesets-p4EijVr6.mjs → rulesets-Bnz3rSBT.mjs} +4 -7
- package/dist/{rum-CHHXe4KK.mjs → rum-CK9HEe3O.mjs} +3 -5
- package/dist/run-Be6Js7D6.mjs +2 -0
- package/dist/run-DnZGQbq_.mjs +2 -0
- package/dist/sanitization-DkVWMHkc.mjs +2 -0
- package/dist/{schema-B38ojvsS.mjs → schema-DuLIZRhA.mjs} +1 -1
- package/dist/{schema-flags-z7yn0JZ_.mjs → schema-flags-BrDlFwLv.mjs} +1 -1
- package/dist/{scim-BMnUa4Oz.mjs → scim-UdqaWnOu.mjs} +3 -5
- package/dist/{secrets-store-EYrhEzVG.mjs → secrets-store-Bf5v96LC.mjs} +3 -5
- package/dist/{security-insights-C-AwDwXb.mjs → security-insights-BAGySlGu.mjs} +1 -1
- package/dist/{security-txt-CQMe8TD3.mjs → security-txt-D0fMmjHs.mjs} +2 -3
- package/dist/session-6xqrJWXy.mjs +2 -0
- package/dist/shared-DYRRG9A-.mjs +2 -0
- package/dist/signed-url-Ce0muRem.mjs +4 -0
- package/dist/{smart-shield-CHSuitaH.mjs → smart-shield-CCy7_M3j.mjs} +3 -5
- package/dist/{snippets-DGSBz4lg.mjs → snippets-Bc8m3HSV.mjs} +3 -5
- package/dist/spawn-BAEdy9kS.mjs +5 -0
- package/dist/{spectrum-59LhYG1t.mjs → spectrum-DtNX8WBX.mjs} +2 -3
- package/dist/{speed-CMCfoG3s.mjs → speed-TbkeWV_x.mjs} +3 -5
- package/dist/{sql-MxWaTDdj.mjs → sql-DI319y25.mjs} +1 -1
- package/dist/src-COwxoocl.mjs +2 -0
- package/dist/{src-J3Yss3VM.mjs → src-Dc6ojwUW.mjs} +5 -5
- package/dist/{ssl-DTTFZR9x.mjs → ssl-D0MIzFl2.mjs} +9 -17
- package/dist/startup-profile-CZYtQziF.mjs +2 -0
- package/dist/{startup-profile-bp348qmf.mjs → startup-profile-DlWrt4Fm.mjs} +5 -5
- package/dist/state-B3Uy1jPX.mjs +2 -0
- package/dist/{state-CqAtTENS.mjs → state-DazGSbRx.mjs} +1 -1
- package/dist/{stream-gVG_7si-.mjs → stream-4Mrb8HEo.mjs} +14 -27
- package/dist/tags-BP25qydR.mjs +22 -0
- package/dist/telemetry-CvZean4s.mjs +2 -0
- package/dist/telemetry-DKSJSLtq.mjs +2 -0
- package/dist/{tenant-custom-nameservers-DBmmUcxn.mjs → tenant-custom-nameservers-BzVP85Tq.mjs} +2 -3
- package/dist/{tenant-Qv_PC8gW.mjs → tenant-jmfZqEZ4.mjs} +1 -1
- package/dist/{tools-B1ajcUAF.mjs → tools-C-vmgYSv.mjs} +1 -1
- package/dist/{tunnels-CHNKPYRV.mjs → tunnels-BNswR1Dj.mjs} +4 -6
- package/dist/{turnstile-C60RxPo2.mjs → turnstile-BgsTP2fz.mjs} +2 -3
- package/dist/ui-Bo6DCvbS.mjs +2 -0
- package/dist/{update-check-BHarE3V9.mjs → update-check-BOF1hn_I.mjs} +1 -1
- package/dist/update-check-C7mfEeQ7.mjs +2 -0
- package/dist/update-check-worker.mjs +1 -1
- package/dist/{url-normalization-3t6Xpafi.mjs → url-normalization-Bqrs4-2F.mjs} +2 -3
- package/dist/{url-scanner-DNG__DiK.mjs → url-scanner-Dm4Fps5T.mjs} +1 -1
- package/dist/{user-B4i7OIFK.mjs → user-u_LxzLM4.mjs} +8 -15
- package/dist/{vectorize-y3PCQDDf.mjs → vectorize-DLGiOyd4.mjs} +3 -5
- package/dist/version-DmTuWNZ5.mjs +2 -0
- package/dist/{waiting-rooms-xkZLvPkT.mjs → waiting-rooms-DmgJgJXb.mjs} +4 -7
- package/dist/{web-assets-BlqHZywy.mjs → web-assets-rNhZWP-6.mjs} +7 -13
- package/dist/{web3-DGAJMcLv.mjs → web3-BVBdFt8E.mjs} +3 -5
- package/dist/{workers-cCNBx0Bc.mjs → workers-CjUKJvH8.mjs} +18 -22
- package/dist/{workers-builds-COKp3NfU.mjs → workers-builds-D3Q97l7X.mjs} +1 -1
- package/dist/{workers-for-platforms-CAtiWI_G.mjs → workers-for-platforms-C_fcw30y.mjs} +5 -9
- package/dist/{workers-vpc-ChBfXwPy.mjs → workers-vpc-CnRO3Stc.mjs} +2 -3
- package/dist/{workflows-BYhgJvyR.mjs → workflows-cpHFe5v6.mjs} +5 -9
- package/dist/{wrangler-migration-B12OR2bu.mjs → wrangler-migration-DQehjmoh.mjs} +74 -74
- package/dist/{zaraz-BW0kvRCK.mjs → zaraz-BRj0J7vK.mjs} +1 -1
- package/dist/{zero-trust-DSeWXkNV.mjs → zero-trust-CVZKDLCB.mjs} +75 -149
- package/dist/{zone-B-YJG2UA.mjs → zone-N6ccK70C.mjs} +1 -1
- package/dist/{zones-B8pqPHu8.mjs → zones-C4S_kpGz.mjs} +49 -52
- package/package.json +12 -12
- package/dist/auth-CdEGiJ5Y.mjs +0 -2
- package/dist/auth-DF_ml7rE.mjs +0 -2
- package/dist/build-BJHRK6qE.mjs +0 -2
- package/dist/build-D7s3a8zW.mjs +0 -2
- package/dist/cache-CDPUUv_O.mjs +0 -45
- package/dist/cf-3vj8dGYz.mjs +0 -18
- package/dist/chunk-DSGVRFIS-RUG6Dtqz.mjs +0 -2
- package/dist/containers-CcZHRM9g.mjs +0 -376
- package/dist/delegate-Tgfxa-MZ.mjs +0 -2
- package/dist/deploy-context-DIAl408H.mjs +0 -56
- package/dist/dialog-BnIgdgWi.mjs +0 -2
- package/dist/discover-DEjUARkU.mjs +0 -2
- package/dist/discover-P20XeGBF.mjs +0 -2
- package/dist/dist-CX6dDtzj.mjs +0 -449
- package/dist/dist-DAeCUX-u.mjs +0 -60
- package/dist/dls-CMTrCDjZ.mjs +0 -17
- package/dist/flagship-geGDHp9H.mjs +0 -28
- package/dist/init-C08hBFYn.mjs +0 -43
- package/dist/interactive-pjVqirHx.mjs +0 -2
- package/dist/kv-Cd8vbPWK.mjs +0 -15
- package/dist/local-CFZtOOxg.mjs +0 -2
- package/dist/log-CRbgNbDp.mjs +0 -3
- package/dist/login-C3Bahro9.mjs +0 -5
- package/dist/login-DvsRxI3E.mjs +0 -2
- package/dist/logo-matches-jeNkUxAq.mjs +0 -6
- package/dist/logos-pxN5aumY.mjs +0 -7
- package/dist/managed-defense-C_KLy4oB.mjs +0 -18
- package/dist/matches-DnjBnG-Y.mjs +0 -6
- package/dist/oauth-Cf3-g-kk.mjs +0 -4
- package/dist/output-CpiIVa7Q.mjs +0 -2
- package/dist/previews-oHUiD54J.mjs +0 -7
- package/dist/progress-B1dpmxCT.mjs +0 -2
- package/dist/prompt-Y5OBwDVE.mjs +0 -4
- package/dist/queries-CS0sYfte.mjs +0 -9
- package/dist/request-headers-Bg8_Idw3.mjs +0 -2
- package/dist/run-0EozpORq.mjs +0 -2
- package/dist/run-DKg70Sqf.mjs +0 -2
- package/dist/session-3DgztoAI.mjs +0 -2
- package/dist/shared-o8saqcSK.mjs +0 -2
- package/dist/source-AlTrHNem.mjs +0 -6
- package/dist/spawn-BZd__5sj.mjs +0 -10
- package/dist/startup-profile-DJsOtbVN.mjs +0 -2
- package/dist/state-Dvzl3aSj.mjs +0 -2
- package/dist/submit-wJYcQB8d.mjs +0 -4
- package/dist/tags-BwFKjaOr.mjs +0 -23
- package/dist/telemetry-BczXOpQn.mjs +0 -2
- package/dist/telemetry-CE15pfOU.mjs +0 -2
- package/dist/ui-CBhKUPys.mjs +0 -2
- package/dist/update-check-C3RhhXja.mjs +0 -2
- package/dist/url-info-By6VD20A.mjs +0 -4
- package/dist/version-izjB0Yrl.mjs +0 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import"./api-eMuS5GI1.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{i as t,n}from"./auth-BcNLQji1.mjs";import{i as r}from"./context-DVh8Wyfs.mjs";import{t as i}from"./output-BJEgbI0G.mjs";import{t as a}from"./dry-run-gy0Hl9xo.mjs";import{t as o}from"./progress-CtGsPOpV.mjs";import{t as s}from"./run-DnZGQbq_.mjs";import"./telemetry-CvZean4s.mjs";import{n as c,t as l}from"./body-parser-ChnyBsfm.mjs";import{n as u}from"./input-validation-D7z60HJH.mjs";import{a as d,i as f,n as p}from"./prompt-YrI7ltMa.mjs";var m={method:`POST`,path:t=>e`/zones/${t.zone_id}/environments/${t.environment_id}/invalidate_cache`,body:`json`};function h(e){return e.usage("$0 cache invalidate-environment <environment-id>\n\nMarks cached content as stale for one environment of the zone. Content cached for the zone's other environments, including production, is not affected. Otherwise this works like `POST /zones/{zone_id}/invalidate_cache`: the next request for invalidated content makes Cloudflare revalidate it with your origin, and the request body takes the same fields. Environments are part of [Version Management](https://developers.cloudflare.com/version-management/). To delete the content instead, use `POST /zones/{zone_id}/environments/{environment_id}/purge_cache`. Invalidating by URL (`files`) does not work for environments that select requests by IP address, country, ASN, or threat score, and fails with error `1136`. Use `tags`, `hosts`, `prefixes`, or `purge_everything` for those environments. ### Availability and limits Rate limits and the number of items you can send in one request depend on your plan. See [Purge cache: availability and limits](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).").positional(`environment-id`,{type:`string`,description:`The environment ID, from Version Management.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`invalidate-environment <environment-id>`,describe:`Invalidate Cached Content by Environment`,builder:h,handler:async e=>s({command:`cache invalidate-environment`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache invalidate-environment`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments/${e[`environment-id`]==null?`<environment-id>`:encodeURIComponent(String(e[`environment-id`]))}/invalidate_cache`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"environment-id":String(e[`environment-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:c(e.body)});return}let s=await n(e),l=await r({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=l,!await p({force:!!e.force,message:`This operation marks the selected content in the environment's cache as stale.`}))return;if(e.body){let t=c(e.body),n=await o(`Deleting`,async()=>s.send(m,{body:t,zone_id:l,environment_id:e[`environment-id`]}));i(n,{successLabel:`Deleted`});return}let u=await o(`Deleting`,async()=>t(s,`POST`,`/zones/${e.zoneId}/environments/${encodeURIComponent(String(e[`environment-id`]))}/invalidate_cache`));i(u,{successLabel:`Deleted`})})};var ee={method:`POST`,path:t=>e`/zones/${t.zone_id}/invalidate_cache`,body:`json`};function te(e){return e.usage("$0 cache invalidate\n\nMarks cached content as stale in every Cloudflare data center and cache tier, including Cache Reserve. The content stays in cache. The next request for it makes Cloudflare revalidate it with your origin, using the `ETag` and `Last-Modified` values it was cached with: - If your origin answers `304 Not Modified`, Cloudflare serves the cached copy without downloading it again, and `CF-Cache-Status` is `REVALIDATED`. - If your origin sends a full response, Cloudflare serves and caches the new content, and `CF-Cache-Status` is `EXPIRED`. With Tiered Cache, each tier revalidates with the tier above it, so a visitor can see `EXPIRED` even when your origin answered `304`. Until content is revalidated, your `stale-while-revalidate` and `stale-if-error` directives still apply, counted from the time you invalidated it. For example, if your origin fails during revalidation, Cloudflare can keep serving the stale copy for the `stale-if-error` window. ### Invalidate or purge? - **Invalidate** when content may not have changed, for example after a deploy. Unchanged content costs your origin a `304` instead of a full response. That saving needs an origin that sends `ETag` or `Last-Modified` and answers conditional requests. Otherwise, every revalidation downloads the full response. - **Purge**, with `POST /zones/{zone_id}/purge_cache`, when content must not be served again, for example content you removed for legal or security reasons. Invalidating takes the same request bodies as purging, needs the same permission, and counts against the same rate limits. After a broad invalidation, such as `purge_everything`, expect more conditional requests to your origin while visitors request the invalidated content again. ### Choose what to invalidate Send one of these fields in the request body: - `files`: specific URLs. If your cache key includes request headers, send each URL with the header values it was cached with. - `tags`: all content whose `Cache-Tag` response header contains one of the tags. - `hosts`: all content cached for the hostnames. - `prefixes`: all content whose URL starts with one of the prefixes. - `purge_everything`: all cached content in the zone. ### Check the result A `200` response with `success: true` means Cloudflare accepted the request. To check, request an invalidated URL and confirm that the `CF-Cache-Status` response header is `REVALIDATED` or `EXPIRED`. ### Availability and limits Rate limits and the number of items you can send in one request depend on your plan. See [Purge cache: availability and limits](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).").option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ne={command:`invalidate`,describe:`Invalidate Cached Content`,builder:te,handler:async e=>s({command:`cache invalidate`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache invalidate`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/invalidate_cache`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:c(e.body)});return}let s=await n(e),l=await r({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=l,!await p({force:!!e.force,message:`This operation marks the selected content in the zone's cache as stale.`}))return;if(e.body){let t=c(e.body),n=await o(`Deleting`,async()=>s.send(ee,{body:t,zone_id:l}));i(n,{successLabel:`Deleted`});return}let u=await o(`Deleting`,async()=>t(s,`POST`,`/zones/${e.zoneId}/invalidate_cache`));i(u,{successLabel:`Deleted`})})};function re(e){return e.usage("$0 cache origin-cloud-regions bulk delete\n\nRemoves up to 100 IP-to-cloud-region mappings in a single request. Each IP is validated independently — successfully deleted items are returned in the `succeeded` array and IPs that could not be found or are invalid are returned in the `failed` array.").option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`delete`,describe:`Batch delete origin cloud region mappings`,builder:re,handler:async e=>s({command:`cache origin-cloud-regions bulk delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache origin-cloud-regions bulk delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin/cloud_regions/batch`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:c(e.body)});return}let s=await n(e);if(e.zoneId=await r({zone:e.zone},s,{quiet:e.quiet}),await p({force:!!e.force,message:`Are you sure you want to delete these Origin Cloud Region configurations?`})){if(e.body){let n=c(e.body);if(Array.isArray(n)&&n.length>100){let r=Math.ceil(n.length/100),a=null;for(let i=0;i<n.length;i+=100){let c=n.slice(i,i+100),l=Math.floor(i/100)+1;a=await o(`Deleting: batch ${l}/${r}`,async()=>t(s,`DELETE`,`/zones/${e.zoneId}/origin/cloud_regions/batch`,{body:c}))}i(a,{successLabel:`Deleted`});return}let r=await o(`Deleting`,async()=>t(s,`DELETE`,`/zones/${e.zoneId}/origin/cloud_regions/batch`,{body:n}));i(r,{successLabel:`Deleted`})}else if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}})};function ae(e){return e.usage("$0 cache origin-cloud-regions bulk update\n\nUpserts up to 100 IP-to-cloud-region mappings in a single request. Items in the request body are created or replaced; mappings not included in the request body are preserved unchanged (this is a merge operation, not a full collection replacement). Each item is validated independently — valid items are applied and invalid items are returned in the `failed` array. The vendor and region for every item are validated against the list from `GET /zones/{zone_id}/origin/cloud_regions/supported_regions`.").option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`update`,describe:`Batch create or replace origin cloud region mappings`,builder:ae,handler:async e=>s({command:`cache origin-cloud-regions bulk update`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache origin-cloud-regions bulk update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin/cloud_regions/batch`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:c(e.body)});return}let s=await n(e);if(e.zoneId=await r({zone:e.zone},s,{quiet:e.quiet}),e.body){let n=c(e.body);if(Array.isArray(n)&&n.length>100){let r=Math.ceil(n.length/100),a=null;for(let i=0;i<n.length;i+=100){let c=n.slice(i,i+100),l=Math.floor(i/100)+1;a=await o(`Updating: batch ${l}/${r}`,async()=>t(s,`PUT`,`/zones/${e.zoneId}/origin/cloud_regions/batch`,{body:c}))}i(a,{successLabel:`Updated`});return}let r=await o(`Updating`,async()=>t(s,`PUT`,`/zones/${e.zoneId}/origin/cloud_regions/batch`,{body:n}));i(r,{successLabel:`Updated`})}else if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})},v={command:`bulk`,describe:`Operations for origin-cloud-regions.bulk`,builder:e=>e.command(ie).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var y={method:`DELETE`,path:t=>e`/zones/${t.zone_id}/origin/cloud_regions/${t.origin_ip}`};function b(e){return e.usage(`$0 cache origin-cloud-regions delete <origin-ip>
|
|
3
|
+
|
|
4
|
+
Removes the cloud region mapping for a single origin IP address. The IP path parameter is normalized before lookup. Returns the deleted IP on success. Returns 404 if no mapping exists for the specified IP. When the last mapping for the zone is removed the underlying rule record is also deleted.`).positional(`origin-ip`,{type:`string`,description:`Origin IP address whose mapping should be deleted.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete <origin-ip>`,describe:`Delete an origin cloud region mapping`,builder:b,handler:async e=>s({command:`cache origin-cloud-regions delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache origin-cloud-regions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin/cloud_regions/${e[`origin-ip`]==null?`<origin-ip>`:encodeURIComponent(String(e[`origin-ip`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"origin-ip":String(e[`origin-ip`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,!await p({force:!!e.force,message:`Are you sure you want to delete this Origin Cloud Region configuration?`}))return;let c=await o(`Deleting`,async()=>t.send(y,{zone_id:s,origin_ip:e[`origin-ip`]}));i(c,{successLabel:`Deleted`})})};var S={method:`GET`,path:t=>e`/zones/${t.zone_id}/origin/cloud_regions/${t.origin_ip}`};function C(e){return e.usage(`$0 cache origin-cloud-regions get <origin-ip>
|
|
5
|
+
|
|
6
|
+
Returns the cloud region mapping for a single origin IP address. The IP path parameter is normalized before lookup (RFC 5952 for IPv6). Returns 404 if the zone has no mappings or if the specified IP has no mapping.`).positional(`origin-ip`,{type:`string`,description:`Origin IP address to look up. IPv4 and IPv6 are supported.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <origin-ip>`,describe:`Get an origin cloud region mapping`,builder:C,handler:async e=>s({command:`cache origin-cloud-regions get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache origin-cloud-regions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin/cloud_regions/${e[`origin-ip`]==null?`<origin-ip>`:encodeURIComponent(String(e[`origin-ip`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"origin-ip":String(e[`origin-ip`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=s;let c=await o(`Loading`,async()=>t.send(S,{zone_id:s,origin_ip:e[`origin-ip`]}));i(c,{successLabel:`Loaded`})})};var T={method:`GET`,path:t=>e`/zones/${t.zone_id}/origin/cloud_regions`,query:[`page`,`per_page`]};function E(e){return e.usage(`$0 cache origin-cloud-regions list
|
|
7
|
+
|
|
8
|
+
Returns all IP-to-cloud-region mappings configured for the zone with pagination support. Each mapping tells Cloudflare which cloud vendor and region hosts the origin at that IP, enabling the edge to route via the nearest Tiered Cache upper-tier co-located with that cloud provider. Returns an empty array when no mappings exist.`).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`list`,describe:`List origin cloud region mappings`,builder:E,handler:async e=>s({command:`cache origin-cloud-regions list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){a({command:`cf cache origin-cloud-regions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin/cloud_regions`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let s=await n(e),c=await r({zone:e.zone},s,{quiet:e.quiet});e.zoneId=c;let l=await o(`Loading`,async()=>s.send(T,{zone_id:c,...t}));i(l,{successLabel:`Loaded`})})};var O={method:`GET`,path:t=>e`/zones/${t.zone_id}/origin/cloud_regions/supported_regions`};function k(e){return e.usage(`$0 cache origin-cloud-regions regions list-supported
|
|
9
|
+
|
|
10
|
+
Returns the cloud vendors and regions that are valid values for origin cloud region mappings. Each region includes the Tiered Cache upper-tier colocation codes that will be used for cache routing when a mapping targeting that region is active. Requires the zone to have Tiered Cache enabled.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list-supported`,describe:`List supported cloud vendors and regions`,builder:k,handler:async e=>s({command:`cache origin-cloud-regions regions list-supported`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache origin-cloud-regions regions list-supported`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin/cloud_regions/supported_regions`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=s;let c=await o(`Loading`,async()=>t.send(O,{zone_id:s}));i(c,{successLabel:`Loaded`})})},j={command:`regions`,describe:`Operations for origin-cloud-regions.regions`,builder:e=>e.command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var M={method:`PUT`,path:t=>e`/zones/${t.zone_id}/origin/cloud_regions/${t.origin_ip}`,body:`json`};function N(e){return e.usage("$0 cache origin-cloud-regions update <origin-ip>\n\nCreates a new IP-to-cloud-region mapping or replaces the existing mapping for the specified IP. PUT is idempotent — calling it repeatedly with the same body produces the same result. The IP path parameter is normalized to canonical form (RFC 5952 for IPv6) before storage. The vendor and region are validated against the list from `GET /zones/{zone_id}/origin/cloud_regions/supported_regions`. Returns 400 if the `origin_ip` in the body does not match the URL path parameter. Returns 403 (code 1164) when the zone has reached the limit of 3,500 IP mappings.").positional(`origin-ip`,{type:`string`,description:`Origin IP address to create or replace.`,demandOption:!0}).option(`region`,{type:`string`,description:`Cloud vendor region identifier. Must be a valid region for the specified vendor as returned by the supported_regions endpoint.`}).option(`vendor`,{type:`string`,description:`Cloud vendor hosting the origin. Must be one of the supported vendors.`,choices:[`aws`,`azure`,`gcp`,`oci`]}).coerce(`vendor`,e=>u(e,`vendor`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating or replacing an origin cloud region mapping.`})}const P={command:`update <origin-ip>`,describe:`Create or replace an origin cloud region mapping`,builder:N,handler:async e=>s({command:`cache origin-cloud-regions update`,classification:{safeFlags:[`vendor`,`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache origin-cloud-regions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/origin/cloud_regions/${e[`origin-ip`]==null?`<origin-ip>`:encodeURIComponent(String(e[`origin-ip`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"origin-ip":String(e[`origin-ip`]??``)},bodyKind:`json`,body:e.body===void 0?l({region:u(e.region,`region`,`text`),vendor:e.vendor}):c(e.body)});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,e.body){let n=c(e.body),r=await o(`Updating`,async()=>t.send(M,{body:n,zone_id:s,origin_ip:e[`origin-ip`]}));i(r,{successLabel:`Updated`});return}e.region===void 0&&(e.region=await d(`region`,`Cloud vendor region identifier. Must be a valid region for the specified vendor as returned by the supported_regions endpoint.`)),e.vendor===void 0&&(e.vendor=await f(`vendor`,`Cloud vendor hosting the origin. Must be one of the supported vendors.`,[`aws`,`azure`,`gcp`,`oci`]));let p=l({region:u(e.region,`region`,`text`),vendor:e.vendor}),m=await o(`Updating`,async()=>t.send(M,{body:p,zone_id:s,origin_ip:e[`origin-ip`]}));i(m,{successLabel:`Updated`})})},F={command:`origin-cloud-regions`,describe:`Manage Origin Cloud Regions routing and failover configurations`,builder:e=>e.command(x).command(w).command(D).command(P).command(v).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var I={method:`POST`,path:t=>e`/zones/${t.zone_id}/environments/${t.environment_id}/purge_cache`,body:`json`};function L(e){return e.usage("$0 cache purge-environment <environment-id>\n\nDeletes cached content for one environment of the zone. Content cached for the zone's other environments, including production, is not affected. Otherwise this works like `POST /zones/{zone_id}/purge_cache`: the next request for purged content is a cache `MISS`, and the request body takes the same fields. Environments are part of [Version Management](https://developers.cloudflare.com/version-management/). To keep content cached and have Cloudflare revalidate it instead, use `POST /zones/{zone_id}/environments/{environment_id}/invalidate_cache`. Purging by URL (`files`) does not work for environments that select requests by IP address, country, ASN, or threat score, and fails with error `1136`. Use `tags`, `hosts`, `prefixes`, or `purge_everything` for those environments. ### Availability and limits Rate limits and the number of items you can send in one request depend on your plan. See [Purge cache: availability and limits](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).").positional(`environment-id`,{type:`string`,description:`The environment ID, from Version Management.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`purge-environment <environment-id>`,describe:`Purge Cached Content by Environment`,builder:L,handler:async e=>s({command:`cache purge-environment`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache purge-environment`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/environments/${e[`environment-id`]==null?`<environment-id>`:encodeURIComponent(String(e[`environment-id`]))}/purge_cache`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"environment-id":String(e[`environment-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:c(e.body)});return}let s=await n(e),l=await r({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=l,!await p({force:!!e.force,message:`This operation deletes the selected content from the environment's cache.`}))return;if(e.body){let t=c(e.body),n=await o(`Deleting`,async()=>s.send(I,{body:t,zone_id:l,environment_id:e[`environment-id`]}));i(n,{successLabel:`Deleted`});return}let u=await o(`Deleting`,async()=>t(s,`POST`,`/zones/${e.zoneId}/environments/${encodeURIComponent(String(e[`environment-id`]))}/purge_cache`));i(u,{successLabel:`Deleted`})})};var z={method:`POST`,path:t=>e`/zones/${t.zone_id}/purge_cache`,body:`json`};function B(e){return e.usage("$0 cache purge\n\nDeletes cached content in every Cloudflare data center and cache tier, including Cache Reserve. The next request for purged content is a cache `MISS`: Cloudflare fetches the full response from your origin and caches it again. Cloudflare does not serve purged content from cache again, even if your origin is unavailable. To keep content cached and have Cloudflare revalidate it with your origin instead, use `POST /zones/{zone_id}/invalidate_cache`. ### Choose what to purge Send one of these fields in the request body: - `files`: specific URLs. If your cache key includes request headers, send each URL with the header values it was cached with. - `tags`: all content whose `Cache-Tag` response header contains one of the tags. - `hosts`: all content cached for the hostnames. - `prefixes`: all content whose URL starts with one of the prefixes. - `purge_everything`: all cached content in the zone. ### Check the result A `200` response with `success: true` means Cloudflare accepted the request. It does not confirm that any content was cached or removed. To check, request a purged URL and confirm that the `CF-Cache-Status` response header is `MISS`. ### Availability and limits Rate limits and the number of items you can send in one request depend on your plan. See [Purge cache: availability and limits](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).").option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`purge`,describe:`Purge Cached Content`,builder:B,handler:async e=>s({command:`cache purge`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache purge`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/purge_cache`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:c(e.body)});return}let s=await n(e),l=await r({zone:e.zone},s,{quiet:e.quiet});if(e.zoneId=l,!await p({force:!!e.force,message:`This operation deletes the selected content from the zone's cache.`}))return;if(e.body){let t=c(e.body),n=await o(`Deleting`,async()=>s.send(z,{body:t,zone_id:l}));i(n,{successLabel:`Deleted`});return}let u=await o(`Deleting`,async()=>t(s,`POST`,`/zones/${e.zoneId}/purge_cache`));i(u,{successLabel:`Deleted`})})};var H={method:`PATCH`,path:t=>e`/zones/${t.zone_id}/cache/regional_tiered_cache`,body:`json`};function U(e){return e.usage(`$0 cache settings regional-tiered-cache edit
|
|
11
|
+
|
|
12
|
+
Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache topologies.`).option(`value`,{type:`string`,description:`Value of the Regional Tiered Cache zone setting.`,choices:[`on`,`off`]}).coerce(`value`,e=>u(e,`value`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`edit`,describe:`Change Regional Tiered Cache setting`,builder:U,handler:async e=>s({command:`cache settings regional-tiered-cache edit`,classification:{safeFlags:[`value`,`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings regional-tiered-cache edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/regional_tiered_cache`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({value:e.value}):c(e.body)});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,e.body){let n=c(e.body),r=await o(`Updating`,async()=>t.send(H,{body:n,zone_id:s}));i(r,{successLabel:`Updated`});return}e.value===void 0&&(e.value=await f(`value`,`Value of the Regional Tiered Cache zone setting.`,[`on`,`off`]));let u=l({value:e.value}),d=await o(`Updating`,async()=>t.send(H,{body:u,zone_id:s}));i(d,{successLabel:`Updated`})})};var G={method:`GET`,path:t=>e`/zones/${t.zone_id}/cache/regional_tiered_cache`};function K(e){return e.usage(`$0 cache settings regional-tiered-cache get
|
|
13
|
+
|
|
14
|
+
Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache topologies.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`get`,describe:`Get Regional Tiered Cache setting`,builder:K,handler:async e=>s({command:`cache settings regional-tiered-cache get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings regional-tiered-cache get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/regional_tiered_cache`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=s;let c=await o(`Loading`,async()=>t.send(G,{zone_id:s}));i(c,{successLabel:`Loaded`})})},J={command:`regional-tiered-cache`,describe:`Restrict tiered cache topology to data centers within a specific geographic region`,builder:e=>e.command(W).command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var oe={method:`POST`,path:t=>e`/zones/${t.zone_id}/cache/cache_reserve_clear`};function se(e){return e.usage(`$0 cache settings reserve clear
|
|
15
|
+
|
|
16
|
+
You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ce={command:`clear`,describe:`Start Cache Reserve Clear`,builder:se,handler:async e=>s({command:`cache settings reserve clear`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache settings reserve clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/cache_reserve_clear`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,!await p({force:!!e.force,message:`This operation permanently clears Cache Reserve for this zone and cannot be undone.`}))return;let c=await o(`Deleting`,async()=>t.send(oe,{zone_id:s}));i(c,{successLabel:`Deleted`})})};var Y={method:`PATCH`,path:t=>e`/zones/${t.zone_id}/cache/cache_reserve`,body:`json`};function le(e){return e.usage(`$0 cache settings reserve edit
|
|
17
|
+
|
|
18
|
+
Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information.`).option(`value`,{type:`string`,description:`Value of the Cache Reserve zone setting.`,choices:[`on`,`off`]}).coerce(`value`,e=>u(e,`value`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`edit`,describe:`Change Cache Reserve setting`,builder:le,handler:async e=>s({command:`cache settings reserve edit`,classification:{safeFlags:[`value`,`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings reserve edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/cache_reserve`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({value:e.value}):c(e.body)});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,e.body){let n=c(e.body),r=await o(`Updating`,async()=>t.send(Y,{body:n,zone_id:s}));i(r,{successLabel:`Updated`});return}e.value===void 0&&(e.value=await f(`value`,`Value of the Cache Reserve zone setting.`,[`on`,`off`]));let u=l({value:e.value}),d=await o(`Updating`,async()=>t.send(Y,{body:u,zone_id:s}));i(d,{successLabel:`Updated`})})};var de={method:`GET`,path:t=>e`/zones/${t.zone_id}/cache/cache_reserve`};function fe(e){return e.usage(`$0 cache settings reserve get
|
|
19
|
+
|
|
20
|
+
Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pe={command:`get`,describe:`Get Cache Reserve setting`,builder:fe,handler:async e=>s({command:`cache settings reserve get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings reserve get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/cache_reserve`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=s;let c=await o(`Loading`,async()=>t.send(de,{zone_id:s}));i(c,{successLabel:`Loaded`})})};var me={method:`GET`,path:t=>e`/zones/${t.zone_id}/cache/cache_reserve_clear`};function he(e){return e.usage(`$0 cache settings reserve status
|
|
21
|
+
|
|
22
|
+
You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`status`,describe:`Get Cache Reserve Clear`,builder:he,handler:async e=>s({command:`cache settings reserve status`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings reserve status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/cache_reserve_clear`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=s;let c=await o(`Loading`,async()=>t.send(me,{zone_id:s}));i(c,{successLabel:`Loaded`})})},_e={command:`reserve`,describe:`Persistent storage tier that keeps cached assets even after eviction from edge caches`,builder:e=>e.command(ce).command(ue).command(pe).command(ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var X={method:`POST`,path:t=>e`/zones/${t.zone_id}/cache/tiered_cache_smart_topology_enable`,body:`json`};function ve(e){return e.usage(`$0 cache settings smart-tiered-cache create
|
|
23
|
+
|
|
24
|
+
Smart Tiered Cache dynamically selects the single closest upper tier for each of your website's origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`).option(`value`,{type:`string`,description:`Enable or disable the Smart Tiered Cache.`,choices:[`on`,`off`]}).coerce(`value`,e=>u(e,`value`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Smart Tiered Cache.`})}const ye={command:`create`,describe:`Create Smart Tiered Cache setting`,builder:ve,handler:async e=>s({command:`cache settings smart-tiered-cache create`,classification:{safeFlags:[`value`,`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings smart-tiered-cache create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({value:e.value}):c(e.body)});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,e.body){let n=c(e.body),r=await o(`Creating`,async()=>t.send(X,{body:n,zone_id:s}));i(r,{successLabel:`Created`});return}e.value===void 0&&(e.value=await f(`value`,`Enable or disable the Smart Tiered Cache.`,[`on`,`off`]));let u=l({value:e.value}),d=await o(`Creating`,async()=>t.send(X,{body:u,zone_id:s}));i(d,{successLabel:`Created`})})};var be={method:`DELETE`,path:t=>e`/zones/${t.zone_id}/cache/tiered_cache_smart_topology_enable`};function xe(e){return e.usage(`$0 cache settings smart-tiered-cache delete
|
|
25
|
+
|
|
26
|
+
Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Se={command:`delete`,describe:`Delete Smart Tiered Cache setting`,builder:xe,handler:async e=>s({command:`cache settings smart-tiered-cache delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache settings smart-tiered-cache delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,!await p({force:!!e.force}))return;let c=await o(`Deleting`,async()=>t.send(be,{zone_id:s}));i(c,{successLabel:`Deleted`})})};var Z={method:`PATCH`,path:t=>e`/zones/${t.zone_id}/cache/tiered_cache_smart_topology_enable`,body:`json`};function Ce(e){return e.usage(`$0 cache settings smart-tiered-cache edit
|
|
27
|
+
|
|
28
|
+
Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`).option(`value`,{type:`string`,description:`Enable or disable the Smart Tiered Cache.`,choices:[`on`,`off`]}).coerce(`value`,e=>u(e,`value`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Smart Tiered Cache.`})}const we={command:`edit`,describe:`Patch Smart Tiered Cache setting`,builder:Ce,handler:async e=>s({command:`cache settings smart-tiered-cache edit`,classification:{safeFlags:[`value`,`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings smart-tiered-cache edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({value:e.value}):c(e.body)});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,e.body){let n=c(e.body),r=await o(`Updating`,async()=>t.send(Z,{body:n,zone_id:s}));i(r,{successLabel:`Updated`});return}e.value===void 0&&(e.value=await f(`value`,`Enable or disable the Smart Tiered Cache.`,[`on`,`off`]));let u=l({value:e.value}),d=await o(`Updating`,async()=>t.send(Z,{body:u,zone_id:s}));i(d,{successLabel:`Updated`})})};var Te={method:`GET`,path:t=>e`/zones/${t.zone_id}/cache/tiered_cache_smart_topology_enable`};function Ee(e){return e.usage(`$0 cache settings smart-tiered-cache get
|
|
29
|
+
|
|
30
|
+
Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`get`,describe:`Get Smart Tiered Cache setting`,builder:Ee,handler:async e=>s({command:`cache settings smart-tiered-cache get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings smart-tiered-cache get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=s;let c=await o(`Loading`,async()=>t.send(Te,{zone_id:s}));i(c,{successLabel:`Loaded`})})},Oe={command:`smart-tiered-cache`,describe:`Automatically determine the best upper-tier data centers for tiered cache topology`,builder:e=>e.command(ye).command(Se).command(we).command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var Q={method:`DELETE`,path:t=>e`/zones/${t.zone_id}/cache/variants`};function ke(e){return e.usage(`$0 cache settings variants delete
|
|
31
|
+
|
|
32
|
+
Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ae={command:`delete`,describe:`Delete variants setting`,builder:ke,handler:async e=>s({command:`cache settings variants delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){a({command:`cf cache settings variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,!await p({force:!!e.force}))return;let c=await o(`Deleting`,async()=>t.send(Q,{zone_id:s}));i(c,{successLabel:`Deleted`})})};var $={method:`PATCH`,path:t=>e`/zones/${t.zone_id}/cache/variants`,body:`json`};function je(e){return e.usage(`$0 cache settings variants edit
|
|
33
|
+
|
|
34
|
+
Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`).option(`value-avif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for avif.`}).option(`value-bmp`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for bmp.`}).option(`value-gif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for gif.`}).option(`value-jp2`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jp2.`}).option(`value-jpeg`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpeg.`}).option(`value-jpg`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpg.`}).option(`value-jpg2`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for jpg2.`}).option(`value-png`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for png.`}).option(`value-tif`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for tif.`}).option(`value-tiff`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for tiff.`}).option(`value-webp`,{type:`string`,array:!0,description:`List of strings with the MIME types of all the variants that should be served for webp.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Me={command:`edit`,describe:`Change variants setting`,builder:je,handler:async e=>s({command:`cache settings variants edit`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({value:{avif:e[`value-avif`],bmp:e[`value-bmp`],gif:e[`value-gif`],jp2:e[`value-jp2`],jpeg:e[`value-jpeg`],jpg:e[`value-jpg`],jpg2:e[`value-jpg2`],png:e[`value-png`],tif:e[`value-tif`],tiff:e[`value-tiff`],webp:e[`value-webp`]}}):c(e.body)});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=s,e.body){let n=c(e.body),r=await o(`Updating`,async()=>t.send($,{body:n,zone_id:s}));i(r,{successLabel:`Updated`});return}let u=l({value:{avif:e[`value-avif`],bmp:e[`value-bmp`],gif:e[`value-gif`],jp2:e[`value-jp2`],jpeg:e[`value-jpeg`],jpg:e[`value-jpg`],jpg2:e[`value-jpg2`],png:e[`value-png`],tif:e[`value-tif`],tiff:e[`value-tiff`],webp:e[`value-webp`]}}),d=await o(`Updating`,async()=>t.send($,{body:u,zone_id:s}));i(d,{successLabel:`Updated`})})};var Ne={method:`GET`,path:t=>e`/zones/${t.zone_id}/cache/variants`};function Pe(e){return e.usage(`$0 cache settings variants get
|
|
35
|
+
|
|
36
|
+
Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`get`,describe:`Get variants setting`,builder:Pe,handler:async e=>s({command:`cache settings variants get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){a({command:`cf cache settings variants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),s=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=s;let c=await o(`Loading`,async()=>t.send(Ne,{zone_id:s}));i(c,{successLabel:`Loaded`})})},Ie={command:`variants`,describe:`Serve different cached versions of an image based on the Accept header (WebP, AVIF, etc.)`,builder:e=>e.command(Ae).command(Me).command(Fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Le={command:`settings`,describe:`Configure Cache Reserve, tiered caching, and variant serving`,builder:e=>e.command(J).command(_e).command(Oe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Re={command:`cache`,describe:`Purge cached content and configure Cache Reserve, tiered caching, and variant serving`,builder:e=>e.command(ne).command(g).command(V).command(R).command(F).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Re as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{D as e,E as t,J as n,L as r,N as i,d as a,et as o,h as s,it as c,k as l,q as u}from"./dist-BtzWfAjU.mjs";import{N as d,O as f}from"./chunk-2HLTAS5V-B92NbX1j.mjs";import{_ as p,a as m,c as ee,d as h,f as g,g as te,h as ne,i as re,l as ie,m as _,o as v,p as y,r as ae,s as b,t as oe,u as x}from"./chunk-XVBBSNW2-DfMyGS-l.mjs";import{createRequire as S}from"node:module";import{chmodSync as C,existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,writeFileSync as k}from"node:fs";import A from"node:path";import{URLSearchParams as se}from"node:url";S(import.meta.url||(typeof __filename==`string`?__filename:`/`));function j(e){function t(){return A.resolve(e(),`preferences.json`)}p(t,`getUserPreferencesPath`);function n(){try{let e=E(t(),`utf8`),n=JSON.parse(e);return typeof n==`object`&&n?n:{}}catch{return{}}}p(n,`readUserPreferences`);function r(e){let r={...n(),...e},i=t();T(A.dirname(i),{recursive:!0}),k(i,JSON.stringify(r,null,` `),{encoding:`utf-8`})}return p(r,`updateUserPreferences`),{readUserPreferences:n,updateUserPreferences:r}}p(j,`createPreferences`);var M=6e4,N=525600,P=43200,F=1440,I=Symbol.for(`constructDateFrom`);function L(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&I in e?e[I](t):e instanceof Date?new e.constructor(t):new Date(t)}p(L,`constructFrom`);function R(e,t){return L(t||e,e)}p(R,`toDate`);var z={};function B(){return z}p(B,`getDefaultOptions`);function V(e){let t=R(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-n}p(V,`getTimezoneOffsetInMilliseconds`);function H(e,...t){let n=L.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}p(H,`normalizeDates`);function U(e,t){let n=+R(e)-R(t);return n<0?-1:n>0?1:n}p(U,`compareAsc`);function W(e){return L(e,Date.now())}p(W,`constructNow`);function ce(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}p(ce,`getRoundingMethod`);var le={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},ue=/* @__PURE__ */ p((e,t,n)=>{let r,i=le[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r},`formatDistance`);function G(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}p(G,`buildFormatLongFn`);var de={date:G({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:G({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:G({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},fe={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},pe=/* @__PURE__ */ p((e,t,n,r)=>fe[e],`formatRelative`);function K(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}p(K,`buildLocalizeFn`);var me={ordinalNumber:/* @__PURE__ */ p((e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},`ordinalNumber`),era:K({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:K({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:/* @__PURE__ */ p(e=>e-1,`argumentCallback`)}),month:K({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:K({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:K({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function q(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?ge(s,e=>e.test(o)):he(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}p(q,`buildMatchFn`);function he(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}p(he,`findKey`);function ge(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}p(ge,`findIndex`);function _e(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}p(_e,`buildMatchPatternFn`);var ve={code:`en-US`,formatDistance:ue,formatLong:de,formatRelative:pe,localize:me,match:{ordinalNumber:_e({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:/* @__PURE__ */ p(e=>parseInt(e,10),`valueCallback`)}),era:q({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:q({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:/* @__PURE__ */ p(e=>e+1,`valueCallback`)}),month:q({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:q({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:q({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function ye(e,t,n){let r=B(),i=n?.locale??r.locale??ve,a=U(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=H(n?.in,...a>0?[t,e]:[e,t]),l=ce(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/M,f=(u-(V(c)-V(s)))/M,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<F?`hour`:f<P?`day`:f<N?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}if(m===`day`){let e=l(f/F);return i.formatDistance(`xDays`,e,o)}if(m===`month`){let e=l(f/P);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}{let e=l(f/N);return i.formatDistance(`xYears`,e,o)}}p(ye,`formatDistanceStrict`);function be(e,t){return ye(e,W(e),t)}p(be,`formatDistanceToNowStrict`);function J(e,t){return{read:/* @__PURE__ */ p(()=>{let n=t();if(!w(n))return;let r=f(n);try{return g(e,r)}catch{return}},`read`),write(n){let r=t();T(A.dirname(r),{recursive:!0}),k(r,_(e,n),{encoding:`utf-8`,mode:384}),C(r,384)},clear(){let e=t(),n=w(e);return O(e,{force:!0}),n},path:t}}p(J,`createFileStorage`);function xe(e){let{temporaryAccountLogger:t,prompt:n}=e;return/* @__PURE__ */ p(async function(e,r){if(l())return t.log(r),!0;let i=await n(e);return typeof i==`string`&&i.trim().toLowerCase()===`yes`},`ensureTemporaryTermsAccepted`)}p(xe,`createTemporaryTermsPrompt`);var Se=[9106,1e4];function Y(e){return e?.code}p(Y,`getErrorCode`);function Ce(e){let t=Y(e);return t!==void 0&&Se.includes(t)}p(Ce,`isMembershipsInaccessible`);function we(e){return{"no-credentials-non-interactive":`Could not authenticate because no credentials were found and the environment is non-interactive. Set a CLOUDFLARE_API_TOKEN environment variable or run \`${e}\` in an interactive terminal first.`,"no-credentials-login-failed":`No credentials were found and the login attempt was unsuccessful. Run \`${e}\` to try again.`,"token-expired-non-interactive":`Your auth token has expired and could not be refreshed, and the environment is non-interactive. Run \`${e}\` in an interactive terminal or set a CLOUDFLARE_API_TOKEN.`,"token-expired-login-failed":`Your auth token has expired and could not be refreshed, and the login attempt was unsuccessful. Run \`${e}\` to try again.`,"token-refresh-unreachable":`Your auth token has expired and could not be refreshed because the Cloudflare auth server could not be reached. This is usually a network problem (connectivity, proxy, or IPv6), not an invalid login: your stored credentials were left unchanged. Check your connection and try again.`}}p(we,`notLoggedInErrorBodies`);function Te(e,t,n){let r=new Date(t.claim.expiresAt);e.log(v`
|
|
3
|
+
Temporary account ready:
|
|
4
|
+
Account: ${t.account.name} (${n?`reused`:`created`})
|
|
5
|
+
Claim within: ${be(r)}
|
|
6
|
+
Claim URL: ${t.claim.url}
|
|
7
|
+
`)}p(Te,`logTemporaryPreviewAccount`);function Ee(o,c){let{logger:u}=c,f=c.temporaryAccountLogger??u,m=o.cliName,h=o.temporaryAccountFlag??`--temporary-account`,g=we(o.commands.login),te=`
|
|
8
|
+
Run \`${o.commands.whoami}\` to check your current authentication status.`,_=j(o.getConfigPath),v=a(u,o.cacheNamespace?{namespace:o.cacheNamespace}:void 0),y=ae({serviceName:o.keyringServiceName,getConfigPath:o.getConfigPath,isKeyringEnabled:/* @__PURE__ */ p(()=>_.readUserPreferences().keyring_enabled===!0,`isKeyringEnabled`),logger:u,isNonInteractiveOrCI:l,loginCommand:o.commands.login,format:o.fileFormat}),b=o.allowGlobalAuthKey??!0,x=re({logger:u,isNonInteractiveOrCI:l,openInBrowser:/* @__PURE__ */ p(e=>i(e,u),`openInBrowser`),hasEnvCredentials:/* @__PURE__ */ p(()=>ee({allowGlobalAuthKey:b})!==void 0,`hasEnvCredentials`),purgeOnLoginOrLogout:v.purgeConfigCaches,clientId:o.clientId,consent:o.consent,cliDisplayName:o.displayName,deviceLoginCommand:o.commands.deviceLogin,redirectUri:o.redirectUri,storageFactory:y.storageFactory,allowGlobalAuthKey:b,temporary:{storage:J(o.fileFormat,o.getTemporaryAccountConfigPath),cliDisplayName:o.displayName,logoutCommand:o.commands.logout,temporaryAccountFlag:h,prompt:xe({temporaryAccountLogger:f,prompt:c.prompt}),temporaryAccountLogger:f}});function S(e){x.setProfile(e)}p(S,`setProfile`);function C(){return x.getActiveProfile()}p(C,`getActiveProfile`);function w(){return y.getActiveStore(x.getActiveProfile())}p(w,`getCredentialStore`);function T(e,t){x.setTemporaryAllowed(e,t)}p(T,`setTemporaryAllowed`);function E(){return x.getAPIToken()}p(E,`getAPIToken`);function D(){return x.requireApiToken()}p(D,`requireApiToken`);function O(e,t){return{complianceConfig:e,scopes:t?.scopes??o.getDefaultScopeKeys(),browser:t?.browser??!0,callbackHost:t?.callbackHost,callbackPort:t?.callbackPort,profile:t?.profile,device:t?.device??o.useDeviceFlowByDefault??!1}}p(O,`withLoginDefaults`);async function k(e,t){return x.login(O(e,t))}p(k,`login`);async function A(e){return x.logout(e)}p(A,`logout`);async function M(e,t){return x.getActiveTemporaryAccount()?{loggedIn:!0}:x.loginOrRefreshIfRequired(O(e,t))}p(M,`loginOrRefreshIfRequired`);async function N(){return x.getOAuthTokenFromLocalState()}p(N,`getOAuthTokenFromLocalState`);function P(){return x.getScopes()}p(P,`getScopes`);function F(){return y.storageFactory(C()).read()}p(F,`readAuthCredentials`);function I(e){y.storageFactory(C()).write(e)}p(I,`writeAuthCredentials`);function L(){let e=x.getActiveProfile();return e==="default"?`${o.accountCachePrefix}.json`:`${o.accountCachePrefix}-${e}.json`}p(L,`getAccountCacheFileName`);function R(e){v.saveToConfigCache(L(),{account:e})}p(R,`saveAccountToCache`);function z(){return v.getConfigCache(L()).account}p(z,`getAccountFromCache`);async function B(e,n,i){let a=[],o=!0,l=1,d;for(;o;){d=new se(d),d.set(`page`,String(l));let{response:f,status:p}=await s(e,n,{},c.userAgent,u,d,void 0,i);f.success?(a.push(...f.result),t(f.result_info)?l+=1:o=!1):r(n,f,p)}return a}p(B,`fetchAccountsPaged`);async function V(e,t={}){let{throwOnEmpty:n=!0}=t,r=await M(e);if(!r.loggedIn)throw new oe(`Not logged in. ${g[r.reason]}${te}`,r.reason,`cfetch auth login required`);let i=D(),[a,s]=await Promise.allSettled([B(e,`/accounts`,i),B(e,`/memberships`,i)]);if(a.status===`rejected`)throw a.reason;if(s.status===`rejected`){if(Ce(s.reason)){if(a.status===`fulfilled`&&a.value.length>0)return a.value;throw Y(s.reason)===9106?new d(`Failed to automatically retrieve account IDs for the logged in user.
|
|
9
|
+
You may have incorrect permissions on your API token, or an environment variable such as CLOUDFLARE_API_TOKEN, CLOUDFLARE_API_KEY, or CLOUDFLARE_EMAIL may be set to an invalid value.
|
|
10
|
+
Check your environment and unset or correct any Cloudflare credential variables, or run \`${o.commands.login}\` to re-authenticate.
|
|
11
|
+
You can also skip this account check by adding an \`account_id\` in your ${o.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,{telemetryMessage:`user account fetch permission denied`}):new d(`Failed to automatically retrieve account IDs for the logged in user.
|
|
12
|
+
You may have incorrect permissions on your API token, or your authentication may have expired. Try running \`${o.commands.login}\` to re-authenticate. You can also skip this account check by adding an \`account_id\` in your ${o.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,{telemetryMessage:`user account fetch permission denied`})}throw s.reason}let c=new Set(s.value.map(e=>e.account.id)),l=a.value.filter(e=>c.has(e.id));if(l.length===0&&n)throw new d(`Failed to automatically retrieve account IDs for the logged in user.
|
|
13
|
+
In a non-interactive environment, it is mandatory to specify an account ID, either by assigning its value to CLOUDFLARE_ACCOUNT_ID, or as \`account_id\` in your ${o.getConfigFileLabel()} file.
|
|
14
|
+
Alternatively, try running \`${o.commands.login}\` to re-authenticate.`,{telemetryMessage:`user account fetch empty`});return l}p(V,`fetchAllAccounts`);function H(e){let t=x.getActiveTemporaryAccount();return t?t.account.id:e.account_id?ne(e.account_id,`set as \`account_id\` in your ${o.getConfigFileLabel()} file`):ie()||z()?.id}p(H,`getActiveAccountId`);async function U(t){let n=H(t);if(n)return n;let r=await V(t);if(r.length===1)return R({id:r[0].id,name:r[0].name}),r[0].id;try{let e=await c.select(`Select an account`,{choices:r.map(e=>({title:e.name,value:e.id}))}),t=r.find(t=>t.id===e);if(!t)throw Error(`Selected account not found in accounts list`);return R({id:t.id,name:t.name}),e}catch(t){if(c.isNoDefaultValueProvidedError(t)){let t=e();throw new d(`More than one account available but unable to select one in non-interactive mode.
|
|
15
|
+
Please set the appropriate \`account_id\` in your ${o.getConfigFileLabel()} file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
|
|
16
|
+
Available accounts are (\`<name>\`: \`<account_id>\`):
|
|
17
|
+
${r.map(e=>` \`${t?`(redacted)`:e.name}\`: \`${e.id}\``).join(`
|
|
18
|
+
`)}`,{telemetryMessage:`user account selection unavailable`})}throw t}}p(U,`getOrSelectAccountId`);async function W(e){if(x.isTemporaryAllowed()){if(n(e)!==`public`)throw new d(`Temporary accounts aren't available when the compliance region is not set to public.`,{telemetryMessage:`user temporary account unavailable in compliance region`});let t=x.getActiveTemporaryAccount();if(t)return t.account.id;if(E())throw new d(`You're already authenticated with Cloudflare, so \`${h}\` can't be used. Temporary preview accounts are only for unauthenticated use. Either remove \`${h}\` to use your existing account, or log out (and unset CLOUDFLARE_API_TOKEN) first.`,{telemetryMessage:`user temporary account already authenticated`});let{account:r,cached:i}=await x.activateTemporaryAccount();return Te(f,r,i),r.account.id}let t=await M(e);if(!t.loggedIn)throw t.reason===`no-credentials-non-interactive`||t.reason===`token-expired-non-interactive`?new d(`In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for ${m} to work. Please go to https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN.`,{telemetryMessage:`user auth missing api token non interactive`}):t.reason===`token-refresh-unreachable`?new d(g[t.reason],{telemetryMessage:`user auth token refresh unreachable`}):new d(`Did not login, quitting...`,{telemetryMessage:`user login cancelled`});let r=await U(e);if(!r)throw new d(`No account id found, quitting...`,{telemetryMessage:`user auth missing account id`});return r}return p(W,`requireAuth`),{setProfile:S,getActiveProfile:C,getCredentialStore:w,setTemporaryAllowed:T,getAPIToken:E,requireApiToken:D,login:k,logout:A,loginOrRefreshIfRequired:M,getOAuthTokenFromLocalState:N,getScopes:P,readAuthCredentials:F,writeAuthCredentials:I,getActiveAccountId:H,getOrSelectAccountId:U,getAccountFromCache:z,fetchAllAccounts:V,requireAuth:W}}p(Ee,`createCloudflareAuth`);var De=`profiles/directory-bindings.json`,Oe=`.enc`;function X(e){let{logger:t,getConfigPath:n,keyringServiceName:r,format:i}=e,a=`.${i}`;function o(e){return b(n(),e,i)}p(o,`plaintextPath`);function s(e){return h(n(),e)}p(s,`encryptedPath`);function c(){return A.dirname(o(`default`))}p(c,`getProfileConfigDirectory`);let l={exists(e){return w(o(e))||w(s(e))},list(){let e=c();if(!w(e))return[];let t=/* @__PURE__ */ new Set;for(let n of D(e))n.endsWith(a)?t.add(n.slice(0,-a.length)):n.endsWith(Oe)&&t.add(n.slice(0,-Oe.length));return[...t]},delete(e){let{backendAvailable:a,encryptedFileExisted:s}=y({serviceName:r,configPath:n(),profile:e,format:i});J(i,()=>o(e)).clear(),s&&!a&&t.warn(`Removed the credential files for profile "${e}", but the keyring backend was not reachable on this host so its keyring entry could not be cleared. Clear it manually if it persists.`)}};function u(){return A.join(n(),De)}return p(u,`getDirectoryBindingsPath`),m({configs:l,bindings:{read(){try{let e=E(u(),`utf-8`);return JSON.parse(e)}catch{return{}}},write(e){let t=u();T(A.dirname(t),{recursive:!0}),k(t,JSON.stringify(e,null,` `),`utf-8`)}}})}p(X,`createCloudflareProfileStore`);function ke(e){let{loginCommand:t,createProfileCommand:n,keyringServiceName:r,getConfigPath:i,format:a,preferences:o}=e,{readUserPreferences:s,updateUserPreferences:c}=o;function l(e){return e??`default`}p(l,`describeProfile`);function u(e){let t=[];w(h(i()))&&t.push(void 0);let n=X({logger:e,getConfigPath:i,keyringServiceName:r,format:a});for(let e of n.configs.list()){try{te(e)}catch{continue}w(h(i(),e))&&t.push(e)}return t}p(u,`listEncryptedProfiles`);function d(e){let o=u(e);if(o.length===0)return;let s=[],c=[];for(let t of o)try{let{backendAvailable:e}=y({serviceName:r,configPath:i(),profile:t,format:a});s.push(l(t)),e||c.push(l(t))}catch(n){e.warn(`Failed to remove encrypted credentials for profile "${l(t)}": ${n instanceof Error?n.message:String(n)}. You may need to clear them manually.`)}if(s.length>0){let r=n?`Re-authenticate with \`${t}\` (default profile) or \`${n} <name>\` (named profiles).`:`Re-authenticate with \`${t}\`.`;e.log(`Removed encrypted credentials for ${s.map(e=>`"${e}"`).join(`, `)}. ${r}`)}c.length>0&&e.warn(`The keyring backend was not reachable on this host, so the keyring entry for ${c.map(e=>`"${e}"`).join(`, `)} could not be cleared. Clear it manually if it persists.`)}p(d,`scrubAllEncryptedProfiles`);function f(e,t){let{logger:n,getCredentialStore:r}=t,i=s().keyring_enabled===!0,a=x();if(a!==void 0&&a!==e&&n.warn(`CLOUDFLARE_AUTH_USE_KEYRING=${a} overrides ${e?`enabling`:`disabling`} keyring storage for this command.`),!e&&a!==!0&&d(n),c({keyring_enabled:e}),e&&a!==!1)try{r().kind!==`encrypted-file`&&(c({keyring_enabled:i}),n.warn(`Keyring storage isn't available on this host (see warning above), so it was not enabled. Try again once the keyring backend is reachable.`))}catch(e){throw c({keyring_enabled:i}),e}return{enabled:s().keyring_enabled===!0}}return p(f,`setKeyringPreference`),{setKeyringPreference:f}}p(ke,`createKeyringPreference`);function Ae(e){let{getConfigPath:t,format:n}=e;function r(e){return b(t(),e,n)}p(r,`getAuthConfigFilePath`);function i(e){return h(t(),e)}p(i,`getEncryptedAuthConfigFilePath`);function a(e){return J(n,()=>r(e))}p(a,`defaultAuthConfigStorage`);function o(e,t){a(t).write(e)}p(o,`writeAuthConfigFile`);function s(e){return a(e).read()}return p(s,`readAuthConfigFile`),{getAuthConfigFilePath:r,getEncryptedAuthConfigFilePath:i,defaultAuthConfigStorage:a,readAuthConfigFile:s,writeAuthConfigFile:o}}p(Ae,`createAuthConfigFileHelpers`),S(import.meta.url||(typeof __filename==`string`?__filename:`/`));var Z=`cloudflare`,je=`cf`,Me=`cf`,Ne=`http://localhost:8877/oauth/callback`,Pe={granted:{url:`https://welcome.developers.workers.dev/cf-oauth-consent-granted`},denied:{url:`https://welcome.developers.workers.dev/cf-oauth-consent-denied`,error:"Error: Consent denied. You must grant consent to cf in order to login.\nIf you don't want to do this consider passing an API token via the `CLOUDFLARE_API_TOKEN` environment variable"}},Fe=c({variableName:`CLOUDFLARE_CLIENT_ID`,defaultValue:/* @__PURE__ */ p(()=>`cbca97e7-c331-4cdd-8fd8-e25a451b98bf`,`defaultValue`)});function Q(){return o({appName:`cloudflare`,leadingDot:!1,useLegacyHomeDir:!1})}p(Q,`getCfConfigPath`);var Ie=/* @__PURE__ */ `access:read,access:write,account:read,account_api_tokens:create,agw:read,agw:run,agw:write,ai:read,ai:write,ai-search:read,ai-search:run,ai-search:write,aiaudit:read,aiaudit:write,aig:read,aig:write,auditlogs:read,billing:read,billing:write,browser:read,browser:write,cfone:read,cfone:write,cloudchamber:write,connectivity:admin,connectivity:bind,connectivity:read,constellation:write,containers:write,d1:write,dex:read,dex:write,dns_analytics:read,dns_records:edit,dns_records:read,dns_settings:read,email_routing:read,email_routing:write,email_sending:read,email_sending:write,firstpartytags:write,hyperdrive-planetscale:setup,images:read,images:write,lb:edit,lb:read,logpush:read,logpush:write,mcp_portals:read,mcp_portals:write,notebook-examples:read,notebook-managed:read,notification:read,notification:write,oauth_account_ssl_and_certificates_write,offline,openid,pages:read,pages:write,pipelines:read,pipelines:setup,pipelines:write,query_cache:write,queues:write,r2_catalog:write,radar:read,rag:read,rag:write,registrar:read,registrar:write,secrets_store:read,secrets_store:write,sso-connector:read,sso-connector:write,ssl_certs:write,teams:pii,teams:read,teams:secure_location,teams:write,url_scanner:read,url_scanner:write,user:read,vectorize:write,workers:read,workers:write,workers_builds:read,workers_builds:write,workers_deployments:read,workers_kv:write,workers_observability:read,workers_observability:write,workers_observability_telemetry:write,workers_routes:write,workers_scripts:write,workers_tail:read,zone:read,account-analytics.read,account-ssl-and-certificates.write,ssl-and-certificates.read,ssl-and-certificates.write,registrar-domains.read,registrar-domains.admin,logs.read,logs.write,websearch.run,snippets.read,snippets.write,access-acct.read,access-acct.revoke,access-acct.write,access-app.read,access-app.revoke,access-app.write,access-audit-log.read,access-certificate.read,access-certificate.write,access-custom-page.read,access-custom-page.write,access-device-posture.read,access-device-posture.write,access-group.read,access-group.write,access-idp.read,access-idp.write,access-key.read,access-key.write,access-org.read,access-org.revoke,access-org.write,access-policy-test.read,access-policy-test.write,access-policy.read,access-policy.write,access-population.read,access-population.write,access-saml-certificate.read,access-saml-certificate.write,access-scim-log.read,access-seats.write,access-service-token.read,access-service-token.write,access-ssh-auditing.read,access-ssh-auditing.write,access-tag.read,access-tag.write,access-users.read,access-users.write,access.read,access.revoke,access.write,account-api-gateway.read,account-api-gateway.write,account-custom-asset.read,account-custom-asset.write,account-custom-error-rules.read,account-custom-error-rules.write,account-custom-pages.read,account-custom-pages.write,account-disable-esc.read,account-disable-esc.write,account-dns-settings.read,account-dns-settings.write,account-firewall-access-rules.read,account-firewall-access-rules.write,account-logs.read,account-logs.write,account-rule-lists.read,account-rule-lists.write,account-rulesets.read,account-rulesets.write,account-security-center-insights.read,account-security-center-insights.write,account-settings.read,account-settings.write,account-ssl-and-certificates.read,account-waf.read,account-waf.write,account-waiting-rooms.read,address-maps.read,address-maps.write,agent-memory.write,agw.read,agw.run,agw.write,ai-search.index,ai-search.metadata_read,ai-search.read,ai-search.run,ai-search.write,ai.read,ai.write,aiaudit.read,aiaudit.write,aig.metadata_read,aig.read,aig.run,aig.write,analytics.read,api-gateway.read,api-gateway.write,apps.write,argotunnel.read,argotunnel.write,artifacts.read,artifacts.write,bot-management-feedback.read,bot-management-feedback.write,bot-management.read,bot-management.write,browser-rendering.read,browser-rendering.write,cache-settings.read,cache-settings.write,cache.purge,calls.read,calls.write,casb.read,casb.write,cf-agents.read,cf-agents.write,challenge-widgets.read,challenge-widgets.write,chinanetwork-steering.read,chinanetwork-steering.write,cloud-connector.read,cloud-connector.write,cloud-email-security.read,cloud-email-security.write,cloudchamber.read,cloudchamber.write,cloudforce-one.read,cloudforce-one.write,config-settings.read,config-settings.write,connectivity-directory.admin,connectivity-directory.bind,connectivity-directory.read,constellation.read,constellation.write,containers.read,containers.write,custom-errors.read,custom-errors.write,custom-pages.read,custom-pages.write,d1.metadata_read,d1.read,d1.write,ddos-botnet-feed.read,ddos-botnet-feed.write,ddos-protection.read,ddos-protection.write,dls.read,dls.write,dns-firewall.read,dns-firewall.write,dns-view.read,dns-view.write,dns.read,dns.write,domain-page-shield.read,domain-page.shield,dynamic-redirect.read,dynamic-redirect.write,email-routing-account-rule.read,email-routing-address.read,email-routing-address.write,email-routing-rule.read,email-routing-rule.write,email-routing-suppression.read,email-routing-suppression.write,email-security-dmarcreports.read,email-security-dmarcreports.write,email-sending.read,email-sending.write,fbm.admin,fbm.read,fbm.write,field-extractor.read,field-extractor.write,firewall-for-ai.read,firewall-for-ai.write,firewall-services.read,firewall-services.write,flagship.evaluate,flagship.read,flagship.write,fraud-detection-pii.read,fraud-detection.read,fraud-detection.write,fraud-events.write,fraud-feedback.read,fraud-feedback.write,healthcheck.read,healthcheck.write,http-applications.read,http-applications.write,http-ddos-managed-ruleset.read,http-ddos-managed-ruleset.write,images.metadata_read,images.read,images.write,integration.write,intel.read,intel.write,iot.read,iot.write,ip-prefix-bgp-on-demand.read,ip-prefix-bgp-on-demand.write,ip-prefix.read,ip-prefix.write,k2.consume,k2.produce,k2.read,k2.write,l4-ddos-managed-ruleset.read,l4-ddos-managed-ruleset.write,load-balancers-account.read,load-balancers-account.write,load-balancers.read,load-balancers.write,load-balancing-monitors-and-pools.read,load-balancing-monitors-and-pools.write,magic-firewall.read,magic-firewall.write,magic-transit.read,magic-transit.write,magic-wan.read,magic-wan.write,managed-headers.read,managed-headers.write,mass-url-redirects.read,mass-url-redirects.write,mcp-portals.read,mcp-portals.write,memberships.read,memberships.write,messaging.edit,messaging.metadata_read,messaging.read,moq.read,moq.write,notifications.read,notifications.write,origin.read,origin.write,page-rules.read,page-rules.write,page-shield.read,page.read,page.shield,page.write,pages.metadata_read,payments-gateway.read,payments-gateway.write,pcaps-api.read,pcaps-api.write,pipelines.read,pipelines.send,pipelines.write,precursor.read,precursor.write,pubsub.read,pubsub.write,query-cache.read,query-cache.write,queues.metadata_read,queues.read,queues.write,r2-catalog-sql.read,r2-catalog.read,r2-catalog.write,radar.read,rag.read,rag.run,rag.write,realtime.admin,realtime.read,realtime.write,registrar-sandbox-domains.admin,registrar-sandbox-domains.read,reports-application-security-report.read,request-tracer.read,resource-library.read,resource-library.write,resource-sharing.read,response-compression.read,response-compression.write,sanitize.read,sanitize.write,secrets-store.read,secrets-store.write,select-configuration.read,select-configuration.write,stream.metadata_read,stream.read,stream.write,tag.read,tag.write,teams-cds-compute-account.read,teams-cds-compute-account.write,teams-connector-cloudflared.monitoring,teams-connector-cloudflared.read,teams-connector-cloudflared.write,teams-connector-warp.read,teams-connector-warp.write,teams-connectors.read,teams-connectors.write,teams-dex.read,teams-dex.write,teams-networks.read,teams-networks.write,teams-pii.read,teams-resilience.read,teams-resilience.write,teams-secure.location,teams.read,teams.report,teams.write,transform-rules.read,transform-rules.write,trust-and-safety.read,trust-and-safety.write,url-scanner.read,url-scanner.write,user-details.read,user-details.write,vectorize.read,vectorize.write,waiting-rooms.read,waiting-rooms.write,web3-hostnames.read,web3-hostnames.write,websearch.metadata_read,websearch.read,websearch.write,workers-ci.read,workers-ci.write,workers-kv-storage.metadata_read,workers-kv-storage.read,workers-kv-storage.write,workers-observability-telemetry.write,workers-observability.read,workers-observability.write,workers-r2-bucket-item.read,workers-r2-bucket-item.write,workers-r2.metadata_read,workers-r2.read,workers-r2.write,workers-routes.read,workers-routes.write,workers-scripts.bind,workers-scripts.read,workers-scripts.write,workers-tail.read,workers_ai.metadata_read,zaraz.edit,zaraz.read,zaraz.write,zone-access.read,zone-access.revoke,zone-access.write,zone-custom-asset.read,zone-custom-asset.write,zone-disable-esc.read,zone-disable-esc.write,zone-dns-settings.read,zone-dns-settings.write,zone-observability.read,zone-observability.write,zone-security-center-insights.read,zone-security-center-insights.write,zone-settings.read,zone-settings.write,zone-transform-rules.read,zone-transform-rules.write,zone-versioning.read,zone-versioning.write,zone-waf.read,zone-waf.write,zone.read,zone.write`.split(`,`),Le=[`billing:read`,`billing:write`,`email_routing:read`,`email_sending:read`,`notebook-managed:read`,`oauth_account_ssl_and_certificates_write`],Re=[`hyperdrive-planetscale:setup`],ze=new Set(Le),Be=Ie.filter(e=>!ze.has(e)),Ve=new Set(Re),He=Be.filter(e=>!Ve.has(e));function Ue(e){He=e}p(Ue,`setLoginScopeKeys`);var We=new Set(Be);function Ge(e){return e.every(e=>We.has(e))}p(Ge,`validateScopeKeys`);function Ke(){let e=u();return e===`production`?`cloudflare-temporary-account.json`:`cloudflare-temporary-account.${e}.json`}p(Ke,`getTemporaryAccountConfigFile`);function qe(){return A.join(Q(),Ke())}p(qe,`getCfTemporaryAccountConfigPath`);function Je(e){return J(`json`,e)}p(Je,`createJsonFileStorage`);var{getAuthConfigFilePath:Ye,getEncryptedAuthConfigFilePath:Xe,defaultAuthConfigStorage:Ze,readAuthConfigFile:Qe,writeAuthConfigFile:$e}=Ae({getConfigPath:Q,format:`json`}),$={cliName:je,displayName:Me,temporaryAccountFlag:`--temporary-account`,commands:{login:`cf auth login`,logout:`cf auth logout`,whoami:`cf auth whoami`,createProfile:`cf auth create`,deviceLogin:`cf auth login`},keyringServiceName:Z,clientId:Fe,consent:Pe,redirectUri:Ne,useDeviceFlowByDefault:!0,allowGlobalAuthKey:!1,getConfigPath:Q,getTemporaryAccountConfigPath:qe,fileFormat:`json`,accountCachePrefix:`cloudflare-account`,cacheNamespace:`cloudflare`,getConfigFileLabel:/* @__PURE__ */ p(()=>`cf config`,`getConfigFileLabel`),getDefaultScopeKeys:/* @__PURE__ */ p(()=>He,`getDefaultScopeKeys`)},et=j(Q),{readUserPreferences:tt,updateUserPreferences:nt}=et;function rt(e){return Ee($,e)}p(rt,`createCfAuth`);function it(e){return X({logger:e.logger,getConfigPath:Q,keyringServiceName:Z,format:`json`})}p(it,`createCfProfileStore`);var at=ke({loginCommand:$.commands.login,createProfileCommand:$.commands.createProfile,keyringServiceName:Z,getConfigPath:Q,format:`json`,preferences:et});function ot(e,t){return at.setKeyringPreference(e,t)}p(ot,`setKeyringPreference`);export{ot as a,Q as i,it as n,Ge as o,Je as r,rt as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{n as e,t}from"./rolldown-runtime-BNtqjh-B.mjs";import{B as n,j as r,m as i}from"./dist-BtzWfAjU.mjs";import{N as a,r as o}from"./chunk-2HLTAS5V-B92NbX1j.mjs";import{createRequire as s}from"node:module";import{readFileSync as c}from"node:fs";import l,{resolve as u}from"node:path";import d from"node:assert";import{spawnSync as f}from"node:child_process";const p=s(import.meta.url||(typeof __filename==`string`?__filename:`/`));var m=Object.create,h=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,v=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,b=(e,t)=>h(e,`name`,{value:t,configurable:!0}),x=/* @__PURE__ */ (e=>p===void 0?typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(p===void 0?e:p)[t]}):e:p)(function(e){if(p!==void 0)return p.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),S=(e,t)=>function(){return t||(0,e[_(e)[0]])((t={exports:{}}).exports,t),t.exports},C=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},w=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of _(t))!y.call(e,i)&&i!==n&&h(e,i,{get:()=>t[i],enumerable:!(r=g(t,i))||r.enumerable});return e},T=(e,t,n)=>(n=e==null?{}:m(v(e)),w(t||!e||!e.__esModule?h(n,`default`,{value:e,enumerable:!0}):n,e)),E=/* @__PURE__ */ t(((t,n)=>{var r=e(`child_process`).exec,i=e(`child_process`).execSync,a=e(`fs`),o=e(`path`),s=a.access,c=a.accessSync,l=a.constants||a,u=process.platform==`win32`,d=function(e,t){s(e,l.F_OK,function(e){t(!e)})},f=function(e){try{return c(e,l.F_OK),!1}catch{return!0}},p=function(e,t){s(e,l.F_OK|l.X_OK,function(e){t(null,!e)})},m=function(e){try{return c(e,l.F_OK|l.X_OK),!0}catch{return!1}},h=function(e,t,n){d(e,function(i){i?p(e,n):r(`command -v `+t+` 2>/dev/null && { echo >&1 `+t+`; exit 0; }`,function(e,t,r){n(null,!!t)})})},g=function(e,t,n){/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(e)?r(`where `+t,function(e){e===null?n(null,!0):n(null,!1)}):n(null,!1)},_=function(e,t){if(f(e))try{return!!i(`command -v `+t+` 2>/dev/null && { echo >&1 `+t+`; exit 0; }`)}catch{return!1}return m(e)},v=function(e,t,n){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(e))return!1;try{return!!i(`where `+t,{stdio:[]})}catch{return!1}},y=function(e){return/[^A-Za-z0-9_\/:=-]/.test(e)&&(e=`'`+e.replace(/'/g,`'\\''`)+`'`,e=e.replace(/^(?:'')+/g,``).replace(/\\'''/g,`\\'`)),e};u&&(y=function(e){if(/[\\]/.test(e)){var t=`"`+o.dirname(e)+`"`,n=`"`+o.basename(e)+`"`;return t+`:`+n}return`"`+e+`"`}),n.exports=function e(t,n){var r=y(t);if(!n&&typeof Promise<`u`)return new Promise(function(n,r){e(t,function(e,i){i?n(t):r(e)})});u?g(t,r,n):h(t,r,n)},n.exports.sync=function(e){var t=y(e);return u?v(e,t):_(e,t)}})),D=/* @__PURE__ */ t(((e,t)=>{t.exports=E()})),ee=n(),O=D();s(import.meta.url||(typeof __filename==`string`?__filename:`/`));function k(e){if(e.compiled_schema)return c(u(e.compiled_schema));let{base_path:t,source_schemas:n}=e,r=(n??[]).map(e=>u(t,e));if(!(0,O.sync)(`capnp`))throw new a(`The capnp compiler is required to upload capnp schemas, but is not present.`,{telemetryMessage:`capnp compiler missing`});let i=u(t??`.`),o=f(`capnp`,[`compile`,`-o-`,`--src-prefix=${i}`,...r],{maxBuffer:3145728});if(o.error)throw o.error;if(o.stderr.length)throw Error(o.stderr.toString());return o.stdout}b(k,`handleUnsafeCapnp`);var A={esm:`application/javascript+module`,commonjs:`application/javascript`,"compiled-wasm":`application/wasm`,buffer:`application/octet-stream`,text:`text/plain`,python:`text/x-python`,"python-requirement":`text/x-python-requirement`};function j(e){let t=A[e];if(t===void 0)throw TypeError(`Unsupported module: `+e);return t}b(j,`toMimeType`);function M(e){let t=Object.keys(A).find(t=>A[t]===e);if(t===void 0)throw TypeError(`Unsupported mime type: `+e);return t}b(M,`fromMimeType`);function N(e,t,n){let s=new ee.FormData,{main:u,sourceMaps:f,migrations:p,code_update_strategy:m,exports:h,compatibility_date:g,compatibility_flags:_,keepVars:v,keepSecrets:y,keepBindings:b,logpush:x,placement:S,tail_consumers:C,streaming_tail_consumers:w,limits:T,annotations:E,keep_assets:D,assets:O,observability:A,cache:M,package_dependencies:N}=e,P={html_handling:O?.assetConfig?.html_handling,not_found_handling:O?.assetConfig?.not_found_handling,base_path:O?.assetConfig?.base_path,run_worker_first:O?.run_worker_first,_redirects:O?._redirects,_headers:O?._headers};if(O&&!O.routerConfig.has_user_worker)return s.set(`metadata`,JSON.stringify({assets:{jwt:O.jwt,config:P},...E&&{annotations:E},...g&&{compatibility_date:g},..._&&{compatibility_flags:_}})),s;let{modules:F}=e,I=[],te=i(`plain_text`,t),ne=i(`json`,t),re=i(`secret_text`,t),ie=i(`kv_namespace`,t),ae=i(`send_email`,t),oe=i(`durable_object_namespace`,t),se=i(`workflow`,t),ce=i(`queue`,t),le=i(`r2_bucket`,t),ue=i(`d1`,t),de=i(`vectorize`,t),fe=i(`ai_search_namespace`,t),pe=i(`ai_search`,t),L=i(`agent_memory`,t),R=i(`hyperdrive`,t),z=i(`secrets_store_secret`,t),B=i(`artifacts`,t),me=i(`unsafe_hello_world`,t),he=i(`flagship`,t),ge=i(`ratelimit`,t),_e=i(`vpc_service`,t),ve=i(`vpc_network`,t),V=i(`service`,t),ye=i(`analytics_engine`,t),be=i(`dispatch_namespace`,t),xe=i(`mtls_certificate`,t),Se=i(`pipeline`,t),Ce=i(`k2`,t),we=i(`worker_loader`,t),Te=i(`logfwdr`,t),Ee=i(`wasm_module`,t),H=i(`browser`,t)[0],U=i(`analytics`,t)[0],W=i(`ai`,t)[0],G=i(`images`,t)[0],K=i(`stream`,t)[0],q=i(`media`,t)[0],J=i(`version_metadata`,t)[0],Y=i(`assets`,t)[0],De=i(`text_blob`,t),Oe=i(`data_blob`,t);i(`inherit`,t).forEach(({binding:e})=>{I.push({name:e,type:`inherit`})}),te.forEach(({binding:e,value:t})=>{I.push({name:e,type:`plain_text`,text:t})}),ne.forEach(({binding:e,value:t})=>{I.push({name:e,type:`json`,json:t})}),re.forEach(({binding:e,value:t})=>{I.push({name:e,type:`secret_text`,text:t})}),ie.forEach(({id:e,binding:t,raw:r})=>{if(n?.dryRun&&(e??=o),e===void 0)throw new a(`${t} bindings must have an "id" field`,{telemetryMessage:`kv namespace binding missing id`});e===o?I.push({name:t,type:`inherit`}):I.push({name:t,type:`kv_namespace`,namespace_id:e,raw:r})}),ae.forEach(e=>{let t={name:e.name,type:`send_email`,allowed_sender_addresses:e.allowed_sender_addresses};e.destination_address===void 0?e.allowed_destination_addresses===void 0?I.push(t):I.push({...t,allowed_destination_addresses:e.allowed_destination_addresses}):I.push({...t,destination_address:e.destination_address})}),oe.forEach(({name:e,class_name:t,script_name:n,environment:r})=>{I.push({name:e,type:`durable_object_namespace`,class_name:t,...n&&{script_name:n},...r&&{environment:r}})}),se.forEach(({binding:e,name:t,class_name:n,script_name:r,raw:i})=>{I.push({type:`workflow`,name:e,workflow_name:t,class_name:n,script_name:r,raw:i})}),ce.forEach(({binding:e,queue_name:t,delivery_delay:r,raw:i})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "queue" field. Add a "queue" field to the producer in your Worker configuration specifying the name of the Queue to bind to.`,{telemetryMessage:`queue binding missing name`});t===o?I.push({name:e,type:`inherit`}):I.push({type:`queue`,name:e,queue_name:t,delivery_delay:r,raw:i})}),le.forEach(({binding:e,bucket_name:t,jurisdiction:r,raw:i})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "bucket_name" field. Add a "bucket_name" field to the binding in your Worker configuration specifying the name of the R2 bucket to bind to.`,{telemetryMessage:`r2 bucket binding missing bucket_name`});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`r2_bucket`,bucket_name:t,jurisdiction:r,raw:i})}),ue.forEach(({binding:e,database_id:t,database_internal_env:r,raw:i})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "database_id" field. Add a "database_id" field to the binding in your Worker configuration specifying the ID of the D1 database to bind to.`,{telemetryMessage:`d1 database binding missing database_id`});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`d1`,id:t,internalEnv:r,raw:i})}),de.forEach(({binding:e,index_name:t,raw:n})=>{I.push({name:e,type:`vectorize`,index_name:t,raw:n})}),fe.forEach(({binding:e,namespace:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the AI Search namespace to bind to.`,{telemetryMessage:`ai search namespace binding missing namespace`});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`ai_search_namespace`,namespace:t})}),pe.forEach(({binding:e,instance_name:t})=>{I.push({name:e,type:`ai_search`,instance_name:t})}),L.forEach(({binding:e,namespace:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the namespace to bind to.`,{telemetryMessage:!1});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`agent_memory`,namespace:t})}),R.forEach(({binding:e,id:t})=>{I.push({name:e,type:`hyperdrive`,id:t})}),z.forEach(({binding:e,store_id:t,secret_name:n})=>{I.push({name:e,type:`secrets_store_secret`,store_id:t,secret_name:n})}),B.forEach(({binding:e,namespace:t})=>{I.push({name:e,type:`artifacts`,namespace:t})}),me.forEach(({binding:e,enable_timer:t})=>{I.push({name:e,type:`unsafe_hello_world`,enable_timer:t})}),he.forEach(({binding:e,app_id:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have an "app_id" field. Add an "app_id" field to the binding in your Worker configuration specifying the Flagship app to bind to.`,{telemetryMessage:`flagship binding missing app id`});I.push(t===o?{name:e,type:`inherit`}:{name:e,type:`flagship`,app_id:t})}),ge.forEach(({name:e,namespace_id:t,simple:n})=>{I.push({name:e,type:`ratelimit`,namespace_id:t,simple:n})}),_e.forEach(({binding:e,service_id:t})=>{I.push({name:e,type:`vpc_service`,service_id:t})}),ve.forEach(({binding:e,tunnel_id:t,network_id:n})=>{I.push({name:e,type:`vpc_network`,...t===void 0?{network_id:n}:{tunnel_id:t}})}),V.forEach(({binding:e,service:t,environment:n,entrypoint:r,props:i,cross_account_grant:a})=>{I.push({name:e,type:`service`,service:t,cross_account_grant:a,...n&&{environment:n},...r&&{entrypoint:r},...i&&{props:i}})}),ye.forEach(({binding:e,dataset:t})=>{I.push({name:e,type:`analytics_engine`,dataset:t})}),be.forEach(({binding:e,namespace:t,outbound:r})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the dispatch namespace to bind to.`,{telemetryMessage:`dispatch namespace binding missing namespace`});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`dispatch_namespace`,namespace:t,...r&&{outbound:{worker:{service:r.service,environment:r.environment},params:r.parameters?.map(e=>({name:e}))}}})}),xe.forEach(({binding:e,certificate_id:t})=>{I.push({name:e,type:`mtls_certificate`,certificate_id:t})}),Se.forEach(({binding:e,stream:t,pipeline:n})=>{if(t)I.push({name:e,type:`pipelines`,stream:t});else if(n)I.push({name:e,type:`pipelines`,pipeline:n});else throw Error(`Pipeline binding must specify a stream or pipeline`)}),Ce.forEach(({binding:e,stream:t})=>{I.push({name:e,type:`k2`,stream:t})}),we.forEach(({binding:e})=>{I.push({name:e,type:`worker_loader`})}),Te.forEach(({name:e,destination:t})=>{I.push({name:e,type:`logfwdr`,destination:t})}),Ee.forEach(({binding:e,source:t})=>{I.push({name:e,type:`wasm_module`,part:e}),s.set(e,new File([`contents`in t?t.contents:c(t.path)],`path`in t?t.path??e:e,{type:`application/wasm`}))}),H!==void 0&&I.push({name:H.binding,type:`browser`,raw:H.raw}),U!==void 0&&I.push({name:U.binding,type:`analytics`}),W!==void 0&&I.push({name:W.binding,staging:W.staging,type:`ai`,raw:W.raw}),G!==void 0&&I.push({name:G.binding,type:`images`,raw:G.raw}),K!==void 0&&I.push({name:K.binding,type:`stream`}),q!==void 0&&I.push({name:q.binding,type:`media`}),J!==void 0&&I.push({name:J.binding,type:`version_metadata`}),Y!==void 0&&I.push({name:Y.binding,type:`assets`}),De.forEach(({binding:e,source:t})=>{I.push({name:e,type:`text_blob`,part:e}),e!==`__STATIC_CONTENT_MANIFEST`&&(`contents`in t?s.set(e,new File([t.contents],t.path??e,{type:`text/plain`})):s.set(e,new File([c(t.path)],t.path,{type:`text/plain`})))}),Oe.forEach(({binding:e,source:t})=>{I.push({name:e,type:`data_blob`,part:e}),s.set(e,new File([`contents`in t?t.contents:c(t.path)],`path`in t?t.path??e:e,{type:`application/octet-stream`}))});for(let[e,n]of Object.entries(t??{}))if(r(n.type)&&n.type!==`unsafe_hello_world`){let{type:t,...r}=n;I.push({name:e,type:t.slice(7),...r})}let X=`__STATIC_CONTENT_MANIFEST`;if(F?.some(({name:e})=>e===X)&&u.type===`esm`){d(F!==void 0);let e=new Set(F.map(e=>l.posix.dirname(e.name)));for(let t of e){if(t===`.`)continue;let e=l.posix.relative(t,X),n=l.posix.join(t,X);F.push({name:n,filePath:n,content:`export { default } from ${JSON.stringify(e)};`,type:`esm`})}}if(u.type===`commonjs`){for(let e of Object.values([...F||[]]))if(e.name===`__STATIC_CONTENT_MANIFEST`)s.set(e.name,new File([e.content],e.name,{type:`text/plain`})),F=F?.filter(t=>t!==e);else if(e.type===`compiled-wasm`||e.type===`text`||e.type===`buffer`){let t=e.name.replace(/[^a-zA-Z0-9_$]/g,`_`);I.push({name:t,type:e.type===`compiled-wasm`?`wasm_module`:e.type===`text`?`text_blob`:`data_blob`,part:t}),s.set(t,new File([e.content],e.name,{type:e.type===`compiled-wasm`?`application/wasm`:e.type===`text`?`text/plain`:`application/octet-stream`})),F=F?.filter(t=>t!==e)}}let Z;if(n?.unsafe?.capnp){let e=k(n.unsafe.capnp);Z=`./capnp-${Date.now()}.compiled`,s.set(Z,new File([e],Z,{type:`application/octet-stream`}))}let Q;v&&(Q??=[],Q.push(`plain_text`,`json`)),y&&(Q??=[],Q.push(`secret_text`,`secret_key`)),b&&(Q??=[],Q.push(...b));let $={...u.type===`commonjs`?{body_part:u.name}:{main_module:u.name},bindings:I,containers:e.containers===void 0?void 0:e.containers.map(e=>({...e.name!==void 0&&{name:e.name},...e.class_name!==void 0&&{class_name:e.class_name},...e.images!==void 0&&{images:e.images}})),...g&&{compatibility_date:g},..._&&{compatibility_flags:_},...p&&{migrations:p},...m&&{code_update_strategy:m},...h&&Object.keys(h).length>0&&{exports:h},capnp_schema:Z,...Q&&{keep_bindings:Q},...x!==void 0&&{logpush:x},...S&&{placement:S},...C&&{tail_consumers:C},...w&&{streaming_tail_consumers:w},...T&&{limits:T},...E&&{annotations:E},...D!==void 0&&{keep_assets:D},...O&&{assets:{jwt:O.jwt,config:P}},...A&&{observability:A},...M&&{cache_options:M},...N?.length&&{package_dependencies:N}};if(n?.unsafe?.metadata!==void 0)for(let e of Object.keys(n.unsafe.metadata))$[e]=n.unsafe.metadata[e];if(s.set(`metadata`,JSON.stringify($)),u.type===`commonjs`&&F&&F.length>0)throw TypeError(`More than one module can only be specified when type = 'esm'`);for(let e of[u].concat(F||[]))s.set(e.name,new File([e.content],e.name,{type:j(e.type??u.type??`esm`)}));for(let e of f||[])s.set(e.name,new File([e.content],e.name,{type:`application/source-map`}));return s}b(N,`createWorkerUploadForm`);export{C as a,T as c,S as i,M as n,b as o,A as r,x as s,N as t};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{B as e,
|
|
2
|
+
import{B as e,H as t,J as n,K as r,it as i,k as a,nt as o,q as s}from"./dist-BtzWfAjU.mjs";import{E as c,M as l,N as u,O as d}from"./chunk-2HLTAS5V-B92NbX1j.mjs";import{createRequire as f}from"node:module";import{chmodSync as p,existsSync as m,mkdirSync as h,rmSync as g,writeFileSync as _}from"node:fs";import v from"node:path";import ee from"node:url";import y from"node:assert";import{TextEncoder as te}from"node:util";import ne from"node:http";import{createCipheriv as re,createDecipheriv as ie,createHash as b,randomBytes as x,webcrypto as S}from"node:crypto";import{spawn as ae,spawnSync as C}from"node:child_process";f(import.meta.url||(typeof __filename==`string`?__filename:`/`));var oe=Object.defineProperty,w=(e,t)=>oe(e,`name`,{value:t,configurable:!0}),T=e();f(import.meta.url||(typeof __filename==`string`?__filename:`/`));var se=!1;function E(e){let{configOverride:t,warningLogger:n,storage:r}=e,{oauth_token:i,refresh_token:a,expiration_time:o,scopes:s,api_token:c}=t??r.read()??{};return i?{accessToken:{value:i,expiry:o??`2000-01-01:00:00:00+00:00`},refreshToken:{value:a??``},scopes:s}:c?(!se&&n&&(se=!0,n.warn(`It looks like you have used Wrangler v1's \`config\` command to login with an API token
|
|
3
3
|
from ${t===void 0?r.path():`in-memory config`}.
|
|
4
4
|
This is no longer supported in the current version of Wrangler.
|
|
5
|
-
If you wish to authenticate via an API token then please set the \`CLOUDFLARE_API_TOKEN\` environment variable.`)),{deprecatedApiToken:c}):{}}w(E,`readStoredAuthState`);var ce=
|
|
5
|
+
If you wish to authenticate via an API token then please set the \`CLOUDFLARE_API_TOKEN\` environment variable.`)),{deprecatedApiToken:c}):{}}w(E,`readStoredAuthState`);var ce=i({variableName:`CLOUDFLARE_API_TOKEN`,deprecatedName:`CF_API_TOKEN`}),le=i({variableName:`CLOUDFLARE_API_KEY`,deprecatedName:`CF_API_KEY`}),ue=i({variableName:`CLOUDFLARE_EMAIL`,deprecatedName:`CF_EMAIL`});function de(e){if(e?.allowGlobalAuthKey??!0){let e=le(),t=ue();if(e&&t)return{authKey:e,authEmail:t}}let t=ce();if(t)return{apiToken:t}}w(de,`getAuthFromEnv`);function fe(e){let t=de(e);if(t)return t;let n=E({storage:e.storage,warningLogger:e.warningLogger});if(n.deprecatedApiToken)return{apiToken:n.deprecatedApiToken};if(n.accessToken?.value)return{apiToken:n.accessToken.value}}w(fe,`getAPIToken`);function pe(e){let t=fe(e);if(!t)throw new u(`No API token found.`,{telemetryMessage:`user auth missing api token`});return t}w(pe,`requireApiToken`);var me=/^[A-Za-z0-9_-]+$/;function he(e,t){if(!me.test(e))throw new u(`Invalid account ID "${e}" ${t}. Account IDs may only contain alphanumeric characters, hyphens, and underscores.`,{telemetryMessage:`user account id invalid characters`});return e}w(he,`validateAccountId`);var D=i({variableName:`WRANGLER_AUTH_DOMAIN`,defaultValue:/* @__PURE__ */ w(()=>s()===`staging`?`dash.staging.cloudflare.com`:`dash.cloudflare.com`,`defaultValue`)}),ge=i({variableName:`WRANGLER_AUTH_URL`,defaultValue:/* @__PURE__ */ w(()=>`https://${D()}/oauth2/auth`,`defaultValue`)}),_e=i({variableName:`WRANGLER_TOKEN_URL`,defaultValue:/* @__PURE__ */ w(()=>`https://${D()}/oauth2/token`,`defaultValue`)}),ve=i({variableName:`WRANGLER_REVOKE_URL`,defaultValue:/* @__PURE__ */ w(()=>`https://${D()}/oauth2/revoke`,`defaultValue`)}),ye=i({variableName:`CLOUDFLARE_ACCOUNT_ID`,deprecatedName:`CF_ACCOUNT_ID`});function be(){let e=ye();if(e)return he(e,"set in the `CLOUDFLARE_ACCOUNT_ID` environment variable")}w(be,`getCloudflareAccountIdFromEnv`);var xe=`/oauth2/device/auth`;function Se(){return`https://${D()}${xe}`}w(Se,`getDeviceAuthUrl`);var Ce=i({variableName:`CLOUDFLARE_ACCESS_CLIENT_ID`}),we=i({variableName:`CLOUDFLARE_ACCESS_CLIENT_SECRET`}),Te=i({variableName:`WRANGLER_CF_AUTHORIZATION_TOKEN`}),Ee=o({variableName:`CLOUDFLARE_AUTH_USE_KEYRING`}),O={},k=/* @__PURE__ */ new Map;function De(e,t){let n=new URL(`https://${e}`);return t&&n.searchParams.set(`cf_workers_preview_token`,t),n.toString()}w(De,`buildProbeUrl`);function Oe(){for(let e of Object.keys(O))delete O[e];k.clear()}w(Oe,`clearAccessCaches`);async function ke(e,t,n){t.debug(`Checking if domain has Access enabled:`,e);let r=JSON.stringify([e,!!n]);if(k.has(r))return t.debug(`Using cached Access switch for:`,e,k.get(r)),k.get(r)??!1;t.debug(`Access switch not cached for:`,e);try{let i=new AbortController,a=setTimeout(()=>{i.abort()},1e3),o=await(0,T.fetch)(De(e,n),{redirect:`manual`,signal:i.signal});clearTimeout(a);let s=!!(o.status===302&&o.headers.get(`location`)?.includes(`cloudflareaccess.com`));return(s||!n)&&(t.debug(`Caching access switch for:`,e),k.set(r,s)),s}catch{return t.debug(`Access probe failed for:`,e),!1}}w(ke,`domainUsesAccess`);async function Ae(e,t){let n=t.logger,r=Ce(),i=we();if(r&&i)return n.debug(`Using Access Service Token headers for domain:`,e),{"CF-Access-Client-Id":r,"CF-Access-Client-Secret":i};if((r!==void 0||i!==void 0)&&n.warn(`Both CLOUDFLARE_ACCESS_CLIENT_ID and CLOUDFLARE_ACCESS_CLIENT_SECRET must be set to use Access Service Token authentication. Only ${r===void 0?`CLOUDFLARE_ACCESS_CLIENT_SECRET`:`CLOUDFLARE_ACCESS_CLIENT_ID`} was found.`),!await ke(e,n,t.previewToken))return{};if(n.debug(`Getting Access headers for domain:`,e),O[e])return n.debug(`Using cached Access headers for domain:`,e),O[e];if((t.isNonInteractiveOrCI??a)())throw new u(`The domain "${e}" is behind Cloudflare Access, but no Access Service Token credentials were found and the current environment is non-interactive.
|
|
6
6
|
Set the CLOUDFLARE_ACCESS_CLIENT_ID and CLOUDFLARE_ACCESS_CLIENT_SECRET environment variables to authenticate with an Access Service Token.
|
|
7
7
|
See https://developers.cloudflare.com/cloudflare-one/access-controls/service-credentials/service-tokens/`,{telemetryMessage:`user access missing service token non interactive`});n.debug(`Spawning cloudflared to get Access token for domain:`);let o=await je(De(e,t.previewToken),t.signal);if(o.error)throw new u(`To use ${t.cliDisplayName} with Cloudflare Access, please install \`cloudflared\` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation`,{telemetryMessage:`user access missing cloudflared`});let s=o.stdout;n.debug(`cloudflared output:`,s);let c=s.match(/fetched your token:\n\n(.*)/m);if(c&&c.length>=2){let t={Cookie:`CF_Authorization=${c[1]}`};return O[e]=t,n.debug(`Caching Access headers for domain:`,e),t}throw Error(`Failed to authenticate with Cloudflare Access`)}w(Ae,`getAccessHeaders`);function je(e,t){return new Promise((n,r)=>{let i=ae(`cloudflared`,[`access`,`login`,e],{signal:t}),a=[];i.stdout.on(`data`,e=>a.push(e)),i.stderr.resume();let o=/* @__PURE__ */ w(()=>i.kill(),`killChild`);process.once(`exit`,o),i.on(`error`,e=>{process.removeListener(`exit`,o),t?.aborted?r(e):n({error:e,stdout:``})}),i.on(`close`,()=>{process.removeListener(`exit`,o),t?.aborted?r(t.reason??/* @__PURE__ */ Error(`The operation was aborted`)):n({stdout:Buffer.concat(a).toString()})})})}w(je,`spawnCloudflaredAccessLogin`);async function Me(e){let t=Te();return t===void 0?Ae(D(),e):(e.logger.debug(`Using WRANGLER_CF_AUTHORIZATION_TOKEN from environment`),{Cookie:`CF_Authorization=${t}`})}w(Me,`getCloudflareAccessHeaders`);var Ne=96,Pe=32,Fe=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~`;function Ie(e){let t=btoa(e);return t=t.replace(/\+/g,`-`),t=t.replace(/\//g,`_`),t=t.replace(/=/g,``),t}w(Ie,`base64urlEncode`);async function Le(){let e=new Uint32Array(Ne);S.getRandomValues(e);let t=Ie(Array.from(e).map(e=>Fe[e%Fe.length]).join(``)),n=await S.subtle.digest(`SHA-256`,new te().encode(t)),r=new Uint8Array(n),i=``,a=r.byteLength;for(let e=0;e<a;e++)i+=String.fromCharCode(r[e]);return{codeChallenge:Ie(i),codeVerifier:t}}w(Le,`generatePKCECodes`);var Re=/* @__PURE__ */ w(({verificationUri:e,userCode:t})=>{let n=new URL(e);return n.searchParams.set(`user_code`,t),n.toString()},`generateVerificationUrl`);function ze(e){try{return new URL(e)}catch{return}}w(ze,`parseUrl`);function Be(e,t){let n=ze(e),r=ze(`https://${t.authDomain}`);if(n===void 0||r===void 0||n.protocol!==`https:`||n.username!==``||n.password!==``||n.host!==r.host)throw new u(`The authorization server returned an untrusted \`${t.field}\`: ${e}
|
|
8
|
-
Expected an \`https\` URL on \`${t.authDomain}\`. Refusing to display or open it.`,{telemetryMessage:`user device-flow untrusted verification url`})}w(Be,`assertTrustedVerificationUrl`);var Ve=/* @__PURE__ */ w(({authUrl:e,clientId:t,scopes:n,stateQueryParam:r,codeChallenge:i,redirectUri:a})=>e+`?response_type=code&client_id=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(a)}&scope=${encodeURIComponent([...n,`offline_access`].join(` `))}&state=${r}&code_challenge=${encodeURIComponent(i)}&code_challenge_method=S256`,`generateAuthUrl`);function He(e){let t=new Uint32Array(e);return S.getRandomValues(t),Array.from(t).map(e=>Fe[e%Fe.length]).join(``)}w(He,`generateRandomState`);var Ue=64e6;function We(e,t,n){let r=Array(t+1),i=b(`sha256`).update(e).digest();r[0]=i;for(let e=0;e<t;e++){for(let e=0;e<n;e++)i=b(`sha256`).update(i).digest();r[e+1]=i}return r}w(We,`solvePow`);function Ge(e){return Buffer.concat(e).toString(`base64`)}w(Ge,`encodeCheckpoints`);function Ke(e){let t=We(Buffer.from(e.seed,`base64url`),e.k,e.g);return{challengeToken:e.challengeToken,solution:{checkpoints:Ge(t)}}}w(Ke,`solveChallenge`);var A={termsOfService:`https://www.cloudflare.com/terms/`,privacyPolicy:`https://www.cloudflare.com/privacypolicy/`},
|
|
8
|
+
Expected an \`https\` URL on \`${t.authDomain}\`. Refusing to display or open it.`,{telemetryMessage:`user device-flow untrusted verification url`})}w(Be,`assertTrustedVerificationUrl`);var Ve=/* @__PURE__ */ w(({authUrl:e,clientId:t,scopes:n,stateQueryParam:r,codeChallenge:i,redirectUri:a})=>e+`?response_type=code&client_id=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(a)}&scope=${encodeURIComponent([...n,`offline_access`].join(` `))}&state=${r}&code_challenge=${encodeURIComponent(i)}&code_challenge_method=S256`,`generateAuthUrl`);function He(e){let t=new Uint32Array(e);return S.getRandomValues(t),Array.from(t).map(e=>Fe[e%Fe.length]).join(``)}w(He,`generateRandomState`);var Ue=64e6;function We(e,t,n){let r=Array(t+1),i=b(`sha256`).update(e).digest();r[0]=i;for(let e=0;e<t;e++){for(let e=0;e<n;e++)i=b(`sha256`).update(i).digest();r[e+1]=i}return r}w(We,`solvePow`);function Ge(e){return Buffer.concat(e).toString(`base64`)}w(Ge,`encodeCheckpoints`);function Ke(e){let t=We(Buffer.from(e.seed,`base64url`),e.k,e.g);return{challengeToken:e.challengeToken,solution:{checkpoints:Ge(t)}}}w(Ke,`solveChallenge`);var qe=`--temporary-account`,A={termsOfService:`https://www.cloudflare.com/terms/`,privacyPolicy:`https://www.cloudflare.com/privacypolicy/`},Je=`You must accept Cloudflare's Terms of Service (${A.termsOfService}) and Privacy Policy (${A.privacyPolicy}) in order to continue. By typing "yes", you agree to these terms. Type "yes" to continue.`,Ye=`Continuing means you accept Cloudflare's Terms of Service (${A.termsOfService}) and Privacy Policy (${A.privacyPolicy}).`,Xe=/* @__PURE__ */ new Map([[1035,{message:`The event code is malformed. Check it and try again.`,telemetryMessage:`deploy temporary event code invalid`}],[1036,{message:`The event code was not found. Check it and try again.`,telemetryMessage:`deploy temporary event not found`}],[1037,{message:`This event has not started yet.`,telemetryMessage:`deploy temporary event not started`}],[1038,{message:`This event has ended.`,telemetryMessage:`deploy temporary event expired`}],[1039,{message:`This event is disabled. Contact the event organizer.`,telemetryMessage:`deploy temporary event disabled`}],[1040,{message:`This event has no temporary accounts remaining.`,telemetryMessage:`deploy temporary event exhausted`}],[1041,{message:`The event account could not be prepared. Try again later or contact the event organizer.`,telemetryMessage:`deploy temporary event provisioning unavailable`,fatal:!0}]]);function Ze(e){if(typeof e!=`object`||!e||!(`errors`in e))return;let{errors:t}=e;if(!Array.isArray(t)||t.length===0)return;let[n]=t;if(typeof n==`object`&&n&&`code`in n)return typeof n.code==`number`?n.code:void 0}w(Ze,`getResponseErrorCode`);async function Qe(e){let t;try{t=await e.json()}catch{return}let n=Ze(t);if(n===void 0)return;let r=Xe.get(n);if(!r)return;let i={telemetryMessage:r.telemetryMessage};return r.fatal?new l(r.message,i):new u(r.message,i)}w(Qe,`getEventAccountError`);function $e(){return`${r(t)}/provisioning/previews`}w($e,`getTemporaryPreviewUrl`);function et(){return`${$e()}/challenge`}w(et,`getTemporaryPreviewChallengeUrl`);function tt(e){let t=Date.parse(e);return!Number.isNaN(t)&&t>Date.now()}w(tt,`isFutureTimestamp`);function nt(e){let t=e.read();if(t&&t.account?.id&&t.account?.apiToken&&t.account?.name&&t.claim?.url&&tt(t.account?.expiresAt??``)&&tt(t.claim?.expiresAt??``))return t}w(nt,`getCachedTemporaryPreviewAccount`);async function rt(e,t){let n=await(0,T.fetch)(et(),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!n.ok)throw new l(`Failed to request a proof-of-work challenge (${n.status} ${n.statusText}).`,{telemetryMessage:`deploy temporary account challenge failed`});let r;try{r=await n.json()}catch{throw new l(`Failed to request a proof-of-work challenge. Received an invalid response (${n.status} ${n.statusText}).`,{telemetryMessage:`deploy temporary account challenge invalid response`})}let{challengeToken:i,seed:a,k:o,g:s}=r.result??{};if(i===void 0||a===void 0||o===void 0||s===void 0)throw new l(`Failed to request a proof-of-work challenge because the response was missing required fields.`,{telemetryMessage:`deploy temporary account challenge incomplete`});if(!Number.isInteger(o)||!Number.isInteger(s)||o<=0||s<=0||o*s>Ue||Buffer.from(a,`base64url`).length!==32)throw new l(`The proof-of-work challenge is not supported by this version of ${t}.`,{telemetryMessage:`deploy temporary account challenge difficulty unsupported`});return e.log(`Solving proof-of-work challenge…`),Ke({challengeToken:i,seed:a,k:o,g:s})}w(rt,`requestPowSolution`);async function it(e,t,n=`Wrangler`){let r=await rt(e,n),i=await(0,T.fetch)($e(),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({termsOfService:A.termsOfService,privacyPolicy:A.privacyPolicy,acceptTermsOfService:`yes`,challengeToken:r.challengeToken,solution:r.solution,...t?.eventCode?{eventCode:t.eventCode}:{}})});if(!i.ok){if(t?.eventCode){let e=await Qe(i);if(e)throw e}throw new l(`Failed to create a temporary preview account (${i.status} ${i.statusText}).`,{telemetryMessage:`deploy temporary account create failed`})}let a;try{a=await i.json()}catch{throw new l(`Failed to create a temporary preview account. Received an invalid response (${i.status} ${i.statusText}).`,{telemetryMessage:`deploy temporary account invalid response`})}let o=a.result,s=o?.account?.id,c=o?.account?.name,u=o?.account?.apiToken,d=o?.account?.expiresAt,f=o?.claim?.url,p=o?.claim?.expiresAt,m=o?.eventCodeAccepted;if(s===void 0||c===void 0||u===void 0||d===void 0||f===void 0||p===void 0)throw new l(`Failed to create a temporary preview account because the response was missing required fields.`,{telemetryMessage:`deploy temporary account response incomplete`});if(t?.eventCode&&m!==!0)throw new l(`Failed to create a temporary preview account because the response did not acknowledge the event code.`,{telemetryMessage:`deploy temporary event acknowledgement missing`});return{account:{id:s,name:c,apiToken:u,expiresAt:d},claim:{url:f,expiresAt:p}}}w(it,`createTemporaryPreviewAccount`);async function at(e){let t=nt(e.storage);if(t){if(e.request?.eventCode)throw new u(`A temporary account is already cached. Rerun without --event-code to reuse it, or run \`${e.logoutCommand??`wrangler logout`}\` and retry to create an account for this event.`,{telemetryMessage:`deploy temporary event cache conflict`});return{account:t,cached:!0}}if(!await e.prompt(Je,Ye))throw new u(`You must accept Cloudflare's Terms of Service (${A.termsOfService}) and Privacy Policy (${A.privacyPolicy}) to use ${e.temporaryAccountFlag??`--temporary-account`}.`,{telemetryMessage:`user temporary terms not accepted`});let n=await it(e.temporaryAccountLogger,e.request,e.cliDisplayName);return e.storage.write(n),{account:n,cached:!1}}w(at,`getOrCreateTemporaryPreviewAccount`);function ot(e){var t=[...arguments].slice(1),n=Array.from(typeof e==`string`?[e]:e);n[n.length-1]=n[n.length-1].replace(/\r?\n([\t ]*)$/,``);var r=n.reduce(function(e,t){var n=t.match(/\n([\t ]+|(?!\s).)/g);return n?e.concat(n.map(function(e){return e.match(/[\t ]/g)?.length??0})):e},[]);if(r.length){var i=RegExp(`
|
|
9
9
|
[ ]{`+Math.min.apply(Math,r)+`}`,`g`);n=n.map(function(e){return e.replace(i,`
|
|
10
10
|
`)})}n[0]=n[0].replace(/^\r?\n/,``);var a=n[0];return t.forEach(function(e,t){var r=a.match(/(?:^|\n)( *)$/),i=r?r[1]:``,o=e;typeof e==`string`&&e.includes(`
|
|
11
11
|
`)&&(o=String(e).split(`
|
|
@@ -53,10 +53,10 @@ Enable debug logging to see the full response.`,{telemetryMessage:`user device-f
|
|
|
53
53
|
Opening a link in your default browser: ${s}`),await r(s));let l=Date.now()+c*1e3,d=Math.max(a.interval??Pt,Pt),f=!0,p;for(;Date.now()<l;){f||await Vt(d),f=!1;let r;try{r=await Bt(a.device_code,e.clientId,n,i,t.cliDisplayName)}catch(e){n.debug(`Ignoring transient error while polling for token:`,e),p=e instanceof Error?e.message:String(e);continue}if(r.kind===`unexpected`){if(!r.retryable)throw new u(`The token endpoint returned a response that could not be interpreted (${r.detail}).
|
|
54
54
|
Enable debug logging to see the full response.`,{telemetryMessage:`user device-flow unusable token response`});n.debug(`Ignoring transient response while polling for token:`,r.detail),p=r.detail;continue}if(p=void 0,r.kind===`oauth-error`)switch(r.error){case`authorization_pending`:continue;case`slow_down`:d+=5;continue;case`access_denied`:throw new u(`Consent denied. You must grant consent to ${t.cliDisplayName} in order to login.
|
|
55
55
|
If you don't want to do this consider passing an API token via the \`CLOUDFLARE_API_TOKEN\` environment variable.`,{telemetryMessage:`user device-flow consent denied`});case`expired_token`:throw new u(`Device code expired before the request was approved. Please run \`${t.deviceLoginCommand}\` again to obtain a new code.`,{telemetryMessage:`user device-flow code expired`});default:throw N(r.error)}let{grant:o}=r;return{token:{value:o.access_token,expiry:new Date(Date.now()+o.expires_in*1e3).toISOString()},scopes:o.scope?o.scope.split(` `):[],refreshToken:o.refresh_token?{value:o.refresh_token}:void 0}}throw p===void 0?new u(`Device authorization timed out after ${Ut(c)}. Please run \`${t.deviceLoginCommand}\` again to obtain a new code.`,{telemetryMessage:`user device-flow authorization timeout`}):new u(`Gave up waiting for device authorization: the token endpoint kept returning responses that could not be interpreted (last: ${p}).
|
|
56
|
-
Enable debug logging to see the full response, then run \`${t.deviceLoginCommand}\` to try again.`,{telemetryMessage:`user device-flow poll failed`})}w(Ht,`getOauthTokenViaDeviceFlow`);function Ut(e){if(e<60)return`${e} seconds`;let t=Math.floor(e/60),n=t===1?`minute`:`minutes`,r=e%60;return r===0?`${t} ${n}`:r==59?`${t+1} ${n}`:`${t} ${n} and ${r} ${r===1?`second`:`seconds`}`}w(Ut,`toHumanPeriod`);function Wt(e){let t={},
|
|
56
|
+
Enable debug logging to see the full response, then run \`${t.deviceLoginCommand}\` to try again.`,{telemetryMessage:`user device-flow poll failed`})}w(Ht,`getOauthTokenViaDeviceFlow`);function Ut(e){if(e<60)return`${e} seconds`;let t=Math.floor(e/60),n=t===1?`minute`:`minutes`,r=e%60;return r===0?`${t} ${n}`:r==59?`${t+1} ${n}`:`${t} ${n} and ${r} ${r===1?`second`:`seconds`}`}w(Ut,`toHumanPeriod`);function Wt(e){let t={},r={generateAuthUrl:e.generateAuthUrl??Ve,generateRandomState:e.generateRandomState??He},i=`default`;function a(t){return e.storageFactory(t??i)}w(a,`getStorage`);let o=/* @__PURE__ */ w(()=>typeof e.clientId==`function`?e.clientId():e.clientId,`getClientId`),s=e.consent,c,l,d=new URL(e.redirectUri),f=d.hostname,p=Number(d.port);async function m(i){if(e.hasEnvCredentials())return e.logger.error(`You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log in via OAuth.`),!1;let c=n(i.complianceConfig);if(c===`fedramp_high`){let e=i.complianceConfig?.compliance_region?"`compliance_region` configuration property":"`CLOUDFLARE_API_ENVIRONMENT` environment variable";throw new u(st`
|
|
57
57
|
OAuth login is not supported in the \`${c}\` compliance region.
|
|
58
58
|
Please use a Cloudflare API token (\`CLOUDFLARE_API_TOKEN\` environment variable) or remove the ${e}.
|
|
59
|
-
`,{telemetryMessage:`user login unsupported compliance region`})}let l;return
|
|
59
|
+
`,{telemetryMessage:`user login unsupported compliance region`})}let l;return i.device?(e.logger.log(`Attempting to login via OAuth Device Authorization Grant...`),l=await Ht({browser:i.browser??!0,scopes:i.scopes,clientId:o()},e)):(e.logger.log(`Attempting to login via OAuth...`),l=await Mt({browser:i.browser??!0,scopes:i.scopes,clientId:o(),redirectUri:e.redirectUri,denied:s.denied,granted:s.granted,callbackHost:i.callbackHost??f,callbackPort:i.callbackPort??p},t,e,r)),a(i.profile).write({oauth_token:l.token?.value??``,expiration_time:l.token?.expiry,refresh_token:l.refreshToken?.value,scopes:l.scopes}),e.logger.log(`Successfully logged in.`),x(),e.purgeOnLoginOrLogout?.(),!0}w(m,`login`);function h(t){if(e.hasEnvCredentials())return!1;let{accessToken:n}=E({warningLogger:e.logger,storage:a(t)});return!!(n&&/* @__PURE__ */ new Date>=new Date(n.expiry))}w(h,`isRefreshNeeded`);async function g(t){let n=a(t);try{let{token:{value:t,expiry:r}={value:``,expiry:``},refreshToken:{value:i}={},scopes:a}=await kt(e.logger,e.isNonInteractiveOrCI,o(),n,e.cliDisplayName);return n.write({oauth_token:t,expiration_time:r,refresh_token:i,scopes:a}),`refreshed`}catch(t){return e.logger.debug(`Token refresh failed: ${t instanceof Error?t.message:String(t)}`),t instanceof lt||t instanceof Error&&t.name===`TimeoutError`?`unreachable`:`rejected`}}w(g,`refreshToken`);async function _(t){if(e.hasEnvCredentials())return{loggedIn:!0};let n=E({warningLogger:e.logger,storage:a(t.profile)});if(!n.accessToken&&!n.deprecatedApiToken)return e.isNonInteractiveOrCI()?{loggedIn:!1,reason:`no-credentials-non-interactive`}:await m(t)?{loggedIn:!0}:{loggedIn:!1,reason:`no-credentials-login-failed`};if(h(t.profile)){let n=await g(t.profile);return n===`refreshed`?{loggedIn:!0}:n===`unreachable`?{loggedIn:!1,reason:`token-refresh-unreachable`}:e.isNonInteractiveOrCI()?{loggedIn:!1,reason:`token-expired-non-interactive`}:await m(t)?{loggedIn:!0}:{loggedIn:!1,reason:`token-expired-login-failed`}}return{loggedIn:!0}}w(_,`loginOrRefreshIfRequired`);async function v(t){let n=x();if(e.hasEnvCredentials()){e.logger.log(`You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log out.`);return}let r=E({warningLogger:e.logger,storage:a(t)}).refreshToken;if(!r){e.logger.log(n?`Cleared temporary preview account.`:`Not logged in, exiting...`);return}let i=`client_id=${encodeURIComponent(o())}&token_type_hint=refresh_token&token=${encodeURIComponent(r.value||``)}`;await(await(0,T.fetch)(ve(),{method:`POST`,body:i,headers:{"Content-Type":`application/x-www-form-urlencoded`}})).text(),a(t).clear(),e.logger.log(`Successfully logged out.`),e.purgeOnLoginOrLogout?.()}w(v,`logout`);async function ee(){let t=E({warningLogger:e.logger,storage:a()});if(t.accessToken){if(t.accessToken&&/* @__PURE__ */ new Date>=new Date(t.accessToken.expiry)){if(await g()!==`refreshed`)return;t=E({warningLogger:e.logger,storage:a()})}return t.accessToken?.value}}w(ee,`getOAuthTokenFromLocalState`);function y(){return l?{apiToken:l.account.apiToken}:fe({storage:a(),warningLogger:e.logger,allowGlobalAuthKey:e.allowGlobalAuthKey})}w(y,`getAPITokenInternal`);function te(){return l?{apiToken:l.account.apiToken}:pe({storage:a(),warningLogger:e.logger,allowGlobalAuthKey:e.allowGlobalAuthKey})}w(te,`requireApiTokenInternal`);function ne(t,n){c=t&&e.temporary!==void 0?n??{}:void 0,l=void 0}w(ne,`setTemporaryAllowed`);function re(){return c!==void 0}w(re,`isTemporaryAllowed`);function ie(){return l}w(ie,`getActiveTemporaryAccount`);async function b(){if(!e.temporary)throw new u(`Temporary preview accounts are not supported by ${e.cliDisplayName}.`,{telemetryMessage:`user temporary account unsupported`});let t=await at({...e.temporary,...c?{request:c}:{}});return l=t.account,t}w(b,`activateTemporaryAccount`);function x(){return l=void 0,e.temporary?.storage.clear()??!1}w(x,`clearTemporaryAccount`);function S(e){i=e}w(S,`setProfile`);function ae(){return i}w(ae,`getActiveProfile`);function C(){return E({warningLogger:e.logger,storage:a()}).scopes}return w(C,`getScopes`),{setProfile:S,getActiveProfile:ae,login:m,logout:v,loginOrRefreshIfRequired:_,getOAuthTokenFromLocalState:ee,getAPIToken:y,requireApiToken:te,getScopes:C,setTemporaryAllowed:ne,isTemporaryAllowed:re,getActiveTemporaryAccount:ie,activateTemporaryAccount:b}}w(Wt,`createOAuthFlow`);var Gt=[`default`,`staging`];function Kt(e){let t={read(){return e.bindings.read()},write(t){e.bindings.write(t)},activate(t,n){let r=v.resolve(n),i=e.bindings.read();i[r]=t,e.bindings.write(i)},deactivate(t){let n=v.resolve(t),r=e.bindings.read(),i=r[n];if(i===void 0){let e=Jt(n,r);throw e?new u(`No profile is directly bound to "${qt(n)}". The active profile "${e.profile}" is bound at "${qt(e.dir)}". Run the deactivate command from that directory instead.`,{telemetryMessage:`auth deactivate wrong directory`}):new u(`No profile is bound to "${qt(n)}". Nothing to deactivate.`,{telemetryMessage:`auth deactivate no binding`})}delete r[n],e.bindings.write(r);let a=Jt(n,r);return a?{removedProfile:i,newResolution:{profile:a.profile,source:`inherited from ${a.dir}`}}:e.configs.exists(`default`)?{removedProfile:i,newResolution:{profile:`default`,source:`default profile`}}:{removedProfile:i,newResolution:{profile:void 0,source:`no profile`}}},getProfileForDirectory(t){return Jt(t,e.bindings.read())?.profile},getBindingsForProfile(t){return Object.entries(e.bindings.read()).filter(([,e])=>e===t).map(([e])=>e)},removeAllBindingsForProfile(t){let n=e.bindings.read(),r=[];for(let[e,i]of Object.entries(n))i===t&&(r.push(e),delete n[e]);return r.length>0&&e.bindings.write(n),r}};return{configs:e.configs,bindings:t,resolve(e){return e.profile?e.profile==="default"?`default`:(z(e.profile),e.profile):t.getProfileForDirectory(e.cwd)||`default`}}}w(Kt,`createProfileStore`);function z(e){if(Gt.includes(e.toLowerCase()))throw new u(`"${e}" is a reserved profile name. Use the login and logout commands to manage the default profile, which applies as a global fallback.`,{telemetryMessage:`auth profile reserved name`});if(!/^[a-zA-Z0-9_-]+$/.test(e))throw new u(`Invalid profile name "${e}". Profile names may only contain alphanumeric characters, hyphens, and underscores.`,{telemetryMessage:`auth profile invalid name`})}w(z,`validateProfileName`);function qt(e){return v.relative(process.cwd(),e)||`.`}w(qt,`formatDirectoryForUserError`);function Jt(e,t){let n=v.resolve(e),r=Object.entries(t).sort(([e],[t])=>t.length-e.length);for(let[e,t]of r)if(n===e||n.startsWith(e)&&n[e.length]===v.sep)return{profile:t,dir:e}}w(Jt,`getProfileForDirectoryFromBindings`);var Yt=/^[a-z0-9-_]+$/i,Xt=!!``.isWellFormed;function B(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(typeof e.getUTCDate==`function`&&e instanceof Date)return`date`;if(globalThis.Temporal){if(e.until){if(e instanceof Temporal.ZonedDateTime)return`temporal/tz+uc`;if(e instanceof Temporal.PlainDateTime||e instanceof Temporal.PlainDate)return`temporal/uc`;if(e instanceof Temporal.PlainTime||e instanceof Temporal.Instant)return`temporal`;if(e instanceof Temporal.PlainYearMonth)return`temporal/x`}else if(e.toPlainDate&&e instanceof Temporal.PlainMonthDay||e.negated&&e instanceof Temporal.Duration)return`temporal/x`}}return t}w(B,`extendedTypeOf`);function Zt(e){for(let t=0;t<e.length;t++)if(B(e[t])!==`object`)return!1;return e.length!=0}w(Zt,`isArrayOfTables`);function Qt(e){return JSON.stringify(e).replaceAll(``,`\\u007f`)}w(Qt,`formatWellFormedStringUnchecked`);function $t(e){return Qt(Xt?e.toWellFormed():e)}w($t,`formatString`);function en(e){if(Yt.test(e))return e;if(Xt&&!e.isWellFormed())throw RangeError(`key contains illegal lone surrogates`);return Qt(e)}w(en,`formatKey`);function V(e,t,n,r,i){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);switch(t){case`number`:if(isNaN(e))return`nan`;if(e===1/0)return`inf`;if(e===-1/0)return`-inf`;if(Number.isInteger(e)&&(r||!Number.isSafeInteger(e)))return e.toFixed(1);case`bigint`:case`boolean`:case`temporal`:return e.toString();case`string`:return $t(e);case`date`:if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString();case`object`:return tn(e,n,r,i);case`array`:return nn(e,n,r,i);case`temporal/tz+uc`:if(i){let t=e.timeZoneId,n=t.charCodeAt(0);if(n!==43&&n!==45&&(n!==85&&n!==71&&n!==90&&n!==69||t!==`UTC`&&t!==`UCT`&&t!==`Universal`&&t!==`Zulu`&&!t.startsWith(`GMT`)&&t!==`Greenwich`&&!t.startsWith(`Etc/`)))throw TypeError(`Temporal objects with an IANA timezone are not allowed in Temporal strict mode`)}case`temporal/uc`:if(i&&e.calendarId!==`iso8601`)throw TypeError(`Temporal objects with a non-default calendar are not allowed in Temporal strict mode`);return e.toString({calendarName:`never`,timeZoneName:`never`});case`temporal/x`:throw TypeError(`Unsupported `+e[Symbol.toStringTag])}}w(V,`stringifyValue`);function tn(e,t,n,r){let i=Object.keys(e);if(i.length===0)return`{}`;let a=`{ `;for(let o=0;o<i.length;o++){let s=i[o];o&&(a+=`, `),a+=en(s)+` = `+V(e[s],B(e[s]),t-1,n,r)}return a+` }`}w(tn,`stringifyInlineTable`);function nn(e,t,n,r){if(e.length===0)return`[]`;let i=`[ `;for(let a=0;a<e.length;a++){if(a&&(i+=`, `),e[a]===null||e[a]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);i+=V(e[a],B(e[a]),t-1,n,r)}return i+` ]`}w(nn,`stringifyArray`);function rn(e,t,n,r,i){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``;for(let o=0;o<e.length;o++)a+=`${a&&`
|
|
60
60
|
`}[[${t}]]
|
|
61
61
|
`,a+=H(0,e[o],t,n,r,i);return a}w(rn,`stringifyArrayTable`);function H(e,t,n,r,i,a){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let o=``,s=``,c=Object.keys(t);for(let e=0;e<c.length;e++){let l=c[e];if(t[l]!==null&&t[l]!==void 0){let e=B(t[l]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let c=en(l);if(e===`array`&&Zt(t[l]))s+=(s&&`
|
|
62
62
|
`)+rn(t[l],n?`${n}.${c}`:c,r-1,i,a);else if(e===`object`){let e=n?`${n}.${c}`:c;s+=(s&&`
|
|
@@ -65,7 +65,7 @@ Enable debug logging to see the full response, then run \`${t.deviceLoginCommand
|
|
|
65
65
|
${o}`:`[${e}]`),o&&s?`${o}
|
|
66
66
|
${s}`:o||s}w(H,`stringifyTable`);function an(e,{maxDepth:t=1e3,numbersAsFloat:n=!1,strictTemporal:r=!1}={}){if(B(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let i=H(0,e,``,t,n,r);return i[i.length-1]===`
|
|
67
67
|
`?i:i+`
|
|
68
|
-
`}w(an,`stringify`);var on={toml:{parse:/* @__PURE__ */ w(e=>c(e),`parse`),stringify:/* @__PURE__ */ w(e=>an(e),`stringify`)},json:{parse:/* @__PURE__ */ w(e=>JSON.parse(e),`parse`),stringify:/* @__PURE__ */ w(e=>JSON.stringify(e,null,` `),`stringify`)}};function U(e,t){return on[e].parse(t)}w(U,`parseFile`);function W(e,t){return on[e].stringify(t)}w(W,`stringifyFile`);var sn=`config`;function G(e){if(e===void 0||e==="default"){let e=
|
|
68
|
+
`}w(an,`stringify`);var on={toml:{parse:/* @__PURE__ */ w(e=>c(e),`parse`),stringify:/* @__PURE__ */ w(e=>an(e),`stringify`)},json:{parse:/* @__PURE__ */ w(e=>JSON.parse(e),`parse`),stringify:/* @__PURE__ */ w(e=>JSON.stringify(e,null,` `),`stringify`)}};function U(e,t){return on[e].parse(t)}w(U,`parseFile`);function W(e,t){return on[e].stringify(t)}w(W,`stringifyFile`);var sn=`config`;function G(e){if(e===void 0||e==="default"){let e=s();return e===`production`?`default`:e}return z(e),e}w(G,`resolveAuthProfileBaseName`);function K(e,t,n=`toml`){return v.join(e,sn,`${G(t)}.${n}`)}w(K,`getAuthConfigFilePath`);var q=class{constructor(e,t,n=`toml`){this.configPath=e,this.profile=t,this.format=n}static{w(this,`FileCredentialStore`)}kind=`file`;filePath(){return K(this.configPath,this.profile,this.format)}read(){let e=this.filePath();if(m(e))return U(this.format,d(e))}write(e){let t=this.filePath();h(v.dirname(t),{recursive:!0}),_(t,W(this.format,e),{encoding:`utf-8`,mode:384}),p(t,384)}clear(){let e=this.filePath(),t=m(e);return t&&g(e),t}path(){return this.filePath()}describe(){return this.filePath()}},J=32,cn=12,ln=16,un=`AES-256-GCM`,dn=`aes-256-gcm`;function fn(){return new Uint8Array(x(J))}w(fn,`generateKey`);function pn(e,t){if(t.length!==J)throw Error(`AES-256-GCM requires a ${J}-byte key (got ${t.length} bytes).`);let n=x(cn),r=re(dn,t,n),i=Buffer.concat([r.update(e,`utf-8`),r.final()]),a=r.getAuthTag();return{v:1,alg:un,iv:n.toString(`base64`),tag:a.toString(`base64`),ciphertext:i.toString(`base64`)}}w(pn,`encryptString`);function mn(e,t){if(t.length!==J)throw Error(`AES-256-GCM requires a ${J}-byte key (got ${t.length} bytes).`);if(e.v!==1)throw Error(`Unsupported encrypted envelope version: ${e.v}.`);let n=Buffer.from(e.iv,`base64`),r=Buffer.from(e.tag,`base64`),i=Buffer.from(e.ciphertext,`base64`);if(n.length!==cn)throw Error(`Expected ${cn}-byte IV in envelope (got ${n.length} bytes).`);if(r.length!==ln)throw Error(`Expected ${ln}-byte auth tag in envelope (got ${r.length} bytes).`);let a=ie(dn,t,n);return a.setAuthTag(r),Buffer.concat([a.update(i),a.final()]).toString(`utf-8`)}w(mn,`decryptString`);function hn(e){if(typeof e!=`object`||!e)return;let t=e;if(t.v===1&&t.alg===un&&typeof t.iv==`string`&&typeof t.tag==`string`&&typeof t.ciphertext==`string`)return t}w(hn,`parseEncryptedEnvelope`);function Y(e,t){return v.join(e,`config`,`${G(t)}.enc`)}w(Y,`getEncryptedAuthConfigFilePath`);var gn=class{constructor(e,t,n,r,i=`toml`){this.configPath=e,this.keyProvider=t,this.onPlaintextMigration=n,this.profile=r,this.format=i}static{w(this,`EncryptedFileCredentialStore`)}kind=`encrypted-file`;plaintextPath(){return K(this.configPath,this.profile,this.format)}read(){let e=Y(this.configPath,this.profile);if(m(e))return this.readEncryptedFile(e);let t=this.plaintextPath();if(m(t))return this.migrateFromPlaintext(t,e)}write(e){let t=this.ensureKey(),n=pn(W(this.format,e),t),r=Y(this.configPath,this.profile);h(v.dirname(r),{recursive:!0}),_(r,JSON.stringify(n,null,` `),{encoding:`utf-8`,mode:384}),p(r,384);let i=this.plaintextPath();m(i)&&g(i)}clear(){let e=Y(this.configPath,this.profile),t=this.plaintextPath(),n=!1;m(e)&&(g(e),n=!0),m(t)&&(g(t),n=!0);try{this.keyProvider.deleteKey()}catch{}return n}path(){return Y(this.configPath,this.profile)}describe(){return`Encrypted file (${Y(this.configPath,this.profile)}) with key in ${this.keyProvider.describe()}`}readEncryptedFile(e){let t=this.keyProvider.getKey();if(t===void 0)return;let n=d(e),r;try{r=hn(JSON.parse(n))}catch{return}if(r===void 0)return;let i;try{i=mn(r,t)}catch{return}try{return U(this.format,i)}catch{return}}migrateFromPlaintext(e,t){let n=d(e),r;try{r=U(this.format,n)}catch{return}return this.write(r),this.onPlaintextMigration?.({plaintextPath:e,encryptedPath:t,keyProviderDescription:this.keyProvider.describe()}),r}ensureKey(){let e=this.keyProvider.getKey();if(e!==void 0)return e;let t=fn();return this.keyProvider.setKey(t),t}},X=`1.3.0`;function _n(e){return C(`npm`,e,{encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`],shell:process.platform===`win32`})}w(_n,`defaultNpmRunner`);var vn=_n,Z=/* @__PURE__ */ new Map;function yn(e){vn=e??_n,Z.clear()}w(yn,`setNpmRunner`);function bn(e){return v.join(e,`native`,`keyring`)}w(bn,`getKeyringInstallDir`);function xn(e){return v.join(e,`node_modules`,`@napi-rs`,`keyring`)}w(xn,`getInstalledBindingPath`);function Sn(e){try{return f(e)(e),!0}catch{return!1}}w(Sn,`canLoadKeyringBinding`);function Cn(e){let t=Z.get(e);if(t!==void 0)return t;let n=xn(e);if(m(v.join(n,`index.js`))&&Sn(n))return Z.set(e,n),n;try{let t=vn([`root`,`-g`]);if(t.status===0){let n=v.join(t.stdout.trim(),`@napi-rs`,`keyring`);if(m(v.join(n,`index.js`))&&Sn(n))return Z.set(e,n),n}}catch{}return Z.set(e,null),null}w(Cn,`findKeyringBinding`);function wn(e){let t=e;h(t,{recursive:!0});let n=v.join(t,`package.json`);m(n)||_(n,JSON.stringify({private:!0,name:`cloudflare-auth-keyring-host`},null,` `),`utf-8`);let r;try{r=vn([`install`,`@napi-rs/keyring@${X}`,`--prefix`,t,`--no-save`,`--no-audit`,`--no-fund`,`--no-package-lock`,`--loglevel=error`])}catch(e){throw new u(`Failed to spawn \`npm\` to install the keyring backend: ${e instanceof Error?e.message:String(e)}
|
|
69
69
|
|
|
70
70
|
Install \`npm\` and retry, or install the binding globally:
|
|
71
71
|
npm install -g @napi-rs/keyring@${X}`,{telemetryMessage:`workers-auth keyring npm spawn failed`})}if(r.status!==0)throw new u(`Failed to install \`@napi-rs/keyring\` (npm exited ${r.status}):
|
|
@@ -96,7 +96,7 @@ Run \`${e} --use-keyring\` interactively to install it automatically, or install
|
|
|
96
96
|
|
|
97
97
|
npm install -g @napi-rs/keyring@${X}
|
|
98
98
|
|
|
99
|
-
Or disable keyring storage: \`${e} --no-use-keyring\`.`}w(er,`windowsBindingMissingMessage`);function tr(e){let t=Y(e.configPath,e.profile),n=m(t),r=Un(e.serviceName,e.profile,e.configPath);return r.kind===`available`?(new gn(e.configPath,r.provider,void 0,e.profile,e.format??`toml`).clear(),{backendAvailable:!0,encryptedFileExisted:n}):(n&&g(t),{backendAvailable:!1,encryptedFileExisted:n})}w(tr,`scrubEncryptedCredentials`);
|
|
99
|
+
Or disable keyring storage: \`${e} --no-use-keyring\`.`}w(er,`windowsBindingMissingMessage`);function tr(e){let t=Y(e.configPath,e.profile),n=m(t),r=Un(e.serviceName,e.profile,e.configPath);return r.kind===`available`?(new gn(e.configPath,r.provider,void 0,e.profile,e.format??`toml`).clear(),{backendAvailable:!0,encryptedFileExisted:n}):(n&&g(t),{backendAvailable:!1,encryptedFileExisted:n})}w(tr,`scrubEncryptedCredentials`);var nr=class extends u{constructor(e,t,n){super(e,{telemetryMessage:n}),this.reason=t}static{w(this,`AuthenticationError`)}};
|
|
100
100
|
/*! Bundled license information:
|
|
101
101
|
|
|
102
102
|
smol-toml/dist/error.js:
|
|
@@ -360,4 +360,4 @@ smol-toml/dist/index.js:
|
|
|
360
360
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
361
361
|
*)
|
|
362
362
|
*/
|
|
363
|
-
export{
|
|
363
|
+
export{w as _,Kt as a,de as c,Y as d,U as f,z as g,he as h,Wt as i,be as l,W as m,qe as n,ot as o,tr as p,qn as r,K as s,nr as t,Ee as u};
|