cf 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-DUs4SKVx.mjs} +2 -2
- package/dist/accounts-BIY8wNGA.mjs +22 -0
- package/dist/{acm-C2lYIWs1.mjs → acm-SqcV8o5o.mjs} +2 -2
- package/dist/addressing-CygRm0pN.mjs +12 -0
- package/dist/{agent-context-CgGCT0xU.mjs → agent-context-CKb6w43K.mjs} +1 -1
- package/dist/ai-BAmEAjN3.mjs +2 -0
- package/dist/ai-gateway-BENwPvvB.mjs +8 -0
- package/dist/ai-search-Bv_Whw3E.mjs +7 -0
- package/dist/ai_gateway-C6WP9oBH.mjs +4 -0
- package/dist/alerting-D_qWrsoY.mjs +6 -0
- package/dist/{analytics-CkhhhZWZ.mjs → analytics-CwFrx-Dr.mjs} +1 -1
- package/dist/analytics_engine-BjV6XLyG.mjs +2 -0
- package/dist/api-gateway-D9PMVVqL.mjs +33 -0
- package/dist/argo-DwYGbyld.mjs +2 -0
- package/dist/artifacts-DKAjY_n4.mjs +4 -0
- package/dist/audit-logs-BvQ9uwuy.mjs +2 -0
- package/dist/auth-DX9KnJ0P.mjs +9 -0
- package/dist/auth-TYwGydWg.mjs +5 -0
- package/dist/billing-CRTlRU88.mjs +2 -0
- package/dist/{bot-management-CJxD1pqi.mjs → bot-management-DgW--8wM.mjs} +2 -2
- package/dist/botnet-feed-CIX6ZORT.mjs +3 -0
- package/dist/brand-protection-ZikBtl0y.mjs +3 -0
- package/dist/browser-rendering-D_ZQVWn8.mjs +4 -0
- package/dist/build-Bgw8TV1p.mjs +134 -0
- package/dist/{cache-B7pRbpTy.mjs → cache-CeN5t6_W.mjs} +4 -4
- package/dist/calls-Cv0ieVg4.mjs +4 -0
- package/dist/certificate-authorities-BzZnWCac.mjs +2 -0
- package/dist/client-certificates-BFuzeBrj.mjs +3 -0
- package/dist/cloud-connector-D5h8Dzzg.mjs +2 -0
- package/dist/cloudforce-one-aqDCIBMp.mjs +21 -0
- package/dist/{completions-D_9WsLG7.mjs → completions-Bvzav4Mj.mjs} +2 -2
- package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
- package/dist/connectivity-CjkXmEhO.mjs +3 -0
- package/dist/connector-interrupts-B7eSface.mjs +2 -0
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +2 -0
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +2 -0
- package/dist/connectors-YYu_Vx3H.mjs +3 -0
- package/dist/content-scanning-BorfRGKT.mjs +4 -0
- package/dist/context-C-WbewL6.mjs +2 -0
- package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-CfRj7QZb.mjs} +4 -4
- package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CcK7_17e.mjs} +4 -4
- package/dist/custom-nameservers-BkKx0THn.mjs +3 -0
- package/dist/custom-pages-DamGVA75.mjs +4 -0
- package/dist/d1-sK0O5THv.mjs +4 -0
- package/dist/data-security-DsWpoWiS.mjs +6 -0
- package/dist/dcv-delegation-BYsNl3qc.mjs +2 -0
- package/dist/{deploy-KBRFIatG.mjs → deploy-BzlPv3ro.mjs} +1 -1
- package/dist/{dev-pPazzZvt.mjs → dev-IOg-_s5_.mjs} +1 -1
- package/dist/diagnostics-CH7T2WR3.mjs +3 -0
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +7 -0
- package/dist/dist-B7hsuvbF.mjs +57 -0
- package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
- package/dist/dns-firewall-VmQf3UVP.mjs +57 -0
- package/dist/dns-o7hUPMCG.mjs +29 -0
- package/dist/durable-objects-DgrTbvoF.mjs +2 -0
- package/dist/email-routing-owCvAEpf.mjs +10 -0
- package/dist/email-security-Dng3DVuf.mjs +8 -0
- package/dist/email-sending-bExMH4lu.mjs +3 -0
- package/dist/filters-DKs-wEzt.mjs +4 -0
- package/dist/{firewall-C3DDwfwh.mjs → firewall-BLaTtX3r.mjs} +10 -10
- package/dist/{fraud-DY3YXFVf.mjs → fraud-D8WmLKyH.mjs} +1 -1
- package/dist/google-tag-gateway-DyCY43k0.mjs +2 -0
- package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-BBtW8vRh.mjs} +3 -3
- package/dist/{hostnames-BdAQo1Mr.mjs → hostnames-Bh2IFxIw.mjs} +2 -2
- package/dist/hyperdrive-DJm1eD-M.mjs +18 -0
- package/dist/iam-apCCcy7R.mjs +6 -0
- package/dist/images-Cxe45OHm.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-8V4h6H46.mjs +3 -0
- package/dist/{ips-B6JETVOY.mjs → ips-BE7JbAnc.mjs} +1 -1
- package/dist/{keyless-certificates-C4MZ4xnf.mjs → keyless-certificates-CfJmXccT.mjs} +2 -2
- package/dist/kv-Dz6then8.mjs +5 -0
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +3 -0
- package/dist/load-balancers-ilsGgudX.mjs +6 -0
- package/dist/logpush-BH14TtuA.mjs +4 -0
- package/dist/logs-B8-mkf_I.mjs +3 -0
- package/dist/magic-cloud-networking-DylCXoG4.mjs +5 -0
- package/dist/magic-network-monitoring-DnyrZy77.mjs +4 -0
- package/dist/magic-transit-B-kU5e3s.mjs +89 -0
- package/dist/managed-transforms-GC9Pq5dg.mjs +3 -0
- package/dist/mtls-certificates-BRlhWw_G.mjs +3 -0
- package/dist/network-interconnects-DuyoFD9_.mjs +36 -0
- package/dist/oauth-B5k80sip.mjs +61 -0
- package/dist/observability-9APhqFHo.mjs +4 -0
- package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
- package/dist/{organizations-aRi1bhFC.mjs → organizations-Dy3kiV_z.mjs} +6 -6
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +2 -0
- package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-B30_2_dO.mjs} +3 -3
- package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
- package/dist/{page-rules-CYqtPU1p.mjs → page-rules-zQJGmTCd.mjs} +5 -5
- package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CxQk5k9X.mjs} +5 -5
- package/dist/pages-5DKLs7CQ.mjs +11 -0
- package/dist/pipelines-DfGE44xo.mjs +6 -0
- package/dist/progress-CL8I-7YK.mjs +2 -0
- package/dist/prompt-q3B7sM2A.mjs +3 -0
- package/dist/queues-BoenUGIw.mjs +6 -0
- package/dist/r2-Cq_JCjK0.mjs +21 -0
- package/dist/r2-data-catalog-eLxltWdO.mjs +14 -0
- package/dist/{radar-CzGM92uM.mjs → radar-YNOCio6T.mjs} +1 -1
- package/dist/rate-limits-CcAF3tMl.mjs +5 -0
- package/dist/raw-fetch-bIXC9D1m.mjs +2 -0
- package/dist/realtime-kit-4bCGviO5.mjs +18 -0
- package/dist/{registrar-8IeA5DKd.mjs → registrar-CfHlaOOf.mjs} +6 -6
- package/dist/request-tracers-DlHawg5l.mjs +2 -0
- package/dist/resource-sharing-7FhuboJE.mjs +5 -0
- package/dist/resource-tagging-divcugVb.mjs +16 -0
- package/dist/rules-CAXkege8.mjs +4 -0
- package/dist/rulesets-CBsdc8IV.mjs +8 -0
- package/dist/rum-D0hHPNl9.mjs +4 -0
- package/dist/{schema-hefO-tzo.mjs → schema-D8o6HcCr.mjs} +1 -1
- package/dist/schema-validation-BWNDnnIT.mjs +24 -0
- package/dist/scim-CWLli4fi.mjs +3 -0
- package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
- package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-B7_HkE8I.mjs} +19 -19
- package/dist/security-center-BQT21oiM.mjs +2 -0
- package/dist/security-txt-CVpmJo29.mjs +3 -0
- package/dist/session-B8r8LNQN.mjs +93 -0
- package/dist/{build-BE4o4imx.mjs → shared-DQI8NGja.mjs} +324 -388
- package/dist/{smart-shield-DblHIce0.mjs → smart-shield-BreBC1Ap.mjs} +2 -2
- package/dist/{snippets-DrpqSXYC.mjs → snippets-BAJoWMSJ.mjs} +3 -3
- package/dist/{spawn-DK7pott_.mjs → spawn-pmGERpdB.mjs} +1 -1
- package/dist/{spectrum-CnrG0jIC.mjs → spectrum-DnIRLY95.mjs} +6 -6
- package/dist/speed-UYEVue28.mjs +4 -0
- package/dist/src-BQ1dr9xR.mjs +108 -0
- package/dist/{ssl-Cp6tQkZH.mjs → ssl-D3Pixs8M.mjs} +3 -3
- package/dist/stream-BUsuOfQh.mjs +14 -0
- package/dist/{tenants-o_M62Y1n.mjs → tenants-BdWJTtcg.mjs} +1 -1
- package/dist/{token-validation-Ca5AGEns.mjs → token-validation-DUvtXWur.mjs} +5 -5
- package/dist/{tools-DtNNmO6l.mjs → tools-CQtA5-cr.mjs} +1 -1
- package/dist/turnstile-CAKVnS1L.mjs +23 -0
- package/dist/{ui-B97lRnOv.mjs → ui-BrNwNHX9.mjs} +1 -1
- package/dist/url-normalization-DA-RAxs4.mjs +3 -0
- package/dist/url-scanner-DmYu43f7.mjs +2 -0
- package/dist/user-Bah4wGGN.mjs +10 -0
- package/dist/vectorize-DhvVG2By.mjs +4 -0
- package/dist/{versions-B6E8WQyA.mjs → versions-NUXxCr0s.mjs} +1 -1
- package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-DoOkT4Mu.mjs} +6 -6
- package/dist/web3-n3GW50u-.mjs +4 -0
- package/dist/workers-D6IaQ_F0.mjs +18 -0
- package/dist/workers-builds-DYi0OMMU.mjs +7 -0
- package/dist/workflows-DrdXUQ2g.mjs +4 -0
- package/dist/{zaraz-CyzfYOEU.mjs → zaraz-9l7KuLqh.mjs} +1 -1
- package/dist/zero-trust-D6V9GH2W.mjs +118 -0
- package/dist/zero_trust-BzXKAX_x.mjs +3 -0
- package/dist/{zones-MSULnDwW.mjs → zones-0MTkuaFk.mjs} +8 -8
- package/package.json +3 -1
- package/dist/accounts-CjtZ8x1z.mjs +0 -22
- package/dist/addressing-CHFK6uxW.mjs +0 -12
- package/dist/ai-DS3i-I1a.mjs +0 -2
- package/dist/ai-gateway-RIsegO2x.mjs +0 -8
- package/dist/ai-search-Dcj4BauG.mjs +0 -7
- package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
- package/dist/alerting-Bk85NNf5.mjs +0 -6
- package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
- package/dist/api-gateway-CWdR4Ne7.mjs +0 -33
- package/dist/argo-DnJRVnGX.mjs +0 -2
- package/dist/artifacts-BVWKiJUl.mjs +0 -4
- package/dist/audit-logs-DjTstbzL.mjs +0 -2
- package/dist/auth-BqDOIrKX.mjs +0 -150
- package/dist/auth-DKkSwnxh.mjs +0 -5
- package/dist/billing-3rEqF83h.mjs +0 -2
- package/dist/botnet-feed-MG91D7BR.mjs +0 -3
- package/dist/brand-protection-CK7gJi06.mjs +0 -3
- package/dist/browser-rendering-Rae0AUt0.mjs +0 -4
- package/dist/calls-DXRWsZ8n.mjs +0 -4
- package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
- package/dist/client-certificates-B0ebLJdk.mjs +0 -3
- package/dist/cloud-connector-BOjaggJk.mjs +0 -2
- package/dist/cloudforce-one-B6HYfk5Z.mjs +0 -21
- package/dist/connectivity-welFvZ7X.mjs +0 -3
- package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
- package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
- package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
- package/dist/connectors-3vjrdFLB.mjs +0 -3
- package/dist/content-scanning-CnW2A0pv.mjs +0 -4
- package/dist/context-CONbNKO-.mjs +0 -2
- package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
- package/dist/custom-pages-5fCSP8in.mjs +0 -4
- package/dist/d1-CyiRbZZn.mjs +0 -4
- package/dist/data-security-Casx4OS_.mjs +0 -6
- package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
- package/dist/diagnostics-BqYDoDfw.mjs +0 -3
- package/dist/dispatch-namespaces-Cz2rajnP.mjs +0 -7
- package/dist/dist-DA54ZQu0.mjs +0 -82
- package/dist/dns-62t95Xif.mjs +0 -29
- package/dist/dns-firewall-Coy8d47t.mjs +0 -57
- package/dist/durable-objects-BSuRERkw.mjs +0 -2
- package/dist/email-routing-BDUYYeV3.mjs +0 -10
- package/dist/email-security-ChHA6eqQ.mjs +0 -8
- package/dist/email-sending-CVrRqn6S.mjs +0 -3
- package/dist/filters-qJpU9uAS.mjs +0 -4
- package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
- package/dist/hyperdrive-99OJV9nl.mjs +0 -18
- package/dist/iam-BRbpg3lN.mjs +0 -6
- package/dist/images-D1jI3r3O.mjs +0 -7
- package/dist/intel-C3ajLpXd.mjs +0 -3
- package/dist/kv-CSWoD9ks.mjs +0 -5
- package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
- package/dist/load-balancers-Du1tNuUt.mjs +0 -6
- package/dist/logpush-SuJyO-uX.mjs +0 -4
- package/dist/logs-DcDNRPRl.mjs +0 -3
- package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
- package/dist/magic-network-monitoring-CqtvOePQ.mjs +0 -4
- package/dist/magic-transit-BTbkhBtF.mjs +0 -89
- package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
- package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
- package/dist/network-interconnects-DsiNytOU.mjs +0 -36
- package/dist/observability-CLqZ7OSi.mjs +0 -4
- package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
- package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
- package/dist/pages-ChurJ2H7.mjs +0 -11
- package/dist/pipelines-CeyujvRf.mjs +0 -6
- package/dist/progress-Cent9Lsg.mjs +0 -2
- package/dist/queues-Rf_n11Cx.mjs +0 -6
- package/dist/r2-BtuTO3vQ.mjs +0 -21
- package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
- package/dist/rate-limits-Bbk7HxP7.mjs +0 -5
- package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
- package/dist/realtime-kit-CivLpkpg.mjs +0 -18
- package/dist/request-tracers-D1aH4NmL.mjs +0 -2
- package/dist/resource-sharing-B-Pcto7-.mjs +0 -5
- package/dist/resource-tagging-Bpb6Qq1M.mjs +0 -16
- package/dist/rules-B10XWY10.mjs +0 -4
- package/dist/rulesets-lYczEcJp.mjs +0 -8
- package/dist/rum-B5GUKa4I.mjs +0 -4
- package/dist/schema-validation-DTq517Em.mjs +0 -24
- package/dist/scim-BiLfOQ89.mjs +0 -3
- package/dist/security-center-AVpTOBK3.mjs +0 -2
- package/dist/security-txt-DVlh8y9l.mjs +0 -3
- package/dist/shared-0bwWVDLo.mjs +0 -2
- package/dist/speed-BzRY3Xlh.mjs +0 -4
- package/dist/src-D9_Gq68b.mjs +0 -108
- package/dist/stream-CGTRN4ZN.mjs +0 -14
- package/dist/turnstile-l7mo9BWL.mjs +0 -23
- package/dist/url-normalization-D1CogSIG.mjs +0 -3
- package/dist/url-scanner-BnJHJqcz.mjs +0 -2
- package/dist/user-CiyYZ69X.mjs +0 -10
- package/dist/vectorize-D3LgMLOn.mjs +0 -4
- package/dist/web3-DlHE0CZc.mjs +0 -4
- package/dist/workers-DRAkU6YR.mjs +0 -18
- package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
- package/dist/workflows-z6oapEJs.mjs +0 -4
- package/dist/zero-trust-fyyIelWx.mjs +0 -118
- package/dist/zero_trust-BAhlNkjo.mjs +0 -3
- /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
- /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
- /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-DGgEbf8K.mjs} +0 -0
- /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
- /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
- /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
- /package/dist/{metadata-jh2EIan8.mjs → metadata-MPDDi08e.mjs} +0 -0
- /package/dist/{resolve-D1mG0REg.mjs → resolve-DGD57PFH.mjs} +0 -0
- /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{N as e,O as t,P as n}from"./oauth-B5k80sip.mjs";import{n as r}from"./auth-DX9KnJ0P.mjs";import{n as i,t as a}from"./body-parser-DWSy7uZ8.mjs";import{t as o}from"./output-B6fBFRqe.mjs";import{n as s,t as c}from"./progress-CL8I-7YK.mjs";import{n as l}from"./input-validation-_fMCApaH.mjs";import{t as u}from"./local-CYc9q7l2.mjs";import{r as d,t as f}from"./prompt-q3B7sM2A.mjs";function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get`,describe:`Returns the current daily sending quota for the account and, when a quota is resolved, the account's current usage against it. Quota is null when not yet available; usage is null when there is no resolved quota or usage is temporarily unavailable.`,builder:p,handler:async e=>{if(e.dryRun){s({command:`cf email-sending limits get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${n()??`<account-id>`}/email/sending/limits`,pathParams:{},bodyKind:`none`});return}let i=await r(e),a=e.local?u:await t();e.accountId=a,o(await c(`Loading`,async()=>i.emailSending.limits.get({account_id:a})),{successLabel:`Loaded`})}},h={command:`limits`,describe:`Operations for limits`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`from`,{type:`string`,description:`Sender email address.`}).option(`mime-message`,{type:`string`,description:`The full MIME-encoded email message. Should include standard RFC 5322 headers such as From, To, Subject, and Content-Type. The from and recipients fields in the request body control SMTP envelope routing; the From and To headers in the MIME message control what the recipient's email client displays.`}).option(`recipients`,{type:`string`,array:!0,description:`List of recipient email addresses.`}).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:`send-raw`,describe:`Send a raw RFC 5322 (MIME) email for the specified account. Provide the full MIME message plus the SMTP envelope (from and recipients).`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf email-sending send-raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n()??`<account-id>`}/email/sending/send_raw`,pathParams:{},bodyKind:`json`,body:e.body===void 0?a({from:l(e.from,`from`,`text`),mime_message:l(e[`mime-message`],`mime-message`,`text`),recipients:e.recipients}):i(e.body)});return}let f=await r(e),p=e.local?u:await t();if(e.accountId=p,e.body){let t=i(e.body);o(await c(`Creating`,async()=>f.emailSending.sendRaw({...t,account_id:p})),{successLabel:`Created`});return}if(e.from===void 0&&(e.from=await d(`from`,`Sender email address.`)),e[`mime-message`]===void 0&&(e[`mime-message`]=await d(`mime-message`,`The full MIME-encoded email message. Should include standard RFC 5322 headers such as From, To, Subject, and Content-Type. The from and recipients fields in the request body control SMTP envelope routing; the From and To headers in the MIME message control what the recipient's email client displays.`)),e.recipients===void 0)throw Error(`--recipients is required (or pass --body with this field set).`);let m=a({from:l(e.from,`from`,`text`),mime_message:l(e[`mime-message`],`mime-message`,`text`),recipients:e.recipients});o(await c(`Creating`,async()=>f.emailSending.sendRaw({...m,account_id:p})),{successLabel:`Created`})}};function v(e){return e.option(`bcc-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`bcc-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`cc-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`cc-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`from-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`from-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`html`,{type:`string`,description:`HTML body of the email. Provide at least one of text or html (non-empty).`}).option(`reply-to-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`reply-to-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`subject`,{type:`string`,description:`Email subject line.`}).option(`text`,{type:`string`,description:`Plain text body of the email. Provide at least one of text or html (non-empty).`}).option(`to-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`to-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).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 y={command:`send`,describe:`Send an email for the specified account using the structured builder. Provide the sender, recipients, subject, and at least one of text or html; attachments are optional.`,builder:v,handler:async e=>{if(e.dryRun){s({command:`cf email-sending send`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n()??`<account-id>`}/email/sending/send`,pathParams:{},bodyKind:`json`,body:e.body===void 0?a({bcc:{address:l(e[`bcc-address`],`bcc-address`,`text`),name:l(e[`bcc-name`],`bcc-name`,`text`)},cc:{address:l(e[`cc-address`],`cc-address`,`text`),name:l(e[`cc-name`],`cc-name`,`text`)},from:{address:l(e[`from-address`],`from-address`,`text`),name:l(e[`from-name`],`from-name`,`text`)},html:l(e.html,`html`,`text`),reply_to:{address:l(e[`reply-to-address`],`reply-to-address`,`text`),name:l(e[`reply-to-name`],`reply-to-name`,`text`)},subject:l(e.subject,`subject`,`text`),text:l(e.text,`text`,`text`),to:{address:l(e[`to-address`],`to-address`,`text`),name:l(e[`to-name`],`to-name`,`text`)}}):i(e.body)});return}let f=await r(e),p=e.local?u:await t();if(e.accountId=p,e.body){let t=i(e.body);o(await c(`Creating`,async()=>f.emailSending.send({...t,account_id:p})),{successLabel:`Created`});return}e.subject===void 0&&(e.subject=await d(`subject`,`Email subject line.`));let m=a({bcc:{address:l(e[`bcc-address`],`bcc-address`,`text`),name:l(e[`bcc-name`],`bcc-name`,`text`)},cc:{address:l(e[`cc-address`],`cc-address`,`text`),name:l(e[`cc-name`],`cc-name`,`text`)},from:{address:l(e[`from-address`],`from-address`,`text`),name:l(e[`from-name`],`from-name`,`text`)},html:l(e.html,`html`,`text`),reply_to:{address:l(e[`reply-to-address`],`reply-to-address`,`text`),name:l(e[`reply-to-name`],`reply-to-name`,`text`)},subject:l(e.subject,`subject`,`text`),text:l(e.text,`text`,`text`),to:{address:l(e[`to-address`],`to-address`,`text`),name:l(e[`to-name`],`to-name`,`text`)}});o(await c(`Creating`,async()=>f.emailSending.send({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.option(`name`,{type:`string`,description:`The subdomain name. Must be within the zone.`}).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 x={command:`create`,describe:`Creates a new sending subdomain or re-enables sending on an existing subdomain that had it disabled. If zone-level Email Sending has not been enabled yet, the zone flag is automatically set when the entitlement is present.`,builder:b,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({name:l(t.name,`name`,`text`)}):i(t.body)});return}let n=await r(t),u=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=i(t.body);o(await c(`Creating`,async()=>n.emailSending.subdomains.create({...e,zone_id:u})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await d(`name`,`The subdomain name. Must be within the zone.`));let f=a({name:l(t.name,`name`,`text`)});o(await c(`Creating`,async()=>n.emailSending.subdomains.create({...f,zone_id:u})),{successLabel:`Created`})}};function S(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,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 C={command:`delete <subdomain-id>`,describe:`Disables sending on a subdomain and removes its DNS records. If routing is still active on the subdomain, only sending is disabled.`,builder:S,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains/${t[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(t[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(t[`subdomain-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=i,!await f({force:!!t.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}o(await c(`Deleting`,async()=>n.emailSending.subdomains.delete({zone_id:i,subdomain_id:t[`subdomain-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`fix <subdomain-id>`,describe:`Idempotently re-applies the sending DNS records (creates missing records, re-applies the email_routing lock on records whose lock has been cleared). Refuses with a 409 if foreign MX, multiple SPF, multiple DMARC, or multiple DKIM records exist at the relevant DNS names — those require manual cleanup.`,builder:w,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains dns fix`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains/${t[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(t[`subdomain-id`]))}/dns`,pathParams:{"subdomain-id":String(t[`subdomain-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,o(await c(`Creating`,async()=>n.emailSending.subdomains.dns.fix({zone_id:i,subdomain_id:t[`subdomain-id`]})),{successLabel:`Created`})}};function E(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get-status <subdomain-id>`,describe:`Returns the desired DNS records for a sending subdomain along with a live diff against actual DNS state. Use this to detect missing, unlocked, foreign, or multi-record conflicts before deciding whether to call the fix endpoint.`,builder:E,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains dns get-status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains/${t[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(t[`subdomain-id`]))}/dns/status`,pathParams:{"subdomain-id":String(t[`subdomain-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,o(await c(`Loading`,async()=>n.emailSending.subdomains.dns.getStatus({zone_id:i,subdomain_id:t[`subdomain-id`]})),{successLabel:`Loaded`})}};function O(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <subdomain-id>`,describe:`Returns the expected DNS records for a sending subdomain.`,builder:O,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains dns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains/${t[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(t[`subdomain-id`]))}/dns`,pathParams:{"subdomain-id":String(t[`subdomain-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,o(await c(`Loading`,async()=>n.emailSending.subdomains.dns.get({zone_id:i,subdomain_id:t[`subdomain-id`]})),{successLabel:`Loaded`})}},A={command:`dns`,describe:`Operations for subdomains.dns`,builder:e=>e.command(T).command(k).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <subdomain-id>`,describe:`Gets information for a specific sending subdomain.`,builder:j,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains/${t[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(t[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(t[`subdomain-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,o(await c(`Loading`,async()=>n.emailSending.subdomains.get({zone_id:i,subdomain_id:t[`subdomain-id`]})),{successLabel:`Loaded`})}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`list`,describe:`Lists all sending-enabled subdomains for the zone.`,builder:N,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,o(await c(`Loading`,async()=>n.emailSending.subdomains.list({zone_id:i})),{successLabel:`Loaded`})}};function F(e){return e.option(`name`,{type:`string`,description:`The subdomain name. Must be within the zone.`}).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 I={command:`preview`,describe:`Returns the DNS records that would be created for a sending subdomain, flags which records are missing, and reports any conflicts with existing DNS records. This is a read-only dry-run — no records are created or modified. Use before or after creating a subdomain to check DNS status.`,builder:F,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains/preview`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({name:l(t.name,`name`,`text`)}):i(t.body)});return}let n=await r(t),u=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=i(t.body);o(await c(`Loading`,async()=>n.emailSending.subdomains.preview({...e,zone_id:u})),{successLabel:`Loaded`});return}t.name===void 0&&(t.name=await d(`name`,`The subdomain name. Must be within the zone.`));let f=a({name:l(t.name,`name`,`text`)});o(await c(`Loading`,async()=>n.emailSending.subdomains.preview({...f,zone_id:u})),{successLabel:`Loaded`})}};function L(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`preview-enabled`,{type:`boolean`,description:`Whether sent messages from this subdomain can be previewed in the activity log.`}).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 R={command:`update <subdomain-id>`,describe:`Updates the activity-log preview preference for a sending subdomain.`,builder:L,handler:async t=>{if(t.dryRun){s({command:`cf email-sending subdomains update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/email/sending/subdomains/${t[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(t[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(t[`subdomain-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?a({preview_enabled:t[`preview-enabled`]}):i(t.body)});return}let n=await r(t),l=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=l,t.body){let e=i(t.body);o(await c(`Updating`,async()=>n.emailSending.subdomains.update({...e,zone_id:l,subdomain_id:t[`subdomain-id`]})),{successLabel:`Updated`});return}if(t[`preview-enabled`]===void 0)throw Error(`--preview-enabled is required (or pass --body with this field set).`);let u=a({preview_enabled:t[`preview-enabled`]});o(await c(`Updating`,async()=>n.emailSending.subdomains.update({...u,zone_id:l,subdomain_id:t[`subdomain-id`]})),{successLabel:`Updated`})}},z={command:`subdomains`,describe:`Operations for subdomains`,builder:e=>e.command(x).command(C).command(M).command(P).command(I).command(R).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`email-sending`,describe:`Send emails and manage sending subdomains`,builder:e=>e.command(y).command(_).command(h).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{B as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{t as c}from"./prompt-q3B7sM2A.mjs";import{t as l}from"./cli-types-DGgEbf8K.mjs";function u(e){return e.option(`id`,{type:`string`,description:`ID`,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 d={command:`bulk-delete`,describe:`Deletes one or more existing filters.`,builder:u,handler:async n=>{let r={id:n.id};if(n.dryRun){a({command:`cf filters bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),l=await e({zone:n.zone},s,{quiet:n.quiet});if(n.zoneId=l,!await c({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>s.filters.bulkDelete({zone_id:l,...r})),{successLabel:`Deleted`})}};function f(e){return e.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 p={command:`bulk-update`,describe:`Updates one or more existing filters.`,builder:f,handler:async r=>{if(r.dryRun){a({command:`cf filters bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?void 0:n(r.body)});return}let s=await t(r),c=await e({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,r.body){let e=n(r.body);i(await o(`Updating`,async()=>s.filters.bulkUpdate({body:e,zone_id:c})),{successLabel:`Updated`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function m(e){return e.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 h={command:`create`,describe:`Creates one or more filters.`,builder:m,handler:async r=>{if(r.dryRun){a({command:`cf filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`json`,body:r.body===void 0?void 0:n(r.body)});return}let s=await t(r),c=await e({zone:r.zone},s,{quiet:r.quiet});if(r.zoneId=c,r.body){let e=n(r.body);i(await o(`Creating`,async()=>s.filters.create({body:e,zone_id:c})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function g(e){return e.positional(`filter-id`,{type:`string`,description:`The unique identifier of the filter.`,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 _={command:`delete <filter-id>`,describe:`Deletes an existing filter.`,builder:g,handler:async n=>{if(n.dryRun){a({command:`cf filters delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/filters/${n[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(n[`filter-id`]))}`,pathParams:{"filter-id":String(n[`filter-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});if(n.zoneId=s,!await c({force:!!n.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}i(await o(`Deleting`,async()=>r.filters.delete({zone_id:s,filter_id:n[`filter-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`filter-id`,{type:`string`,description:`The unique identifier of the filter.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <filter-id>`,describe:`Fetches the details of a filter.`,builder:v,handler:async n=>{if(n.dryRun){a({command:`cf filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/filters/${n[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(n[`filter-id`]))}`,pathParams:{"filter-id":String(n[`filter-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.filters.get({zone_id:s,filter_id:n[`filter-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`expression`,{type:`string`,description:`A case-insensitive string to find in the expression.`}).option(`description`,{type:`string`,description:`A case-insensitive string to find in the description.`}).option(`ref`,{type:`string`,description:`The filter ref (a short reference tag) to search for. Must be an exact match.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of filters per page.`}).option(`id`,{type:`string`,description:`The unique identifier of the filter.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Fetches filters in a zone. You can filter the results using several optional parameters.`,builder:l(b),handler:async n=>{let r={paused:n.paused,expression:n.expression,description:n.description,ref:n.ref,page:n.page,per_page:n[`per-page`],id:n.id};if(n.dryRun){a({command:`cf filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.filters.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function S(e){return e.positional(`filter-id`,{type:`string`,description:`The unique identifier of the filter.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative summary of the filter.`}).option(`expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).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:`update <filter-id>`,describe:`Updates an existing filter.`,builder:S,handler:async c=>{if(c.dryRun){a({command:`cf filters update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/filters/${c[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(c[`filter-id`]))}`,pathParams:{"filter-id":String(c[`filter-id`]??``),"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({description:s(c.description,`description`,`text`),expression:s(c.expression,`expression`,`text`),paused:c.paused,ref:s(c.ref,`ref`,`text`)}):n(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=n(c.body);i(await o(`Updating`,async()=>l.filters.update({body:e,zone_id:u,filter_id:c[`filter-id`]})),{successLabel:`Updated`});return}let d=r({description:s(c.description,`description`,`text`),expression:s(c.expression,`expression`,`text`),paused:c.paused,ref:s(c.ref,`ref`,`text`)});i(await o(`Updating`,async()=>l.filters.update({body:d,zone_id:u,filter_id:c[`filter-id`]})),{successLabel:`Updated`})}},w={command:`filters`,describe:`Filter expressions used by legacy firewall rules to match requests — prefer Rulesets for new configurations`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{w as default};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}
|
|
4
|
-
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Fetches IP Access rules of an account. These rules apply to all the zones in the account. You can filter the results using several optional parameters.`,builder:m(x),handler:async
|
|
5
|
-
`);return}
|
|
6
|
-
`);return}if(
|
|
7
|
-
`);return}if(
|
|
8
|
-
`);return}
|
|
9
|
-
`);return}l(await d(`Deleting`,async()=>t.firewall.waf.overrides.delete({zone_id:i,overrides_id:e[`overrides-id`]})),{successLabel:`Deleted`})}};function ve(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get <overrides-id>`,describe:`Fetches the details of a URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ve,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.overrides.get({zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Loaded`})}};function be(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of WAF overrides per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`Fetches the URI-based WAF overrides in a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:be,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){u({command:`cf firewall waf overrides list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.overrides.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function Se(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 Ce={command:`update <overrides-id>`,describe:`Updates an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Se,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...n,zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i=c({urls:e.urls});l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...i,zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`})}},we={command:`overrides`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(he).command(_e).command(ye).command(xe).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return e.positional(`package-id`,{type:`string`,description:`Defines a package identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ee={command:`get <package-id>`,describe:`Fetches the details of a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Te,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.get({zone_id:r,package_id:e[`package-id`]})),{successLabel:`Loaded`})}};function De(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",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 Oe={command:`edit <group-id>`,describe:"Updates a WAF rule group. You can update the state (`mode` parameter) of a rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).",builder:De,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...n,zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`});return}let i=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...i,zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <group-id>`,describe:`Fetches the details of a WAF rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.groups.get({zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Loaded`})}};function je(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rule groups per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rule groups.`,choices:[`mode`,`rules_count`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rule groups.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the condition for search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`Defines the name of the rule group.`}).option(`rules-count`,{type:`number`,description:`Defines the number of rules in the current rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`Fetches the WAF rule groups in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(je),handler:async e=>{let t={mode:e.mode,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name,rules_count:e[`rules-count`]};if(e.dryRun){u({command:`cf firewall waf packages groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.groups.list({zone_id:i,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},Ne={command:`groups`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Oe).command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of packages per page.`}).option(`order`,{type:`string`,description:`The field used to sort returned packages.`,choices:[`name`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned packages.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`The name of the WAF package.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`list`,describe:`Fetches WAF packages for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Pe),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name};if(e.dryRun){u({command:`cf firewall waf packages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the mode/action of the rule when triggered. You must use a value from the `allowed_modes` array of the current rule.",choices:[`default`,`disable`,`simulate`,`block`,`challenge`,`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 Le={command:`edit <rule-id>`,describe:`Updates a WAF rule. You can only update the mode/action of the rule. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Ie,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...n,zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let i=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...i,zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function Re(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <rule-id>`,describe:`Fetches the details of a WAF rule in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Re,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.rules.get({zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Loaded`})}};function Be(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Defines the action/mode a rule has been overridden to perform.`,choices:[`DIS`,`CHL`,`BLK`,`SIM`]}).option(`group-id`,{type:`string`,description:`Defines the unique identifier of the rule group.`}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rules per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`priority`,`group_id`,`description`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`description`,{type:`string`,description:`Defines the public description of the WAF rule.`}).option(`priority`,{type:`string`,description:`Defines the order in which the individual WAF rule is executed within its rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Fetches WAF rules in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Be),handler:async e=>{let t={mode:e.mode,group_id:e[`group-id`],page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,description:e.description,priority:e.priority};if(e.dryRun){u({command:`cf firewall waf packages rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.rules.list({zone_id:i,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},$={command:`rules`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},He={command:`packages`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Ee).command(Fe).command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`waf`,describe:`Operations for waf`,builder:e=>e.command(we).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).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 Ge={command:`create`,describe:`Creates a new IP Access rule for a zone. Note: To create an IP Access rule that applies to multiple zones, refer to [IP Access rules for a user](#ip-access-rules-for-a-user) or [IP Access rules for an account](#ip-access-rules-for-an-account) as appropriate.`,builder:We,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>r.firewall.zoneAccessRules.create({...t,zone_id:i})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)});l(await d(`Creating`,async()=>r.firewall.zoneAccessRules.create({...a,zone_id:i})),{successLabel:`Created`})}};function Ke(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`cascade`,{type:`string`,description:"The level to attempt to delete similar rules defined for other zones with the same owner. The default value is `none`, which will only delete the current rule. Using `basic` will delete rules that match the same action (mode) and configuration, while using `aggressive` will delete rules that match the same configuration.",choices:[`none`,`basic`,`aggressive`],default:`none`}).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 qe={command:`delete <rule-id>`,describe:"Deletes an IP Access rule defined at the zone level. Optionally, you can use the `cascade` property to specify that you wish to delete similar rules in other zones managed by the same zone owner.",builder:Ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({cascade:f(e.cascade,`cascade`,`text`)}):s(e.body)});return}let t=await o(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}if(
|
|
11
|
-
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}).option(`order`,{type:`string`,description:`The field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`list`,describe:`Fetches IP Access rules of a zone. You can filter the results using several optional parameters.`,builder:m(Xe),handler:async
|
|
2
|
+
import{N as e,O as t,P as n}from"./oauth-B5k80sip.mjs";import{i as r,n as i}from"./auth-DX9KnJ0P.mjs";import{n as a,t as o}from"./body-parser-DWSy7uZ8.mjs";import{t as s}from"./output-B6fBFRqe.mjs";import{n as c,t as l}from"./progress-CL8I-7YK.mjs";import{n as u}from"./input-validation-_fMCApaH.mjs";import{t as d}from"./local-CYc9q7l2.mjs";import{n as f,t as p}from"./prompt-q3B7sM2A.mjs";import{t as m}from"./cli-types-DGgEbf8K.mjs";function ee(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).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 te={command:`create`,describe:`Creates a new IP Access rule for an account. The rule will apply to all zones in the account. Note: To create an IP Access rule that applies to a single zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.`,builder:ee,handler:async e=>{if(e.dryRun){c({command:`cf firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:e.body===void 0?o({configuration:{target:u(e[`configuration-target`],`configuration-target`,`text`),value:u(e[`configuration-value`],`configuration-value`,`text`)},mode:u(e.mode,`mode`,`text`)}):a(e.body)});return}let r=await i(e),p=e.local?d:await t();if(e.accountId=p,e.body){let t=a(e.body);s(await l(`Creating`,async()=>r.firewall.accessRules.create({...t,account_id:p})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await f(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m=o({configuration:{target:u(e[`configuration-target`],`configuration-target`,`text`),value:u(e[`configuration-value`],`configuration-value`,`text`)},mode:u(e.mode,`mode`,`text`)});s(await l(`Creating`,async()=>r.firewall.accessRules.create({...m,account_id:p})),{successLabel:`Created`})}};function h(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,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 g={command:`delete <rule-id>`,describe:`Deletes an existing IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:h,handler:async e=>{if(e.dryRun){c({command:`cf firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n()??`<account-id>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await t();if(e.accountId=a,!await p({force:!!e.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}s(await l(`Deleting`,async()=>r.firewall.accessRules.delete({account_id:a,rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).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 v={command:`edit <rule-id>`,describe:`Updates an IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:_,handler:async e=>{if(e.dryRun){c({command:`cf firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n()??`<account-id>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?o({configuration:{target:u(e[`configuration-target`],`configuration-target`,`text`),value:u(e[`configuration-value`],`configuration-value`,`text`)},mode:u(e.mode,`mode`,`text`),notes:u(e.notes,`notes`,`text`)}):a(e.body)});return}let r=await i(e),p=e.local?d:await t();if(e.accountId=p,e.body){let t=a(e.body);s(await l(`Updating`,async()=>r.firewall.accessRules.edit({body:t,account_id:p,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}e.mode===void 0&&(e.mode=await f(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m=o({configuration:{target:u(e[`configuration-target`],`configuration-target`,`text`),value:u(e[`configuration-value`],`configuration-value`,`text`)},mode:u(e.mode,`mode`,`text`),notes:u(e.notes,`notes`,`text`)});s(await l(`Updating`,async()=>r.firewall.accessRules.edit({body:m,account_id:p,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <rule-id>`,describe:`Fetches the details of an IP Access rule defined at the account level.`,builder:y,handler:async e=>{if(e.dryRun){c({command:`cf firewall access-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${n()??`<account-id>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`none`});return}let r=await i(e),a=e.local?d:await t();e.accountId=a,s(await l(`Loading`,async()=>r.firewall.accessRules.get({account_id:a,rule_id:e[`rule-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`Defines the target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"Defines the target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`Defines the string to search for in the notes of existing IP Access rules.
|
|
4
|
+
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Fetches IP Access rules of an account. These rules apply to all the zones in the account. You can filter the results using several optional parameters.`,builder:m(x),handler:async e=>{let r={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){c({command:`cf firewall access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${n()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},query:r,bodyKind:`none`});return}let a=await i(e),o=e.local?d:await t();e.accountId=o,s(await l(`Loading`,async()=>a.firewall.accessRules.list({account_id:o,...r})),{successLabel:`Loaded`})}},C={command:`access-rules`,describe:`IP-based access rules that allow, block, challenge, or whitelist traffic globally or per-zone`,builder:e=>e.command(te).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 T={command:`create`,describe:`Creates a new Zone Lockdown rule.`,builder:w,handler:async t=>{if(t.dryRun){c({command:`cf firewall lockdowns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({description:u(t.description,`description`,`text`),paused:t.paused,priority:t.priority,urls:t.urls}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.firewall.lockdowns.create({...e,zone_id:r})),{successLabel:`Created`});return}if(t.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let d=o({description:u(t.description,`description`,`text`),paused:t.paused,priority:t.priority,urls:t.urls});s(await l(`Creating`,async()=>n.firewall.lockdowns.create({...d,zone_id:r})),{successLabel:`Created`})}};function E(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,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 D={command:`delete <lock-downs-id>`,describe:`Deletes an existing Zone Lockdown rule.`,builder:E,handler:async t=>{if(t.dryRun){c({command:`cf firewall lockdowns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/lockdowns/${t[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(t[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(t[`lock-downs-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,!await p({force:!!t.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}s(await l(`Deleting`,async()=>n.firewall.lockdowns.delete({zone_id:r,lock_downs_id:t[`lock-downs-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <lock-downs-id>`,describe:`Fetches the details of a Zone Lockdown rule.`,builder:O,handler:async t=>{if(t.dryRun){c({command:`cf firewall lockdowns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/lockdowns/${t[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(t[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(t[`lock-downs-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,s(await l(`Loading`,async()=>n.firewall.lockdowns.get({zone_id:r,lock_downs_id:t[`lock-downs-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`modified-on`,{type:`string`,description:`The timestamp of when the rule was last modified.`}).option(`ip`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`uri-search`,{type:`string`,description:`A single URI to search for in the list of URLs of existing rules.`}).option(`ip-range-search`,{type:`string`,description:`A single IP address range to search for in existing rules.`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`created-on`,{type:`string`,description:`The timestamp of when the rule was created.`}).option(`description-search`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`ip-search`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Fetches Zone Lockdown rules. You can filter the results using several optional parameters.`,builder:A,handler:async t=>{let n={page:t.page,description:t.description,modified_on:t[`modified-on`],ip:t.ip,priority:t.priority,uri_search:t[`uri-search`],ip_range_search:t[`ip-range-search`],per_page:t[`per-page`],created_on:t[`created-on`],description_search:t[`description-search`],ip_search:t[`ip-search`]};if(t.dryRun){c({command:`cf firewall lockdowns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.lockdowns.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function M(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 N={command:`update <lock-downs-id>`,describe:`Updates an existing Zone Lockdown rule.`,builder:M,handler:async t=>{if(t.dryRun){c({command:`cf firewall lockdowns update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/lockdowns/${t[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(t[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(t[`lock-downs-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({urls:t.urls}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.lockdowns.update({...e,zone_id:r,lock_downs_id:t[`lock-downs-id`]})),{successLabel:`Updated`});return}if(t.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let u=o({urls:t.urls});s(await l(`Updating`,async()=>n.firewall.lockdowns.update({...u,zone_id:r,lock_downs_id:t[`lock-downs-id`]})),{successLabel:`Updated`})}},P={command:`lockdowns`,describe:`Zone lockdown rules that restrict access to URLs by IP address or range`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(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 I={command:`bulk-delete`,describe:`Deletes existing firewall rules.`,builder:F,handler:async t=>{if(t.dryRun){c({command:`cf firewall rules bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,!await p({force:!!t.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}if(t.body){let e=a(t.body);s(await l(`Deleting`,async()=>n.firewall.rules.bulkDelete({...e,zone_id:r})),{successLabel:`Deleted`});return}s(await l(`Deleting`,async()=>n.firewall.rules.bulkDelete({zone_id:r})),{successLabel:`Deleted`})}};function L(e){return e.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 R={command:`bulk-edit`,describe:`Updates the priority of existing firewall rules.`,builder:L,handler:async t=>{if(t.dryRun){c({command:`cf firewall rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),o=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=o,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.rules.bulkEdit({body:e,zone_id:o})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>r(n,`PATCH`,`/zones/${t.zoneId}/firewall/rules`)),{successLabel:`Updated`})}};function z(e){return e.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:`bulk-update`,describe:`Updates one or more existing firewall rules.`,builder:z,handler:async t=>{if(t.dryRun){c({command:`cf firewall rules bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),o=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=o,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.rules.bulkUpdate({body:e,zone_id:o})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>r(n,`PUT`,`/zones/${t.zoneId}/firewall/rules`)),{successLabel:`Updated`})}};function V(e){return e.option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).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 H={command:`create`,describe:`Create one or more firewall rules.`,builder:V,handler:async t=>{if(t.dryRun){c({command:`cf firewall rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({filter:{description:u(t[`filter-description`],`filter-description`,`text`),expression:u(t[`filter-expression`],`filter-expression`,`text`),paused:t[`filter-paused`],ref:u(t[`filter-ref`],`filter-ref`,`text`)}}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.firewall.rules.create({...e,zone_id:r})),{successLabel:`Created`});return}let d=o({filter:{description:u(t[`filter-description`],`filter-description`,`text`),expression:u(t[`filter-expression`],`filter-expression`,`text`),paused:t[`filter-paused`],ref:u(t[`filter-ref`],`filter-ref`,`text`)}});s(await l(`Creating`,async()=>n.firewall.rules.create({...d,zone_id:r})),{successLabel:`Created`})}};function U(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`delete-filter-if-unused`,{type:`boolean`,description:`When true, indicates that Cloudflare should also delete the associated filter if there are no other firewall rules referencing the filter.`}).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 W={command:`delete <rule-id>`,describe:`Deletes an existing firewall rule.`,builder:U,handler:async t=>{if(t.dryRun){c({command:`cf firewall rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({delete_filter_if_unused:t[`delete-filter-if-unused`]}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,!await p({force:!!t.force})){process.stderr.write(`Aborted.
|
|
7
|
+
`);return}if(t.body){let e=a(t.body);s(await l(`Deleting`,async()=>n.firewall.rules.delete({...e,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Deleted`});return}let u=o({delete_filter_if_unused:t[`delete-filter-if-unused`]});s(await l(`Deleting`,async()=>n.firewall.rules.delete({...u,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).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 K={command:`edit <rule-id>`,describe:`Updates the priority of an existing firewall rule.`,builder:G,handler:async t=>{if(t.dryRun){c({command:`cf firewall rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.rules.edit({...e,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}s(await l(`Updating`,async()=>n.firewall.rules.edit({zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`})}};function q(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <rule-id>`,describe:`Fetches the details of a firewall rule.`,builder:q,handler:async t=>{let n={id:t.id};if(t.dryRun){c({command:`cf firewall rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.rules.get({zone_id:a,rule_id:t[`rule-id`],...n})),{successLabel:`Loaded`})}};function Y(e){return e.option(`description`,{type:`string`,description:`A case-insensitive string to find in the description.`}).option(`action`,{type:`string`,description:`The action to search for. Must be an exact match.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of firewall rules per page.`}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the firewall rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Fetches firewall rules in a zone. You can filter the results using several optional parameters.`,builder:Y,handler:async t=>{let n={description:t.description,action:t.action,page:t.page,per_page:t[`per-page`],id:t.id,paused:t.paused};if(t.dryRun){c({command:`cf firewall rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.rules.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).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 Q={command:`update <rule-id>`,describe:`Updates an existing firewall rule.`,builder:Z,handler:async t=>{if(t.dryRun){c({command:`cf firewall rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({filter:{description:u(t[`filter-description`],`filter-description`,`text`),expression:u(t[`filter-expression`],`filter-expression`,`text`),paused:t[`filter-paused`],ref:u(t[`filter-ref`],`filter-ref`,`text`)}}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.rules.update({...e,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let d=o({filter:{description:u(t[`filter-description`],`filter-description`,`text`),expression:u(t[`filter-expression`],`filter-expression`,`text`),paused:t[`filter-paused`],ref:u(t[`filter-ref`],`filter-ref`,`text`)}});s(await l(`Updating`,async()=>n.firewall.rules.update({...d,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`})}},ne={command:`rules`,describe:`Legacy firewall rules with filter expressions — prefer Rulesets for new configurations`,builder:e=>e.command(I).command(R).command(B).command(H).command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ua` when specifying a user agent in the rule.",choices:[`ua`]}).option(`configuration-value`,{type:`string`,description:`the user agent to exactly match`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).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 ie={command:`create`,describe:`Creates a new User Agent Blocking rule in a zone.`,builder:re,handler:async t=>{if(t.dryRun){c({command:`cf firewall ua-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({configuration:{target:u(t[`configuration-target`],`configuration-target`,`text`),value:u(t[`configuration-value`],`configuration-value`,`text`)},description:u(t.description,`description`,`text`),mode:u(t.mode,`mode`,`text`),paused:t.paused}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.firewall.uaRules.create({...e,zone_id:r})),{successLabel:`Created`});return}t.mode===void 0&&(t.mode=await f(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let d=o({configuration:{target:u(t[`configuration-target`],`configuration-target`,`text`),value:u(t[`configuration-value`],`configuration-value`,`text`)},description:u(t.description,`description`,`text`),mode:u(t.mode,`mode`,`text`),paused:t.paused});s(await l(`Creating`,async()=>n.firewall.uaRules.create({...d,zone_id:r})),{successLabel:`Created`})}};function ae(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,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 oe={command:`delete <ua-rule-id>`,describe:`Deletes an existing User Agent Blocking rule.`,builder:ae,handler:async t=>{if(t.dryRun){c({command:`cf firewall ua-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/ua_rules/${t[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(t[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(t[`ua-rule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,!await p({force:!!t.force})){process.stderr.write(`Aborted.
|
|
8
|
+
`);return}s(await l(`Deleting`,async()=>n.firewall.uaRules.delete({zone_id:r,ua_rule_id:t[`ua-rule-id`]})),{successLabel:`Deleted`})}};function se(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`get <ua-rule-id>`,describe:`Fetches the details of a User Agent Blocking rule.`,builder:se,handler:async t=>{if(t.dryRun){c({command:`cf firewall ua-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/ua_rules/${t[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(t[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(t[`ua-rule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,s(await l(`Loading`,async()=>n.firewall.uaRules.get({zone_id:r,ua_rule_id:t[`ua-rule-id`]})),{successLabel:`Loaded`})}};function le(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`user-agent`,{type:`string`,description:`A string to search for in the user agent values of existing rules.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`list`,describe:`Fetches User Agent Blocking rules in a zone. You can filter the results using several optional parameters.`,builder:le,handler:async t=>{let n={page:t.page,description:t.description,per_page:t[`per-page`],user_agent:t[`user-agent`],paused:t.paused};if(t.dryRun){c({command:`cf firewall ua-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.uaRules.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function de(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).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 fe={command:`update <ua-rule-id>`,describe:`Updates an existing User Agent Blocking rule.`,builder:de,handler:async t=>{if(t.dryRun){c({command:`cf firewall ua-rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/ua_rules/${t[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(t[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(t[`ua-rule-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({configuration:{target:u(t[`configuration-target`],`configuration-target`,`text`),value:u(t[`configuration-value`],`configuration-value`,`text`)},description:u(t.description,`description`,`text`),mode:u(t.mode,`mode`,`text`),paused:t.paused}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.uaRules.update({...e,zone_id:r,ua_rule_id:t[`ua-rule-id`]})),{successLabel:`Updated`});return}t.mode===void 0&&(t.mode=await f(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let d=o({configuration:{target:u(t[`configuration-target`],`configuration-target`,`text`),value:u(t[`configuration-value`],`configuration-value`,`text`)},description:u(t.description,`description`,`text`),mode:u(t.mode,`mode`,`text`),paused:t.paused});s(await l(`Updating`,async()=>n.firewall.uaRules.update({...d,zone_id:r,ua_rule_id:t[`ua-rule-id`]})),{successLabel:`Updated`})}},pe={command:`ua-rules`,describe:`Block or challenge requests based on the User-Agent header string`,builder:e=>e.command(ie).command(oe).command(ce).command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 he={command:`create`,describe:`Creates a URI-based WAF override for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:me,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf overrides create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({urls:t.urls}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.firewall.waf.overrides.create({...e,zone_id:r})),{successLabel:`Created`});return}if(t.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let u=o({urls:t.urls});s(await l(`Creating`,async()=>n.firewall.waf.overrides.create({...u,zone_id:r})),{successLabel:`Created`})}};function ge(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,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 _e={command:`delete <overrides-id>`,describe:`Deletes an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ge,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf overrides delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/overrides/${t[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(t[`overrides-id`]))}`,pathParams:{"overrides-id":String(t[`overrides-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,!await p({force:!!t.force})){process.stderr.write(`Aborted.
|
|
9
|
+
`);return}s(await l(`Deleting`,async()=>n.firewall.waf.overrides.delete({zone_id:r,overrides_id:t[`overrides-id`]})),{successLabel:`Deleted`})}};function ve(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get <overrides-id>`,describe:`Fetches the details of a URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ve,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf overrides get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/overrides/${t[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(t[`overrides-id`]))}`,pathParams:{"overrides-id":String(t[`overrides-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,s(await l(`Loading`,async()=>n.firewall.waf.overrides.get({zone_id:r,overrides_id:t[`overrides-id`]})),{successLabel:`Loaded`})}};function be(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of WAF overrides per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`Fetches the URI-based WAF overrides in a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:be,handler:async t=>{let n={page:t.page,per_page:t[`per-page`]};if(t.dryRun){c({command:`cf firewall waf overrides list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.waf.overrides.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function Se(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).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 Ce={command:`update <overrides-id>`,describe:`Updates an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Se,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf overrides update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/overrides/${t[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(t[`overrides-id`]))}`,pathParams:{"overrides-id":String(t[`overrides-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({urls:t.urls}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.waf.overrides.update({...e,zone_id:r,overrides_id:t[`overrides-id`]})),{successLabel:`Updated`});return}if(t.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let u=o({urls:t.urls});s(await l(`Updating`,async()=>n.firewall.waf.overrides.update({...u,zone_id:r,overrides_id:t[`overrides-id`]})),{successLabel:`Updated`})}},we={command:`overrides`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(he).command(_e).command(ye).command(xe).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return e.positional(`package-id`,{type:`string`,description:`Defines a package identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ee={command:`get <package-id>`,describe:`Fetches the details of a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Te,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf packages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/packages/${t[`package-id`]==null?`<package-id>`:encodeURIComponent(String(t[`package-id`]))}`,pathParams:{"package-id":String(t[`package-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,s(await l(`Loading`,async()=>n.firewall.waf.packages.get({zone_id:r,package_id:t[`package-id`]})),{successLabel:`Loaded`})}};function De(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",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 Oe={command:`edit <group-id>`,describe:"Updates a WAF rule group. You can update the state (`mode` parameter) of a rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).",builder:De,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf packages groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/packages/${t[`package-id`]==null?`<package-id>`:encodeURIComponent(String(t[`package-id`]))}/groups/${t[`group-id`]==null?`<group-id>`:encodeURIComponent(String(t[`group-id`]))}`,pathParams:{"group-id":String(t[`group-id`]??``),"package-id":String(t[`package-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({mode:u(t.mode,`mode`,`text`)}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.waf.packages.groups.edit({...e,zone_id:r,package_id:t[`package-id`],group_id:t[`group-id`]})),{successLabel:`Updated`});return}let d=o({mode:u(t.mode,`mode`,`text`)});s(await l(`Updating`,async()=>n.firewall.waf.packages.groups.edit({...d,zone_id:r,package_id:t[`package-id`],group_id:t[`group-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <group-id>`,describe:`Fetches the details of a WAF rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ke,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf packages groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/packages/${t[`package-id`]==null?`<package-id>`:encodeURIComponent(String(t[`package-id`]))}/groups/${t[`group-id`]==null?`<group-id>`:encodeURIComponent(String(t[`group-id`]))}`,pathParams:{"group-id":String(t[`group-id`]??``),"package-id":String(t[`package-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,s(await l(`Loading`,async()=>n.firewall.waf.packages.groups.get({zone_id:r,package_id:t[`package-id`],group_id:t[`group-id`]})),{successLabel:`Loaded`})}};function je(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rule groups per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rule groups.`,choices:[`mode`,`rules_count`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rule groups.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the condition for search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`Defines the name of the rule group.`}).option(`rules-count`,{type:`number`,description:`Defines the number of rules in the current rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`Fetches the WAF rule groups in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(je),handler:async t=>{let n={mode:t.mode,page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction,match:t.match,name:t.name,rules_count:t[`rules-count`]};if(t.dryRun){c({command:`cf firewall waf packages groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/packages/${t[`package-id`]==null?`<package-id>`:encodeURIComponent(String(t[`package-id`]))}/groups`,pathParams:{"package-id":String(t[`package-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.waf.packages.groups.list({zone_id:a,package_id:t[`package-id`],...n})),{successLabel:`Loaded`})}},Ne={command:`groups`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Oe).command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of packages per page.`}).option(`order`,{type:`string`,description:`The field used to sort returned packages.`,choices:[`name`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned packages.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`The name of the WAF package.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`list`,describe:`Fetches WAF packages for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Pe),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction,match:t.match,name:t.name};if(t.dryRun){c({command:`cf firewall waf packages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/packages`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.waf.packages.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the mode/action of the rule when triggered. You must use a value from the `allowed_modes` array of the current rule.",choices:[`default`,`disable`,`simulate`,`block`,`challenge`,`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 Le={command:`edit <rule-id>`,describe:`Updates a WAF rule. You can only update the mode/action of the rule. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Ie,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf packages rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/packages/${t[`package-id`]==null?`<package-id>`:encodeURIComponent(String(t[`package-id`]))}/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"package-id":String(t[`package-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({mode:u(t.mode,`mode`,`text`)}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.waf.packages.rules.edit({...e,zone_id:r,package_id:t[`package-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let d=o({mode:u(t.mode,`mode`,`text`)});s(await l(`Updating`,async()=>n.firewall.waf.packages.rules.edit({...d,zone_id:r,package_id:t[`package-id`],rule_id:t[`rule-id`]})),{successLabel:`Updated`})}};function Re(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <rule-id>`,describe:`Fetches the details of a WAF rule in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Re,handler:async t=>{if(t.dryRun){c({command:`cf firewall waf packages rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/packages/${t[`package-id`]==null?`<package-id>`:encodeURIComponent(String(t[`package-id`]))}/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``),"package-id":String(t[`package-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,s(await l(`Loading`,async()=>n.firewall.waf.packages.rules.get({zone_id:r,package_id:t[`package-id`],rule_id:t[`rule-id`]})),{successLabel:`Loaded`})}};function Be(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Defines the action/mode a rule has been overridden to perform.`,choices:[`DIS`,`CHL`,`BLK`,`SIM`]}).option(`group-id`,{type:`string`,description:`Defines the unique identifier of the rule group.`}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rules per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`priority`,`group_id`,`description`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`description`,{type:`string`,description:`Defines the public description of the WAF rule.`}).option(`priority`,{type:`string`,description:`Defines the order in which the individual WAF rule is executed within its rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Fetches WAF rules in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Be),handler:async t=>{let n={mode:t.mode,group_id:t[`group-id`],page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction,match:t.match,description:t.description,priority:t.priority};if(t.dryRun){c({command:`cf firewall waf packages rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/waf/packages/${t[`package-id`]==null?`<package-id>`:encodeURIComponent(String(t[`package-id`]))}/rules`,pathParams:{"package-id":String(t[`package-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.waf.packages.rules.list({zone_id:a,package_id:t[`package-id`],...n})),{successLabel:`Loaded`})}},$={command:`rules`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},He={command:`packages`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Ee).command(Fe).command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`waf`,describe:`Operations for waf`,builder:e=>e.command(we).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).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 Ge={command:`create`,describe:`Creates a new IP Access rule for a zone. Note: To create an IP Access rule that applies to multiple zones, refer to [IP Access rules for a user](#ip-access-rules-for-a-user) or [IP Access rules for an account](#ip-access-rules-for-an-account) as appropriate.`,builder:We,handler:async t=>{if(t.dryRun){c({command:`cf firewall zone-access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({configuration:{target:u(t[`configuration-target`],`configuration-target`,`text`),value:u(t[`configuration-value`],`configuration-value`,`text`)},mode:u(t.mode,`mode`,`text`)}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Creating`,async()=>n.firewall.zoneAccessRules.create({...e,zone_id:r})),{successLabel:`Created`});return}t.mode===void 0&&(t.mode=await f(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let d=o({configuration:{target:u(t[`configuration-target`],`configuration-target`,`text`),value:u(t[`configuration-value`],`configuration-value`,`text`)},mode:u(t.mode,`mode`,`text`)});s(await l(`Creating`,async()=>n.firewall.zoneAccessRules.create({...d,zone_id:r})),{successLabel:`Created`})}};function Ke(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`cascade`,{type:`string`,description:"The level to attempt to delete similar rules defined for other zones with the same owner. The default value is `none`, which will only delete the current rule. Using `basic` will delete rules that match the same action (mode) and configuration, while using `aggressive` will delete rules that match the same configuration.",choices:[`none`,`basic`,`aggressive`],default:`none`}).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 qe={command:`delete <rule-id>`,describe:"Deletes an IP Access rule defined at the zone level. Optionally, you can use the `cascade` property to specify that you wish to delete similar rules in other zones managed by the same zone owner.",builder:Ke,handler:async t=>{if(t.dryRun){c({command:`cf firewall zone-access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"rule-id":String(t[`rule-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({cascade:u(t.cascade,`cascade`,`text`)}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,!await p({force:!!t.force})){process.stderr.write(`Aborted.
|
|
10
|
+
`);return}if(t.body){let e=a(t.body);s(await l(`Deleting`,async()=>n.firewall.zoneAccessRules.delete({...e,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Deleted`});return}let d=o({cascade:u(t.cascade,`cascade`,`text`)});s(await l(`Deleting`,async()=>n.firewall.zoneAccessRules.delete({...d,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}};function Je(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).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 Ye={command:`edit <rule-id>`,describe:"Updates an IP Access rule defined at the zone level. You can only update the rule action (`mode` parameter) and notes.",builder:Je,handler:async t=>{if(t.dryRun){c({command:`cf firewall zone-access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"rule-id":String(t[`rule-id`]??``)},bodyKind:`json`,body:t.body===void 0?o({mode:u(t.mode,`mode`,`text`),notes:u(t.notes,`notes`,`text`)}):a(t.body)});return}let n=await i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});if(t.zoneId=r,t.body){let e=a(t.body);s(await l(`Updating`,async()=>n.firewall.zoneAccessRules.edit({...e,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`});return}let d=o({mode:u(t.mode,`mode`,`text`),notes:u(t.notes,`notes`,`text`)});s(await l(`Updating`,async()=>n.firewall.zoneAccessRules.edit({...d,zone_id:r,rule_id:t[`rule-id`]})),{successLabel:`Updated`})}};function Xe(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`The target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`The string to search for in the notes of existing IP Access rules.
|
|
11
|
+
Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}).option(`order`,{type:`string`,description:`The field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`list`,describe:`Fetches IP Access rules of a zone. You can filter the results using several optional parameters.`,builder:m(Xe),handler:async t=>{let n={mode:t.mode,"configuration.target":t[`configuration-target`],"configuration.value":t[`configuration-value`],notes:t.notes,match:t.match,page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){c({command:`cf firewall zone-access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),a=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=a,s(await l(`Loading`,async()=>r.firewall.zoneAccessRules.list({zone_id:a,...n})),{successLabel:`Loaded`})}},Qe={command:`zone-access-rules`,describe:`Zone-scoped IP access rules for blocking or allowing traffic`,builder:e=>e.command(Ge).command(qe).command(Ye).command(Ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$e={command:`firewall`,describe:`Legacy firewall rules, zone lockdowns, access rules, user-agent blocking, and WAF packages`,builder:e=>e.command(C).command(P).command(ne).command(pe).command(Ue).command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{$e as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`Retrieve Fraud Detection settings for a zone.`,builder:c,handler:async n=>{if(n.dryRun){a({command:`cf fraud get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/fraud_detection/settings`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.fraud.get({zone_id:s})),{successLabel:`Loaded`})}};function u(e){return e.option(`authentication-settings-failure-criteria-kind`,{type:`string`,description:"The type of criterion. Currently only `status_code` is supported.",choices:[`status_code`]}).option(`authentication-settings-failure-criteria-status-codes`,{type:`string`,array:!0,description:`HTTP status codes to match against the origin response.
|
|
3
3
|
- Maximum of 10 codes per criterion.
|
|
4
4
|
- Each code must be a valid HTTP status code (100-599).
|
|
5
5
|
- Codes are deduplicated and sorted on save.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{N as e}from"./oauth-B5k80sip.mjs";import{n as t}from"./auth-DX9KnJ0P.mjs";import{n,t as r}from"./body-parser-DWSy7uZ8.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-CL8I-7YK.mjs";import{n as s}from"./input-validation-_fMCApaH.mjs";import{r as c}from"./prompt-q3B7sM2A.mjs";function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Gets the Google Tag Gateway configuration for a zone.`,builder:l,handler:async n=>{if(n.dryRun){a({command:`cf google-tag-gateway config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.googleTagGateway.config.get({zone_id:s})),{successLabel:`Loaded`})}};function d(e){return e.option(`enabled`,{type:`boolean`,description:`Enables or disables Google Tag Gateway for this zone.`}).option(`endpoint`,{type:`string`,description:`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`}).option(`hide-original-ip`,{type:`boolean`,description:`Hides the original client IP address from Google when enabled.`}).option(`measurement-id`,{type:`string`,description:`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`}).option(`set-up-tag`,{type:`boolean`,description:`Set up the associated Google Tag on the zone automatically when enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Google Tag Gateway configuration for a zone.`})}const f={command:`update`,describe:`Updates the Google Tag Gateway configuration for a zone.`,builder:d,handler:async l=>{if(l.dryRun){a({command:`cf google-tag-gateway config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?r({enabled:l.enabled,endpoint:s(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:s(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]}):n(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=n(l.body);i(await o(`Updating`,async()=>u.googleTagGateway.config.update({body:e,zone_id:d})),{successLabel:`Updated`});return}if(l.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);if(l.endpoint===void 0&&(l.endpoint=await c(`endpoint`,`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`)),l[`hide-original-ip`]===void 0)throw Error(`--hide-original-ip is required (or pass --body with this field set).`);l[`measurement-id`]===void 0&&(l[`measurement-id`]=await c(`measurement-id`,`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`));let f=r({enabled:l.enabled,endpoint:s(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:s(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]});i(await o(`Updating`,async()=>u.googleTagGateway.config.update({body:f,zone_id:d})),{successLabel:`Updated`})}},p={command:`config`,describe:`Operations for config`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`google-tag-gateway`,describe:`Google Tag Gateway operations`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
|