cf 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_meta/agent-context.json +78 -41
- package/dist/_meta/commands.json +19888 -21071
- package/dist/_meta/schemas.json +14305 -15328
- package/dist/abuse-reports-BsF9JZPW.mjs +8 -0
- package/dist/account-D8mYiWxQ.mjs +2 -0
- package/dist/accounts-CJci1Oez.mjs +23 -0
- package/dist/acm-CmCd985Q.mjs +3 -0
- package/dist/addressing-R7p6TRBe.mjs +12 -0
- package/dist/{agent-context-CKb6w43K.mjs → agent-context-Bzl5PGW-.mjs} +1 -1
- package/dist/ai-BzJg0RIX.mjs +3 -0
- package/dist/ai-audit-B0vJNOZG.mjs +2 -0
- package/dist/ai-gateway-D3vJR3My.mjs +10 -0
- package/dist/ai-search-CNg7W7U4.mjs +7 -0
- package/dist/alerting-_sdM0B0S.mjs +6 -0
- package/dist/alerts-dpT6Qsdu.mjs +2 -0
- package/dist/{analytics-CwFrx-Dr.mjs → analytics-BFBJhDrP.mjs} +1 -1
- package/dist/analytics_engine-CWhFvyeK.mjs +2 -0
- package/dist/{api-gateway-D9PMVVqL.mjs → api-gateway-D4AIEtUq.mjs} +10 -10
- package/dist/argo-Bjk6nFfs.mjs +2 -0
- package/dist/artifacts-Ba4b3iOa.mjs +4 -0
- package/dist/{audit-logs-BvQ9uwuy.mjs → audit-logs-BE0T5All.mjs} +1 -1
- package/dist/{auth-DX9KnJ0P.mjs → auth-CZ0E51rF.mjs} +3 -3
- package/dist/auth-D_zyQbDR.mjs +5 -0
- package/dist/autorag-Cnpp8PAG.mjs +2 -0
- package/dist/billing-Dz6Zj8Eq.mjs +2 -0
- package/dist/bot-management-pFwIbFi-.mjs +5 -0
- package/dist/botnet-feed-BY9uGChY.mjs +3 -0
- package/dist/brand-protection-DkPAk2Cz.mjs +3 -0
- package/dist/brands-CGpk9nZB.mjs +2 -0
- package/dist/browser-extension-D9P6Yv8i.mjs +3 -0
- package/dist/browser-run-DhHtz4y3.mjs +4 -0
- package/dist/build-CWuStmDi.mjs +2 -0
- package/dist/{cache-CeN5t6_W.mjs → cache-DVhkiIGK.mjs} +4 -4
- package/dist/calls-95zjvIcO.mjs +4 -0
- package/dist/certificate-authorities-BowBqbVq.mjs +2 -0
- package/dist/cf-BLT7uKJF.mjs +18 -0
- package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +397 -0
- package/dist/clear-DXx8WBAN.mjs +2 -0
- package/dist/client-certificates-D6mE4vJu.mjs +3 -0
- package/dist/cloud-connector-DmwsjeFN.mjs +2 -0
- package/dist/cloudforce-one-CG3TT7IN.mjs +23 -0
- package/dist/{completions-Bvzav4Mj.mjs → completions-DMc_PlIw.mjs} +2 -2
- package/dist/connectivity-DJkE3crz.mjs +3 -0
- package/dist/connector-interrupts-DTgQ7onV.mjs +2 -0
- package/dist/connector-telemetry-events-D0rTHDou.mjs +2 -0
- package/dist/connector-telemetry-snapshots--0QmD3z6.mjs +2 -0
- package/dist/connectors-zWaZTi2A.mjs +3 -0
- package/dist/content-scanning-CGvGf04y.mjs +4 -0
- package/dist/ct-alerting-ebSPSWNC.mjs +3 -0
- package/dist/{custom-certificates-CfRj7QZb.mjs → custom-certificates-CWUrPYLP.mjs} +4 -4
- package/dist/custom-csrs-CRtdrF9R.mjs +4 -0
- package/dist/{custom-hostnames-CcK7_17e.mjs → custom-hostnames-CVQSksqq.mjs} +4 -4
- package/dist/custom-nameservers-BRwbIdsX.mjs +3 -0
- package/dist/custom-pages-Ci8sTQX7.mjs +4 -0
- package/dist/d1-78Ym1P6D.mjs +4 -0
- package/dist/data-security-zmFoMwRU.mjs +6 -0
- package/dist/{dcv-delegation-BYsNl3qc.mjs → dcv-delegation-Dd4FZ2IG.mjs} +1 -1
- package/dist/{deploy-BzlPv3ro.mjs → deploy-CVvkZFjR.mjs} +1 -1
- package/dist/{dev-IOg-_s5_.mjs → dev-DSslyDXx.mjs} +1 -1
- package/dist/diagnostics-B8Ev5m_o.mjs +3 -0
- package/dist/dispatch-namespaces-Dm5vGeEP.mjs +7 -0
- package/dist/dist-BH-4NQOV.mjs +134 -0
- package/dist/dns-D7VAaCyO.mjs +29 -0
- package/dist/dns-firewall-ByLCsf0q.mjs +57 -0
- package/dist/domain-info-CRvKc2Lg.mjs +2 -0
- package/dist/durable-objects-BIpvyu9m.mjs +2 -0
- package/dist/email-auth-Cx--s8W4.mjs +2 -0
- package/dist/email-routing-CiDbivcN.mjs +10 -0
- package/dist/email-security-BYeAuSc6.mjs +12 -0
- package/dist/email-sending-Dg2rSmHH.mjs +4 -0
- package/dist/{filters-DKs-wEzt.mjs → filters-DZ8YnQ90.mjs} +3 -3
- package/dist/firewall-DEd1hs_I.mjs +11 -0
- package/dist/flagship-DVw7xGoP.mjs +4 -0
- package/dist/{fraud-D8WmLKyH.mjs → fraud-BbGS3FZs.mjs} +2 -2
- package/dist/google-tag-gateway-CBnRGYQR.mjs +2 -0
- package/dist/{healthchecks-BBtW8vRh.mjs → healthchecks-Da9N3ix4.mjs} +3 -3
- package/dist/{hostnames-Bh2IFxIw.mjs → hostnames-mimZu2tB.mjs} +2 -2
- package/dist/hyperdrive-BNdvxOos.mjs +21 -0
- package/dist/iam-DGQ-OgRl.mjs +6 -0
- package/dist/images-CI6Iy9ho.mjs +7 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-BDB-aRtU.mjs +3 -0
- package/dist/internal-Czlp5Ekb.mjs +2 -0
- package/dist/{ips-BE7JbAnc.mjs → ips-B9UuPvsY.mjs} +1 -1
- package/dist/keyless-certificates-Ua9uJgPt.mjs +3 -0
- package/dist/kv-BHerx4dZ.mjs +5 -0
- package/dist/leaked-credential-checks-B8Vunj9h.mjs +3 -0
- package/dist/live-Ce7dZW7p.mjs +2 -0
- package/dist/load-balancers-DSjS5WKw.mjs +6 -0
- package/dist/logexplorer-DBIfTlRP.mjs +24 -0
- package/dist/logo-matches-C00iGpzW.mjs +2 -0
- package/dist/logos-CJLhx1go.mjs +3 -0
- package/dist/logpush-Cr1U-eK-.mjs +5 -0
- package/dist/logs-DMvtchc6.mjs +3 -0
- package/dist/magic-cloud-networking-FQfO8QWH.mjs +5 -0
- package/dist/magic-network-monitoring-CDd70fJQ.mjs +4 -0
- package/dist/magic-transit-DiKiPUax.mjs +110 -0
- package/dist/managed-transforms-fPVUTrAv.mjs +3 -0
- package/dist/matches-B0yHbQ2I.mjs +2 -0
- package/dist/moq-UgBawOXe.mjs +13 -0
- package/dist/mtls-certificates-xKUbC5EL.mjs +3 -0
- package/dist/network-interconnects-BJzOE2ny.mjs +41 -0
- package/dist/oauth-DBJ5GSFk.mjs +40 -0
- package/dist/observability-B-1y36QS.mjs +4 -0
- package/dist/organization-Dq3PClZ7.mjs +41 -0
- package/dist/organizations-AhsQkHyX.mjs +2 -0
- package/dist/origin-ca-certificates-CRgF0UyU.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BXTx7DPa.mjs +2 -0
- package/dist/{origin-tls-client-auth-B30_2_dO.mjs → origin-tls-client-auth-BDw5q-6G.mjs} +3 -3
- package/dist/{page-rules-zQJGmTCd.mjs → page-rules-DqYQ23eg.mjs} +5 -5
- package/dist/{page-shield-CxQk5k9X.mjs → page-shield-DKdlZOLO.mjs} +5 -5
- package/dist/pages-BsXF11Kv.mjs +11 -0
- package/dist/pay-per-crawl-BGAwuAP3.mjs +2 -0
- package/dist/pipelines-D_QhSnGW.mjs +6 -0
- package/dist/progress-O88q63Bk.mjs +2 -0
- package/dist/{prompt-q3B7sM2A.mjs → prompt-DTAWiEm2.mjs} +1 -1
- package/dist/queries-CAE95-OH.mjs +3 -0
- package/dist/queues-BBz35Mqd.mjs +6 -0
- package/dist/r2-Zp99S5xF.mjs +21 -0
- package/dist/r2-data-catalog-BeVLZwrE.mjs +16 -0
- package/dist/radar-Cij-XVQJ.mjs +2 -0
- package/dist/rate-limit-analytics-CGviSPnJ.mjs +2 -0
- package/dist/rate-limits-DSdToIWv.mjs +5 -0
- package/dist/raw-fetch-DgezeshQ.mjs +2 -0
- package/dist/ready-DMpJvyaz.mjs +2 -0
- package/dist/realtime-kit-9rJcapfM.mjs +18 -0
- package/dist/recent-submissions-LS5IM-bm.mjs +2 -0
- package/dist/refute-BGTpr5sy.mjs +2 -0
- package/dist/registrar-CXViZlah.mjs +83 -0
- package/dist/registrar-sandbox-CvQyjXLJ.mjs +83 -0
- package/dist/request-tracers-DATfBnE9.mjs +2 -0
- package/dist/{resolve-DGD57PFH.mjs → resolve-Bs2sMRYS.mjs} +1 -1
- package/dist/resource-sharing-Cmhn6ghR.mjs +3 -0
- package/dist/resource-tagging-BTn05AOj.mjs +16 -0
- package/dist/rules-ens3OHme.mjs +4 -0
- package/dist/rulesets-bkreZRao.mjs +8 -0
- package/dist/rum-CpgXFcwl.mjs +4 -0
- package/dist/scan-logo-DUDIZJ2A.mjs +2 -0
- package/dist/scan-page-BqoQTk3R.mjs +2 -0
- package/dist/{schema-D8o6HcCr.mjs → schema-DCF4yEp_.mjs} +1 -1
- package/dist/{schema-validation-BWNDnnIT.mjs → schema-validation-Ca6o94ts.mjs} +5 -5
- package/dist/scim-C4oT8TMc.mjs +4 -0
- package/dist/sdk-pQ5kaGUX.mjs +3 -0
- package/dist/search-C4T5riPh.mjs +2 -0
- package/dist/secrets-store-CWEuiDNo.mjs +7 -0
- package/dist/security-center-BOvm7xy6.mjs +2 -0
- package/dist/{security-txt-CVpmJo29.mjs → security-txt-BCAUBctN.mjs} +2 -2
- package/dist/session-B1ARgLG7.mjs +2 -0
- package/dist/share-DhmVspmL.mjs +5 -0
- package/dist/{shared-DQI8NGja.mjs → shared-Bod3-Exx.mjs} +332 -332
- package/dist/signed-url-DA509wgp.mjs +2 -0
- package/dist/{smart-shield-BreBC1Ap.mjs → smart-shield-DZm4fn6z.mjs} +2 -2
- package/dist/{snippets-BAJoWMSJ.mjs → snippets-oQ0u26-z.mjs} +3 -3
- package/dist/{spawn-pmGERpdB.mjs → spawn-ChG5Xi9Z.mjs} +1 -1
- package/dist/{spectrum-DnIRLY95.mjs → spectrum-Cnkee5Ww.mjs} +6 -6
- package/dist/speed-DqNnvLBD.mjs +4 -0
- package/dist/{src-BQ1dr9xR.mjs → src-By-zTCHz.mjs} +9 -9
- package/dist/ssl-tS3CYZsZ.mjs +15 -0
- package/dist/state-OsdDJvdj.mjs +2 -0
- package/dist/stream-Bud9Os5V.mjs +14 -0
- package/dist/submission-info-DfIXmu-M.mjs +2 -0
- package/dist/submit-BtP8she2.mjs +2 -0
- package/dist/tenant-CMwHa-tU.mjs +2 -0
- package/dist/{token-validation-DUvtXWur.mjs → token-validation-BYC7HTok.mjs} +5 -5
- package/dist/{tools-CQtA5-cr.mjs → tools-Dru4l8yh.mjs} +1 -1
- package/dist/total-queries-DdLBNJzd.mjs +2 -0
- package/dist/tracked-domains-BbaY-IuY.mjs +2 -0
- package/dist/turnstile-CP4nScaL.mjs +23 -0
- package/dist/{ui-BrNwNHX9.mjs → ui-BNoF0KpD.mjs} +2 -2
- package/dist/url-info-Chs9h7Y-.mjs +2 -0
- package/dist/url-normalization-XYxW5Gj0.mjs +3 -0
- package/dist/url-scanner-D4pYNlO-.mjs +2 -0
- package/dist/user-DtefniLc.mjs +11 -0
- package/dist/vectorize-BeAY2g-7.mjs +4 -0
- package/dist/verify-D7J3F_NZ.mjs +2 -0
- package/dist/{versions-NUXxCr0s.mjs → versions-dMW3bLVv.mjs} +1 -1
- package/dist/waiting-rooms-K78HeeTg.mjs +11 -0
- package/dist/{web3-n3GW50u-.mjs → web3-Dhw79l4S.mjs} +3 -3
- package/dist/workers-builds-CuOAB3u4.mjs +7 -0
- package/dist/workers-l3zMNOU6.mjs +20 -0
- package/dist/workflows-rb7RYBKP.mjs +6 -0
- package/dist/{zaraz-9l7KuLqh.mjs → zaraz-CHecMYuo.mjs} +1 -1
- package/dist/zero-trust-DAZoa-Aj.mjs +117 -0
- package/dist/zone-BnnqJwW-.mjs +2 -0
- package/dist/zones-DpI2YikF.mjs +21 -0
- package/package.json +1 -1
- package/dist/abuse-reports-DUs4SKVx.mjs +0 -8
- package/dist/accounts-BIY8wNGA.mjs +0 -22
- package/dist/acm-SqcV8o5o.mjs +0 -3
- package/dist/addressing-CygRm0pN.mjs +0 -12
- package/dist/ai-BAmEAjN3.mjs +0 -2
- package/dist/ai-gateway-BENwPvvB.mjs +0 -8
- package/dist/ai-search-Bv_Whw3E.mjs +0 -7
- package/dist/ai_gateway-C6WP9oBH.mjs +0 -4
- package/dist/alerting-D_qWrsoY.mjs +0 -6
- package/dist/analytics_engine-BjV6XLyG.mjs +0 -2
- package/dist/argo-DwYGbyld.mjs +0 -2
- package/dist/artifacts-DKAjY_n4.mjs +0 -4
- package/dist/auth-TYwGydWg.mjs +0 -5
- package/dist/billing-CRTlRU88.mjs +0 -2
- package/dist/bot-management-DgW--8wM.mjs +0 -5
- package/dist/botnet-feed-CIX6ZORT.mjs +0 -3
- package/dist/brand-protection-ZikBtl0y.mjs +0 -3
- package/dist/browser-rendering-D_ZQVWn8.mjs +0 -4
- package/dist/build-Bgw8TV1p.mjs +0 -134
- package/dist/calls-Cv0ieVg4.mjs +0 -4
- package/dist/certificate-authorities-BzZnWCac.mjs +0 -2
- package/dist/client-certificates-BFuzeBrj.mjs +0 -3
- package/dist/cloud-connector-D5h8Dzzg.mjs +0 -2
- package/dist/cloudforce-one-aqDCIBMp.mjs +0 -21
- package/dist/config-B5k-XbwS.mjs +0 -2
- package/dist/connectivity-CjkXmEhO.mjs +0 -3
- package/dist/connector-interrupts-B7eSface.mjs +0 -2
- package/dist/connector-telemetry-events-F3Co8HUf.mjs +0 -2
- package/dist/connector-telemetry-snapshots-CQY8XMUg.mjs +0 -2
- package/dist/connectors-YYu_Vx3H.mjs +0 -3
- package/dist/content-scanning-BorfRGKT.mjs +0 -4
- package/dist/context-C-WbewL6.mjs +0 -2
- package/dist/custom-nameservers-BkKx0THn.mjs +0 -3
- package/dist/custom-pages-DamGVA75.mjs +0 -4
- package/dist/d1-sK0O5THv.mjs +0 -4
- package/dist/data-security-DsWpoWiS.mjs +0 -6
- package/dist/diagnostics-CH7T2WR3.mjs +0 -3
- package/dist/dispatch-namespaces-Bgj9XCRx.mjs +0 -7
- package/dist/dist-C6zxsVdY.mjs +0 -306
- package/dist/dns-firewall-VmQf3UVP.mjs +0 -57
- package/dist/dns-o7hUPMCG.mjs +0 -29
- package/dist/durable-objects-DgrTbvoF.mjs +0 -2
- package/dist/email-routing-owCvAEpf.mjs +0 -10
- package/dist/email-security-Dng3DVuf.mjs +0 -8
- package/dist/email-sending-bExMH4lu.mjs +0 -3
- package/dist/firewall-BLaTtX3r.mjs +0 -11
- package/dist/google-tag-gateway-DyCY43k0.mjs +0 -2
- package/dist/hyperdrive-DJm1eD-M.mjs +0 -18
- package/dist/iam-apCCcy7R.mjs +0 -6
- package/dist/images-Cxe45OHm.mjs +0 -7
- package/dist/intel-8V4h6H46.mjs +0 -3
- package/dist/keyless-certificates-CfJmXccT.mjs +0 -3
- package/dist/kv-Dz6then8.mjs +0 -5
- package/dist/leaked-credential-checks-BJ-zQMlx.mjs +0 -3
- package/dist/load-balancers-ilsGgudX.mjs +0 -6
- package/dist/logpush-BH14TtuA.mjs +0 -4
- package/dist/logs-B8-mkf_I.mjs +0 -3
- package/dist/magic-cloud-networking-DylCXoG4.mjs +0 -5
- package/dist/magic-network-monitoring-DnyrZy77.mjs +0 -4
- package/dist/magic-transit-B-kU5e3s.mjs +0 -89
- package/dist/managed-transforms-GC9Pq5dg.mjs +0 -3
- package/dist/mtls-certificates-BRlhWw_G.mjs +0 -3
- package/dist/network-interconnects-DuyoFD9_.mjs +0 -36
- package/dist/oauth-B5k80sip.mjs +0 -61
- package/dist/observability-9APhqFHo.mjs +0 -4
- package/dist/organizations-Dy3kiV_z.mjs +0 -41
- package/dist/origin-ca-certificates-2rwPoQdG.mjs +0 -3
- package/dist/origin-post-quantum-encryption-BnBLTvEO.mjs +0 -2
- package/dist/pages-5DKLs7CQ.mjs +0 -11
- package/dist/pipelines-DfGE44xo.mjs +0 -6
- package/dist/progress-CL8I-7YK.mjs +0 -2
- package/dist/queues-BoenUGIw.mjs +0 -6
- package/dist/r2-Cq_JCjK0.mjs +0 -21
- package/dist/r2-data-catalog-eLxltWdO.mjs +0 -14
- package/dist/radar-YNOCio6T.mjs +0 -2
- package/dist/rate-limits-CcAF3tMl.mjs +0 -5
- package/dist/raw-fetch-bIXC9D1m.mjs +0 -2
- package/dist/realtime-kit-4bCGviO5.mjs +0 -18
- package/dist/registrar-CfHlaOOf.mjs +0 -46
- package/dist/request-tracers-DlHawg5l.mjs +0 -2
- package/dist/resource-sharing-7FhuboJE.mjs +0 -5
- package/dist/resource-tagging-divcugVb.mjs +0 -16
- package/dist/rules-CAXkege8.mjs +0 -4
- package/dist/rulesets-CBsdc8IV.mjs +0 -8
- package/dist/rum-D0hHPNl9.mjs +0 -4
- package/dist/scim-CWLli4fi.mjs +0 -3
- package/dist/sdk-DhIhH6GB.mjs +0 -5
- package/dist/secrets-store-B7_HkE8I.mjs +0 -25
- package/dist/security-center-BQT21oiM.mjs +0 -2
- package/dist/session-B8r8LNQN.mjs +0 -93
- package/dist/speed-UYEVue28.mjs +0 -4
- package/dist/ssl-D3Pixs8M.mjs +0 -15
- package/dist/stream-BUsuOfQh.mjs +0 -14
- package/dist/tenants-BdWJTtcg.mjs +0 -2
- package/dist/turnstile-CAKVnS1L.mjs +0 -23
- package/dist/url-normalization-DA-RAxs4.mjs +0 -3
- package/dist/url-scanner-DmYu43f7.mjs +0 -2
- package/dist/user-Bah4wGGN.mjs +0 -10
- package/dist/vectorize-DhvVG2By.mjs +0 -4
- package/dist/waiting-rooms-DoOkT4Mu.mjs +0 -11
- package/dist/workers-D6IaQ_F0.mjs +0 -18
- package/dist/workers-builds-DYi0OMMU.mjs +0 -7
- package/dist/workflows-DrdXUQ2g.mjs +0 -4
- package/dist/zero-trust-D6V9GH2W.mjs +0 -118
- package/dist/zero_trust-BzXKAX_x.mjs +0 -3
- package/dist/zones-0MTkuaFk.mjs +0 -21
- /package/dist/{body-parser-DWSy7uZ8.mjs → body-parser-BO6mfo_W.mjs} +0 -0
- /package/dist/{cli-types-DGgEbf8K.mjs → cli-types-CFw6Xygp.mjs} +0 -0
- /package/dist/{input-validation-_fMCApaH.mjs → input-validation-BwUR9z8e.mjs} +0 -0
- /package/dist/{lib-4PQI6yRW.mjs → lib-Og5sB51C.mjs} +0 -0
- /package/dist/{local-CYc9q7l2.mjs → local-C6TLPAT6.mjs} +0 -0
- /package/dist/{metadata-MPDDi08e.mjs → metadata-Cnyws6iO.mjs} +0 -0
- /package/dist/{open-YWOUIZ5Y-3jqSKAB1.mjs → open-YWOUIZ5Y-CFRcYALi.mjs} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{i as n,n as r}from"./auth-CZ0E51rF.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-O88q63Bk.mjs";import{t as s}from"./local-C6TLPAT6.mjs";import{n as c,t as l}from"./body-parser-BO6mfo_W.mjs";import{n as u}from"./input-validation-BwUR9z8e.mjs";import{n as d,r as f,t as p}from"./prompt-DTAWiEm2.mjs";import{t as m}from"./cli-types-CFw6Xygp.mjs";function ee(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`create <job-id>`,describe:`Cancels the job, marking it as cancelled and stopping any pending message processing. The job record remains visible in list and detail endpoints.`,builder:ee,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate bulk cancel create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/bulk/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}/cancel`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Creating`,async()=>c.emailSecurity.investigate.bulk.cancel.create({account_id:l,job_id:n[`job-id`]})),{successLabel:`Created`})}},h={command:`cancel`,describe:`Operations for investigate.bulk.cancel`,builder:e=>e.command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`action`,{type:`string`,description:`The action field`,choices:[`MOVE`,`RELEASE`]}).option(`comment`,{type:`string`,description:`The comment field`}).option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).option(`search-params-action-log`,{type:`boolean`,description:"Deprecated, use `GET /investigate/{investigate_id}/action_log` instead. End of life: November 1, 2026.",default:!1}).option(`search-params-alert-id`,{type:`string`,description:`The search_params.alert_id field`}).option(`search-params-delivery-status`,{type:`string`,description:`Delivery status of the message.`,choices:[`delivered`,`moved`,`quarantined`,`rejected`,`deferred`,`bounced`,`queued`]}).option(`search-params-detections-only`,{type:`boolean`,description:`The search_params.detections_only field`,default:!0}).option(`search-params-domain`,{type:`string`,description:`The search_params.domain field`}).option(`search-params-end`,{type:`string`,description:`End of search date range.`}).option(`search-params-exact-subject`,{type:`string`,description:`The search_params.exact_subject field`}).option(`search-params-final-disposition`,{type:`string`,description:`The search_params.final_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).option(`search-params-message-action`,{type:`string`,description:`The search_params.message_action field`,choices:[`PREVIEW`,`QUARANTINE_RELEASED`,`MOVED`]}).option(`search-params-message-id`,{type:`string`,description:`The search_params.message_id field`}).option(`search-params-metric`,{type:`string`,description:`The search_params.metric field`}).option(`search-params-query`,{type:`string`,description:`The search_params.query field`}).option(`search-params-recipient`,{type:`string`,description:`The search_params.recipient field`}).option(`search-params-sender`,{type:`string`,description:`The search_params.sender field`}).option(`search-params-start`,{type:`string`,description:`Beginning of search date range.`}).option(`search-params-subject`,{type:`string`,description:`The search_params.subject field`}).option(`search-params-submissions`,{type:`boolean`,description:`The search_params.submissions field`,default:!1}).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:`create`,describe:`Creates a new bulk action job to move or release messages that match the provided search parameters.`,builder:g,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/bulk`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({action:u(n.action,`action`,`text`),comment:u(n.comment,`comment`,`text`),destination:u(n.destination,`destination`,`text`),expected_disposition:u(n[`expected-disposition`],`expected-disposition`,`text`),search_params:{action_log:n[`search-params-action-log`],alert_id:u(n[`search-params-alert-id`],`search-params-alert-id`,`text`),delivery_status:u(n[`search-params-delivery-status`],`search-params-delivery-status`,`text`),detections_only:n[`search-params-detections-only`],domain:u(n[`search-params-domain`],`search-params-domain`,`text`),end:u(n[`search-params-end`],`search-params-end`,`text`),exact_subject:u(n[`search-params-exact-subject`],`search-params-exact-subject`,`text`),final_disposition:u(n[`search-params-final-disposition`],`search-params-final-disposition`,`text`),message_action:u(n[`search-params-message-action`],`search-params-message-action`,`text`),message_id:u(n[`search-params-message-id`],`search-params-message-id`,`text`),metric:u(n[`search-params-metric`],`search-params-metric`,`text`),query:u(n[`search-params-query`],`search-params-query`,`text`),recipient:u(n[`search-params-recipient`],`search-params-recipient`,`text`),sender:u(n[`search-params-sender`],`search-params-sender`,`text`),start:u(n[`search-params-start`],`search-params-start`,`text`),subject:u(n[`search-params-subject`],`search-params-subject`,`text`),submissions:n[`search-params-submissions`]}}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>f.emailSecurity.investigate.bulk.create({...e,account_id:p})),{successLabel:`Created`});return}n.action===void 0&&(n.action=await d(`action`,`The action field`,[`MOVE`,`RELEASE`]));let m=l({action:u(n.action,`action`,`text`),comment:u(n.comment,`comment`,`text`),destination:u(n.destination,`destination`,`text`),expected_disposition:u(n[`expected-disposition`],`expected-disposition`,`text`),search_params:{action_log:n[`search-params-action-log`],alert_id:u(n[`search-params-alert-id`],`search-params-alert-id`,`text`),delivery_status:u(n[`search-params-delivery-status`],`search-params-delivery-status`,`text`),detections_only:n[`search-params-detections-only`],domain:u(n[`search-params-domain`],`search-params-domain`,`text`),end:u(n[`search-params-end`],`search-params-end`,`text`),exact_subject:u(n[`search-params-exact-subject`],`search-params-exact-subject`,`text`),final_disposition:u(n[`search-params-final-disposition`],`search-params-final-disposition`,`text`),message_action:u(n[`search-params-message-action`],`search-params-message-action`,`text`),message_id:u(n[`search-params-message-id`],`search-params-message-id`,`text`),metric:u(n[`search-params-metric`],`search-params-metric`,`text`),query:u(n[`search-params-query`],`search-params-query`,`text`),recipient:u(n[`search-params-recipient`],`search-params-recipient`,`text`),sender:u(n[`search-params-sender`],`search-params-sender`,`text`),start:u(n[`search-params-start`],`search-params-start`,`text`),subject:u(n[`search-params-subject`],`search-params-subject`,`text`),submissions:n[`search-params-submissions`]}});i(await o(`Creating`,async()=>f.emailSecurity.investigate.bulk.create({...m,account_id:p})),{successLabel:`Created`})}};function v(e){return e.positional(`job-id`,{type:`string`,description:`Job 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 y={command:`delete <job-id>`,describe:"Deletes the job, removing it from all list and detail endpoints. Only jobs in a terminal state (`COMPLETED`, `CANCELLED`, `FAILED`, or `SKIPPED`) can be deleted. To stop an in-progress job without removing it, use the cancel endpoint instead.",builder:v,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate bulk delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/bulk/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>c.emailSecurity.investigate.bulk.delete({account_id:l,job_id:n[`job-id`]})),{successLabel:`Deleted`})}};function b(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`get <job-id>`,describe:`Returns the status and details of a specific bulk action job.`,builder:b,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate bulk get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/bulk/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}`,pathParams:{"job-id":String(n[`job-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.bulk.get({account_id:l,job_id:n[`job-id`]})),{successLabel:`Loaded`})}};function S(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`action-type`,{type:`string`,description:`Action type`,choices:[`MOVE`,`RELEASE`]}).option(`status`,{type:`string`,description:`Status`,choices:[`PENDING`,`DISCOVERING`,`PROCESSING`,`COMPLETED`,`FAILED`,`CANCELLED`,`SKIPPED`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`list`,describe:`Returns a paginated list of bulk action jobs for the account.`,builder:m(S),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],action_type:n[`action-type`],status:n.status};if(n.dryRun){a({command:`cf email-security investigate bulk list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/bulk`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.investigate.bulk.list({account_id:u,...c})),{successLabel:`Loaded`})}};function w(e){return e.option(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`status`,{type:`string`,description:`Status`,choices:[`PENDING`,`DISCOVERING`,`PROCESSING`,`COMPLETED`,`FAILED`,`CANCELLED`,`SKIPPED`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`list`,describe:`Returns the individual messages associated with a bulk action job, including their processing status.`,builder:m(w),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],status:n.status};if(n.dryRun){a({command:`cf email-security investigate bulk messages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/bulk/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}/messages`,pathParams:{"job-id":String(n[`job-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.investigate.bulk.messages.list({account_id:u,job_id:n[`job-id`],...c})),{successLabel:`Loaded`})}},E={command:`messages`,describe:`Operations for investigate.bulk.messages`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`bulk`,describe:`Operations for investigate.bulk`,builder:e=>e.command(_).command(y).command(x).command(C).command(h).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <investigate-id>`,describe:`Returns detection details such as threat categories and sender information for non-benign messages.`,builder:O,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate detections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/${n[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(n[`investigate-id`]))}/detections`,pathParams:{"investigate-id":String(n[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.detections.get({account_id:l,investigate_id:n[`investigate-id`]})),{successLabel:`Loaded`})}},A={command:`detections`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`log <investigate-id>`,describe:`Returns the list of post-delivery actions (moves, quarantine releases, previews, etc.) that have been applied to a specific email message.`,builder:j,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate get-action log`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/${n[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(n[`investigate-id`]))}/action_log`,pathParams:{"investigate-id":String(n[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.getAction.log({account_id:l,investigate_id:n[`investigate-id`]})),{successLabel:`Loaded`})}},N={command:`get-action`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the
|
|
4
|
+
regular datastore only.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`get <investigate-id>`,describe:`Retrieves comprehensive details for a specific email message including headers, recipients, sender information, and current quarantine status. Use the investigate_id from search results to fetch detailed information.`,builder:P,handler:async n=>{let c={submission:n.submission};if(n.dryRun){a({command:`cf email-security investigate get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/${n[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(n[`investigate-id`]))}`,pathParams:{"investigate-id":String(n[`investigate-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.investigate.get({account_id:u,investigate_id:n[`investigate-id`],...c})),{successLabel:`Loaded`})}};function I(e){return e.option(`start`,{type:`string`,description:"The beginning of the search date range. Defaults to `now - 30 days`. Must not be in the future."}).option(`end`,{type:`string`,description:"The end of the search date range. Defaults to `now`."}).option(`query`,{type:`string`,description:`Space-delimited search term. Case-insensitive.`}).option(`detections-only`,{type:`boolean`,description:`Whether to include only detections in search results.`}).option(`final-disposition`,{type:`string`,description:`Dispositions to filter by.`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`metric`,{type:`string`,description:`Metric`}).option(`message-action`,{type:`string`,description:`Message actions to filter by.`,choices:[`PREVIEW`,`QUARANTINE_RELEASED`,`MOVED`]}).option(`recipient`,{type:`string`,description:`Recipient`}).option(`sender`,{type:`string`,description:`Sender`}).option(`alert-id`,{type:`string`,description:`Alert ID`}).option(`domain`,{type:`string`,description:`Sender domains to filter by.`}).option(`message-id`,{type:`string`,description:`Message ID`}).option(`subject`,{type:`string`,description:`Subject`}).option(`delivery-status`,{type:`string`,description:`Delivery status to filter by.`,choices:[`delivered`,`moved`,`quarantined`,`rejected`,`deferred`,`bounced`,`queued`]}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`page`,{type:`number`,description:`Deprecated: Use cursor pagination instead. End of life: November 1, 2026.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`Returns information for each email that matches the search parameter(s).`,builder:m(I),handler:async n=>{let c={start:n.start,end:n.end,query:n.query,detections_only:n[`detections-only`],final_disposition:n[`final-disposition`],metric:n.metric,message_action:n[`message-action`],recipient:n.recipient,sender:n.sender,alert_id:n[`alert-id`],domain:n.domain,message_id:n[`message-id`],subject:n.subject,delivery_status:n[`delivery-status`],cursor:n.cursor,per_page:n[`per-page`],page:n.page};if(n.dryRun){a({command:`cf email-security investigate list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.investigate.list({account_id:u,...c})),{successLabel:`Loaded`})}};function R(e){return e.option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).option(`ids`,{type:`string`,array:!0,description:`List of message IDs to move.`}).option(`postfix-ids`,{type:`string`,array:!0,description:"Deprecated, use `ids` instead. End of life: November 1, 2026."}).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 z={command:`bulk`,describe:`Moves multiple messages to a specified mailbox folder (Inbox, JunkEmail, DeletedItems, RecoverableItemsDeletions, or RecoverableItemsPurges). Requires active integration.`,builder:R,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate move bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/move`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({destination:u(n.destination,`destination`,`text`),expected_disposition:u(n[`expected-disposition`],`expected-disposition`,`text`),ids:n.ids,postfix_ids:n[`postfix-ids`]}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>f.emailSecurity.investigate.move.bulk({...e,account_id:p})),{successLabel:`Created`});return}n.destination===void 0&&(n.destination=await d(`destination`,`The destination field`,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let m=l({destination:u(n.destination,`destination`,`text`),expected_disposition:u(n[`expected-disposition`],`expected-disposition`,`text`),ids:n.ids,postfix_ids:n[`postfix-ids`]});i(await o(`Creating`,async()=>f.emailSecurity.investigate.move.bulk({...m,account_id:p})),{successLabel:`Created`})}};function B(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).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:`create <investigate-id>`,describe:`Moves a single message to a specified mailbox folder (Inbox, JunkEmail, DeletedItems, RecoverableItemsDeletions, or RecoverableItemsPurges). Requires active integration.`,builder:B,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/${n[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(n[`investigate-id`]))}/move`,pathParams:{"investigate-id":String(n[`investigate-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({destination:u(n.destination,`destination`,`text`),expected_disposition:u(n[`expected-disposition`],`expected-disposition`,`text`)}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>f.emailSecurity.investigate.move.create({...e,account_id:p,investigate_id:n[`investigate-id`]})),{successLabel:`Created`});return}n.destination===void 0&&(n.destination=await d(`destination`,`The destination field`,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let m=l({destination:u(n.destination,`destination`,`text`),expected_disposition:u(n[`expected-disposition`],`expected-disposition`,`text`)});i(await o(`Creating`,async()=>f.emailSecurity.investigate.move.create({...m,account_id:p,investigate_id:n[`investigate-id`]})),{successLabel:`Created`})}},H={command:`move`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`postfix-id`,{type:`string`,description:`The identifier of the message.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`create`,describe:`Generates a preview image for a message that was not flagged as a detection. Useful for investigating benign messages. Returns a base64-encoded PNG screenshot of the email body.`,builder:U,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/preview`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({postfix_id:u(n[`postfix-id`],`postfix-id`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.emailSecurity.investigate.preview.create({...e,account_id:p})),{successLabel:`Created`});return}n[`postfix-id`]===void 0&&(n[`postfix-id`]=await f(`postfix-id`,`The identifier of the message.`));let m=l({postfix_id:u(n[`postfix-id`],`postfix-id`,`text`)});i(await o(`Creating`,async()=>d.emailSecurity.investigate.preview.create({...m,account_id:p})),{successLabel:`Created`})}};function G(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <investigate-id>`,describe:`Returns a preview of the message body as a base64 encoded PNG image for non-benign messages.`,builder:G,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate preview get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/${n[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(n[`investigate-id`]))}/preview`,pathParams:{"investigate-id":String(n[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.preview.get({account_id:l,investigate_id:n[`investigate-id`]})),{successLabel:`Loaded`})}},q={command:`preview`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(W).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`get <investigate-id>`,describe:`Returns the raw eml of any non-benign message.`,builder:J,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate raw get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/${n[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(n[`investigate-id`]))}/raw`,pathParams:{"investigate-id":String(n[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.raw.get({account_id:l,investigate_id:n[`investigate-id`]})),{successLabel:`Loaded`})}},X={command:`raw`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(Y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Z(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`eml-content`,{type:`string`,description:`Base64 encoded content of the EML file.`}).option(`escalated-submission-id`,{type:`string`,description:`The escalated_submission_id field`}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`NONE`,`BULK`,`MALICIOUS`,`SPAM`,`SPOOF`,`SUSPICIOUS`]}).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:`create <investigate-id>`,describe:`Submits a request to reclassify an email's disposition. Use for reporting false positives or false negatives. Optionally provide the raw EML content for reanalysis. The reclassification is processed asynchronously.`,builder:Z,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate reclassify create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/${n[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(n[`investigate-id`]))}/reclassify`,pathParams:{"investigate-id":String(n[`investigate-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({eml_content:u(n[`eml-content`],`eml-content`,`text`),escalated_submission_id:u(n[`escalated-submission-id`],`escalated-submission-id`,`text`),expected_disposition:u(n[`expected-disposition`],`expected-disposition`,`text`)}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>f.emailSecurity.investigate.reclassify.create({...e,account_id:p,investigate_id:n[`investigate-id`]})),{successLabel:`Created`});return}n[`expected-disposition`]===void 0&&(n[`expected-disposition`]=await d(`expected-disposition`,`The expected_disposition field`,[`NONE`,`BULK`,`MALICIOUS`,`SPAM`,`SPOOF`,`SUSPICIOUS`]));let m=l({eml_content:u(n[`eml-content`],`eml-content`,`text`),escalated_submission_id:u(n[`escalated-submission-id`],`escalated-submission-id`,`text`),expected_disposition:u(n[`expected-disposition`],`expected-disposition`,`text`)});i(await o(`Creating`,async()=>f.emailSecurity.investigate.reclassify.create({...m,account_id:p,investigate_id:n[`investigate-id`]})),{successLabel:`Created`})}},ne={command:`reclassify`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A list of investigate IDs identifying the messages to release.`})}const ie={command:`bulk`,describe:`Delivers one or more quarantined messages to their intended recipients, for cases where a message was incorrectly quarantined. The response includes delivery status for each recipient.`,builder:re,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate release bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/release`,pathParams:{},bodyKind:`json`,body:n.body===void 0?void 0:c(n.body)});return}let l=await r(n),u=n.local?s:await t();if(n.accountId=u,n.body){let e=c(n.body);i(await o(`Creating`,async()=>l.emailSecurity.investigate.release.bulk({body:e,account_id:u})),{successLabel:`Created`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ae={command:`release`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`get <investigate-id>`,describe:`Retrieves delivery and processing trace information for an email message. Shows the delivery path, retraction history, and move operations performed on the message. Useful for debugging delivery issues.`,builder:oe,handler:async n=>{if(n.dryRun){a({command:`cf email-security investigate trace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/investigate/${n[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(n[`investigate-id`]))}/trace`,pathParams:{"investigate-id":String(n[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.trace.get({account_id:l,investigate_id:n[`investigate-id`]})),{successLabel:`Loaded`})}},ce={command:`trace`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},le={command:`investigate`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(F).command(L).command(D).command(A).command(N).command(H).command(q).command(X).command(ne).command(ae).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ue(e){return e.option(`start`,{type:`string`,description:`Start of the time range (RFC3339). Takes precedence over from_date.`}).option(`end`,{type:`string`,description:`End of the time range (RFC3339). Takes precedence over to_date.`}).option(`from-date`,{type:`string`,description:"Deprecated, use `start` instead. Start date in YYYY-MM-DD format."}).option(`to-date`,{type:`string`,description:"Deprecated, use `end` instead. End date in YYYY-MM-DD format."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const de={command:`list`,describe:`Retrieves PhishGuard security alert reports for a specified date range. Reports include detected threats, dispositions, and contextual information. Use for security monitoring and threat analysis.`,builder:ue,handler:async n=>{let c={start:n.start,end:n.end,from_date:n[`from-date`],to_date:n[`to-date`]};if(n.dryRun){a({command:`cf email-security phishguard reports list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/phishguard/reports`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.phishguard.reports.list({account_id:u,...c})),{successLabel:`Loaded`})}},fe={command:`reports`,describe:`PhishGuard user-reported phishing submissions and analysis reports`,builder:e=>e.command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},pe={command:`phishguard`,describe:`Operations for phishguard`,builder:e=>e.command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Exempts messages from this sender from Spam, Spoof and Bulk dispositions only; Malicious and Suspicious dispositions still apply.`}).option(`is-exempt-recipient`,{type:`boolean`,description:`Bypasses all detections for messages to this recipient.`}).option(`is-recipient`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026."}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-sender`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026."}).option(`is-spoof`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026."}).option(`is-trusted-sender`,{type:`boolean`,description:`Bypasses all detections and link following for messages from this sender.`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 address or IPv4 CIDR block for IP (e.g. `1.2.3.4` or `1.2.3.0/24`); the API accepts only globally reachable IP addresses and rejects private, loopback, link-local, and unspecified addresses."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). The API accepts only globally reachable addresses.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create an allow policy.`})}const he={command:`create`,describe:`Creates a new allow policy that exempts matching emails from security detections. Use with caution as this bypasses email security scanning. Policies can match on sender patterns and apply to specific detections or all detections.`,builder:me,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings allow-policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),is_acceptable_sender:n[`is-acceptable-sender`],is_exempt_recipient:n[`is-exempt-recipient`],is_recipient:n[`is-recipient`],is_regex:n[`is-regex`],is_sender:n[`is-sender`],is_spoof:n[`is-spoof`],is_trusted_sender:n[`is-trusted-sender`],pattern:u(n.pattern,`pattern`,`text`),pattern_type:u(n[`pattern-type`],`pattern-type`,`text`),verify_sender:n[`verify-sender`]}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.emailSecurity.settings.allowPolicies.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=l({comments:u(n.comments,`comments`,`text`),is_acceptable_sender:n[`is-acceptable-sender`],is_exempt_recipient:n[`is-exempt-recipient`],is_recipient:n[`is-recipient`],is_regex:n[`is-regex`],is_sender:n[`is-sender`],is_spoof:n[`is-spoof`],is_trusted_sender:n[`is-trusted-sender`],pattern:u(n.pattern,`pattern`,`text`),pattern_type:u(n[`pattern-type`],`pattern-type`,`text`),verify_sender:n[`verify-sender`]});i(await o(`Creating`,async()=>d.emailSecurity.settings.allowPolicies.create({body:p,account_id:f})),{successLabel:`Created`})}};function ge(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy 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 _e={command:`delete <policy-id>`,describe:`Removes an allow policy. After deletion, emails matching this pattern will be subject to normal security scanning and disposition actions.`,builder:ge,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings allow-policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/allow_policies/${n[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(n[`policy-id`]))}`,pathParams:{"policy-id":String(n[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
5
|
+
`);return}i(await o(`Deleting`,async()=>c.emailSecurity.settings.allowPolicies.delete({account_id:l,policy_id:n[`policy-id`]})),{successLabel:`Deleted`})}};function ve(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Exempts messages from this sender from Spam, Spoof and Bulk dispositions only; Malicious and Suspicious dispositions still apply.`}).option(`is-exempt-recipient`,{type:`boolean`,description:`Bypasses all detections for messages to this recipient.`}).option(`is-recipient`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026."}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-sender`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026."}).option(`is-spoof`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026."}).option(`is-trusted-sender`,{type:`boolean`,description:`Bypasses all detections and link following for messages from this sender.`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 address or IPv4 CIDR block for IP (e.g. `1.2.3.4` or `1.2.3.0/24`); the API accepts only globally reachable IP addresses and rejects private, loopback, link-local, and unspecified addresses."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). The API accepts only globally reachable addresses.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update an allow policy.`})}const ye={command:`edit <policy-id>`,describe:`Updates an existing allow policy. Only provided fields will be modified. Changes take effect for new emails matching the pattern.`,builder:ve,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings allow-policies edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/allow_policies/${n[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(n[`policy-id`]))}`,pathParams:{"policy-id":String(n[`policy-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),is_acceptable_sender:n[`is-acceptable-sender`],is_exempt_recipient:n[`is-exempt-recipient`],is_recipient:n[`is-recipient`],is_regex:n[`is-regex`],is_sender:n[`is-sender`],is_spoof:n[`is-spoof`],is_trusted_sender:n[`is-trusted-sender`],pattern:u(n.pattern,`pattern`,`text`),pattern_type:u(n[`pattern-type`],`pattern-type`,`text`),verify_sender:n[`verify-sender`]}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.emailSecurity.settings.allowPolicies.edit({body:e,account_id:f,policy_id:n[`policy-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(n.comments,`comments`,`text`),is_acceptable_sender:n[`is-acceptable-sender`],is_exempt_recipient:n[`is-exempt-recipient`],is_recipient:n[`is-recipient`],is_regex:n[`is-regex`],is_sender:n[`is-sender`],is_spoof:n[`is-spoof`],is_trusted_sender:n[`is-trusted-sender`],pattern:u(n.pattern,`pattern`,`text`),pattern_type:u(n[`pattern-type`],`pattern-type`,`text`),verify_sender:n[`verify-sender`]});i(await o(`Updating`,async()=>d.emailSecurity.settings.allowPolicies.edit({body:p,account_id:f,policy_id:n[`policy-id`]})),{successLabel:`Updated`})}};function be(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`get <policy-id>`,describe:`Retrieves details for a specific allow policy including its pattern, dispositions that are exempted, and whether it applies to all detections.`,builder:be,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings allow-policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/allow_policies/${n[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(n[`policy-id`]))}`,pathParams:{"policy-id":String(n[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.settings.allowPolicies.get({account_id:l,policy_id:n[`policy-id`]})),{successLabel:`Loaded`})}};function Se(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`is-exempt-recipient`,{type:`boolean`,description:`Filter to show only policies where messages to the recipient bypass all detections.`}).option(`is-trusted-sender`,{type:`boolean`,description:`Filter to show only policies where messages from the sender bypass all detections and link following.`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Filter to show only policies where messages from the sender are exempted from Spam, Spoof, and Bulk dispositions (not Malicious or Suspicious).`}).option(`verify-sender`,{type:`boolean`,description:`Filter to show only policies that enforce DMARC, SPF, or DKIM authentication.`}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). The API accepts only globally reachable addresses.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`list`,describe:`Returns a paginated list of email allow policies. These policies exempt matching emails from security detection, allowing them to bypass disposition actions. Supports filtering by pattern type and policy attributes.`,builder:m(Se),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search,order:n.order,direction:n.direction,is_exempt_recipient:n[`is-exempt-recipient`],is_trusted_sender:n[`is-trusted-sender`],is_acceptable_sender:n[`is-acceptable-sender`],verify_sender:n[`verify-sender`],pattern_type:n[`pattern-type`],pattern:n.pattern};if(n.dryRun){a({command:`cf email-security settings allow-policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.settings.allowPolicies.list({account_id:u,...c})),{successLabel:`Loaded`})}},we={command:`allow-policies`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,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.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 Ee={command:`create`,describe:`Executes multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:Te,handler:async l=>{if(l.dryRun){a({command:`cf email-security settings batch allow policies batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/allow_policies/batch`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await r(l),d=l.local?s:await t();if(l.accountId=d,l.body){let e=c(l.body);i(await o(`Creating`,async()=>u.emailSecurity.settings.batch.allow.policies.batch.create({...e,account_id:d})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/email-security/settings/allow_policies/batch`)),{successLabel:`Created`})}},De={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Oe={command:`policies`,describe:`Operations for settings.batch.allow.policies`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ke={command:`allow`,describe:`Operations for settings.batch.allow`,builder:e=>e.command(Oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ae(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 je={command:`create`,describe:`Executes multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:Ae,handler:async l=>{if(l.dryRun){a({command:`cf email-security settings batch block senders batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/block_senders/batch`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await r(l),d=l.local?s:await t();if(l.accountId=d,l.body){let e=c(l.body);i(await o(`Creating`,async()=>u.emailSecurity.settings.batch.block.senders.batch.create({...e,account_id:d})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/email-security/settings/block_senders/batch`)),{successLabel:`Created`})}},Me={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(je).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ne={command:`senders`,describe:`Operations for settings.batch.block.senders`,builder:e=>e.command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Pe={command:`block`,describe:`Operations for settings.batch.block`,builder:e=>e.command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Fe(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 Ie={command:`create`,describe:`Executes multiple delete operations on sending domain restrictions atomically. All operations succeed or fail together as a transaction. Currently only supports batch deletion. Removes TLS enforcement requirements for the specified domains.`,builder:Fe,handler:async l=>{if(l.dryRun){a({command:`cf email-security settings batch sending domain restrictions batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/sending_domain_restrictions/batch`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await r(l),d=l.local?s:await t();if(l.accountId=d,l.body){let e=c(l.body);i(await o(`Creating`,async()=>u.emailSecurity.settings.batch.sending.domain.restrictions.batch.create({...e,account_id:d})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/email-security/settings/sending_domain_restrictions/batch`)),{successLabel:`Created`})}},Le={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Re={command:`restrictions`,describe:`Operations for settings.batch.sending.domain.restrictions`,builder:e=>e.command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ze={command:`domain`,describe:`Operations for settings.batch.sending.domain`,builder:e=>e.command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Be={command:`sending`,describe:`Operations for settings.batch.sending`,builder:e=>e.command(ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ve(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 He={command:`create`,describe:`Executes multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:Ve,handler:async l=>{if(l.dryRun){a({command:`cf email-security settings batch trusted domains batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/trusted_domains/batch`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await r(l),d=l.local?s:await t();if(l.accountId=d,l.body){let e=c(l.body);i(await o(`Creating`,async()=>u.emailSecurity.settings.batch.trusted.domains.batch.create({...e,account_id:d})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/email-security/settings/trusted_domains/batch`)),{successLabel:`Created`})}},Ue={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},We={command:`domains`,describe:`Operations for settings.batch.trusted.domains`,builder:e=>e.command(Ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ge={command:`trusted`,describe:`Operations for settings.batch.trusted`,builder:e=>e.command(We).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ke={command:`batch`,describe:`Operations for settings.batch`,builder:e=>e.command(ke).command(Pe).command(Be).command(Ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qe(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 address or IPv4 CIDR block for IP (e.g. `1.2.3.4` or `1.2.3.0/24`); the API accepts only globally reachable IP addresses and rejects private, loopback, link-local, and unspecified addresses."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). The API accepts only globally reachable addresses.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a blocked sender pattern.`})}const Je={command:`create`,describe:`Creates a new blocked sender pattern. Emails matching this pattern will be blocked from delivery. Patterns can be email addresses, domains, or IP addresses, and support regular expressions.`,builder:qe,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings block-senders create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),is_regex:n[`is-regex`],pattern:u(n.pattern,`pattern`,`text`),pattern_type:u(n[`pattern-type`],`pattern-type`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.emailSecurity.settings.blockSenders.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=l({comments:u(n.comments,`comments`,`text`),is_regex:n[`is-regex`],pattern:u(n.pattern,`pattern`,`text`),pattern_type:u(n[`pattern-type`],`pattern-type`,`text`)});i(await o(`Creating`,async()=>d.emailSecurity.settings.blockSenders.create({body:p,account_id:f})),{successLabel:`Created`})}};function Ye(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern 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 Xe={command:`delete <pattern-id>`,describe:`Removes a blocked sender pattern. After deletion, emails from this sender will no longer be automatically blocked based on this rule.`,builder:Ye,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings block-senders delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/block_senders/${n[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(n[`pattern-id`]))}`,pathParams:{"pattern-id":String(n[`pattern-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
6
|
+
`);return}i(await o(`Deleting`,async()=>c.emailSecurity.settings.blockSenders.delete({account_id:l,pattern_id:n[`pattern-id`]})),{successLabel:`Deleted`})}};function Ze(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 address or IPv4 CIDR block for IP (e.g. `1.2.3.4` or `1.2.3.0/24`); the API accepts only globally reachable IP addresses and rejects private, loopback, link-local, and unspecified addresses."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). The API accepts only globally reachable addresses.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update a blocked sender pattern.`})}const Qe={command:`edit <pattern-id>`,describe:`Updates an existing blocked sender pattern. Only provided fields will be modified. The pattern will continue blocking emails until deleted.`,builder:Ze,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings block-senders edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/block_senders/${n[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(n[`pattern-id`]))}`,pathParams:{"pattern-id":String(n[`pattern-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),is_regex:n[`is-regex`],pattern:u(n.pattern,`pattern`,`text`),pattern_type:u(n[`pattern-type`],`pattern-type`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.emailSecurity.settings.blockSenders.edit({body:e,account_id:f,pattern_id:n[`pattern-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(n.comments,`comments`,`text`),is_regex:n[`is-regex`],pattern:u(n.pattern,`pattern`,`text`),pattern_type:u(n[`pattern-type`],`pattern-type`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.settings.blockSenders.edit({body:p,account_id:f,pattern_id:n[`pattern-id`]})),{successLabel:`Updated`})}};function $e(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const et={command:`get <pattern-id>`,describe:`Retrieves details for a specific blocked sender pattern including its pattern type, value, and metadata.`,builder:$e,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings block-senders get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/block_senders/${n[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(n[`pattern-id`]))}`,pathParams:{"pattern-id":String(n[`pattern-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.settings.blockSenders.get({account_id:l,pattern_id:n[`pattern-id`]})),{successLabel:`Loaded`})}};function tt(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`pattern-type`,{type:`string`,description:`Filter by pattern type.`,choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`pattern`,{type:`string`,description:`Filter by pattern value.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nt={command:`list`,describe:`Returns a paginated list of blocked email sender patterns. These patterns prevent emails from matching senders from being delivered. Supports filtering by pattern type and searching across patterns.`,builder:m(tt),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search,order:n.order,direction:n.direction,pattern_type:n[`pattern-type`],pattern:n.pattern};if(n.dryRun){a({command:`cf email-security settings block-senders list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.settings.blockSenders.list({account_id:u,...c})),{successLabel:`Loaded`})}},rt={command:`block-senders`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(Je).command(Xe).command(Qe).command(et).command(nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function it(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 at={command:`batch`,describe:`Executes multiple domain operations in a single request. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:it,handler:async l=>{if(l.dryRun){a({command:`cf email-security settings domains batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains/batch`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await r(l),d=l.local?s:await t();if(l.accountId=d,l.body){let e=c(l.body);i(await o(`Creating`,async()=>u.emailSecurity.settings.domains.batch({...e,account_id:d})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/email-security/settings/domains/batch`)),{successLabel:`Created`})}};function ot(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 st={command:`bulk-delete`,describe:`Removes protection from multiple email domains. Deprecated; use the batch endpoint instead.`,builder:ot,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings domains bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains`,pathParams:{},bodyKind:`json`,body:n.body===void 0?void 0:c(n.body)});return}let l=await r(n),u=n.local?s:await t();if(n.accountId=u,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
7
|
+
`);return}if(n.body){let e=c(n.body);i(await o(`Deleting`,async()=>l.emailSecurity.settings.domains.bulkDelete({body:e,account_id:u})),{successLabel:`Deleted`});return}if(n.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function ct(e){return e.option(`allowed-delivery-modes`,{type:`string`,array:!0,description:`The allowed_delivery_modes field`}).option(`domain`,{type:`string`,description:`The domain field`}).option(`drop-dispositions`,{type:`string`,array:!0,description:`The drop_dispositions field`}).option(`integration-id`,{type:`string`,description:`The integration_id field`}).option(`ip-restrictions`,{type:`string`,array:!0,description:`The ip_restrictions field`}).option(`lookback-hops`,{type:`number`,description:`The lookback_hops field`}).option(`regions`,{type:`string`,array:!0,description:`The regions field`}).option(`require-tls-inbound`,{type:`boolean`,description:`The require_tls_inbound field`}).option(`require-tls-outbound`,{type:`boolean`,description:`The require_tls_outbound field`}).option(`transport`,{type:`string`,description:`The transport field`}).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 lt={command:`create`,describe:`Protects a new email domain by adding it to Email Security. Accepts a flat configuration object covering all delivery modes. Returns the newly created domain configuration.`,builder:ct,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({allowed_delivery_modes:n[`allowed-delivery-modes`],domain:u(n.domain,`domain`,`text`),drop_dispositions:n[`drop-dispositions`],integration_id:u(n[`integration-id`],`integration-id`,`text`),ip_restrictions:n[`ip-restrictions`],lookback_hops:n[`lookback-hops`],regions:n.regions,require_tls_inbound:n[`require-tls-inbound`],require_tls_outbound:n[`require-tls-outbound`],transport:u(n.transport,`transport`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.emailSecurity.settings.domains.create({body:e,account_id:p})),{successLabel:`Created`});return}if(n[`allowed-delivery-modes`]===void 0)throw Error(`--allowed-delivery-modes is required (or pass --body with this field set).`);if(n.domain===void 0&&(n.domain=await f(`domain`,`The domain field`)),n[`drop-dispositions`]===void 0)throw Error(`--drop-dispositions is required (or pass --body with this field set).`);if(n[`ip-restrictions`]===void 0)throw Error(`--ip-restrictions is required (or pass --body with this field set).`);if(n.regions===void 0)throw Error(`--regions is required (or pass --body with this field set).`);let m=l({allowed_delivery_modes:n[`allowed-delivery-modes`],domain:u(n.domain,`domain`,`text`),drop_dispositions:n[`drop-dispositions`],integration_id:u(n[`integration-id`],`integration-id`,`text`),ip_restrictions:n[`ip-restrictions`],lookback_hops:n[`lookback-hops`],regions:n.regions,require_tls_inbound:n[`require-tls-inbound`],require_tls_outbound:n[`require-tls-outbound`],transport:u(n.transport,`transport`,`text`)});i(await o(`Creating`,async()=>d.emailSecurity.settings.domains.create({body:m,account_id:p})),{successLabel:`Created`})}};function ut(e){return e.positional(`domain-id`,{type:`string`,description:`Domain 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 dt={command:`delete <domain-id>`,describe:`Removes email security protection from a domain. After deletion, emails for this domain will no longer be processed by Email Security. This action cannot be undone.`,builder:ut,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains/${n[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(n[`domain-id`]))}`,pathParams:{"domain-id":String(n[`domain-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
8
|
+
`);return}i(await o(`Deleting`,async()=>c.emailSecurity.settings.domains.delete({account_id:l,domain_id:n[`domain-id`]})),{successLabel:`Deleted`})}};function ft(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`allowed-delivery-modes`,{type:`string`,array:!0,description:`The allowed_delivery_modes field`}).option(`drop-dispositions`,{type:`string`,array:!0,description:`The drop_dispositions field`}).option(`integration-id`,{type:`string`,description:`The integration_id field`}).option(`ip-restrictions`,{type:`string`,array:!0,description:`The ip_restrictions field`}).option(`lookback-hops`,{type:`number`,description:`The lookback_hops field`}).option(`regions`,{type:`string`,array:!0,description:`The regions field`}).option(`require-tls-inbound`,{type:`boolean`,description:`The require_tls_inbound field`}).option(`require-tls-outbound`,{type:`boolean`,description:`The require_tls_outbound field`}).option(`transport`,{type:`string`,description:`The transport field`}).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 pt={command:`edit <domain-id>`,describe:`Updates configuration for a protected email domain. Only provided fields will be modified. Changes affect delivery mode, security settings, and regional processing.`,builder:ft,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains/${n[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(n[`domain-id`]))}`,pathParams:{"domain-id":String(n[`domain-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({allowed_delivery_modes:n[`allowed-delivery-modes`],drop_dispositions:n[`drop-dispositions`],integration_id:u(n[`integration-id`],`integration-id`,`text`),ip_restrictions:n[`ip-restrictions`],lookback_hops:n[`lookback-hops`],regions:n.regions,require_tls_inbound:n[`require-tls-inbound`],require_tls_outbound:n[`require-tls-outbound`],transport:u(n.transport,`transport`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.emailSecurity.settings.domains.edit({body:e,account_id:f,domain_id:n[`domain-id`]})),{successLabel:`Updated`});return}let p=l({allowed_delivery_modes:n[`allowed-delivery-modes`],drop_dispositions:n[`drop-dispositions`],integration_id:u(n[`integration-id`],`integration-id`,`text`),ip_restrictions:n[`ip-restrictions`],lookback_hops:n[`lookback-hops`],regions:n.regions,require_tls_inbound:n[`require-tls-inbound`],require_tls_outbound:n[`require-tls-outbound`],transport:u(n.transport,`transport`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.settings.domains.edit({body:p,account_id:f,domain_id:n[`domain-id`]})),{successLabel:`Updated`})}};function mt(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ht={command:`get <domain-id>`,describe:`Retrieves detailed information for a specific protected email domain including its delivery configuration, SPF/DMARC status, and authorization state.`,builder:mt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains/${n[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(n[`domain-id`]))}`,pathParams:{"domain-id":String(n[`domain-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.settings.domains.get({account_id:l,domain_id:n[`domain-id`]})),{successLabel:`Loaded`})}};function gt(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`domain`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`allowed-delivery-mode`,{type:`string`,description:`Delivery mode to filter by.`,choices:[`DIRECT`,`BCC`,`JOURNAL`,`API`,`RETRO_SCAN`]}).option(`domain`,{type:`string`,description:`Domain names to filter by.`}).option(`active-delivery-mode`,{type:`string`,description:`Currently active delivery mode to filter by.`,choices:[`DIRECT`,`BCC`,`JOURNAL`,`API`,`RETRO_SCAN`]}).option(`integration-id`,{type:`string`,description:`Integration ID to filter by.`}).option(`status`,{type:`string`,description:`Filters response to domains with the provided status.`,choices:[`pending`,`active`,`failed`,`timeout`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _t={command:`list`,describe:`Returns a paginated list of email domains protected by Email Security. Includes domain configuration, delivery modes, and authorization status. Supports filtering by delivery mode and integration ID.`,builder:m(gt),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search,order:n.order,direction:n.direction,allowed_delivery_mode:n[`allowed-delivery-mode`],domain:n.domain,active_delivery_mode:n[`active-delivery-mode`],integration_id:n[`integration-id`],status:n.status};if(n.dryRun){a({command:`cf email-security settings domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.settings.domains.list({account_id:u,...c})),{successLabel:`Loaded`})}};function vt(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`allowed-delivery-modes`,{type:`string`,array:!0,description:`The allowed_delivery_modes field`}).option(`drop-dispositions`,{type:`string`,array:!0,description:`The drop_dispositions field`}).option(`integration-id`,{type:`string`,description:`The integration_id field`}).option(`ip-restrictions`,{type:`string`,array:!0,description:`The ip_restrictions field`}).option(`lookback-hops`,{type:`number`,description:`The lookback_hops field`}).option(`regions`,{type:`string`,array:!0,description:`The regions field`}).option(`require-tls-inbound`,{type:`boolean`,description:`The require_tls_inbound field`}).option(`require-tls-outbound`,{type:`boolean`,description:`The require_tls_outbound field`}).option(`transport`,{type:`string`,description:`The transport field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for replacing an email domain. The `domain` field is intentionally absent — the domain name is immutable after creation. "})}const yt={command:`update <domain-id>`,describe:`Replaces all mutable fields of a protected email domain in a single atomic operation. Unlike PATCH, all non-computed fields are required.`,builder:vt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings domains update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains/${n[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(n[`domain-id`]))}`,pathParams:{"domain-id":String(n[`domain-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({allowed_delivery_modes:n[`allowed-delivery-modes`],drop_dispositions:n[`drop-dispositions`],integration_id:u(n[`integration-id`],`integration-id`,`text`),ip_restrictions:n[`ip-restrictions`],lookback_hops:n[`lookback-hops`],regions:n.regions,require_tls_inbound:n[`require-tls-inbound`],require_tls_outbound:n[`require-tls-outbound`],transport:u(n.transport,`transport`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.emailSecurity.settings.domains.update({body:e,account_id:f,domain_id:n[`domain-id`]})),{successLabel:`Updated`});return}if(n[`allowed-delivery-modes`]===void 0)throw Error(`--allowed-delivery-modes is required (or pass --body with this field set).`);if(n[`drop-dispositions`]===void 0)throw Error(`--drop-dispositions is required (or pass --body with this field set).`);if(n[`ip-restrictions`]===void 0)throw Error(`--ip-restrictions is required (or pass --body with this field set).`);if(n.regions===void 0)throw Error(`--regions is required (or pass --body with this field set).`);let p=l({allowed_delivery_modes:n[`allowed-delivery-modes`],drop_dispositions:n[`drop-dispositions`],integration_id:u(n[`integration-id`],`integration-id`,`text`),ip_restrictions:n[`ip-restrictions`],lookback_hops:n[`lookback-hops`],regions:n.regions,require_tls_inbound:n[`require-tls-inbound`],require_tls_outbound:n[`require-tls-outbound`],transport:u(n.transport,`transport`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.settings.domains.update({body:p,account_id:f,domain_id:n[`domain-id`]})),{successLabel:`Updated`})}};function bt(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xt={command:`get <domain-id>`,describe:"Returns DNS TXT verification details for a domain created through the Terraform API. Returns `200 OK` with the TXT record name and value when the domain uses `dns_txt` verification. Returns `204 No Content` for pre-existing domains or domains verified by other means (Cloudflare zone ownership, CASB integration).",builder:bt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings domains verification get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/domains/${n[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(n[`domain-id`]))}/verification`,pathParams:{"domain-id":String(n[`domain-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.settings.domains.verification.get({account_id:l,domain_id:n[`domain-id`]})),{successLabel:`Loaded`})}},St={command:`verification`,describe:`Operations for settings.domains.verification`,builder:e=>e.command(xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ct={command:`domains`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(at).command(st).command(lt).command(dt).command(pt).command(ht).command(_t).command(yt).command(St).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function wt(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`directory-id`,{type:`number`,description:`The directory_id field`}).option(`directory-node-id`,{type:`number`,description:`The directory_node_id field`}).option(`email`,{type:`string`,description:`The email field`}).option(`external-directory-node-id`,{type:`string`,description:`The external_directory_node_id field`}).option(`is-email-regex`,{type:`boolean`,description:`The is_email_regex field`}).option(`name`,{type:`string`,description:`The name field`}).option(`provenance`,{type:`string`,description:`The provenance field`,choices:[`A1S_INTERNAL`,`SNOOPY-CASB_OFFICE_365`,`SNOOPY-OFFICE_365`,`SNOOPY-GOOGLE_DIRECTORY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create an impersonation registry entry.`})}const Tt={command:`create`,describe:`Creates a new entry in the impersonation registry to protect against impersonation. Emails attempting to impersonate this identity will be flagged. Supports regex patterns for flexible email matching.`,builder:wt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings impersonation-registry create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/impersonation_registry`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),directory_id:n[`directory-id`],directory_node_id:n[`directory-node-id`],email:u(n.email,`email`,`text`),external_directory_node_id:u(n[`external-directory-node-id`],`external-directory-node-id`,`text`),is_email_regex:n[`is-email-regex`],name:u(n.name,`name`,`text`),provenance:u(n.provenance,`provenance`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.emailSecurity.settings.impersonationRegistry.create({...e,account_id:f})),{successLabel:`Created`});return}let p=l({comments:u(n.comments,`comments`,`text`),directory_id:n[`directory-id`],directory_node_id:n[`directory-node-id`],email:u(n.email,`email`,`text`),external_directory_node_id:u(n[`external-directory-node-id`],`external-directory-node-id`,`text`),is_email_regex:n[`is-email-regex`],name:u(n.name,`name`,`text`),provenance:u(n.provenance,`provenance`,`text`)});i(await o(`Creating`,async()=>d.emailSecurity.settings.impersonationRegistry.create({...p,account_id:f})),{successLabel:`Created`})}};function Et(e){return e.positional(`impersonation-registry-id`,{type:`string`,description:`Impersonation registry entry 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 Dt={command:`delete <impersonation-registry-id>`,describe:`Removes an entry from the impersonation registry. After deletion, this identity will no longer be protected from impersonation.`,builder:Et,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings impersonation-registry delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/impersonation_registry/${n[`impersonation-registry-id`]==null?`<impersonation-registry-id>`:encodeURIComponent(String(n[`impersonation-registry-id`]))}`,pathParams:{"impersonation-registry-id":String(n[`impersonation-registry-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
9
|
+
`);return}i(await o(`Deleting`,async()=>c.emailSecurity.settings.impersonationRegistry.delete({account_id:l,impersonation_registry_id:n[`impersonation-registry-id`]})),{successLabel:`Deleted`})}};function Ot(e){return e.positional(`impersonation-registry-id`,{type:`string`,description:`Impersonation registry entry identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`directory-id`,{type:`number`,description:`The directory_id field`}).option(`directory-node-id`,{type:`number`,description:`The directory_node_id field`}).option(`email`,{type:`string`,description:`The email field`}).option(`external-directory-node-id`,{type:`string`,description:`The external_directory_node_id field`}).option(`is-email-regex`,{type:`boolean`,description:`The is_email_regex field`}).option(`name`,{type:`string`,description:`The name field`}).option(`provenance`,{type:`string`,description:`The provenance field`,choices:[`A1S_INTERNAL`,`SNOOPY-CASB_OFFICE_365`,`SNOOPY-OFFICE_365`,`SNOOPY-GOOGLE_DIRECTORY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update an impersonation registry entry.`})}const kt={command:`edit <impersonation-registry-id>`,describe:`Updates an existing impersonation registry entry. Only provided fields will be modified. Directory-synced entries can't be updated.`,builder:Ot,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings impersonation-registry edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/impersonation_registry/${n[`impersonation-registry-id`]==null?`<impersonation-registry-id>`:encodeURIComponent(String(n[`impersonation-registry-id`]))}`,pathParams:{"impersonation-registry-id":String(n[`impersonation-registry-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),directory_id:n[`directory-id`],directory_node_id:n[`directory-node-id`],email:u(n.email,`email`,`text`),external_directory_node_id:u(n[`external-directory-node-id`],`external-directory-node-id`,`text`),is_email_regex:n[`is-email-regex`],name:u(n.name,`name`,`text`),provenance:u(n.provenance,`provenance`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.emailSecurity.settings.impersonationRegistry.edit({...e,account_id:f,impersonation_registry_id:n[`impersonation-registry-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(n.comments,`comments`,`text`),directory_id:n[`directory-id`],directory_node_id:n[`directory-node-id`],email:u(n.email,`email`,`text`),external_directory_node_id:u(n[`external-directory-node-id`],`external-directory-node-id`,`text`),is_email_regex:n[`is-email-regex`],name:u(n.name,`name`,`text`),provenance:u(n.provenance,`provenance`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.settings.impersonationRegistry.edit({...p,account_id:f,impersonation_registry_id:n[`impersonation-registry-id`]})),{successLabel:`Updated`})}};function At(e){return e.positional(`impersonation-registry-id`,{type:`string`,description:`Impersonation registry entry identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const jt={command:`get <impersonation-registry-id>`,describe:`Retrieves details for a specific impersonation registry entry including the protected identity, email pattern, and synchronization source if directory-synced.`,builder:At,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings impersonation-registry get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/impersonation_registry/${n[`impersonation-registry-id`]==null?`<impersonation-registry-id>`:encodeURIComponent(String(n[`impersonation-registry-id`]))}`,pathParams:{"impersonation-registry-id":String(n[`impersonation-registry-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.settings.impersonationRegistry.get({account_id:l,impersonation_registry_id:n[`impersonation-registry-id`]})),{successLabel:`Loaded`})}};function Mt(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`name`,`email`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`provenance`,{type:`string`,description:`Provenance`,choices:[`A1S_INTERNAL`,`SNOOPY-CASB_OFFICE_365`,`SNOOPY-OFFICE_365`,`SNOOPY-GOOGLE_DIRECTORY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Nt={command:`list`,describe:`Returns a paginated list of protected identities in the impersonation registry. These entries define identities and email addresses to protect from impersonation attacks. Can be manually added or automatically synced from directory integrations.`,builder:m(Mt),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search,order:n.order,direction:n.direction,provenance:n.provenance};if(n.dryRun){a({command:`cf email-security settings impersonation-registry list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/impersonation_registry`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.settings.impersonationRegistry.list({account_id:u,...c})),{successLabel:`Loaded`})}},Pt={command:`impersonation-registry`,describe:`Operations for settings.impersonation-registry`,builder:e=>e.command(Tt).command(Dt).command(kt).command(jt).command(Nt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ft(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`domain`,{type:`string`,description:`Domain that requires TLS enforcement.`}).option(`exclude`,{type:`string`,array:!0,description:`Subdomains to exempt from TLS requirements.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a sending domain restriction.`})}const It={command:`create`,describe:`Creates a new sending domain restriction to enforce TLS requirements for a domain. Emails without TLS from this domain will be dropped unless the subdomain is in the exclude list.`,builder:Ft,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings sending-domain-restrictions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/sending_domain_restrictions`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),domain:u(n.domain,`domain`,`text`),exclude:n.exclude}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.emailSecurity.settings.sendingDomainRestrictions.create({...e,account_id:f})),{successLabel:`Created`});return}let p=l({comments:u(n.comments,`comments`,`text`),domain:u(n.domain,`domain`,`text`),exclude:n.exclude});i(await o(`Creating`,async()=>d.emailSecurity.settings.sendingDomainRestrictions.create({...p,account_id:f})),{successLabel:`Created`})}};function Lt(e){return e.positional(`sending-domain-restriction-id`,{type:`string`,description:`Sending domain restriction 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 Rt={command:`delete <sending-domain-restriction-id>`,describe:`Removes a sending domain restriction. After deletion, TLS will no longer be enforced for emails from this domain.`,builder:Lt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings sending-domain-restrictions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/sending_domain_restrictions/${n[`sending-domain-restriction-id`]==null?`<sending-domain-restriction-id>`:encodeURIComponent(String(n[`sending-domain-restriction-id`]))}`,pathParams:{"sending-domain-restriction-id":String(n[`sending-domain-restriction-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
10
|
+
`);return}i(await o(`Deleting`,async()=>c.emailSecurity.settings.sendingDomainRestrictions.delete({account_id:l,sending_domain_restriction_id:n[`sending-domain-restriction-id`]})),{successLabel:`Deleted`})}};function zt(e){return e.positional(`sending-domain-restriction-id`,{type:`string`,description:`Sending domain restriction identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`domain`,{type:`string`,description:`Domain that requires TLS enforcement.`}).option(`exclude`,{type:`string`,array:!0,description:`Subdomains to exempt from TLS requirements.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update a sending domain restriction.`})}const Bt={command:`edit <sending-domain-restriction-id>`,describe:`Updates an existing sending domain restriction. Only provided fields will be modified. Changes affect which domains require TLS and which subdomains are excluded.`,builder:zt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings sending-domain-restrictions edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/sending_domain_restrictions/${n[`sending-domain-restriction-id`]==null?`<sending-domain-restriction-id>`:encodeURIComponent(String(n[`sending-domain-restriction-id`]))}`,pathParams:{"sending-domain-restriction-id":String(n[`sending-domain-restriction-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),domain:u(n.domain,`domain`,`text`),exclude:n.exclude}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.emailSecurity.settings.sendingDomainRestrictions.edit({...e,account_id:f,sending_domain_restriction_id:n[`sending-domain-restriction-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(n.comments,`comments`,`text`),domain:u(n.domain,`domain`,`text`),exclude:n.exclude});i(await o(`Updating`,async()=>d.emailSecurity.settings.sendingDomainRestrictions.edit({...p,account_id:f,sending_domain_restriction_id:n[`sending-domain-restriction-id`]})),{successLabel:`Updated`})}};function Vt(e){return e.positional(`sending-domain-restriction-id`,{type:`string`,description:`Sending domain restriction identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ht={command:`get <sending-domain-restriction-id>`,describe:`Retrieves details for a specific sending domain restriction including the domain requiring TLS and any excluded subdomains exempt from the TLS requirement.`,builder:Vt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings sending-domain-restrictions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/sending_domain_restrictions/${n[`sending-domain-restriction-id`]==null?`<sending-domain-restriction-id>`:encodeURIComponent(String(n[`sending-domain-restriction-id`]))}`,pathParams:{"sending-domain-restriction-id":String(n[`sending-domain-restriction-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.settings.sendingDomainRestrictions.get({account_id:l,sending_domain_restriction_id:n[`sending-domain-restriction-id`]})),{successLabel:`Loaded`})}};function Ut(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`domain`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Wt={command:`list`,describe:`Returns a paginated list of sending domain restrictions. These restrictions enforce TLS requirements for emails from specific domains. Mail without TLS from restricted domains will be dropped unless the subdomain is in the exclude list. Supports sorting and searching.`,builder:m(Ut),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search,order:n.order,direction:n.direction};if(n.dryRun){a({command:`cf email-security settings sending-domain-restrictions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/sending_domain_restrictions`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.settings.sendingDomainRestrictions.list({account_id:u,...c})),{successLabel:`Loaded`})}},Gt={command:`sending-domain-restrictions`,describe:`Operations for settings.sending-domain-restrictions`,builder:e=>e.command(It).command(Rt).command(Bt).command(Ht).command(Wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Kt(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-recent`,{type:`boolean`,description:`Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a trusted domain.`})}const qt={command:`create`,describe:`Creates a new trusted domain pattern. Use for partner domains or approved senders that should bypass recent domain registration and similarity checks. Configure whether it prevents recent domain or spoof dispositions.`,builder:Kt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings trusted-domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),is_recent:n[`is-recent`],is_regex:n[`is-regex`],is_similarity:n[`is-similarity`],pattern:u(n.pattern,`pattern`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.emailSecurity.settings.trustedDomains.create({body:e,account_id:f})),{successLabel:`Created`});return}let p=l({comments:u(n.comments,`comments`,`text`),is_recent:n[`is-recent`],is_regex:n[`is-regex`],is_similarity:n[`is-similarity`],pattern:u(n.pattern,`pattern`,`text`)});i(await o(`Creating`,async()=>d.emailSecurity.settings.trustedDomains.create({body:p,account_id:f})),{successLabel:`Created`})}};function Jt(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain 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 Yt={command:`delete <trusted-domain-id>`,describe:`Removes a trusted domain pattern. After deletion, emails from this domain will be subject to normal recent domain and similarity checks.`,builder:Jt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings trusted-domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/trusted_domains/${n[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(n[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(n[`trusted-domain-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
11
|
+
`);return}i(await o(`Deleting`,async()=>c.emailSecurity.settings.trustedDomains.delete({account_id:l,trusted_domain_id:n[`trusted-domain-id`]})),{successLabel:`Deleted`})}};function Xt(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-recent`,{type:`boolean`,description:`Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update a trusted domain.`})}const Zt={command:`edit <trusted-domain-id>`,describe:`Updates an existing trusted domain pattern. Only provided fields will be modified. Changes take effect for new emails matching the pattern.`,builder:Xt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings trusted-domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/trusted_domains/${n[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(n[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(n[`trusted-domain-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),is_recent:n[`is-recent`],is_regex:n[`is-regex`],is_similarity:n[`is-similarity`],pattern:u(n.pattern,`pattern`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.emailSecurity.settings.trustedDomains.edit({body:e,account_id:f,trusted_domain_id:n[`trusted-domain-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(n.comments,`comments`,`text`),is_recent:n[`is-recent`],is_regex:n[`is-regex`],is_similarity:n[`is-similarity`],pattern:u(n.pattern,`pattern`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.settings.trustedDomains.edit({body:p,account_id:f,trusted_domain_id:n[`trusted-domain-id`]})),{successLabel:`Updated`})}};function Qt(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $t={command:`get <trusted-domain-id>`,describe:`Retrieves details for a specific trusted domain pattern including its pattern value, whether it uses regex matching, and which detection types it affects.`,builder:Qt,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings trusted-domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/trusted_domains/${n[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(n[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(n[`trusted-domain-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.settings.trustedDomains.get({account_id:l,trusted_domain_id:n[`trusted-domain-id`]})),{successLabel:`Loaded`})}};function en(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`is-recent`,{type:`boolean`,description:`Filter to show only recently registered domains that are trusted to prevent triggering Suspicious or Malicious dispositions.`}).option(`is-similarity`,{type:`boolean`,description:`Filter to show only proximity domains (partner or approved domains with similar spelling to connected domains) that prevent Spoof dispositions.`}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`Returns a paginated list of trusted domain patterns. Trusted domains prevent false positives for recently registered domains and lookalike domain detections. Patterns can use regular expressions for flexible matching.`,builder:m(en),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search,order:n.order,direction:n.direction,is_recent:n[`is-recent`],is_similarity:n[`is-similarity`],pattern:n.pattern};if(n.dryRun){a({command:`cf email-security settings trusted-domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.settings.trustedDomains.list({account_id:u,...c})),{successLabel:`Loaded`})}},tn={command:`trusted-domains`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(qt).command(Yt).command(Zt).command($t).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function nn(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 rn={command:`batch`,describe:`Sends a batch of URL ignore patterns API calls to execute together.`,builder:nn,handler:async l=>{if(l.dryRun){a({command:`cf email-security settings url-ignore-patterns batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/url_ignore_patterns/batch`,pathParams:{},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await r(l),d=l.local?s:await t();if(l.accountId=d,l.body){let e=c(l.body);i(await o(`Creating`,async()=>u.emailSecurity.settings.urlIgnorePatterns.batch({...e,account_id:d})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/email-security/settings/url_ignore_patterns/batch`)),{successLabel:`Created`})}};function an(e){return e.option(`comments`,{type:`string`,description:`Optional note describing the reason for the ignore pattern.`}).option(`pattern`,{type:`string`,description:`Regular expression identifying URLs to exempt from rewriting.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Creates a URL ignore pattern that exempts matching URLs from rewriting.`})}const on={command:`create`,describe:`Creates a new URL rewrite ignore pattern. URLs matching this pattern will not be rewritten.`,builder:an,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings url-ignore-patterns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/url_ignore_patterns`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),pattern:u(n.pattern,`pattern`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.emailSecurity.settings.urlIgnorePatterns.create({body:e,account_id:p})),{successLabel:`Created`});return}n.pattern===void 0&&(n.pattern=await f(`pattern`,`Regular expression identifying URLs to exempt from rewriting.`));let m=l({comments:u(n.comments,`comments`,`text`),pattern:u(n.pattern,`pattern`,`text`)});i(await o(`Creating`,async()=>d.emailSecurity.settings.urlIgnorePatterns.create({body:m,account_id:p})),{successLabel:`Created`})}};function sn(e){return e.positional(`pattern-id`,{type:`string`,description:`URL ignore pattern 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 cn={command:`delete <pattern-id>`,describe:`Removes a URL rewrite ignore pattern. After deletion, URLs matching this pattern will be rewritten again.`,builder:sn,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings url-ignore-patterns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/url_ignore_patterns/${n[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(n[`pattern-id`]))}`,pathParams:{"pattern-id":String(n[`pattern-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
|
|
12
|
+
`);return}i(await o(`Deleting`,async()=>c.emailSecurity.settings.urlIgnorePatterns.delete({account_id:l,pattern_id:n[`pattern-id`]})),{successLabel:`Deleted`})}};function ln(e){return e.positional(`pattern-id`,{type:`string`,description:`URL ignore pattern identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`Optional note describing the reason for the ignore pattern.`}).option(`pattern`,{type:`string`,description:`Regular expression identifying URLs to exempt from rewriting.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Updates a URL rewrite ignore pattern; modifies only the provided fields.`})}const un={command:`edit <pattern-id>`,describe:`Updates an existing URL rewrite ignore pattern. Only provided fields will be modified.`,builder:ln,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings url-ignore-patterns edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/url_ignore_patterns/${n[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(n[`pattern-id`]))}`,pathParams:{"pattern-id":String(n[`pattern-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({comments:u(n.comments,`comments`,`text`),pattern:u(n.pattern,`pattern`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.emailSecurity.settings.urlIgnorePatterns.edit({body:e,account_id:f,pattern_id:n[`pattern-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(n.comments,`comments`,`text`),pattern:u(n.pattern,`pattern`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.settings.urlIgnorePatterns.edit({body:p,account_id:f,pattern_id:n[`pattern-id`]})),{successLabel:`Updated`})}};function dn(e){return e.positional(`pattern-id`,{type:`string`,description:`URL ignore pattern identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fn={command:`get <pattern-id>`,describe:`Returns a single URL rewrite ignore pattern by its identifier.`,builder:dn,handler:async n=>{if(n.dryRun){a({command:`cf email-security settings url-ignore-patterns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/url_ignore_patterns/${n[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(n[`pattern-id`]))}`,pathParams:{"pattern-id":String(n[`pattern-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.settings.urlIgnorePatterns.get({account_id:l,pattern_id:n[`pattern-id`]})),{successLabel:`Loaded`})}};function pn(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const mn={command:`list`,describe:`Returns a paginated list of URL rewrite ignore patterns for the account. URLs matching these patterns will not be rewritten.`,builder:pn,handler:async n=>{let c={page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf email-security settings url-ignore-patterns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/settings/url_ignore_patterns`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.settings.urlIgnorePatterns.list({account_id:u,...c})),{successLabel:`Loaded`})}},hn={command:`url-ignore-patterns`,describe:`Operations for settings.url-ignore-patterns`,builder:e=>e.command(rn).command(on).command(cn).command(un).command(fn).command(mn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},gn={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(we).command(Ke).command(rt).command(Ct).command(Pt).command(Gt).command(tn).command(hn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _n(e){return e.option(`start`,{type:`string`,description:"The beginning of the search date range. Defaults to `now - 30 days`."}).option(`end`,{type:`string`,description:"The end of the search date range. Defaults to `now`."}).option(`type`,{type:`string`,description:`Type`,choices:[`TEAM`,`USER`]}).option(`submission-id`,{type:`string`,description:`Submission ID`}).option(`original-disposition`,{type:`string`,description:`Original disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`requested-disposition`,{type:`string`,description:`Requested disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`outcome-disposition`,{type:`string`,description:`Outcome disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`status`,{type:`string`,description:`Status`}).option(`query`,{type:`string`,description:`Query`}).option(`escalated-from-user`,{type:`boolean`,description:`When true, return only submissions that were escalated by an end user (vs. by the security team). When false, return only submissions that were not escalated by an end user. When omitted, no filter is applied.`}).option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const vn={command:`list`,describe:`Returns information for submissions made to reclassify emails. Shows the status, outcome, and disposition changes for reclassification requests made by users or the security team. Useful for tracking false positive/negative reports.`,builder:m(_n),handler:async n=>{let c={start:n.start,end:n.end,type:n.type,submission_id:n[`submission-id`],original_disposition:n[`original-disposition`],requested_disposition:n[`requested-disposition`],outcome_disposition:n[`outcome-disposition`],status:n.status,query:n.query,escalated_from_user:n[`escalated-from-user`],page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf email-security submissions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/email-security/submissions`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.submissions.list({account_id:u,...c})),{successLabel:`Loaded`})}},yn={command:`submissions`,describe:`User and admin email submissions for classification review`,builder:e=>e.command(vn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},bn={command:`email-security`,describe:`Cloud email security (Area 1) — investigate threats, manage allow/block policies, and detect phishing`,builder:e=>e.command(le).command(pe).command(gn).command(yn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{bn as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{D as e,O as t,w as n}from"./oauth-DBJ5GSFk.mjs";import{i as r,n as i}from"./auth-CZ0E51rF.mjs";import{t as a}from"./output-B6fBFRqe.mjs";import{n as o,t as s}from"./progress-O88q63Bk.mjs";import{t as c}from"./local-C6TLPAT6.mjs";import{n as l,t as u}from"./body-parser-BO6mfo_W.mjs";import{n as d}from"./input-validation-BwUR9z8e.mjs";import{r as f,t as p}from"./prompt-DTAWiEm2.mjs";import{t as m}from"./cli-types-CFw6Xygp.mjs";function h(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`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:h,handler:async e=>{if(e.dryRun){o({command:`cf email-sending limits get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/email/sending/limits`,pathParams:{},bodyKind:`none`});return}let r=await i(e),l=e.local?c:await n();e.accountId=l,a(await s(`Loading`,async()=>r.emailSending.limits.get({account_id:l})),{successLabel:`Loaded`})}},_={command:`limits`,describe:`Operations for limits`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(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 y={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:v,handler:async e=>{if(e.dryRun){o({command:`cf email-sending send-raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/email/sending/send_raw`,pathParams:{},bodyKind:`json`,body:e.body===void 0?u({from:d(e.from,`from`,`text`),mime_message:d(e[`mime-message`],`mime-message`,`text`),recipients:e.recipients}):l(e.body)});return}let r=await i(e),p=e.local?c:await n();if(e.accountId=p,e.body){let t=l(e.body);a(await s(`Creating`,async()=>r.emailSending.sendRaw({...t,account_id:p})),{successLabel:`Created`});return}if(e.from===void 0&&(e.from=await f(`from`,`Sender email address.`)),e[`mime-message`]===void 0&&(e[`mime-message`]=await f(`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=u({from:d(e.from,`from`,`text`),mime_message:d(e[`mime-message`],`mime-message`,`text`),recipients:e.recipients});a(await s(`Creating`,async()=>r.emailSending.sendRaw({...m,account_id:p})),{successLabel:`Created`})}};function b(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 x={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:b,handler:async e=>{if(e.dryRun){o({command:`cf email-sending send`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/email/sending/send`,pathParams:{},bodyKind:`json`,body:e.body===void 0?u({bcc:{address:d(e[`bcc-address`],`bcc-address`,`text`),name:d(e[`bcc-name`],`bcc-name`,`text`)},cc:{address:d(e[`cc-address`],`cc-address`,`text`),name:d(e[`cc-name`],`cc-name`,`text`)},from:{address:d(e[`from-address`],`from-address`,`text`),name:d(e[`from-name`],`from-name`,`text`)},html:d(e.html,`html`,`text`),reply_to:{address:d(e[`reply-to-address`],`reply-to-address`,`text`),name:d(e[`reply-to-name`],`reply-to-name`,`text`)},subject:d(e.subject,`subject`,`text`),text:d(e.text,`text`,`text`),to:{address:d(e[`to-address`],`to-address`,`text`),name:d(e[`to-name`],`to-name`,`text`)}}):l(e.body)});return}let r=await i(e),p=e.local?c:await n();if(e.accountId=p,e.body){let t=l(e.body);a(await s(`Creating`,async()=>r.emailSending.send({...t,account_id:p})),{successLabel:`Created`});return}e.subject===void 0&&(e.subject=await f(`subject`,`Email subject line.`));let m=u({bcc:{address:d(e[`bcc-address`],`bcc-address`,`text`),name:d(e[`bcc-name`],`bcc-name`,`text`)},cc:{address:d(e[`cc-address`],`cc-address`,`text`),name:d(e[`cc-name`],`cc-name`,`text`)},from:{address:d(e[`from-address`],`from-address`,`text`),name:d(e[`from-name`],`from-name`,`text`)},html:d(e.html,`html`,`text`),reply_to:{address:d(e[`reply-to-address`],`reply-to-address`,`text`),name:d(e[`reply-to-name`],`reply-to-name`,`text`)},subject:d(e.subject,`subject`,`text`),text:d(e.text,`text`,`text`),to:{address:d(e[`to-address`],`to-address`,`text`),name:d(e[`to-name`],`to-name`,`text`)}});a(await s(`Creating`,async()=>r.emailSending.send({...m,account_id:p})),{successLabel:`Created`})}};function S(e){return e.option(`name`,{type:`string`,description:"The domain name within the zone. A wildcard is allowed only as the complete leftmost label (`*.example.com`) and requires the account wildcard Email Sending entitlement."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`create`,describe:"Creates a new 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. A leftmost wildcard such as `*.example.com` is accepted only for accounts with wildcard Email Sending enabled. Wildcard senders share the base domain's DKIM signing identity and `cf-bounce.<base>` return path.",builder:S,handler:async t=>{if(t.dryRun){o({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?u({name:d(t.name,`name`,`text`)}):l(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=l(t.body);a(await s(`Creating`,async()=>n.emailSending.subdomains.create({...e,zone_id:r})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await f(`name`,"The domain name within the zone. A wildcard is allowed only as the complete leftmost label (`*.example.com`) and requires the account wildcard Email Sending entitlement."));let c=u({name:d(t.name,`name`,`text`)});a(await s(`Creating`,async()=>n.emailSending.subdomains.create({...c,zone_id:r})),{successLabel:`Created`})}};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}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const T={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:w,handler:async t=>{if(t.dryRun){o({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 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.
|
|
3
|
+
`);return}a(await s(`Deleting`,async()=>n.emailSending.subdomains.delete({zone_id:r,subdomain_id:t[`subdomain-id`]})),{successLabel:`Deleted`})}};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:`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:E,handler:async t=>{if(t.dryRun){o({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 i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,a(await s(`Creating`,async()=>n.emailSending.subdomains.dns.fix({zone_id:r,subdomain_id:t[`subdomain-id`]})),{successLabel:`Created`})}};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-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. For wildcard sending rows, each call also rechecks the governing organizational-domain DMARC policy and reports policy drift that DNS Fix cannot repair.`,builder:O,handler:async t=>{if(t.dryRun){o({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 i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,a(await s(`Loading`,async()=>n.emailSending.subdomains.dns.getStatus({zone_id:r,subdomain_id:t[`subdomain-id`]})),{successLabel:`Loaded`})}};function A(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 j={command:`get <subdomain-id>`,describe:`Returns the expected DNS records for a sending subdomain.`,builder:A,handler:async t=>{if(t.dryRun){o({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 i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,a(await s(`Loading`,async()=>n.emailSending.subdomains.dns.get({zone_id:r,subdomain_id:t[`subdomain-id`]})),{successLabel:`Loaded`})}},M={command:`dns`,describe:`Operations for subdomains.dns`,builder:e=>e.command(D).command(j).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(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 P={command:`get <subdomain-id>`,describe:`Gets information for a specific sending subdomain.`,builder:N,handler:async t=>{if(t.dryRun){o({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 i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,a(await s(`Loading`,async()=>n.emailSending.subdomains.get({zone_id:r,subdomain_id:t[`subdomain-id`]})),{successLabel:`Loaded`})}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`list`,describe:`Lists all sending-enabled subdomains for the zone.`,builder:F,handler:async t=>{if(t.dryRun){o({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 i(t),r=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=r,a(await s(`Loading`,async()=>n.emailSending.subdomains.list({zone_id:r})),{successLabel:`Loaded`})}};function I(e){return e.option(`name`,{type:`string`,description:"The domain name within the zone. A wildcard is allowed only as the complete leftmost label (`*.example.com`) and requires the account wildcard Email Sending entitlement."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`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. A leftmost wildcard requires wildcard Email Sending to be enabled for the account and previews base-scoped DKIM and return-path records.`,builder:I,handler:async t=>{if(t.dryRun){o({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?u({name:d(t.name,`name`,`text`)}):l(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=l(t.body);a(await s(`Loading`,async()=>n.emailSending.subdomains.preview({...e,zone_id:r})),{successLabel:`Loaded`});return}t.name===void 0&&(t.name=await f(`name`,"The domain name within the zone. A wildcard is allowed only as the complete leftmost label (`*.example.com`) and requires the account wildcard Email Sending entitlement."));let c=u({name:d(t.name,`name`,`text`)});a(await s(`Loading`,async()=>n.emailSending.subdomains.preview({...c,zone_id:r})),{successLabel:`Loaded`})}};function R(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`start-at`,{type:`string`,description:`Start at`,demandOption:!0}).option(`end-at`,{type:`string`,description:`End at`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`get-complaints <subdomain-id>`,describe:`Returns the matched complaint count for a sending subdomain in a half-open time window of up to seven days.`,builder:R,handler:async t=>{let n={start_at:t[`start-at`],end_at:t[`end-at`]};if(t.dryRun){o({command:`cf email-sending subdomains reputation get-complaints`,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`]))}/reputation/complaints`,pathParams:{"subdomain-id":String(t[`subdomain-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},query:n,bodyKind:`none`});return}let r=await i(t),c=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=c,a(await s(`Loading`,async()=>r.emailSending.subdomains.reputation.getComplaints({zone_id:c,subdomain_id:t[`subdomain-id`],...n})),{successLabel:`Loaded`})}},B={command:`reputation`,describe:`Operations for subdomains.reputation`,builder:e=>e.command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(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 H={command:`update <subdomain-id>`,describe:`Updates the activity-log preview preference for a sending subdomain.`,builder:V,handler:async t=>{if(t.dryRun){o({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?u({preview_enabled:t[`preview-enabled`]}):l(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=l(t.body);a(await s(`Updating`,async()=>n.emailSending.subdomains.update({...e,zone_id:r,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 c=u({preview_enabled:t[`preview-enabled`]});a(await s(`Updating`,async()=>n.emailSending.subdomains.update({...c,zone_id:r,subdomain_id:t[`subdomain-id`]})),{successLabel:`Updated`})}},U={command:`subdomains`,describe:`Operations for subdomains`,builder:e=>e.command(C).command(T).command(P).command(ee).command(L).command(H).command(M).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.option(`email`,{type:`string`,description:`The email field`}).option(`expires-at`,{type:`string`,description:`The expires_at field`}).option(`note`,{type:`string`,description:`The note field`}).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 G={command:`create`,describe:`Creates an account-wide suppression. If a mutable legacy zone-linked row already exists, it is promoted without changing its identifier.`,builder:W,handler:async e=>{if(e.dryRun){o({command:`cf email-sending suppressions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/email/sending/suppressions`,pathParams:{},bodyKind:`json`,body:e.body===void 0?u({email:d(e.email,`email`,`text`),expires_at:d(e[`expires-at`],`expires-at`,`text`),note:d(e.note,`note`,`text`)}):l(e.body)});return}let r=await i(e),p=e.local?c:await n();if(e.accountId=p,e.body){let t=l(e.body);a(await s(`Creating`,async()=>r.emailSending.suppressions.create({...t,account_id:p})),{successLabel:`Created`});return}e.email===void 0&&(e.email=await f(`email`,`The email field`));let m=u({email:d(e.email,`email`,`text`),expires_at:d(e[`expires-at`],`expires-at`,`text`),note:d(e.note,`note`,`text`)});a(await s(`Creating`,async()=>r.emailSending.suppressions.create({...m,account_id:p})),{successLabel:`Created`})}};function K(e){return e.positional(`suppression-id`,{type:`string`,description:`Suppression 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 q={command:`delete <suppression-id>`,describe:`Deletes the suppression, its note, and every legacy internal zone membership, allowing future delivery attempts to the address.`,builder:K,handler:async e=>{if(e.dryRun){o({command:`cf email-sending suppressions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/email/sending/suppressions/${e[`suppression-id`]==null?`<suppression-id>`:encodeURIComponent(String(e[`suppression-id`]))}`,pathParams:{"suppression-id":String(e[`suppression-id`]??``)},bodyKind:`none`});return}let r=await i(e),l=e.local?c:await n();if(e.accountId=l,!await p({force:!!e.force,message:`This operation removes an Email Sending suppression and may allow email delivery to resume for the address.`})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}a(await s(`Deleting`,async()=>r.emailSending.suppressions.delete({account_id:l,suppression_id:e[`suppression-id`]})),{successLabel:`Deleted`})}};function J(e){return e.positional(`suppression-id`,{type:`string`,description:`Suppression ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`get <suppression-id>`,describe:`Gets an Email Sending suppression owned by the account.`,builder:J,handler:async e=>{if(e.dryRun){o({command:`cf email-sending suppressions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/email/sending/suppressions/${e[`suppression-id`]==null?`<suppression-id>`:encodeURIComponent(String(e[`suppression-id`]))}`,pathParams:{"suppression-id":String(e[`suppression-id`]??``)},bodyKind:`none`});return}let r=await i(e),l=e.local?c:await n();e.accountId=l,a(await s(`Loading`,async()=>r.emailSending.suppressions.get({account_id:l,suppression_id:e[`suppression-id`]})),{successLabel:`Loaded`})}};function X(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 Z={command:`import`,describe:`Imports up to 1,000 account-level Email Sending suppressions in one request.`,builder:X,handler:async e=>{if(e.dryRun){o({command:`cf email-sending suppressions import`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/email/sending/suppressions/bulk`,pathParams:{},bodyKind:`json`,body:e.body===void 0?void 0:l(e.body)});return}let u=await i(e),d=e.local?c:await n();if(e.accountId=d,e.body){let t=l(e.body);a(await s(`Creating`,async()=>u.emailSending.suppressions.import({...t,account_id:d})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${d}/email/sending/suppressions/bulk`)),{successLabel:`Created`})}};function Q(e){return e.option(`per-page`,{type:`number`,description:`Per page`}).option(`cursor`,{type:`string`,description:"Opaque pagination cursor returned as `result_info.next_cursor`. It carries the filters that produced it."}).option(`email`,{type:`string`,description:`Exact email-address filter.`}).option(`search`,{type:`string`,description:"A complete address is an exact match; a value ending in `@` matches that username across every domain. Prefix searches may return short intermediate pages while the bounded account scan advances."}).option(`reason`,{type:`string`,description:`Reason`,choices:[`manual`,`complaint`,`hard_bounce`,`soft_bounce`,`policy`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`Lists every active Email Sending suppression owned by the account, including legacy rows with internal zone memberships.`,builder:m(Q),handler:async e=>{let r={per_page:e[`per-page`],cursor:e.cursor,email:e.email,search:e.search,reason:e.reason};if(e.dryRun){o({command:`cf email-sending suppressions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await t()??`<account-id>`}/email/sending/suppressions`,pathParams:{},query:r,bodyKind:`none`});return}let l=await i(e),u=e.local?c:await n();e.accountId=u,a(await s(`Loading`,async()=>l.emailSending.suppressions.list({account_id:u,...r})),{successLabel:`Loaded`})}},te={command:`suppressions`,describe:`Operations for suppressions`,builder:e=>e.command(G).command(q).command(Y).command(Z).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ne={command:`email-sending`,describe:`Send emails and manage sending subdomains`,builder:e=>e.command(x).command(y).command(_).command(U).command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ne as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`);return}
|
|
4
|
-
`);return}
|
|
2
|
+
import{D as e}from"./oauth-DBJ5GSFk.mjs";import{n as t}from"./auth-CZ0E51rF.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-O88q63Bk.mjs";import{n as a,t as o}from"./body-parser-BO6mfo_W.mjs";import{n as s}from"./input-validation-BwUR9z8e.mjs";import{t as c}from"./prompt-DTAWiEm2.mjs";import{t as l}from"./cli-types-CFw6Xygp.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 a=>{let o={id:a.id};if(a.dryRun){r({command:`cf filters bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),l=await e({zone:a.zone},s,{quiet:a.quiet});if(a.zoneId=l,!await c({force:!!a.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}n(await i(`Deleting`,async()=>s.filters.bulkDelete({zone_id:l,...o})),{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 o=>{if(o.dryRun){r({command:`cf filters bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`json`,body:o.body===void 0?void 0:a(o.body)});return}let s=await t(o),c=await e({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,o.body){let e=a(o.body);n(await i(`Updating`,async()=>s.filters.bulkUpdate({body:e,zone_id:c})),{successLabel:`Updated`});return}if(o.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 o=>{if(o.dryRun){r({command:`cf filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`json`,body:o.body===void 0?void 0:a(o.body)});return}let s=await t(o),c=await e({zone:o.zone},s,{quiet:o.quiet});if(o.zoneId=c,o.body){let e=a(o.body);n(await i(`Creating`,async()=>s.filters.create({body:e,zone_id:c})),{successLabel:`Created`});return}if(o.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 a=>{if(a.dryRun){r({command:`cf filters delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/filters/${a[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(a[`filter-id`]))}`,pathParams:{"filter-id":String(a[`filter-id`]??``),"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});if(a.zoneId=s,!await c({force:!!a.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}n(await i(`Deleting`,async()=>o.filters.delete({zone_id:s,filter_id:a[`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 a=>{if(a.dryRun){r({command:`cf filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/filters/${a[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(a[`filter-id`]))}`,pathParams:{"filter-id":String(a[`filter-id`]??``),"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.filters.get({zone_id:s,filter_id:a[`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 a=>{let o={paused:a.paused,expression:a.expression,description:a.description,ref:a.ref,page:a.page,per_page:a[`per-page`],id:a.id};if(a.dryRun){r({command:`cf filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.filters.list({zone_id:c,...o})),{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){r({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?o({description:s(c.description,`description`,`text`),expression:s(c.expression,`expression`,`text`),paused:c.paused,ref:s(c.ref,`ref`,`text`)}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Updating`,async()=>l.filters.update({body:e,zone_id:u,filter_id:c[`filter-id`]})),{successLabel:`Updated`});return}let d=o({description:s(c.description,`description`,`text`),expression:s(c.expression,`expression`,`text`),paused:c.paused,ref:s(c.ref,`ref`,`text`)});n(await i(`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};
|