cf 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_meta/agent-context.json +78 -41
- package/dist/_meta/commands.json +19888 -21071
- package/dist/_meta/schemas.json +14305 -15328
- package/dist/abuse-reports-BsF9JZPW.mjs +8 -0
- package/dist/account-D8mYiWxQ.mjs +2 -0
- package/dist/accounts-CJci1Oez.mjs +23 -0
- package/dist/acm-CmCd985Q.mjs +3 -0
- package/dist/addressing-R7p6TRBe.mjs +12 -0
- package/dist/{agent-context-CKb6w43K.mjs → agent-context-Bzl5PGW-.mjs} +1 -1
- package/dist/ai-BzJg0RIX.mjs +3 -0
- package/dist/ai-audit-B0vJNOZG.mjs +2 -0
- package/dist/ai-gateway-D3vJR3My.mjs +10 -0
- package/dist/ai-search-CNg7W7U4.mjs +7 -0
- package/dist/alerting-_sdM0B0S.mjs +6 -0
- package/dist/alerts-dpT6Qsdu.mjs +2 -0
- package/dist/{analytics-CwFrx-Dr.mjs → analytics-BFBJhDrP.mjs} +1 -1
- package/dist/analytics_engine-CWhFvyeK.mjs +2 -0
- package/dist/{api-gateway-D9PMVVqL.mjs → api-gateway-D4AIEtUq.mjs} +10 -10
- package/dist/argo-Bjk6nFfs.mjs +2 -0
- package/dist/artifacts-Ba4b3iOa.mjs +4 -0
- package/dist/{audit-logs-BvQ9uwuy.mjs → audit-logs-BE0T5All.mjs} +1 -1
- package/dist/{auth-DX9KnJ0P.mjs → auth-CZ0E51rF.mjs} +3 -3
- package/dist/auth-D_zyQbDR.mjs +5 -0
- package/dist/autorag-Cnpp8PAG.mjs +2 -0
- package/dist/billing-Dz6Zj8Eq.mjs +2 -0
- package/dist/bot-management-pFwIbFi-.mjs +5 -0
- package/dist/botnet-feed-BY9uGChY.mjs +3 -0
- package/dist/brand-protection-DkPAk2Cz.mjs +3 -0
- package/dist/brands-CGpk9nZB.mjs +2 -0
- package/dist/browser-extension-D9P6Yv8i.mjs +3 -0
- package/dist/browser-run-DhHtz4y3.mjs +4 -0
- package/dist/build-CWuStmDi.mjs +2 -0
- package/dist/{cache-CeN5t6_W.mjs → cache-DVhkiIGK.mjs} +4 -4
- package/dist/calls-95zjvIcO.mjs +4 -0
- package/dist/certificate-authorities-BowBqbVq.mjs +2 -0
- package/dist/cf-BLT7uKJF.mjs +18 -0
- package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +397 -0
- package/dist/clear-DXx8WBAN.mjs +2 -0
- package/dist/client-certificates-D6mE4vJu.mjs +3 -0
- package/dist/cloud-connector-DmwsjeFN.mjs +2 -0
- package/dist/cloudforce-one-CG3TT7IN.mjs +23 -0
- package/dist/{completions-Bvzav4Mj.mjs → completions-DMc_PlIw.mjs} +2 -2
- package/dist/connectivity-DJkE3crz.mjs +3 -0
- package/dist/connector-interrupts-DTgQ7onV.mjs +2 -0
- package/dist/connector-telemetry-events-D0rTHDou.mjs +2 -0
- package/dist/connector-telemetry-snapshots--0QmD3z6.mjs +2 -0
- package/dist/connectors-zWaZTi2A.mjs +3 -0
- package/dist/content-scanning-CGvGf04y.mjs +4 -0
- package/dist/ct-alerting-ebSPSWNC.mjs +3 -0
- package/dist/{custom-certificates-CfRj7QZb.mjs → custom-certificates-CWUrPYLP.mjs} +4 -4
- package/dist/custom-csrs-CRtdrF9R.mjs +4 -0
- package/dist/{custom-hostnames-CcK7_17e.mjs → custom-hostnames-CVQSksqq.mjs} +4 -4
- package/dist/custom-nameservers-BRwbIdsX.mjs +3 -0
- package/dist/custom-pages-Ci8sTQX7.mjs +4 -0
- package/dist/d1-78Ym1P6D.mjs +4 -0
- package/dist/data-security-zmFoMwRU.mjs +6 -0
- package/dist/{dcv-delegation-BYsNl3qc.mjs → dcv-delegation-Dd4FZ2IG.mjs} +1 -1
- package/dist/{deploy-BzlPv3ro.mjs → deploy-CVvkZFjR.mjs} +1 -1
- package/dist/{dev-IOg-_s5_.mjs → dev-DSslyDXx.mjs} +1 -1
- package/dist/diagnostics-B8Ev5m_o.mjs +3 -0
- package/dist/dispatch-namespaces-Dm5vGeEP.mjs +7 -0
- package/dist/dist-BH-4NQOV.mjs +134 -0
- package/dist/dns-D7VAaCyO.mjs +29 -0
- package/dist/dns-firewall-ByLCsf0q.mjs +57 -0
- package/dist/domain-info-CRvKc2Lg.mjs +2 -0
- package/dist/durable-objects-BIpvyu9m.mjs +2 -0
- package/dist/email-auth-Cx--s8W4.mjs +2 -0
- package/dist/email-routing-CiDbivcN.mjs +10 -0
- package/dist/email-security-BYeAuSc6.mjs +12 -0
- package/dist/email-sending-Dg2rSmHH.mjs +4 -0
- package/dist/{filters-DKs-wEzt.mjs → filters-DZ8YnQ90.mjs} +3 -3
- package/dist/firewall-DEd1hs_I.mjs +11 -0
- package/dist/flagship-DVw7xGoP.mjs +4 -0
- package/dist/{fraud-D8WmLKyH.mjs → fraud-BbGS3FZs.mjs} +2 -2
- package/dist/google-tag-gateway-CBnRGYQR.mjs +2 -0
- package/dist/{healthchecks-BBtW8vRh.mjs → healthchecks-Da9N3ix4.mjs} +3 -3
- package/dist/{hostnames-Bh2IFxIw.mjs → hostnames-mimZu2tB.mjs} +2 -2
- package/dist/hyperdrive-BNdvxOos.mjs +21 -0
- package/dist/iam-DGQ-OgRl.mjs +6 -0
- package/dist/images-CI6Iy9ho.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-BDB-aRtU.mjs +3 -0
- package/dist/internal-Czlp5Ekb.mjs +2 -0
- package/dist/{ips-BE7JbAnc.mjs → ips-B9UuPvsY.mjs} +1 -1
- package/dist/keyless-certificates-Ua9uJgPt.mjs +3 -0
- package/dist/kv-BHerx4dZ.mjs +5 -0
- package/dist/leaked-credential-checks-B8Vunj9h.mjs +3 -0
- package/dist/live-Ce7dZW7p.mjs +2 -0
- package/dist/load-balancers-DSjS5WKw.mjs +6 -0
- package/dist/logexplorer-DBIfTlRP.mjs +24 -0
- package/dist/logo-matches-C00iGpzW.mjs +2 -0
- package/dist/logos-CJLhx1go.mjs +3 -0
- package/dist/logpush-Cr1U-eK-.mjs +5 -0
- package/dist/logs-DMvtchc6.mjs +3 -0
- package/dist/magic-cloud-networking-FQfO8QWH.mjs +5 -0
- package/dist/magic-network-monitoring-CDd70fJQ.mjs +4 -0
- package/dist/magic-transit-DiKiPUax.mjs +110 -0
- package/dist/managed-transforms-fPVUTrAv.mjs +3 -0
- package/dist/matches-B0yHbQ2I.mjs +2 -0
- package/dist/moq-UgBawOXe.mjs +13 -0
- package/dist/mtls-certificates-xKUbC5EL.mjs +3 -0
- package/dist/network-interconnects-BJzOE2ny.mjs +41 -0
- package/dist/oauth-DBJ5GSFk.mjs +40 -0
- package/dist/observability-B-1y36QS.mjs +4 -0
- package/dist/organization-Dq3PClZ7.mjs +41 -0
- package/dist/organizations-AhsQkHyX.mjs +2 -0
- package/dist/origin-ca-certificates-CRgF0UyU.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BXTx7DPa.mjs +2 -0
- package/dist/{origin-tls-client-auth-B30_2_dO.mjs → origin-tls-client-auth-BDw5q-6G.mjs} +3 -3
- package/dist/{page-rules-zQJGmTCd.mjs → page-rules-DqYQ23eg.mjs} +5 -5
- package/dist/{page-shield-CxQk5k9X.mjs → page-shield-DKdlZOLO.mjs} +5 -5
- package/dist/pages-BsXF11Kv.mjs +11 -0
- package/dist/pay-per-crawl-BGAwuAP3.mjs +2 -0
- package/dist/pipelines-D_QhSnGW.mjs +6 -0
- package/dist/progress-O88q63Bk.mjs +2 -0
- package/dist/{prompt-q3B7sM2A.mjs → prompt-DTAWiEm2.mjs} +1 -1
- package/dist/queries-CAE95-OH.mjs +3 -0
- package/dist/queues-BBz35Mqd.mjs +6 -0
- package/dist/r2-Zp99S5xF.mjs +21 -0
- package/dist/r2-data-catalog-BeVLZwrE.mjs +16 -0
- package/dist/radar-Cij-XVQJ.mjs +2 -0
- package/dist/rate-limit-analytics-CGviSPnJ.mjs +2 -0
- package/dist/rate-limits-DSdToIWv.mjs +5 -0
- package/dist/raw-fetch-DgezeshQ.mjs +2 -0
- package/dist/ready-DMpJvyaz.mjs +2 -0
- package/dist/realtime-kit-9rJcapfM.mjs +18 -0
- package/dist/recent-submissions-LS5IM-bm.mjs +2 -0
- package/dist/refute-BGTpr5sy.mjs +2 -0
- package/dist/registrar-CXViZlah.mjs +83 -0
- package/dist/registrar-sandbox-CvQyjXLJ.mjs +83 -0
- package/dist/request-tracers-DATfBnE9.mjs +2 -0
- package/dist/{resolve-DGD57PFH.mjs → resolve-Bs2sMRYS.mjs} +1 -1
- package/dist/resource-sharing-Cmhn6ghR.mjs +3 -0
- package/dist/resource-tagging-BTn05AOj.mjs +16 -0
- package/dist/rules-ens3OHme.mjs +4 -0
- package/dist/rulesets-bkreZRao.mjs +8 -0
- package/dist/rum-CpgXFcwl.mjs +4 -0
- package/dist/scan-logo-DUDIZJ2A.mjs +2 -0
- package/dist/scan-page-BqoQTk3R.mjs +2 -0
- package/dist/{schema-D8o6HcCr.mjs → schema-DCF4yEp_.mjs} +1 -1
- package/dist/{schema-validation-BWNDnnIT.mjs → schema-validation-Ca6o94ts.mjs} +5 -5
- package/dist/scim-C4oT8TMc.mjs +4 -0
- package/dist/sdk-pQ5kaGUX.mjs +3 -0
- package/dist/search-C4T5riPh.mjs +2 -0
- package/dist/secrets-store-CWEuiDNo.mjs +7 -0
- package/dist/security-center-BOvm7xy6.mjs +2 -0
- package/dist/{security-txt-CVpmJo29.mjs → security-txt-BCAUBctN.mjs} +2 -2
- package/dist/session-B1ARgLG7.mjs +2 -0
- package/dist/share-DhmVspmL.mjs +5 -0
- package/dist/{shared-DQI8NGja.mjs → shared-Bod3-Exx.mjs} +332 -332
- package/dist/signed-url-DA509wgp.mjs +2 -0
- package/dist/{smart-shield-BreBC1Ap.mjs → smart-shield-DZm4fn6z.mjs} +2 -2
- package/dist/{snippets-BAJoWMSJ.mjs → snippets-oQ0u26-z.mjs} +3 -3
- package/dist/{spawn-pmGERpdB.mjs → spawn-ChG5Xi9Z.mjs} +1 -1
- package/dist/{spectrum-DnIRLY95.mjs → spectrum-Cnkee5Ww.mjs} +6 -6
- package/dist/speed-DqNnvLBD.mjs +4 -0
- package/dist/{src-BQ1dr9xR.mjs → src-By-zTCHz.mjs} +9 -9
- package/dist/ssl-tS3CYZsZ.mjs +15 -0
- package/dist/state-OsdDJvdj.mjs +2 -0
- package/dist/stream-Bud9Os5V.mjs +14 -0
- package/dist/submission-info-DfIXmu-M.mjs +2 -0
- package/dist/submit-BtP8she2.mjs +2 -0
- package/dist/tenant-CMwHa-tU.mjs +2 -0
- package/dist/{token-validation-DUvtXWur.mjs → token-validation-BYC7HTok.mjs} +5 -5
- package/dist/{tools-CQtA5-cr.mjs → tools-Dru4l8yh.mjs} +1 -1
- package/dist/total-queries-DdLBNJzd.mjs +2 -0
- package/dist/tracked-domains-BbaY-IuY.mjs +2 -0
- package/dist/turnstile-CP4nScaL.mjs +23 -0
- package/dist/{ui-BrNwNHX9.mjs → ui-BNoF0KpD.mjs} +2 -2
- package/dist/url-info-Chs9h7Y-.mjs +2 -0
- package/dist/url-normalization-XYxW5Gj0.mjs +3 -0
- package/dist/url-scanner-D4pYNlO-.mjs +2 -0
- package/dist/user-DtefniLc.mjs +11 -0
- package/dist/vectorize-BeAY2g-7.mjs +4 -0
- package/dist/verify-D7J3F_NZ.mjs +2 -0
- package/dist/{versions-NUXxCr0s.mjs → versions-dMW3bLVv.mjs} +1 -1
- package/dist/waiting-rooms-K78HeeTg.mjs +11 -0
- package/dist/{web3-n3GW50u-.mjs → web3-Dhw79l4S.mjs} +3 -3
- package/dist/workers-builds-CuOAB3u4.mjs +7 -0
- package/dist/workers-l3zMNOU6.mjs +20 -0
- package/dist/workflows-rb7RYBKP.mjs +6 -0
- package/dist/{zaraz-9l7KuLqh.mjs → zaraz-CHecMYuo.mjs} +1 -1
- package/dist/zero-trust-DAZoa-Aj.mjs +117 -0
- package/dist/zone-BnnqJwW-.mjs +2 -0
- package/dist/zones-DpI2YikF.mjs +21 -0
- package/package.json +1 -1
- package/dist/abuse-reports-DUs4SKVx.mjs +0 -8
- package/dist/accounts-BIY8wNGA.mjs +0 -22
- package/dist/acm-SqcV8o5o.mjs +0 -3
- package/dist/addressing-CygRm0pN.mjs +0 -12
- package/dist/ai-BAmEAjN3.mjs +0 -2
- package/dist/ai-gateway-BENwPvvB.mjs +0 -8
- package/dist/ai-search-Bv_Whw3E.mjs +0 -7
- package/dist/ai_gateway-C6WP9oBH.mjs +0 -4
- package/dist/alerting-D_qWrsoY.mjs +0 -6
- package/dist/analytics_engine-BjV6XLyG.mjs +0 -2
- package/dist/argo-DwYGbyld.mjs +0 -2
- package/dist/artifacts-DKAjY_n4.mjs +0 -4
- package/dist/auth-TYwGydWg.mjs +0 -5
- package/dist/billing-CRTlRU88.mjs +0 -2
- package/dist/bot-management-DgW--8wM.mjs +0 -5
- package/dist/botnet-feed-CIX6ZORT.mjs +0 -3
- package/dist/brand-protection-ZikBtl0y.mjs +0 -3
- package/dist/browser-rendering-D_ZQVWn8.mjs +0 -4
- package/dist/build-Bgw8TV1p.mjs +0 -134
- package/dist/calls-Cv0ieVg4.mjs +0 -4
- package/dist/certificate-authorities-BzZnWCac.mjs +0 -2
- package/dist/client-certificates-BFuzeBrj.mjs +0 -3
- package/dist/cloud-connector-D5h8Dzzg.mjs +0 -2
- package/dist/cloudforce-one-aqDCIBMp.mjs +0 -21
- package/dist/config-B5k-XbwS.mjs +0 -2
- package/dist/connectivity-CjkXmEhO.mjs +0 -3
- package/dist/connector-interrupts-B7eSface.mjs +0 -2
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +0 -2
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +0 -2
- package/dist/connectors-YYu_Vx3H.mjs +0 -3
- package/dist/content-scanning-BorfRGKT.mjs +0 -4
- package/dist/context-C-WbewL6.mjs +0 -2
- package/dist/custom-nameservers-BkKx0THn.mjs +0 -3
- package/dist/custom-pages-DamGVA75.mjs +0 -4
- package/dist/d1-sK0O5THv.mjs +0 -4
- package/dist/data-security-DsWpoWiS.mjs +0 -6
- package/dist/diagnostics-CH7T2WR3.mjs +0 -3
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +0 -7
- package/dist/dist-C6zxsVdY.mjs +0 -306
- package/dist/dns-firewall-VmQf3UVP.mjs +0 -57
- package/dist/dns-o7hUPMCG.mjs +0 -29
- package/dist/durable-objects-DgrTbvoF.mjs +0 -2
- package/dist/email-routing-owCvAEpf.mjs +0 -10
- package/dist/email-security-Dng3DVuf.mjs +0 -8
- package/dist/email-sending-bExMH4lu.mjs +0 -3
- package/dist/firewall-BLaTtX3r.mjs +0 -11
- package/dist/google-tag-gateway-DyCY43k0.mjs +0 -2
- package/dist/hyperdrive-DJm1eD-M.mjs +0 -18
- package/dist/iam-apCCcy7R.mjs +0 -6
- package/dist/images-Cxe45OHm.mjs +0 -7
- package/dist/intel-8V4h6H46.mjs +0 -3
- package/dist/keyless-certificates-CfJmXccT.mjs +0 -3
- package/dist/kv-Dz6then8.mjs +0 -5
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +0 -3
- package/dist/load-balancers-ilsGgudX.mjs +0 -6
- package/dist/logpush-BH14TtuA.mjs +0 -4
- package/dist/logs-B8-mkf_I.mjs +0 -3
- package/dist/magic-cloud-networking-DylCXoG4.mjs +0 -5
- package/dist/magic-network-monitoring-DnyrZy77.mjs +0 -4
- package/dist/magic-transit-B-kU5e3s.mjs +0 -89
- package/dist/managed-transforms-GC9Pq5dg.mjs +0 -3
- package/dist/mtls-certificates-BRlhWw_G.mjs +0 -3
- package/dist/network-interconnects-DuyoFD9_.mjs +0 -36
- package/dist/oauth-B5k80sip.mjs +0 -61
- package/dist/observability-9APhqFHo.mjs +0 -4
- package/dist/organizations-Dy3kiV_z.mjs +0 -41
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +0 -3
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +0 -2
- package/dist/pages-5DKLs7CQ.mjs +0 -11
- package/dist/pipelines-DfGE44xo.mjs +0 -6
- package/dist/progress-CL8I-7YK.mjs +0 -2
- package/dist/queues-BoenUGIw.mjs +0 -6
- package/dist/r2-Cq_JCjK0.mjs +0 -21
- package/dist/r2-data-catalog-eLxltWdO.mjs +0 -14
- package/dist/radar-YNOCio6T.mjs +0 -2
- package/dist/rate-limits-CcAF3tMl.mjs +0 -5
- package/dist/raw-fetch-bIXC9D1m.mjs +0 -2
- package/dist/realtime-kit-4bCGviO5.mjs +0 -18
- package/dist/registrar-CfHlaOOf.mjs +0 -46
- package/dist/request-tracers-DlHawg5l.mjs +0 -2
- package/dist/resource-sharing-7FhuboJE.mjs +0 -5
- package/dist/resource-tagging-divcugVb.mjs +0 -16
- package/dist/rules-CAXkege8.mjs +0 -4
- package/dist/rulesets-CBsdc8IV.mjs +0 -8
- package/dist/rum-D0hHPNl9.mjs +0 -4
- package/dist/scim-CWLli4fi.mjs +0 -3
- package/dist/sdk-DhIhH6GB.mjs +0 -5
- package/dist/secrets-store-B7_HkE8I.mjs +0 -25
- package/dist/security-center-BQT21oiM.mjs +0 -2
- package/dist/session-B8r8LNQN.mjs +0 -93
- package/dist/speed-UYEVue28.mjs +0 -4
- package/dist/ssl-D3Pixs8M.mjs +0 -15
- package/dist/stream-BUsuOfQh.mjs +0 -14
- package/dist/tenants-BdWJTtcg.mjs +0 -2
- package/dist/turnstile-CAKVnS1L.mjs +0 -23
- package/dist/url-normalization-DA-RAxs4.mjs +0 -3
- package/dist/url-scanner-DmYu43f7.mjs +0 -2
- package/dist/user-Bah4wGGN.mjs +0 -10
- package/dist/vectorize-DhvVG2By.mjs +0 -4
- package/dist/waiting-rooms-DoOkT4Mu.mjs +0 -11
- package/dist/workers-D6IaQ_F0.mjs +0 -18
- package/dist/workers-builds-DYi0OMMU.mjs +0 -7
- package/dist/workflows-DrdXUQ2g.mjs +0 -4
- package/dist/zero-trust-D6V9GH2W.mjs +0 -118
- package/dist/zero_trust-BzXKAX_x.mjs +0 -3
- package/dist/zones-0MTkuaFk.mjs +0 -21
- /package/dist/{body-parser-DWSy7uZ8.mjs → body-parser-BO6mfo_W.mjs} +0 -0
- /package/dist/{cli-types-DGgEbf8K.mjs → cli-types-CFw6Xygp.mjs} +0 -0
- /package/dist/{input-validation-_fMCApaH.mjs → input-validation-BwUR9z8e.mjs} +0 -0
- /package/dist/{lib-4PQI6yRW.mjs → lib-Og5sB51C.mjs} +0 -0
- /package/dist/{local-CYc9q7l2.mjs → local-C6TLPAT6.mjs} +0 -0
- /package/dist/{metadata-MPDDi08e.mjs → metadata-Cnyws6iO.mjs} +0 -0
- /package/dist/{open-YWOUIZ5Y-3jqSKAB1.mjs → open-YWOUIZ5Y-CFRcYALi.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}if(
|
|
4
|
-
`);return}
|
|
5
|
-
`);return}
|
|
2
|
+
import{D as e}from"./oauth-DBJ5GSFk.mjs";import{i as t,n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{n as o,t as s}from"./body-parser-BO6mfo_W.mjs";import{n as c}from"./input-validation-BwUR9z8e.mjs";import{n as l,t as u}from"./prompt-DTAWiEm2.mjs";function d(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const f={command:`clear`,describe:`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.`,builder:d,handler:async t=>{if(t.dryRun){i({command:`cf cache cache-reserve clear`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve_clear`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Creating`,async()=>o.cache.cacheReserve.clear({zone_id:s})),{successLabel:`Created`})}};function p(e){return e.option(`value`,{type:`string`,description:`Value of the Cache Reserve zone setting.`,choices:[`on`,`off`]}).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 m={command:`edit`,describe:`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.`,builder:p,handler:async t=>{if(t.dryRun){i({command:`cf cache cache-reserve edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({value:c(t.value,`value`,`text`)}):o(t.body)});return}let u=await n(t),d=await e({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=o(t.body);r(await a(`Updating`,async()=>u.cache.cacheReserve.edit({...e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await l(`value`,`Value of the Cache Reserve zone setting.`,[`on`,`off`]));let f=s({value:c(t.value,`value`,`text`)});r(await a(`Updating`,async()=>u.cache.cacheReserve.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`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.`,builder:h,handler:async t=>{if(t.dryRun){i({command:`cf cache cache-reserve get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.cache.cacheReserve.get({zone_id:s})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`status`,describe:`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.`,builder:_,handler:async t=>{if(t.dryRun){i({command:`cf cache cache-reserve status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/cache_reserve_clear`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.cache.cacheReserve.status({zone_id:s})),{successLabel:`Loaded`})}},y={command:`cache-reserve`,describe:`Persistent storage tier that keeps cached assets even after eviction from edge caches`,builder:e=>e.command(f).command(m).command(g).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.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 x={command:`purge`,describe:'### Purge All Cached Content Removes ALL files from Cloudflare\'s cache. All tiers can purge everything. ``` {"purge_everything": true} ``` ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare\'s cache by specifying URLs. All tiers can purge by URL. To purge files with custom cache keys, include the headers used to compute the cache key as in the example. If you have a device type or geo in your cache key, you will need to include the CF-Device-Type or CF-IPCountry headers. If you have lang in your cache key, you will need to include the Accept-Language header. **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for http, 443 for https), but must be included otherwise. Single file purge example with files: ``` {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} ``` Single file purge example with url and header pairs: ``` {"files": [{"url": "http://www.example.com/cat_picture.jpg", "headers": {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}}, {"url": "http://www.example.com/dog_picture.jpg", "headers": {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}}]} ``` ### Purge Cached Content by Tag, Host or Prefix Granularly removes one or more files from Cloudflare\'s cache either by specifying the host, the associated Cache-Tag, or a Prefix. Flex purge with tags: ``` {"tags": ["a-cache-tag", "another-cache-tag"]} ``` Flex purge with hosts: ``` {"hosts": ["www.example.com", "images.example.com"]} ``` Flex purge with prefixes: ``` {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} ``` ### Availability and limits Please refer to [purge cache availability and limits documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits).',builder:b,handler:async s=>{if(s.dryRun){i({command:`cf cache purge`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/purge_cache`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?void 0:o(s.body)});return}let c=await n(s),l=await e({zone:s.zone},c,{quiet:s.quiet});if(s.zoneId=l,!await u({force:!!s.force,message:`This operation destroys cached content for a zone.`})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}if(s.body){let e=o(s.body);r(await a(`Deleting`,async()=>c.cache.purge({body:e,zone_id:l})),{successLabel:`Deleted`});return}r(await a(`Deleting`,async()=>t(c,`POST`,`/zones/${s.zoneId}/purge_cache`)),{successLabel:`Deleted`})}};function S(e){return e.option(`value`,{type:`string`,description:`Value of the Regional Tiered Cache zone setting.`,choices:[`on`,`off`]}).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 C={command:`edit`,describe:`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.`,builder:S,handler:async t=>{if(t.dryRun){i({command:`cf cache regional-tiered-cache edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/regional_tiered_cache`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({value:c(t.value,`value`,`text`)}):o(t.body)});return}let u=await n(t),d=await e({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=o(t.body);r(await a(`Updating`,async()=>u.cache.regionalTieredCache.edit({...e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await l(`value`,`Value of the Regional Tiered Cache zone setting.`,[`on`,`off`]));let f=s({value:c(t.value,`value`,`text`)});r(await a(`Updating`,async()=>u.cache.regionalTieredCache.edit({...f,zone_id:d})),{successLabel:`Updated`})}};function w(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`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.`,builder:w,handler:async t=>{if(t.dryRun){i({command:`cf cache regional-tiered-cache get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/regional_tiered_cache`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.cache.regionalTieredCache.get({zone_id:s})),{successLabel:`Loaded`})}},E={command:`regional-tiered-cache`,describe:`Restrict tiered cache topology to data centers within a specific geographic region`,builder:e=>e.command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.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 O={command:`delete`,describe:`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.`,builder:D,handler:async t=>{if(t.dryRun){i({command:`cf cache smart-tiered-cache delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=s,!await u({force:!!t.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}r(await a(`Deleting`,async()=>o.cache.smartTieredCache.delete({zone_id:s})),{successLabel:`Deleted`})}};function k(e){return e.option(`value`,{type:`string`,description:`Enable or disable the Smart Tiered Cache.`,choices:[`on`,`off`]}).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 A={command:`edit`,describe:`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.`,builder:k,handler:async t=>{if(t.dryRun){i({command:`cf cache smart-tiered-cache edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({value:c(t.value,`value`,`text`)}):o(t.body)});return}let u=await n(t),d=await e({zone:t.zone},u,{quiet:t.quiet});if(t.zoneId=d,t.body){let e=o(t.body);r(await a(`Updating`,async()=>u.cache.smartTieredCache.edit({body:e,zone_id:d})),{successLabel:`Updated`});return}t.value===void 0&&(t.value=await l(`value`,`Enable or disable the Smart Tiered Cache.`,[`on`,`off`]));let f=s({value:c(t.value,`value`,`text`)});r(await a(`Updating`,async()=>u.cache.smartTieredCache.edit({body:f,zone_id:d})),{successLabel:`Updated`})}};function j(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get`,describe:`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.`,builder:j,handler:async t=>{if(t.dryRun){i({command:`cf cache smart-tiered-cache get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/tiered_cache_smart_topology_enable`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.cache.smartTieredCache.get({zone_id:s})),{successLabel:`Loaded`})}},N={command:`smart-tiered-cache`,describe:`Automatically determine the best upper-tier data centers for tiered cache topology`,builder:e=>e.command(O).command(A).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.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 F={command:`delete`,describe:`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.`,builder:P,handler:async t=>{if(t.dryRun){i({command:`cf cache variants delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});if(t.zoneId=s,!await u({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}r(await a(`Deleting`,async()=>o.cache.variants.delete({zone_id:s})),{successLabel:`Deleted`})}};function I(e){return e.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 L={command:`edit`,describe:`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.`,builder:I,handler:async t=>{if(t.dryRun){i({command:`cf cache variants edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({value:{avif:t[`value-avif`],bmp:t[`value-bmp`],gif:t[`value-gif`],jp2:t[`value-jp2`],jpeg:t[`value-jpeg`],jpg:t[`value-jpg`],jpg2:t[`value-jpg2`],png:t[`value-png`],tif:t[`value-tif`],tiff:t[`value-tiff`],webp:t[`value-webp`]}}):o(t.body)});return}let c=await n(t),l=await e({zone:t.zone},c,{quiet:t.quiet});if(t.zoneId=l,t.body){let e=o(t.body);r(await a(`Updating`,async()=>c.cache.variants.edit({...e,zone_id:l})),{successLabel:`Updated`});return}let u=s({value:{avif:t[`value-avif`],bmp:t[`value-bmp`],gif:t[`value-gif`],jp2:t[`value-jp2`],jpeg:t[`value-jpeg`],jpg:t[`value-jpg`],jpg2:t[`value-jpg2`],png:t[`value-png`],tif:t[`value-tif`],tiff:t[`value-tiff`],webp:t[`value-webp`]}});r(await a(`Updating`,async()=>c.cache.variants.edit({...u,zone_id:l})),{successLabel:`Updated`})}};function R(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`get`,describe:`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.`,builder:R,handler:async t=>{if(t.dryRun){i({command:`cf cache variants get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/cache/variants`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let o=await n(t),s=await e({zone:t.zone},o,{quiet:t.quiet});t.zoneId=s,r(await a(`Loading`,async()=>o.cache.variants.get({zone_id:s})),{successLabel:`Loaded`})}},B={command:`variants`,describe:`Serve different cached versions of an image based on the Accept header (WebP, AVIF, etc.)`,builder:e=>e.command(F).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},V={command:`cache`,describe:`Purge cached content and configure Cache Reserve, tiered caching, and variant serving`,builder:e=>e.command(x).command(y).command(E).command(N).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{V as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{n}from"./auth-CZ0E51rF.mjs";import{t as r}from"./output-B6fBFRqe.mjs";import{n as i,t as a}from"./progress-O88q63Bk.mjs";import{t as o}from"./local-C6TLPAT6.mjs";import{n as s,t as c}from"./body-parser-BO6mfo_W.mjs";import{n as l}from"./input-validation-BwUR9z8e.mjs";import{t as u}from"./prompt-DTAWiEm2.mjs";function d(e){return e.option(`name`,{type:`string`,description:`A short description of Calls app, not shown to end users.`,default:``}).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 f={command:`create`,describe:`Creates a new Cloudflare calls app. An app is an unique enviroment where each Session can access all Tracks within the app.`,builder:d,handler:async u=>{if(u.dryRun){i({command:`cf calls sfu create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({name:l(u.name,`name`,`text`)}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Creating`,async()=>d.calls.sfu.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=c({name:l(u.name,`name`,`text`)});r(await a(`Creating`,async()=>d.calls.sfu.create({body:p,account_id:f})),{successLabel:`Created`})}};function p(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,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 m={command:`delete <app-id>`,describe:`Deletes an app from Cloudflare Calls`,builder:p,handler:async s=>{if(s.dryRun){i({command:`cf calls sfu delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/apps/${s[`app-id`]==null?`<app-id>`:encodeURIComponent(String(s[`app-id`]))}`,pathParams:{"app-id":String(s[`app-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await u({force:!!s.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}r(await a(`Deleting`,async()=>c.calls.sfu.delete({account_id:l,app_id:s[`app-id`]})),{successLabel:`Deleted`})}};function h(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <app-id>`,describe:`Fetches details for a single Calls app.`,builder:h,handler:async s=>{if(s.dryRun){i({command:`cf calls sfu get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/apps/${s[`app-id`]==null?`<app-id>`:encodeURIComponent(String(s[`app-id`]))}`,pathParams:{"app-id":String(s[`app-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.calls.sfu.get({account_id:l,app_id:s[`app-id`]})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`Lists all apps in the Cloudflare account`,builder:_,handler:async s=>{if(s.dryRun){i({command:`cf calls sfu list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.calls.sfu.list({account_id:l})),{successLabel:`Loaded`})}};function y(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`name`,{type:`string`,description:`A short description of Calls app, not shown to end users.`}).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 b={command:`update <app-id>`,describe:`Edit details for a single app.`,builder:y,handler:async u=>{if(u.dryRun){i({command:`cf calls sfu update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/apps/${u[`app-id`]==null?`<app-id>`:encodeURIComponent(String(u[`app-id`]))}`,pathParams:{"app-id":String(u[`app-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({name:l(u.name,`name`,`text`)}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Updating`,async()=>d.calls.sfu.update({body:e,account_id:f,app_id:u[`app-id`]})),{successLabel:`Updated`});return}let p=c({name:l(u.name,`name`,`text`)});r(await a(`Updating`,async()=>d.calls.sfu.update({body:p,account_id:f,app_id:u[`app-id`]})),{successLabel:`Updated`})}},x={command:`sfu`,describe:`Operations for sfu`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`name`,{type:`string`,description:`A short description of a TURN key, not shown to end users.`,default:``}).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 C={command:`create`,describe:`Creates a new Cloudflare Calls TURN key.`,builder:S,handler:async u=>{if(u.dryRun){i({command:`cf calls turn create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({name:l(u.name,`name`,`text`)}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Creating`,async()=>d.calls.turn.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=c({name:l(u.name,`name`,`text`)});r(await a(`Creating`,async()=>d.calls.turn.create({body:p,account_id:f})),{successLabel:`Created`})}};function w(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,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 T={command:`delete <key-id>`,describe:`Deletes a TURN key from Cloudflare Calls`,builder:w,handler:async s=>{if(s.dryRun){i({command:`cf calls turn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/turn_keys/${s[`key-id`]==null?`<key-id>`:encodeURIComponent(String(s[`key-id`]))}`,pathParams:{"key-id":String(s[`key-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();if(s.accountId=l,!await u({force:!!s.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}r(await a(`Deleting`,async()=>c.calls.turn.delete({account_id:l,key_id:s[`key-id`]})),{successLabel:`Deleted`})}};function E(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <key-id>`,describe:`Fetches details for a single TURN key.`,builder:E,handler:async s=>{if(s.dryRun){i({command:`cf calls turn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/turn_keys/${s[`key-id`]==null?`<key-id>`:encodeURIComponent(String(s[`key-id`]))}`,pathParams:{"key-id":String(s[`key-id`]??``)},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.calls.turn.get({account_id:l,key_id:s[`key-id`]})),{successLabel:`Loaded`})}};function O(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists all TURN keys in the Cloudflare account`,builder:O,handler:async s=>{if(s.dryRun){i({command:`cf calls turn list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`none`});return}let c=await n(s),l=s.local?o:await t();s.accountId=l,r(await a(`Loading`,async()=>c.calls.turn.list({account_id:l})),{successLabel:`Loaded`})}};function A(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`name`,{type:`string`,description:`A short description of a TURN key, not shown to end users.`}).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 j={command:`update <key-id>`,describe:`Edit details for a single TURN key.`,builder:A,handler:async u=>{if(u.dryRun){i({command:`cf calls turn update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/calls/turn_keys/${u[`key-id`]==null?`<key-id>`:encodeURIComponent(String(u[`key-id`]))}`,pathParams:{"key-id":String(u[`key-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({name:l(u.name,`name`,`text`)}):s(u.body)});return}let d=await n(u),f=u.local?o:await t();if(u.accountId=f,u.body){let e=s(u.body);r(await a(`Updating`,async()=>d.calls.turn.update({body:e,account_id:f,key_id:u[`key-id`]})),{successLabel:`Updated`});return}let p=c({name:l(u.name,`name`,`text`)});r(await a(`Updating`,async()=>d.calls.turn.update({body:p,account_id:f,key_id:u[`key-id`]})),{successLabel:`Updated`})}},M={command:`turn`,describe:`Operations for turn`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`calls`,describe:`calls`,builder:e=>e.command(x).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{N as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{D as e}from"./oauth-DBJ5GSFk.mjs";import{n as t}from"./auth-CZ0E51rF.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-O88q63Bk.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";function c(e){return e.option(`mtls-certificate-id`,{type:`string`,description:`The UUID to match against for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the results will be the hostnames associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`List Hostname Associations.`,builder:c,handler:async a=>{let o={mtls_certificate_id:a[`mtls-certificate-id`]};if(a.dryRun){r({command:`cf certificate-authorities hostname-associations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.certificateAuthorities.hostnameAssociations.get({zone_id:c,...o})),{successLabel:`Loaded`})}};function u(e){return e.option(`hostnames`,{type:`string`,array:!0,description:`The hostnames field`}).option(`mtls-certificate-id`,{type:`string`,description:`The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA.`}).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 d={command:`update`,describe:`Replace Hostname Associations.`,builder:u,handler:async c=>{if(c.dryRun){r({command:`cf certificate-authorities hostname-associations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({hostnames:c.hostnames,mtls_certificate_id:s(c[`mtls-certificate-id`],`mtls-certificate-id`,`text`)}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Updating`,async()=>l.certificateAuthorities.hostnameAssociations.update({...e,zone_id:u})),{successLabel:`Updated`});return}let d=o({hostnames:c.hostnames,mtls_certificate_id:s(c[`mtls-certificate-id`],`mtls-certificate-id`,`text`)});n(await i(`Updating`,async()=>l.certificateAuthorities.hostnameAssociations.update({...d,zone_id:u})),{successLabel:`Updated`})}},f={command:`hostname-associations`,describe:`Operations for hostname-associations`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`certificate-authorities`,describe:`Map client certificates to specific hostnames for mTLS authentication`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{A as e,H as t,J as n,K as r,P as i,U as a,W as o,a as s,b as c,c as l,d as u,dt as d,f,i as p,k as m,l as h,m as g,n as ee,nt as _,o as te,p as v,r as y,s as ne,t as re,u as b,ut as x,v as ie}from"./chunk-2SIGYDH3-qXx_zE6v.mjs";import{chmodSync as S,existsSync as C,mkdirSync as w,readFileSync as T,readdirSync as E,rmSync as D,writeFileSync as O}from"node:fs";import k from"node:path";import{URLSearchParams as ae}from"node:url";function A(e){function t(){return k.resolve(e(),`preferences.json`)}g(t,`getUserPreferencesPath`);function n(){try{let e=T(t(),`utf8`),n=JSON.parse(e);return typeof n==`object`&&n?n:{}}catch{return{}}}g(n,`readUserPreferences`);function r(e){let r={...n(),...e},i=t();w(k.dirname(i),{recursive:!0}),O(i,JSON.stringify(r,null,` `),{encoding:`utf-8`})}return g(r,`updateUserPreferences`),{readUserPreferences:n,updateUserPreferences:r}}g(A,`createPreferences`);var j=6e4,M=525600,N=43200,P=1440,F=Symbol.for(`constructDateFrom`);function I(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&F in e?e[F](t):e instanceof Date?new e.constructor(t):new Date(t)}g(I,`constructFrom`);function L(e,t){return I(t||e,e)}g(L,`toDate`);var R={};function z(){return R}g(z,`getDefaultOptions`);function B(e){let t=L(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}g(B,`getTimezoneOffsetInMilliseconds`);function V(e,...t){let n=I.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}g(V,`normalizeDates`);function H(e,t){let n=L(e)-+L(t);return n<0?-1:n>0?1:n}g(H,`compareAsc`);function oe(e){return I(e,Date.now())}g(oe,`constructNow`);function se(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}g(se,`getRoundingMethod`);var ce={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`}},le=g((e,t,n)=>{let r,i=ce[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 U(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}g(U,`buildFormatLongFn`);var ue={date:U({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:U({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:U({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},de={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},fe=g((e,t,n,r)=>de[e],`formatRelative`);function W(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]}}g(W,`buildLocalizeFn`);var pe={ordinalNumber:g((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:W({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:W({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:g(e=>e-1,`argumentCallback`)}),month:W({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:W({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:W({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 G(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)?he(s,e=>e.test(o)):me(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}}}g(G,`buildMatchFn`);function me(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}g(me,`findKey`);function he(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}g(he,`findIndex`);function ge(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}}}g(ge,`buildMatchPatternFn`);var _e={code:`en-US`,formatDistance:le,formatLong:ue,formatRelative:fe,localize:pe,match:{ordinalNumber:ge({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:g(e=>parseInt(e,10),`valueCallback`)}),era:G({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:G({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:g(e=>e+1,`valueCallback`)}),month:G({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:G({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:G({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 ve(e,t,n){let r=z(),i=n?.locale??r.locale??_e,a=H(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=V(n?.in,...a>0?[t,e]:[e,t]),l=se(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/j,f=(u-(B(c)-B(s)))/j,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<P?`hour`:f<N?`day`:f<M?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}else if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}else if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}else if(m===`day`){let e=l(f/P);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/N);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/M);return i.formatDistance(`xYears`,e,o)}}g(ve,`formatDistanceStrict`);function ye(e,t){return ve(e,oe(e),t)}g(ye,`formatDistanceToNowStrict`);function K(e,t){return{read:g(()=>{let n=t();if(!C(n))return;let r=x(n);try{return b(e,r)}catch{return}},`read`),write(n){let r=t();w(k.dirname(r),{recursive:!0}),O(r,f(e,n),{encoding:`utf-8`,mode:384}),S(r,384)},clear(){let e=t(),n=C(e);return D(e,{force:!0}),n},path:t}}g(K,`createFileStorage`);function be(e){let{logger:t,prompt:n}=e;return g(async function(e,r){if(o())return t.log(r),!0;let i=await n(e);return typeof i==`string`&&i.trim().toLowerCase()===`yes`},`ensureTemporaryTermsAccepted`)}g(be,`createTemporaryTermsPrompt`);var xe=[9106,1e4];function q(e){return e?.code}g(q,`getErrorCode`);function Se(e){let t=q(e);return t!==void 0&&xe.includes(t)}g(Se,`isMembershipsInaccessible`);function Ce(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.`}}g(Ce,`notLoggedInErrorBodies`);function we(e,t,n){let r=new Date(t.claim.expiresAt);e.log(p`
|
|
3
|
+
Temporary account ready:
|
|
4
|
+
Account: ${t.account.name} (${n?`reused`:`created`})
|
|
5
|
+
Claim within: ${ye(r)}
|
|
6
|
+
Claim URL: ${t.claim.url}
|
|
7
|
+
`)}g(we,`logTemporaryPreviewAccount`);function Te(i,s){let{logger:l}=s,u=i.cliName,d=Ce(i.commands.login),f=`
|
|
8
|
+
Run \`${i.commands.whoami}\` to check your current authentication status.`,p=A(i.getConfigPath),m=ie(l,i.cacheNamespace?{namespace:i.cacheNamespace}:void 0),h=re({serviceName:i.keyringServiceName,getConfigPath:i.getConfigPath,isKeyringEnabled:g(()=>p.readUserPreferences().keyring_enabled===!0,`isKeyringEnabled`),logger:l,isNonInteractiveOrCI:o,loginCommand:i.commands.login,format:i.fileFormat}),v=i.allowGlobalAuthKey??!0,y=ee({logger:l,isNonInteractiveOrCI:o,openInBrowser:g(e=>r(e,l),`openInBrowser`),hasEnvCredentials:g(()=>te({allowGlobalAuthKey:v})!==void 0,`hasEnvCredentials`),purgeOnLoginOrLogout:m.purgeConfigCaches,clientId:i.clientId,consent:i.consent,redirectUri:i.redirectUri,storageFactory:h.storageFactory,allowGlobalAuthKey:v,temporary:{storage:K(i.fileFormat,i.getTemporaryAccountConfigPath),prompt:be({logger:l,prompt:s.prompt})}});function b(e){y.setProfile(e)}g(b,`setProfile`);function x(){return y.getActiveProfile()}g(x,`getActiveProfile`);function S(){return h.getActiveStore(y.getActiveProfile())}g(S,`getCredentialStore`);function C(e){y.setTemporaryAllowed(e)}g(C,`setTemporaryAllowed`);function w(){return y.getAPIToken()}g(w,`getAPIToken`);function T(){return y.requireApiToken()}g(T,`requireApiToken`);function E(e,t){return{complianceConfig:e,scopes:t?.scopes??i.getDefaultScopeKeys(),browser:t?.browser??!0,callbackHost:t?.callbackHost,callbackPort:t?.callbackPort,profile:t?.profile}}g(E,`withDefaultScopes`);async function D(e,t){return y.login(E(e,t))}g(D,`login`);async function O(e){return y.logout(e)}g(O,`logout`);async function k(e,t){return y.getActiveTemporaryAccount()?{loggedIn:!0}:y.loginOrRefreshIfRequired(E(e,t))}g(k,`loginOrRefreshIfRequired`);async function j(){return y.getOAuthTokenFromLocalState()}g(j,`getOAuthTokenFromLocalState`);function M(){return y.getScopes()}g(M,`getScopes`);function N(){return h.storageFactory(x()).read()}g(N,`readAuthCredentials`);function P(e){h.storageFactory(x()).write(e)}g(P,`writeAuthCredentials`);function F(){let e=y.getActiveProfile();return e===`default`?`${i.accountCachePrefix}.json`:`${i.accountCachePrefix}-${e}.json`}g(F,`getAccountCacheFileName`);function I(e){m.saveToConfigCache(F(),{account:e})}g(I,`saveAccountToCache`);function L(){return m.getConfigCache(F()).account}g(L,`getAccountFromCache`);async function R(e,r){let i=await k(e);if(!i.loggedIn)throw new _(`Not logged in. ${d[i.reason]}${f}`,{telemetryMessage:`cfetch auth login required`});let a=T(),o=[],u=!0,p=1,m;for(;u;){m=new ae(m),m.set(`page`,String(p));let{response:i,status:d}=await c(e,r,{},s.userAgent,l,m,void 0,a);i.success?(o.push(...i.result),t(i.result_info)?p+=1:u=!1):n(r,i,d)}return o}g(R,`fetchAccountsPaged`);async function z(e,t={}){let{throwOnEmpty:n=!0}=t,[r,a]=await Promise.allSettled([R(e,`/accounts`),R(e,`/memberships`)]);if(r.status===`rejected`)throw r.reason;if(a.status===`rejected`)if(Se(a.reason)){if(r.status===`fulfilled`&&r.value.length>0)return r.value;throw q(a.reason)===9106?new _(`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 \`${i.commands.login}\` to re-authenticate.
|
|
11
|
+
You can also skip this account check by adding an \`account_id\` in your ${i.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,{telemetryMessage:`user account fetch permission denied`}):new _(`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 \`${i.commands.login}\` to re-authenticate. You can also skip this account check by adding an \`account_id\` in your ${i.getConfigFileLabel()} file, or by setting the value of CLOUDFLARE_ACCOUNT_ID`,{telemetryMessage:`user account fetch permission denied`})}else throw a.reason;let o=new Set(a.value.map(e=>e.account.id)),s=r.value.filter(e=>o.has(e.id));if(s.length===0&&n)throw new _(`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 ${i.getConfigFileLabel()} file.
|
|
14
|
+
Alternatively, try running \`${i.commands.login}\` to re-authenticate.`,{telemetryMessage:`user account fetch empty`});return s}g(z,`fetchAllAccounts`);function B(e){let t=y.getActiveTemporaryAccount();return t?t.account.id:e.account_id?e.account_id:ne()||L()?.id}g(B,`getActiveAccountId`);async function V(e){let t=B(e);if(t)return t;let n=await z(e);if(n.length===1)return I({id:n[0].id,name:n[0].name}),n[0].id;try{let e=await s.select(`Select an account`,{choices:n.map(e=>({title:e.name,value:e.id}))}),t=n.find(t=>t.id===e);if(!t)throw Error(`Selected account not found in accounts list`);return I({id:t.id,name:t.name}),e}catch(e){if(s.isNoDefaultValueProvidedError(e)){let e=a();throw new _(`More than one account available but unable to select one in non-interactive mode.
|
|
15
|
+
Please set the appropriate \`account_id\` in your ${i.getConfigFileLabel()} file or assign it to the \`CLOUDFLARE_ACCOUNT_ID\` environment variable.
|
|
16
|
+
Available accounts are (\`<name>\`: \`<account_id>\`):
|
|
17
|
+
${n.map(t=>` \`${e?`(redacted)`:t.name}\`: \`${t.id}\``).join(`
|
|
18
|
+
`)}`,{telemetryMessage:`user account selection unavailable`})}throw e}}g(V,`getOrSelectAccountId`);async function H(t){if(y.isTemporaryAllowed()){if(e(t)!==`public`)throw new _(`Temporary accounts aren't available when the compliance region is not set to public.`,{telemetryMessage:`user temporary account unavailable in compliance region`});if(w())throw new _("You're already authenticated with Cloudflare, so `--temporary` can't be used. Temporary preview accounts are only for unauthenticated use. Either remove `--temporary` to use your existing account, or log out (and unset CLOUDFLARE_API_TOKEN) first.",{telemetryMessage:`user temporary account already authenticated`});let{account:n,cached:r}=await y.activateTemporaryAccount();return we(l,n,r),n.account.id}let n=await k(t);if(!n.loggedIn)throw n.reason===`no-credentials-non-interactive`||n.reason===`token-expired-non-interactive`?new _(`In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for ${u} 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`}):new _(`Did not login, quitting...`,{telemetryMessage:`user login cancelled`});let r=await V(t);if(!r)throw new _(`No account id found, quitting...`,{telemetryMessage:`user auth missing account id`});return r}return g(H,`requireAuth`),{setProfile:b,getActiveProfile:x,getCredentialStore:S,setTemporaryAllowed:C,getAPIToken:w,requireApiToken:T,login:D,logout:O,loginOrRefreshIfRequired:k,getOAuthTokenFromLocalState:j,getScopes:M,readAuthCredentials:N,writeAuthCredentials:P,getActiveAccountId:B,getOrSelectAccountId:V,getAccountFromCache:L,fetchAllAccounts:z,requireAuth:H}}g(Te,`createCloudflareAuth`);var Ee=`profiles/directory-bindings.json`,De=`.enc`;function J(e){let{logger:t,getConfigPath:n,keyringServiceName:r,format:i}=e,a=`.${i}`;function o(e){return s(n(),e,i)}g(o,`plaintextPath`);function c(e){return h(n(),e)}g(c,`encryptedPath`);function l(){return k.dirname(o(`default`))}g(l,`getProfileConfigDirectory`);let d={exists(e){return C(o(e))||C(c(e))},list(){let e=l();if(!C(e))return[];let t=new Set;for(let n of E(e))n.endsWith(a)?t.add(n.slice(0,-a.length)):n.endsWith(De)&&t.add(n.slice(0,-De.length));return[...t]},delete(e){let{backendAvailable:a,encryptedFileExisted:s}=u({serviceName:r,configPath:n(),profile:e,format:i});K(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 f(){return k.join(n(),Ee)}return g(f,`getDirectoryBindingsPath`),y({configs:d,bindings:{read(){try{let e=T(f(),`utf-8`);return JSON.parse(e)}catch{return{}}},write(e){let t=f();w(k.dirname(t),{recursive:!0}),O(t,JSON.stringify(e,null,` `),`utf-8`)}}})}g(J,`createCloudflareProfileStore`);function Oe(e){let{loginCommand:t,createProfileCommand:n,keyringServiceName:r,getConfigPath:i,format:a,preferences:o}=e,{readUserPreferences:s,updateUserPreferences:c}=o;function d(e){return e??`default`}g(d,`describeProfile`);function f(e){let t=[];C(h(i()))&&t.push(void 0);let n=J({logger:e,getConfigPath:i,keyringServiceName:r,format:a});for(let e of n.configs.list()){try{v(e)}catch{continue}C(h(i(),e))&&t.push(e)}return t}g(f,`listEncryptedProfiles`);function p(e){let o=f(e);if(o.length===0)return;let s=[],c=[];for(let t of o)try{let{backendAvailable:e}=u({serviceName:r,configPath:i(),profile:t,format:a});s.push(d(t)),e||c.push(d(t))}catch(n){e.warn(`Failed to remove encrypted credentials for profile "${d(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.`)}g(p,`scrubAllEncryptedProfiles`);function m(e,t){let{logger:n,getCredentialStore:r}=t,i=s().keyring_enabled===!0,a=l();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&&p(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 g(m,`setKeyringPreference`),{setKeyringPreference:m}}g(Oe,`createKeyringPreference`);function ke(e){let{getConfigPath:t,format:n}=e;function r(e){return s(t(),e,n)}g(r,`getAuthConfigFilePath`);function i(e){return h(t(),e)}g(i,`getEncryptedAuthConfigFilePath`);function a(e){return K(n,()=>r(e))}g(a,`defaultAuthConfigStorage`);function o(e,t){a(t).write(e)}g(o,`writeAuthConfigFile`);function c(e){return a(e).read()}return g(c,`readAuthConfigFile`),{getAuthConfigFilePath:r,getEncryptedAuthConfigFilePath:i,defaultAuthConfigStorage:a,readAuthConfigFile:c,writeAuthConfigFile:o}}g(ke,`createAuthConfigFileHelpers`);var Y=`cloudflare`,Ae=`cf`,je=`http://localhost:8877/oauth/callback`,Me={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"}},Ne=i({variableName:`CLOUDFLARE_CLIENT_ID`,defaultValue:g(()=>`cbca97e7-c331-4cdd-8fd8-e25a451b98bf`,`defaultValue`)});function X(){return d({appName:`cloudflare`,leadingDot:!1,useLegacyHomeDir:!1})}g(X,`getCfConfigPath`);var Pe=`openid.offline.user:read.account:read.access:read.access:write.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.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.firstpartytags:write.images:read.images:write.lb:edit.lb:read.logpush:read.logpush:write.mcp_portals:read.mcp_portals:write.notebook-examples:read.notification:read.notification:write.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.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`.split(`.`),Fe=[...Pe];function Ie(e){Fe=e}g(Ie,`setLoginScopeKeys`);var Le=new Set(Pe);function Re(e){return e.every(e=>Le.has(e))}g(Re,`validateScopeKeys`);function ze(){let e=m();return e===`production`?`cloudflare-temporary-account.json`:`cloudflare-temporary-account.${e}.json`}g(ze,`getTemporaryAccountConfigFile`);function Z(){return k.join(X(),ze())}g(Z,`getCfTemporaryAccountConfigPath`);function Be(e){return K(`json`,e)}g(Be,`createJsonFileStorage`);var{getAuthConfigFilePath:Ve,getEncryptedAuthConfigFilePath:He,defaultAuthConfigStorage:Ue,readAuthConfigFile:We,writeAuthConfigFile:Ge}=ke({getConfigPath:X,format:`json`}),Q={cliName:Ae,commands:{login:`cf auth login`,whoami:`cf auth whoami`},keyringServiceName:Y,clientId:Ne,consent:Me,redirectUri:je,allowGlobalAuthKey:!1,getConfigPath:X,getTemporaryAccountConfigPath:Z,fileFormat:`json`,accountCachePrefix:`cloudflare-account`,cacheNamespace:`cloudflare`,getConfigFileLabel:g(()=>`cf config`,`getConfigFileLabel`),getDefaultScopeKeys:g(()=>Fe,`getDefaultScopeKeys`)},Ke=A(X),{readUserPreferences:qe,updateUserPreferences:Je}=Ke;function Ye(e){return Te(Q,e)}g(Ye,`createCfAuth`);function $(e){return J({logger:e.logger,getConfigPath:X,keyringServiceName:Y,format:`json`})}g($,`createCfProfileStore`);var Xe=Oe({loginCommand:Q.commands.login,createProfileCommand:Q.commands.createProfile,keyringServiceName:Y,getConfigPath:X,format:`json`,preferences:Ke});function Ze(e,t){return Xe.setKeyringPreference(e,t)}g(Ze,`setKeyringPreference`);export{Re as a,X as i,$ as n,Be as r,Ye as t};
|