cf 0.2.0 → 0.3.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.
Files changed (262) hide show
  1. package/dist/_meta/agent-context.json +63 -62
  2. package/dist/_meta/commands.json +12365 -9690
  3. package/dist/_meta/schemas.json +19206 -15404
  4. package/dist/abuse-reports-dMIfUJ8v.mjs +8 -0
  5. package/dist/accounts-Kx1epdA1.mjs +22 -0
  6. package/dist/acm-Utu252kC.mjs +3 -0
  7. package/dist/addressing-CBq7Z7Vq.mjs +12 -0
  8. package/dist/{agent-context-D26woB9J.mjs → agent-context-BGTU299M.mjs} +1 -1
  9. package/dist/ai-DOOKLPkG.mjs +2 -0
  10. package/dist/ai-gateway-Cj1T3avF.mjs +8 -0
  11. package/dist/ai-search-CQF_Sn7d.mjs +7 -0
  12. package/dist/ai_gateway-C3fH22C0.mjs +4 -0
  13. package/dist/alerting-CqmEIaKn.mjs +6 -0
  14. package/dist/analytics-Dv-X8x7D.mjs +20 -0
  15. package/dist/analytics_engine-DdXVR8z2.mjs +2 -0
  16. package/dist/api-gateway-CNv0IHTU.mjs +33 -0
  17. package/dist/argo-CX_A4kcn.mjs +2 -0
  18. package/dist/audit-logs-BfBf3oo-.mjs +2 -0
  19. package/dist/auth-SyWhMmPu.mjs +6 -0
  20. package/dist/auth-ffdf9yR0.mjs +135 -0
  21. package/dist/autorag-BuGhGTeZ.mjs +2 -0
  22. package/dist/billing-PoG81XaQ.mjs +2 -0
  23. package/dist/body-parser-DKa8Ipg1.mjs +2 -0
  24. package/dist/bot-management-CFvtVx62.mjs +5 -0
  25. package/dist/botnet-feed-B-M4Yu0W.mjs +3 -0
  26. package/dist/brand-protection-D05Eg-_6.mjs +3 -0
  27. package/dist/browser-rendering-xu8F_Rrv.mjs +4 -0
  28. package/dist/{build-5jmmOZhm.mjs → build-DYkGW4dh.mjs} +1 -1
  29. package/dist/cache-DsoW6Xwv.mjs +5 -0
  30. package/dist/calls-CZbO7TyR.mjs +4 -0
  31. package/dist/certificate-authorities-D2yr7_3t.mjs +2 -0
  32. package/dist/cli-types-CRIDdDw3.mjs +2 -0
  33. package/dist/client-certificates-MJcDsTId.mjs +3 -0
  34. package/dist/cloud-connector-DWOrN2eM.mjs +2 -0
  35. package/dist/cloudforce-one-2Bhz8YdW.mjs +21 -0
  36. package/dist/{completions-BKrxcfhN.mjs → completions-BwRpZQVn.mjs} +1 -1
  37. package/dist/connectivity-BX8C7tvK.mjs +3 -0
  38. package/dist/content-scanning-r6uzMO1r.mjs +4 -0
  39. package/dist/context-DGlHRGWM.mjs +2 -0
  40. package/dist/custom-certificates-aAiEguR7.mjs +5 -0
  41. package/dist/custom-hostnames-AG5yBHIi.mjs +5 -0
  42. package/dist/custom-nameservers-D1DtlRue.mjs +3 -0
  43. package/dist/custom-pages-DQCi2plU.mjs +4 -0
  44. package/dist/d1-DbnYhw45.mjs +4 -0
  45. package/dist/data-security-D_EtYBfo.mjs +6 -0
  46. package/dist/dcv-delegation-CHspSzTI.mjs +2 -0
  47. package/dist/{deploy-DbkiIzUr.mjs → deploy-CQial3kN.mjs} +1 -1
  48. package/dist/{dev-C6iSuQZm.mjs → dev-B38LfCTl.mjs} +1 -1
  49. package/dist/diagnostics-BJQGjVJn.mjs +3 -0
  50. package/dist/dispatch-namespaces-DmHvoBOg.mjs +7 -0
  51. package/dist/{dist-CnSubA1Z.mjs → dist-AIcZFk0U.mjs} +7 -7
  52. package/dist/dns-VMhQSr5n.mjs +29 -0
  53. package/dist/dns-firewall-B4DVXFBQ.mjs +57 -0
  54. package/dist/durable-objects-CTboySEo.mjs +2 -0
  55. package/dist/email-routing-tIR2SFu-.mjs +10 -0
  56. package/dist/email-security-Ca1id3rZ.mjs +8 -0
  57. package/dist/email-sending-DwWKc5jC.mjs +3 -0
  58. package/dist/filters-A4dg_a68.mjs +4 -0
  59. package/dist/firewall-DWPQgYd9.mjs +11 -0
  60. package/dist/fraud-BMkSsJGU.mjs +20 -0
  61. package/dist/google-tag-gateway-BGD49nRC.mjs +2 -0
  62. package/dist/healthchecks-CtIfrFql.mjs +4 -0
  63. package/dist/hostnames-BiomxukN.mjs +3 -0
  64. package/dist/hyperdrive-Da104VaQ.mjs +18 -0
  65. package/dist/iam-BIGKo0WW.mjs +6 -0
  66. package/dist/images-BO8FbDAa.mjs +5 -0
  67. package/dist/index.mjs +1 -1
  68. package/dist/intel-CY6_79v8.mjs +3 -0
  69. package/dist/{ips-B8fwxKZD.mjs → ips-K4bzaGqd.mjs} +1 -1
  70. package/dist/keyless-certificates-CZC-L8gM.mjs +3 -0
  71. package/dist/kv-8o27w_pY.mjs +5 -0
  72. package/dist/leaked-credential-checks-qLzRyu85.mjs +3 -0
  73. package/dist/load-balancers-DtG8nj25.mjs +6 -0
  74. package/dist/logpush-4L0njy1d.mjs +4 -0
  75. package/dist/logs-B_Yp95hv.mjs +3 -0
  76. package/dist/magic-cloud-networking-CSOM3EM-.mjs +5 -0
  77. package/dist/magic-network-monitoring-BnwvM4-I.mjs +4 -0
  78. package/dist/magic-transit-CXDyvhxq.mjs +90 -0
  79. package/dist/managed-transforms-D15yVbZx.mjs +3 -0
  80. package/dist/mtls-certificates-D8k0AXWK.mjs +3 -0
  81. package/dist/network-interconnects-rrr7red3.mjs +36 -0
  82. package/dist/observability-DWvpqnQJ.mjs +4 -0
  83. package/dist/organizations-T77D50Sq.mjs +41 -0
  84. package/dist/origin-ca-certificates-DXIvD8H5.mjs +3 -0
  85. package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +2 -0
  86. package/dist/origin-tls-client-auth-CaVW1Ztp.mjs +4 -0
  87. package/dist/output-BJFNwj7b.mjs +2 -0
  88. package/dist/page-rules-CjZPTMQX.mjs +18 -0
  89. package/dist/page-shield-D5RRNJCY.mjs +37 -0
  90. package/dist/pages-CWJtJnL0.mjs +11 -0
  91. package/dist/pipelines-B0L_7j9e.mjs +6 -0
  92. package/dist/{progress-CjcQ6ato.mjs → progress-CrCGTq7N.mjs} +1 -1
  93. package/dist/queues-CN6DPhRR.mjs +6 -0
  94. package/dist/r2-DQIcyRtA.mjs +21 -0
  95. package/dist/r2-data-catalog-Bbo93TJx.mjs +14 -0
  96. package/dist/radar-Bxb0WX8V.mjs +2 -0
  97. package/dist/rate-limits-DcrQV6Ar.mjs +5 -0
  98. package/dist/raw-fetch-Dlccg0Tr.mjs +2 -0
  99. package/dist/realtime-kit-CaquuVOE.mjs +18 -0
  100. package/dist/registrar-Ko-xZemf.mjs +46 -0
  101. package/dist/request-tracers-DOW_reTJ.mjs +2 -0
  102. package/dist/{resolve-BuJRWSk0.mjs → resolve-4-OSeHlK.mjs} +1 -1
  103. package/dist/resource-sharing-D7TX0JV0.mjs +5 -0
  104. package/dist/resource-tagging-C3qtLzCz.mjs +16 -0
  105. package/dist/rules-BXRADHL5.mjs +4 -0
  106. package/dist/rulesets-CBgpeSvJ.mjs +8 -0
  107. package/dist/rum-BjPptTUP.mjs +4 -0
  108. package/dist/{schema-CHBfkARI.mjs → schema-D16TgWBg.mjs} +1 -1
  109. package/dist/schema-validation-Dgv_opM3.mjs +24 -0
  110. package/dist/scim-DdSEr4kZ.mjs +3 -0
  111. package/dist/secrets-store-7BfyvJLb.mjs +25 -0
  112. package/dist/security-center-DAy6AKtT.mjs +2 -0
  113. package/dist/security-txt-xAMb7K6Y.mjs +3 -0
  114. package/dist/session-COHHdS7A.mjs +5 -0
  115. package/dist/{shared-DEzmTsEC.mjs → shared-AGtpXwwL.mjs} +1 -1
  116. package/dist/smart-shield-TeWZFnH2.mjs +3 -0
  117. package/dist/snippets-CCSsCXVs.mjs +4 -0
  118. package/dist/{spawn-13QQ0IwO.mjs → spawn-DcppKGI5.mjs} +1 -1
  119. package/dist/spectrum-CTTZID8u.mjs +63 -0
  120. package/dist/speed-CuzTE0AL.mjs +4 -0
  121. package/dist/{src-B9cKsgsg.mjs → src-BW6vfAwE.mjs} +10 -10
  122. package/dist/ssl-BWA2LdwC.mjs +15 -0
  123. package/dist/stream-GFsIZ-pP.mjs +14 -0
  124. package/dist/tenants-Bd7NGQ_m.mjs +2 -0
  125. package/dist/token-validation-DAgtFOvs.mjs +10 -0
  126. package/dist/{tools-B7QiNu-d.mjs → tools-DXQmfFuE.mjs} +1 -1
  127. package/dist/turnstile-cfdaO4ca.mjs +23 -0
  128. package/dist/{ui-BXjU1dX1.mjs → ui-D4KtlMh9.mjs} +1 -1
  129. package/dist/url-normalization-B5RN4nLD.mjs +3 -0
  130. package/dist/url-scanner-BrZ1L9OC.mjs +2 -0
  131. package/dist/user-CAo-yCJA.mjs +10 -0
  132. package/dist/vectorize-C7_oQlaI.mjs +4 -0
  133. package/dist/{versions-DzyrlUAi.mjs → versions-CUwWJWmy.mjs} +1 -1
  134. package/dist/waiting-rooms-Dln5ICg5.mjs +11 -0
  135. package/dist/web3-HQJRm38W.mjs +4 -0
  136. package/dist/workers-Dg7ddG2Q.mjs +18 -0
  137. package/dist/workers-builds-AVfx8IyL.mjs +7 -0
  138. package/dist/workflows-VquuSh2J.mjs +4 -0
  139. package/dist/zaraz-xYSWIV4P.mjs +2 -0
  140. package/dist/zero-trust-CP96wnSh.mjs +118 -0
  141. package/dist/zones-BSgmZ9WC.mjs +21 -0
  142. package/package.json +4 -3
  143. package/dist/abuse-reports-KtfZhi6j.mjs +0 -8
  144. package/dist/accounts-BopMfODC.mjs +0 -21
  145. package/dist/acm-BT4vlnEJ.mjs +0 -3
  146. package/dist/addressing-B3uFxHst.mjs +0 -13
  147. package/dist/ai-DWHqwMap.mjs +0 -2
  148. package/dist/ai-gateway-CbKEO-3o.mjs +0 -8
  149. package/dist/ai-search-VnOQ5n--.mjs +0 -7
  150. package/dist/alerting-BmmgIlIO.mjs +0 -6
  151. package/dist/analytics-isY03taL.mjs +0 -20
  152. package/dist/api-gateway-DXurEbA-.mjs +0 -33
  153. package/dist/argo-B02BL_hp.mjs +0 -2
  154. package/dist/audit-logs-DcgR9xUc.mjs +0 -2
  155. package/dist/auth-CQcAgnOy.mjs +0 -135
  156. package/dist/auth-DenWm_X0.mjs +0 -6
  157. package/dist/autorag-CmrwnGVj.mjs +0 -2
  158. package/dist/billing-CaW1ZAB1.mjs +0 -2
  159. package/dist/body-parser-Br-BoYk-.mjs +0 -2
  160. package/dist/bot-management-CeBsFx68.mjs +0 -5
  161. package/dist/botnet-feed-B396vQeQ.mjs +0 -3
  162. package/dist/brand-protection-D4V1v5Kl.mjs +0 -3
  163. package/dist/browser-rendering-GF7rNtKI.mjs +0 -4
  164. package/dist/builds-C_ySULja.mjs +0 -2
  165. package/dist/cache-DmXizSMi.mjs +0 -5
  166. package/dist/calls-x4KQpTB4.mjs +0 -4
  167. package/dist/certificate-authorities-hC0SG-Ga.mjs +0 -2
  168. package/dist/client-certificates-BGVsDyeJ.mjs +0 -3
  169. package/dist/cloud-connector-BClQpEzI.mjs +0 -2
  170. package/dist/cloudforce-one-BfhFrO6M.mjs +0 -21
  171. package/dist/connectivity-G0NP6LtW.mjs +0 -3
  172. package/dist/content-scanning-DEtPJ7aF.mjs +0 -4
  173. package/dist/context-CC0Rhkhy.mjs +0 -2
  174. package/dist/custom-certificates-rJXFpUWu.mjs +0 -5
  175. package/dist/custom-hostnames-Be5mgLeF.mjs +0 -5
  176. package/dist/custom-nameservers-CoFdy6hD.mjs +0 -3
  177. package/dist/custom-pages-D-oErw57.mjs +0 -4
  178. package/dist/d1-C95ckPKI.mjs +0 -3
  179. package/dist/dcv-delegation-CWSkbGuc.mjs +0 -2
  180. package/dist/diagnostics-DEEhPnXj.mjs +0 -3
  181. package/dist/dispatch-namespaces-BzXeV7PH.mjs +0 -7
  182. package/dist/dns-firewall-BQXD_NxG.mjs +0 -57
  183. package/dist/dns-qW-3TZOT.mjs +0 -29
  184. package/dist/durable-objects-CgWFYEJJ.mjs +0 -2
  185. package/dist/email-routing-tdNJaCpJ.mjs +0 -10
  186. package/dist/email-security-DTVHNr2h.mjs +0 -60
  187. package/dist/email-sending-DsFTvE31.mjs +0 -3
  188. package/dist/filters-DO1Is_tI.mjs +0 -4
  189. package/dist/firewall-DbUhVTCg.mjs +0 -11
  190. package/dist/fraud-Bzr4njYb.mjs +0 -8
  191. package/dist/google-tag-gateway-BQxkA90M.mjs +0 -2
  192. package/dist/healthchecks-BBAs-lS_.mjs +0 -4
  193. package/dist/hostnames-Dz9PEUKS.mjs +0 -3
  194. package/dist/hyperdrive-B1iUJddG.mjs +0 -18
  195. package/dist/iam-CJM8gHpG.mjs +0 -6
  196. package/dist/images-DEoBmtFS.mjs +0 -5
  197. package/dist/intel-BM6xkZ0C.mjs +0 -3
  198. package/dist/keyless-certificates-DffYnd4b.mjs +0 -3
  199. package/dist/kv-BTceLtWZ.mjs +0 -5
  200. package/dist/leaked-credential-checks-CALfvoCo.mjs +0 -3
  201. package/dist/load-balancers-C1Ho1gCF.mjs +0 -6
  202. package/dist/logpush-CSYhgevA.mjs +0 -4
  203. package/dist/logs-DlIwmMpt.mjs +0 -3
  204. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +0 -5
  205. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +0 -4
  206. package/dist/magic-transit-qQmA-981.mjs +0 -89
  207. package/dist/managed-transforms-Dd6AnbWE.mjs +0 -3
  208. package/dist/mtls-certificates-C0rlCRGs.mjs +0 -3
  209. package/dist/network-interconnects-CxG2deY0.mjs +0 -36
  210. package/dist/organizations-DyEAiGiR.mjs +0 -41
  211. package/dist/origin-ca-certificates-S8RcoMF6.mjs +0 -3
  212. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +0 -2
  213. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +0 -5
  214. package/dist/output-D7_yAFVR.mjs +0 -2
  215. package/dist/page-rules-DP-w6TAm.mjs +0 -18
  216. package/dist/page-shield-Bf7kFp8c.mjs +0 -37
  217. package/dist/pages-D0Y_XRqW.mjs +0 -10
  218. package/dist/pipelines-C-SPESAk.mjs +0 -6
  219. package/dist/queues-wv6CZsi8.mjs +0 -6
  220. package/dist/r2-DuXjp9n5.mjs +0 -21
  221. package/dist/r2-data-catalog-DQCMrmNO.mjs +0 -14
  222. package/dist/radar-BW_ZHP8X.mjs +0 -2
  223. package/dist/rate-limits-DLTkIvwr.mjs +0 -5
  224. package/dist/raw-fetch-hRv-6P3D.mjs +0 -2
  225. package/dist/realtime-kit-Ch7Vg3vj.mjs +0 -6
  226. package/dist/registrar-DIIv6fWd.mjs +0 -46
  227. package/dist/request-tracers-DMej0Drs.mjs +0 -2
  228. package/dist/resource-sharing-CYJ7cMWq.mjs +0 -5
  229. package/dist/resource-tagging-Dnz65MgH.mjs +0 -16
  230. package/dist/rules-DLJpOYbC.mjs +0 -4
  231. package/dist/rulesets-D9nqEJT5.mjs +0 -8
  232. package/dist/rum-DBVmdPkp.mjs +0 -4
  233. package/dist/schema-validation-MCd3xdtX.mjs +0 -4
  234. package/dist/scim-DZA3VXog.mjs +0 -3
  235. package/dist/scm-CilfPOue.mjs +0 -2
  236. package/dist/secrets-store-BrvcZSOM.mjs +0 -21
  237. package/dist/security-center-BU6f3Cm1.mjs +0 -2
  238. package/dist/security-txt-BPIbP3dG.mjs +0 -3
  239. package/dist/session-H7IV2BrM.mjs +0 -2
  240. package/dist/smart-shield-e8XFBkiF.mjs +0 -3
  241. package/dist/snippets-B4M3MMb8.mjs +0 -4
  242. package/dist/spectrum-B0adfSRI.mjs +0 -59
  243. package/dist/speed-BVcUtkAz.mjs +0 -4
  244. package/dist/ssl-BAa91gsc.mjs +0 -15
  245. package/dist/stream-D53sxKb3.mjs +0 -14
  246. package/dist/tenants-bH5pt3dJ.mjs +0 -2
  247. package/dist/token-validation-M61Vx_Tw.mjs +0 -4
  248. package/dist/turnstile-wAU0Gc2Z.mjs +0 -23
  249. package/dist/url-normalization-DZrWDgB5.mjs +0 -3
  250. package/dist/url-scanner-Zo49edNp.mjs +0 -2
  251. package/dist/user-DbXlVReB.mjs +0 -10
  252. package/dist/vectorize-CUnTM0DT.mjs +0 -4
  253. package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
  254. package/dist/waiting-rooms-BZW0X69-.mjs +0 -11
  255. package/dist/web3-DueyOQtx.mjs +0 -4
  256. package/dist/workers-builds-BM_aoeUR.mjs +0 -7
  257. package/dist/workers-nV_vBCfV.mjs +0 -16
  258. package/dist/workflows-CQITmo-s.mjs +0 -4
  259. package/dist/zaraz-DIbpF5Op.mjs +0 -2
  260. package/dist/zero-trust-CKp8j512.mjs +0 -119
  261. package/dist/zones-BZ5tZDbH.mjs +0 -28
  262. /package/dist/{metadata-DGdCpUxn.mjs → metadata-5VwHPW6C.mjs} +0 -0
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,T as t,h as n,t as r,w as i,x as a}from"./auth-CQcAgnOy.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-CjcQ6ato.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.positional(`postfix-id`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <postfix-id>`,describe:`Returns detection details such as threat categories and sender information for non-benign messages.`,builder:p,handler:async e=>{if(e.dryRun){l({command:`cf email-security investigate detections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/${e[`postfix-id`]==null?`<postfix-id>`:encodeURIComponent(String(e[`postfix-id`]))}/detections`,pathParams:{"postfix-id":String(e[`postfix-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.investigate.detections.get(i,e[`postfix-id`])),{successLabel:`Loaded`})}},h={command:`detections`,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 g(e){return e.positional(`investigate-id`,{type:`string`,description:`The investigation identifier for an email message.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={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:g,handler:async e=>{if(e.dryRun){l({command:`cf email-security investigate get-action log`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/${e[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(e[`investigate-id`]))}/action_log`,pathParams:{"investigate-id":String(e[`investigate-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.investigate.getAction.log(i,e[`investigate-id`])),{successLabel:`Loaded`})}},te={command:`get-action`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.positional(`postfix-id`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}).option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the
3
- regular datastore only.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <postfix-id>`,describe:`Retrieves detailed information about a specific email message, including headers, metadata, and security scan results.`,builder:_,handler:async e=>{let t={submission:e.submission};if(e.dryRun){l({command:`cf email-security investigate get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/${e[`postfix-id`]==null?`<postfix-id>`:encodeURIComponent(String(e[`postfix-id`]))}`,pathParams:{"postfix-id":String(e[`postfix-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.investigate.get(o,e[`postfix-id`],t)),{successLabel:`Loaded`})}};function y(e){return e.option(`start`,{type:`string`,description:"The beginning of the search date range.\nDefaults to `now - 30 days` if not provided."}).option(`end`,{type:`string`,description:"The end of the search date range.\nDefaults to `now` if not provided."}).option(`query`,{type:`string`,description:`The space-delimited term used in the query. The search is case-insensitive.
4
-
5
- The content of the following email metadata fields are searched:
6
- * alert_id
7
- * CC
8
- * From (envelope_from)
9
- * From Name
10
- * final_disposition
11
- * md5 hash (of any attachment)
12
- * sha1 hash (of any attachment)
13
- * sha256 hash (of any attachment)
14
- * name (of any attachment)
15
- * Reason
16
- * Received DateTime (yyyy-mm-ddThh:mm:ss)
17
- * Sent DateTime (yyyy-mm-ddThh:mm:ss)
18
- * ReplyTo
19
- * To (envelope_to)
20
- * To Name
21
- * Message-ID
22
- * smtp_helo_server_ip
23
- * smtp_previous_hop_ip
24
- * x_originating_ip
25
- * Subject`}).option(`detections-only`,{type:`boolean`,description:`Determines if the search results will include detections or not.`}).option(`action-log`,{type:`boolean`,description:`Determines if the message action log is included in the response.`}).option(`final-disposition`,{type:`string`,description:`The dispositions the search filters by.`}).option(`metric`,{type:`string`,description:`Metric`}).option(`message-action`,{type:`string`,description:`The message actions the search filters by.`}).option(`recipient`,{type:`string`,description:`Filter by recipient. Matches either an email address or a domain.`}).option(`sender`,{type:`string`,description:`Filter by sender. Matches either an email address or a domain.`}).option(`alert-id`,{type:`string`,description:`Alert ID`}).option(`domain`,{type:`string`,description:`Filter by a domain found in the email: sender domain, recipient domain, or a domain in a link.`}).option(`message-id`,{type:`string`,description:`Message ID`}).option(`subject`,{type:`string`,description:`Search for messages containing individual keywords in any order within the subject.`}).option(`exact-subject`,{type:`string`,description:`Search for messages with an exact subject match.`}).option(`submissions`,{type:`boolean`,description:`Search for submissions instead of original messages`}).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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Returns information for each email that matches the search parameter(s). If the search takes too long, the endpoint returns 202 with a Location header pointing to a polling endpoint where results can be retrieved once ready.`,builder:y,handler:async e=>{let t={start:e.start,end:e.end,query:e.query,detections_only:e[`detections-only`],action_log:e[`action-log`],final_disposition:e[`final-disposition`],metric:e.metric,message_action:e[`message-action`],recipient:e.recipient,sender:e.sender,alert_id:e[`alert-id`],domain:e.domain,message_id:e[`message-id`],subject:e.subject,exact_subject:e[`exact-subject`],submissions:e.submissions,cursor:e.cursor,per_page:e[`per-page`],page:e.page};if(e.dryRun){l({command:`cf email-security investigate list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.investigate.list(o,t)),{successLabel:`Loaded`})}};function x(e){return e.option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).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. List of message IDs to move."}).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 S={command:`bulk`,describe:`Maximum batch size: 1000 messages per request`,builder:x,handler:async e=>{if(e.dryRun){l({command:`cf email-security investigate move bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/move`,pathParams:{},bodyKind:`json`,body:{destination:e.destination,ids:e.ids,"postfix-ids":e[`postfix-ids`],body:e.body}});return}let t=await r(e),p=e.local?f:await n(t);if(e.accountId=p,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${p}/email-security/investigate/move`,{body:n})),{successLabel:`Created`});return}e.destination===void 0&&(e.destination=await i(`destination`,`The destination field`,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let m={};e.destination!==void 0&&o(m,[`destination`],d(e.destination,`destination`,`text`)),e.ids!==void 0&&o(m,[`ids`],e.ids),e[`postfix-ids`]!==void 0&&o(m,[`postfix_ids`],e[`postfix-ids`]),c(await u(`Creating`,async()=>t.post(`/accounts/${p}/email-security/investigate/move`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function C(e){return e.positional(`postfix-id`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}).option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the
26
- regular datastore only.`}).option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).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 <postfix-id>`,describe:`Moves a single email message to a different folder or changes its quarantine status.`,builder:C,handler:async e=>{let t={submission:e.submission};if(e.dryRun){l({command:`cf email-security investigate move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/${e[`postfix-id`]==null?`<postfix-id>`:encodeURIComponent(String(e[`postfix-id`]))}/move`,pathParams:{"postfix-id":String(e[`postfix-id`]??``)},query:t,bodyKind:`json`,body:{destination:e.destination,body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let n=s(e.body),r=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/investigate/${encodeURIComponent(String(e[`postfix-id`]))}/move${r?`?`+r:``}`,{body:n})),{successLabel:`Created`});return}e.destination===void 0&&(e.destination=await i(`destination`,`The destination field`,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let h={};e.destination!==void 0&&o(h,[`destination`],d(e.destination,`destination`,`text`));let g=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/investigate/${encodeURIComponent(String(e[`postfix-id`]))}/move${g?`?`+g:``}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}},T={command:`move`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the
27
- regular datastore only.`}).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 D={command:`create`,describe:`Generates a preview of an email message for safe viewing without executing any embedded content.`,builder:E,handler:async e=>{let i={submission:e.submission};if(e.dryRun){l({command:`cf email-security investigate preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/preview`,pathParams:{},query:i,bodyKind:`json`,body:{"postfix-id":e[`postfix-id`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body),n=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/investigate/preview${n?`?`+n:``}`,{body:t})),{successLabel:`Created`});return}e[`postfix-id`]===void 0&&(e[`postfix-id`]=await t(`postfix-id`,`The identifier of the message.`));let h={};e[`postfix-id`]!==void 0&&o(h,[`postfix_id`],d(e[`postfix-id`],`postfix-id`,`text`));let g=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/investigate/preview${g?`?`+g:``}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function O(e){return e.positional(`postfix-id`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <postfix-id>`,describe:`Returns a preview of the message body as a base64 encoded PNG image for non-benign messages.`,builder:O,handler:async e=>{if(e.dryRun){l({command:`cf email-security investigate preview get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/${e[`postfix-id`]==null?`<postfix-id>`:encodeURIComponent(String(e[`postfix-id`]))}/preview`,pathParams:{"postfix-id":String(e[`postfix-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.investigate.preview.get(i,e[`postfix-id`])),{successLabel:`Loaded`})}},A={command:`preview`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`postfix-id`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <postfix-id>`,describe:`Returns the raw eml of any non-benign message.`,builder:j,handler:async e=>{if(e.dryRun){l({command:`cf email-security investigate raw get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/${e[`postfix-id`]==null?`<postfix-id>`:encodeURIComponent(String(e[`postfix-id`]))}/raw`,pathParams:{"postfix-id":String(e[`postfix-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.investigate.raw.get(i,e[`postfix-id`])),{successLabel:`Loaded`})}},N={command:`raw`,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(`postfix-id`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}).option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the
28
- regular datastore only.`}).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 F={command:`create <postfix-id>`,describe:`Submits an email message for reclassification, updating its threat assessment based on new analysis.`,builder:P,handler:async e=>{let t={submission:e.submission};if(e.dryRun){l({command:`cf email-security investigate reclassify create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/${e[`postfix-id`]==null?`<postfix-id>`:encodeURIComponent(String(e[`postfix-id`]))}/reclassify`,pathParams:{"postfix-id":String(e[`postfix-id`]??``)},query:t,bodyKind:`json`,body:{"eml-content":e[`eml-content`],"escalated-submission-id":e[`escalated-submission-id`],"expected-disposition":e[`expected-disposition`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let n=s(e.body),r=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/investigate/${encodeURIComponent(String(e[`postfix-id`]))}/reclassify${r?`?`+r:``}`,{body:n})),{successLabel:`Created`});return}e[`expected-disposition`]===void 0&&(e[`expected-disposition`]=await i(`expected-disposition`,`The expected_disposition field`,[`NONE`,`BULK`,`MALICIOUS`,`SPAM`,`SPOOF`,`SUSPICIOUS`]));let h={};e[`eml-content`]!==void 0&&o(h,[`eml_content`],d(e[`eml-content`],`eml-content`,`text`)),e[`escalated-submission-id`]!==void 0&&o(h,[`escalated_submission_id`],d(e[`escalated-submission-id`],`escalated-submission-id`,`text`)),e[`expected-disposition`]!==void 0&&o(h,[`expected_disposition`],d(e[`expected-disposition`],`expected-disposition`,`text`));let g=new URLSearchParams(Object.entries(t).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/investigate/${encodeURIComponent(String(e[`postfix-id`]))}/reclassify${g?`?`+g:``}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}},I={command:`reclassify`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"A list of messages identfied by their `postfix_id`s that should be released."})}const R={command:`bulk`,describe:`Releases a quarantined email message, allowing it to be delivered to the recipient.`,builder:L,handler:async e=>{if(e.dryRun){l({command:`cf email-security investigate release bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/release`,pathParams:{},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/email-security/investigate/release`,{body:n})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},z={command:`release`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`postfix-id`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}).option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the
29
- regular datastore only.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <postfix-id>`,describe:`Gets the delivery trace for an email message, showing its path through email security processing.`,builder:B,handler:async e=>{let t={submission:e.submission};if(e.dryRun){l({command:`cf email-security investigate trace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/investigate/${e[`postfix-id`]==null?`<postfix-id>`:encodeURIComponent(String(e[`postfix-id`]))}/trace`,pathParams:{"postfix-id":String(e[`postfix-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.investigate.trace.get(o,e[`postfix-id`],t)),{successLabel:`Loaded`})}},H={command:`trace`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`investigate`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(v).command(b).command(h).command(te).command(T).command(A).command(N).command(I).command(z).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.option(`from-date`,{type:`string`,description:`From date`}).option(`to-date`,{type:`string`,description:`To date`}).option(`start`,{type:`string`,description:`The beginning of the search date range (RFC3339 format).`}).option(`end`,{type:`string`,description:`The end of the search date range (RFC3339 format).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`list`,describe:"Retrieves `PhishGuard` reports showing phishing attempts and suspicious email patterns detected.",builder:W,handler:async e=>{let t={from_date:e[`from-date`],to_date:e[`to-date`],start:e.start,end:e.end};if(e.dryRun){l({command:`cf email-security phishguard reports list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/phishguard/reports`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.phishguard.reports.list(o,t)),{successLabel:`Loaded`})}},K={command:`reports`,describe:`PhishGuard user-reported phishing submissions and analysis reports`,builder:e=>e.command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`phishguard`,describe:`Operations for phishguard`,builder:e=>e.command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions.
30
- Note: This will not exempt messages with Malicious or Suspicious dispositions.`}).option(`is-exempt-recipient`,{type:`boolean`,description:`Messages to this recipient will bypass all detections.`}).option(`is-recipient`,{type:`boolean`,description:`The is_recipient field`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-sender`,{type:`boolean`,description:`The is_sender field`}).option(`is-spoof`,{type:`boolean`,description:`The is_spoof field`}).option(`is-trusted-sender`,{type:`boolean`,description:`Messages from this sender will bypass all detections and link following.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`pattern-type`,{type:`string`,description:`The pattern_type field`,choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication.
31
- 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:`Raw JSON request body (bypasses individual flags)`})}const Y={command:`create`,describe:`Creates a new email allow policy that permits specific senders, domains, or patterns to bypass security scanning.`,builder:J,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings allow-policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},bodyKind:`json`,body:{comments:e.comments,"is-acceptable-sender":e[`is-acceptable-sender`],"is-exempt-recipient":e[`is-exempt-recipient`],"is-recipient":e[`is-recipient`],"is-regex":e[`is-regex`],"is-sender":e[`is-sender`],"is-spoof":e[`is-spoof`],"is-trusted-sender":e[`is-trusted-sender`],pattern:e.pattern,"pattern-type":e[`pattern-type`],"verify-sender":e[`verify-sender`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/settings/allow_policies`,{body:t})),{successLabel:`Created`});return}if(e[`is-acceptable-sender`]===void 0)throw Error(`--is-acceptable-sender is required (or pass --body with this field set).`);if(e[`is-exempt-recipient`]===void 0)throw Error(`--is-exempt-recipient is required (or pass --body with this field set).`);if(e[`is-regex`]===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);if(e[`is-trusted-sender`]===void 0)throw Error(`--is-trusted-sender is required (or pass --body with this field set).`);if(e.pattern===void 0&&(e.pattern=await t(`pattern`,`The pattern field`)),e[`pattern-type`]===void 0&&(e[`pattern-type`]=await i(`pattern-type`,`The pattern_type field`,[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`])),e[`verify-sender`]===void 0)throw Error(`--verify-sender is required (or pass --body with this field set).`);let h={};e.comments!==void 0&&o(h,[`comments`],d(e.comments,`comments`,`text`)),e[`is-acceptable-sender`]!==void 0&&o(h,[`is_acceptable_sender`],e[`is-acceptable-sender`]),e[`is-exempt-recipient`]!==void 0&&o(h,[`is_exempt_recipient`],e[`is-exempt-recipient`]),e[`is-recipient`]!==void 0&&o(h,[`is_recipient`],e[`is-recipient`]),e[`is-regex`]!==void 0&&o(h,[`is_regex`],e[`is-regex`]),e[`is-sender`]!==void 0&&o(h,[`is_sender`],e[`is-sender`]),e[`is-spoof`]!==void 0&&o(h,[`is_spoof`],e[`is-spoof`]),e[`is-trusted-sender`]!==void 0&&o(h,[`is_trusted_sender`],e[`is-trusted-sender`]),e.pattern!==void 0&&o(h,[`pattern`],d(e.pattern,`pattern`,`text`)),e[`pattern-type`]!==void 0&&o(h,[`pattern_type`],d(e[`pattern-type`],`pattern-type`,`text`)),e[`verify-sender`]!==void 0&&o(h,[`verify_sender`],e[`verify-sender`]),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/settings/allow_policies`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function X(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier for the allow policy.`,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 Z={command:`delete <policy-id>`,describe:`Removes an email allow policy. Previously allowed senders will be subject to normal security scanning.`,builder:X,handler:async t=>{if(t.dryRun){l({command:`cf email-security settings allow-policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/allow_policies/${t[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(t[`policy-id`]))}`,pathParams:{"policy-id":String(t[`policy-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
32
- `);return}c(await u(`Deleting`,async()=>i.emailSecurity.settings.allowPolicies.delete(o,t[`policy-id`])),{successLabel:`Deleted`})}};function Q(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier for the allow policy.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions.
33
- Note: This will not exempt messages with Malicious or Suspicious dispositions.`}).option(`is-exempt-recipient`,{type:`boolean`,description:`Messages to this recipient will bypass all detections.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-trusted-sender`,{type:`boolean`,description:`Messages from this sender will bypass all detections and link following.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication.
34
- 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:`Raw JSON request body (bypasses individual flags)`})}const ne={command:`edit <policy-id>`,describe:`Updates an existing email allow policy, modifying its matching criteria or scope.`,builder:Q,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings allow-policies edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/allow_policies/${e[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(e[`policy-id`]))}`,pathParams:{"policy-id":String(e[`policy-id`]??``)},bodyKind:`json`,body:{comments:e.comments,"is-acceptable-sender":e[`is-acceptable-sender`],"is-exempt-recipient":e[`is-exempt-recipient`],"is-regex":e[`is-regex`],"is-trusted-sender":e[`is-trusted-sender`],pattern:e.pattern,"verify-sender":e[`verify-sender`],body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/allow_policies/${encodeURIComponent(String(e[`policy-id`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e.comments!==void 0&&o(p,[`comments`],d(e.comments,`comments`,`text`)),e[`is-acceptable-sender`]!==void 0&&o(p,[`is_acceptable_sender`],e[`is-acceptable-sender`]),e[`is-exempt-recipient`]!==void 0&&o(p,[`is_exempt_recipient`],e[`is-exempt-recipient`]),e[`is-regex`]!==void 0&&o(p,[`is_regex`],e[`is-regex`]),e[`is-trusted-sender`]!==void 0&&o(p,[`is_trusted_sender`],e[`is-trusted-sender`]),e.pattern!==void 0&&o(p,[`pattern`],d(e.pattern,`pattern`,`text`)),e[`verify-sender`]!==void 0&&o(p,[`verify_sender`],e[`verify-sender`]),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/allow_policies/${encodeURIComponent(String(e[`policy-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function re(e){return e.positional(`policy-id`,{type:`string`,description:`The unique identifier for the allow policy.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get <policy-id>`,describe:`Retrieves details for a specific email allow policy, including its matching criteria and scope.`,builder:re,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings allow-policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/allow_policies/${e[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(e[`policy-id`]))}`,pathParams:{"policy-id":String(e[`policy-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.settings.allowPolicies.get(i,e[`policy-id`])),{successLabel:`Loaded`})}};function ae(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order`,{type:`string`,description:`The field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`}).option(`search`,{type:`string`,description:`Allows searching in multiple properties of a record simultaneously.
35
- This parameter is intended for human users, not automation. Its exact
36
- behavior is intentionally left unspecified and is subject to change
37
- in the future.`}).option(`is-sender`,{type:`boolean`,description:`Is sender`}).option(`is-trusted-sender`,{type:`boolean`,description:`Is trusted sender`}).option(`is-recipient`,{type:`boolean`,description:`Is recipient`}).option(`is-exempt-recipient`,{type:`boolean`,description:`Is exempt recipient`}).option(`is-spoof`,{type:`boolean`,description:`Is spoof`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Is acceptable sender`}).option(`verify-sender`,{type:`boolean`,description:`Verify sender`}).option(`pattern-type`,{type:`string`,description:`Pattern type`}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:`Lists, searches, and sorts an account’s email allow policies.`,builder:ae,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,search:e.search,is_sender:e[`is-sender`],is_trusted_sender:e[`is-trusted-sender`],is_recipient:e[`is-recipient`],is_exempt_recipient:e[`is-exempt-recipient`],is_spoof:e[`is-spoof`],is_acceptable_sender:e[`is-acceptable-sender`],verify_sender:e[`verify-sender`],pattern_type:e[`pattern-type`],pattern:e.pattern};if(e.dryRun){l({command:`cf email-security settings allow-policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.settings.allowPolicies.list(o,t)),{successLabel:`Loaded`})}},se={command:`allow-policies`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(Y).command(Z).command(ne).command(ie).command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(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 le={command:`create`,describe:`Send a Batch of Allow Policies API calls to be executed together.`,builder:ce,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings batch allow policies batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/allow_policies/batch`,pathParams:{},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/email-security/settings/allow_policies/batch`,{body:n})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>t.emailSecurity.settings.batch.allow.policies.batch.create(i)),{successLabel:`Created`})}},ue={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},de={command:`policies`,describe:`Operations for settings.batch.allow.policies`,builder:e=>e.command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},fe={command:`allow`,describe:`Operations for settings.batch.allow`,builder:e=>e.command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(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 me={command:`create`,describe:`Send a Batch of Block Senders API calls to be executed together.`,builder:pe,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings batch block senders batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/block_senders/batch`,pathParams:{},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/email-security/settings/block_senders/batch`,{body:n})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>t.emailSecurity.settings.batch.block.senders.batch.create(i)),{successLabel:`Created`})}},he={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ge={command:`senders`,describe:`Operations for settings.batch.block.senders`,builder:e=>e.command(he).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},_e={command:`block`,describe:`Operations for settings.batch.block`,builder:e=>e.command(ge).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 ye={command:`create`,describe:"Send a Batch of `sending_domain_restrictions` API calls to be executed together.",builder:ve,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings batch sending domain restrictions batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/sending_domain_restrictions/batch`,pathParams:{},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/email-security/settings/sending_domain_restrictions/batch`,{body:n})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>t.emailSecurity.settings.batch.sending.domain.restrictions.batch.create(i)),{successLabel:`Created`})}},be={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},xe={command:`restrictions`,describe:`Operations for settings.batch.sending.domain.restrictions`,builder:e=>e.command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Se={command:`domain`,describe:`Operations for settings.batch.sending.domain`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ce={command:`sending`,describe:`Operations for settings.batch.sending`,builder:e=>e.command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(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 Te={command:`create`,describe:`Send a Batch of Trusted Domains API calls to be executed together.`,builder:we,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings batch trusted domains batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/trusted_domains/batch`,pathParams:{},bodyKind:`json`,body:{body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/email-security/settings/trusted_domains/batch`,{body:n})),{successLabel:`Created`});return}c(await u(`Creating`,async()=>t.emailSecurity.settings.batch.trusted.domains.batch.create(i)),{successLabel:`Created`})}},Ee={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},De={command:`domains`,describe:`Operations for settings.batch.trusted.domains`,builder:e=>e.command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Oe={command:`trusted`,describe:`Operations for settings.batch.trusted`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ke={command:`batch`,describe:`Operations for settings.batch`,builder:e=>e.command(fe).command(_e).command(Ce).command(Oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ae(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 field`}).option(`pattern-type`,{type:`string`,description:`The pattern_type field`,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:`Raw JSON request body (bypasses individual flags)`})}const je={command:`create`,describe:`Adds a sender pattern to the email block list, preventing messages from matching senders from being delivered.`,builder:Ae,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings block-senders create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},bodyKind:`json`,body:{comments:e.comments,"is-regex":e[`is-regex`],pattern:e.pattern,"pattern-type":e[`pattern-type`],body:e.body}});return}let p=await r(e),m=e.local?f:await n(p);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/settings/block_senders`,{body:t})),{successLabel:`Created`});return}if(e[`is-regex`]===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);e.pattern===void 0&&(e.pattern=await t(`pattern`,`The pattern field`)),e[`pattern-type`]===void 0&&(e[`pattern-type`]=await i(`pattern-type`,`The pattern_type field`,[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]));let h={};e.comments!==void 0&&o(h,[`comments`],d(e.comments,`comments`,`text`)),e[`is-regex`]!==void 0&&o(h,[`is_regex`],e[`is-regex`]),e.pattern!==void 0&&o(h,[`pattern`],d(e.pattern,`pattern`,`text`)),e[`pattern-type`]!==void 0&&o(h,[`pattern_type`],d(e[`pattern-type`],`pattern-type`,`text`)),c(await u(`Creating`,async()=>p.post(`/accounts/${m}/email-security/settings/block_senders`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function Me(e){return e.positional(`pattern-id`,{type:`string`,description:`The unique identifier for the allow policy.`,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 Ne={command:`delete <pattern-id>`,describe:`Removes a sender from the email block list, allowing their messages to be delivered normally.`,builder:Me,handler:async t=>{if(t.dryRun){l({command:`cf email-security settings block-senders delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/block_senders/${t[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(t[`pattern-id`]))}`,pathParams:{"pattern-id":String(t[`pattern-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
38
- `);return}c(await u(`Deleting`,async()=>i.emailSecurity.settings.blockSenders.delete(o,t[`pattern-id`])),{successLabel:`Deleted`})}};function Pe(e){return e.positional(`pattern-id`,{type:`string`,description:`The unique identifier for the allow policy.`,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 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 Fe={command:`edit <pattern-id>`,describe:`Modifies a blocked sender entry, updating its pattern or block reason.`,builder:Pe,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings block-senders edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/block_senders/${e[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(e[`pattern-id`]))}`,pathParams:{"pattern-id":String(e[`pattern-id`]??``)},bodyKind:`json`,body:{comments:e.comments,"is-regex":e[`is-regex`],pattern:e.pattern,body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/block_senders/${encodeURIComponent(String(e[`pattern-id`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e.comments!==void 0&&o(p,[`comments`],d(e.comments,`comments`,`text`)),e[`is-regex`]!==void 0&&o(p,[`is_regex`],e[`is-regex`]),e.pattern!==void 0&&o(p,[`pattern`],d(e.pattern,`pattern`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/block_senders/${encodeURIComponent(String(e[`pattern-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function Ie(e){return e.positional(`pattern-id`,{type:`string`,description:`The unique identifier for the allow policy.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Le={command:`get <pattern-id>`,describe:`Gets information about a specific blocked sender entry, including the pattern and block reason.`,builder:Ie,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings block-senders get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/block_senders/${e[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(e[`pattern-id`]))}`,pathParams:{"pattern-id":String(e[`pattern-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.settings.blockSenders.get(i,e[`pattern-id`])),{successLabel:`Loaded`})}};function Re(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order`,{type:`string`,description:`The field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`}).option(`search`,{type:`string`,description:`Allows searching in multiple properties of a record simultaneously.
39
- This parameter is intended for human users, not automation. Its exact
40
- behavior is intentionally left unspecified and is subject to change
41
- in the future.`}).option(`pattern-type`,{type:`string`,description:`Pattern type`}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`list`,describe:`Lists all blocked sender entries with their patterns and block reasons.`,builder:Re,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,search:e.search,pattern_type:e[`pattern-type`],pattern:e.pattern};if(e.dryRun){l({command:`cf email-security settings block-senders list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.settings.blockSenders.list(o,t)),{successLabel:`Loaded`})}},Be={command:`block-senders`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(je).command(Ne).command(Fe).command(Le).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(`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 He={command:`bulk-delete`,describe:`Bulk removes multiple domains from email security configuration in a single request.`,builder:Ve,handler:async t=>{if(t.dryRun){l({command:`cf email-security settings domains bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/domains`,pathParams:{},bodyKind:`json`,body:{body:t.body}});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
42
- `);return}if(t.body){let e=s(t.body);c(await u(`Deleting`,async()=>i.delete(`/accounts/${o}/email-security/settings/domains`,{body:e})),{successLabel:`Deleted`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Ue(e){return e.positional(`domain-id`,{type:`string`,description:`The unique identifier for the domain.`,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 We={command:`delete <domain-id>`,describe:`Removes a domain from the email security configuration.`,builder:Ue,handler:async t=>{if(t.dryRun){l({command:`cf email-security settings domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/domains/${t[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(t[`domain-id`]))}`,pathParams:{"domain-id":String(t[`domain-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
43
- `);return}c(await u(`Deleting`,async()=>i.emailSecurity.settings.domains.delete(o,t[`domain-id`])),{successLabel:`Deleted`})}};function Ge(e){return e.positional(`domain-id`,{type:`string`,description:`The unique identifier for the domain.`,demandOption:!0}).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 Ke={command:`edit <domain-id>`,describe:`Updates configuration for a domain in email security.`,builder:Ge,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/domains/${e[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(e[`domain-id`]))}`,pathParams:{"domain-id":String(e[`domain-id`]??``)},bodyKind:`json`,body:{"allowed-delivery-modes":e[`allowed-delivery-modes`],domain:e.domain,"drop-dispositions":e[`drop-dispositions`],"integration-id":e[`integration-id`],"ip-restrictions":e[`ip-restrictions`],"lookback-hops":e[`lookback-hops`],regions:e.regions,"require-tls-inbound":e[`require-tls-inbound`],"require-tls-outbound":e[`require-tls-outbound`],transport:e.transport,body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/domains/${encodeURIComponent(String(e[`domain-id`]))}`,{body:n})),{successLabel:`Updated`});return}if(e[`ip-restrictions`]===void 0)throw Error(`--ip-restrictions is required (or pass --body with this field set).`);let p={};e[`allowed-delivery-modes`]!==void 0&&o(p,[`allowed_delivery_modes`],e[`allowed-delivery-modes`]),e.domain!==void 0&&o(p,[`domain`],d(e.domain,`domain`,`text`)),e[`drop-dispositions`]!==void 0&&o(p,[`drop_dispositions`],e[`drop-dispositions`]),e[`integration-id`]!==void 0&&o(p,[`integration_id`],d(e[`integration-id`],`integration-id`,`text`)),e[`ip-restrictions`]!==void 0&&o(p,[`ip_restrictions`],e[`ip-restrictions`]),e[`lookback-hops`]!==void 0&&o(p,[`lookback_hops`],e[`lookback-hops`]),e.regions!==void 0&&o(p,[`regions`],e.regions),e[`require-tls-inbound`]!==void 0&&o(p,[`require_tls_inbound`],e[`require-tls-inbound`]),e[`require-tls-outbound`]!==void 0&&o(p,[`require_tls_outbound`],e[`require-tls-outbound`]),e.transport!==void 0&&o(p,[`transport`],d(e.transport,`transport`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/domains/${encodeURIComponent(String(e[`domain-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function qe(e){return e.positional(`domain-id`,{type:`string`,description:`The unique identifier for the domain.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Je={command:`get <domain-id>`,describe:`Gets configuration details for a specific domain in email security.`,builder:qe,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/domains/${e[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(e[`domain-id`]))}`,pathParams:{"domain-id":String(e[`domain-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.settings.domains.get(i,e[`domain-id`])),{successLabel:`Loaded`})}};function Ye(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order`,{type:`string`,description:`The field to sort by.`,choices:[`domain`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`}).option(`search`,{type:`string`,description:`Allows searching in multiple properties of a record simultaneously.
44
- This parameter is intended for human users, not automation. Its exact
45
- behavior is intentionally left unspecified and is subject to change
46
- in the future.`}).option(`allowed-delivery-mode`,{type:`string`,description:`Filters response to domains with the provided delivery mode.`}).option(`domain`,{type:`string`,description:`Filters results by the provided domains, allowing for multiple occurrences.`}).option(`active-delivery-mode`,{type:`string`,description:`Filters response to domains with the currently active delivery mode.`}).option(`integration-id`,{type:`string`,description:`Filters response to domains with the provided integration ID.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Xe={command:`list`,describe:`Lists, searches, and sorts an account’s email domains.`,builder:Ye,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,search:e.search,allowed_delivery_mode:e[`allowed-delivery-mode`],domain:e.domain,active_delivery_mode:e[`active-delivery-mode`],integration_id:e[`integration-id`]};if(e.dryRun){l({command:`cf email-security settings domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/domains`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.settings.domains.list(o,t)),{successLabel:`Loaded`})}},Ze={command:`domains`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(He).command(We).command(Ke).command(Je).command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qe(e){return e.option(`email`,{type:`string`,description:`The email field`}).option(`is-email-regex`,{type:`boolean`,description:`The is_email_regex field`}).option(`name`,{type:`string`,description:`The name 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 $e={command:`create`,describe:`Creates a display name entry for email security impersonation protection.`,builder:Qe,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings impersonation-registry create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/impersonation_registry`,pathParams:{},bodyKind:`json`,body:{email:e.email,"is-email-regex":e[`is-email-regex`],name:e.name,body:e.body}});return}let i=await r(e),p=e.local?f:await n(i);if(e.accountId=p,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${p}/email-security/settings/impersonation_registry`,{body:t})),{successLabel:`Created`});return}if(e.email===void 0&&(e.email=await t(`email`,`The email field`)),e[`is-email-regex`]===void 0)throw Error(`--is-email-regex is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e.email!==void 0&&o(m,[`email`],d(e.email,`email`,`text`)),e[`is-email-regex`]!==void 0&&o(m,[`is_email_regex`],e[`is-email-regex`]),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${p}/email-security/settings/impersonation_registry`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function et(e){return e.positional(`display-name-id`,{type:`string`,description:`Display name 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 tt={command:`delete <display-name-id>`,describe:`Removes a display name from impersonation protection monitoring.`,builder:et,handler:async t=>{if(t.dryRun){l({command:`cf email-security settings impersonation-registry delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/impersonation_registry/${t[`display-name-id`]==null?`<display-name-id>`:encodeURIComponent(String(t[`display-name-id`]))}`,pathParams:{"display-name-id":String(t[`display-name-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
47
- `);return}c(await u(`Deleting`,async()=>i.emailSecurity.settings.impersonationRegistry.delete(o,t[`display-name-id`])),{successLabel:`Deleted`})}};function nt(e){return e.positional(`display-name-id`,{type:`string`,description:`Display name ID`,demandOption:!0}).option(`email`,{type:`string`,description:`The email field`}).option(`is-email-regex`,{type:`boolean`,description:`The is_email_regex field`}).option(`name`,{type:`string`,description:`The name 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 rt={command:`edit <display-name-id>`,describe:`Updates a display name entry used for impersonation protection.`,builder:nt,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings impersonation-registry edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/impersonation_registry/${e[`display-name-id`]==null?`<display-name-id>`:encodeURIComponent(String(e[`display-name-id`]))}`,pathParams:{"display-name-id":String(e[`display-name-id`]??``)},bodyKind:`json`,body:{email:e.email,"is-email-regex":e[`is-email-regex`],name:e.name,body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/impersonation_registry/${encodeURIComponent(String(e[`display-name-id`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e.email!==void 0&&o(p,[`email`],d(e.email,`email`,`text`)),e[`is-email-regex`]!==void 0&&o(p,[`is_email_regex`],e[`is-email-regex`]),e.name!==void 0&&o(p,[`name`],d(e.name,`name`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/impersonation_registry/${encodeURIComponent(String(e[`display-name-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function it(e){return e.positional(`display-name-id`,{type:`string`,description:`Display name ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const at={command:`get <display-name-id>`,describe:`Retrieves a display name entry used for impersonation protection.`,builder:it,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings impersonation-registry get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/impersonation_registry/${e[`display-name-id`]==null?`<display-name-id>`:encodeURIComponent(String(e[`display-name-id`]))}`,pathParams:{"display-name-id":String(e[`display-name-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.settings.impersonationRegistry.get(i,e[`display-name-id`])),{successLabel:`Loaded`})}};function ot(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order`,{type:`string`,description:`The field to sort by.`,choices:[`name`,`email`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`}).option(`search`,{type:`string`,description:`Allows searching in multiple properties of a record simultaneously.
48
- This parameter is intended for human users, not automation. Its exact
49
- behavior is intentionally left unspecified and is subject to change
50
- in the future.`}).option(`provenance`,{type:`string`,description:`Provenance`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const st={command:`list`,describe:`Lists, searches, and sorts entries in the impersonation registry.`,builder:ot,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,search:e.search,provenance:e.provenance};if(e.dryRun){l({command:`cf email-security settings impersonation-registry list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/impersonation_registry`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.settings.impersonationRegistry.list(o,t)),{successLabel:`Loaded`})}},ct={command:`impersonation-registry`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command($e).command(tt).command(rt).command(at).command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function lt(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
51
- 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
52
- spelling to your connected domains. Prevents listed domains from
53
- 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:`Raw JSON request body (bypasses individual flags)`}).implies(`is-recent`,[`is-similarity`,`is-regex`,`pattern`]).implies(`is-regex`,[`is-recent`,`is-similarity`,`pattern`]).implies(`is-similarity`,[`is-recent`,`is-regex`,`pattern`]).implies(`pattern`,[`is-recent`,`is-similarity`,`is-regex`])}const ut={command:`create`,describe:`Adds a domain to the trusted domains list for email security, reducing false positive detections.`,builder:lt,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings trusted-domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},bodyKind:`json`,body:{comments:e.comments,"is-recent":e[`is-recent`],"is-regex":e[`is-regex`],"is-similarity":e[`is-similarity`],pattern:e.pattern,body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/email-security/settings/trusted_domains`,{body:n})),{successLabel:`Created`});return}let p={};e.comments!==void 0&&o(p,[`comments`],d(e.comments,`comments`,`text`)),e[`is-recent`]!==void 0&&o(p,[`is_recent`],e[`is-recent`]),e[`is-regex`]!==void 0&&o(p,[`is_regex`],e[`is-regex`]),e[`is-similarity`]!==void 0&&o(p,[`is_similarity`],e[`is-similarity`]),e.pattern!==void 0&&o(p,[`pattern`],d(e.pattern,`pattern`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/email-security/settings/trusted_domains`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function dt(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`The unique identifier for the trusted domain.`,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 ft={command:`delete <trusted-domain-id>`,describe:`Removes a domain from the trusted domains list, subjecting it to normal security scanning.`,builder:dt,handler:async t=>{if(t.dryRun){l({command:`cf email-security settings trusted-domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/trusted_domains/${t[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(t[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(t[`trusted-domain-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
54
- `);return}c(await u(`Deleting`,async()=>i.emailSecurity.settings.trustedDomains.delete(o,t[`trusted-domain-id`])),{successLabel:`Deleted`})}};function $(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`The unique identifier for the trusted domain.`,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
55
- 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
56
- spelling to your connected domains. Prevents listed domains from
57
- 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:`Raw JSON request body (bypasses individual flags)`})}const pt={command:`edit <trusted-domain-id>`,describe:`Modifies a trusted domain entry's configuration.`,builder:$,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings trusted-domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/trusted_domains/${e[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(e[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(e[`trusted-domain-id`]??``)},bodyKind:`json`,body:{comments:e.comments,"is-recent":e[`is-recent`],"is-regex":e[`is-regex`],"is-similarity":e[`is-similarity`],pattern:e.pattern,body:e.body}});return}let t=await r(e),i=e.local?f:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/trusted_domains/${encodeURIComponent(String(e[`trusted-domain-id`]))}`,{body:n})),{successLabel:`Updated`});return}let p={};e.comments!==void 0&&o(p,[`comments`],d(e.comments,`comments`,`text`)),e[`is-recent`]!==void 0&&o(p,[`is_recent`],e[`is-recent`]),e[`is-regex`]!==void 0&&o(p,[`is_regex`],e[`is-regex`]),e[`is-similarity`]!==void 0&&o(p,[`is_similarity`],e[`is-similarity`]),e.pattern!==void 0&&o(p,[`pattern`],d(e.pattern,`pattern`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/email-security/settings/trusted_domains/${encodeURIComponent(String(e[`trusted-domain-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}};function mt(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`The unique identifier for the trusted domain.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ht={command:`get <trusted-domain-id>`,describe:`Gets information about a specific trusted domain entry.`,builder:mt,handler:async e=>{if(e.dryRun){l({command:`cf email-security settings trusted-domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/trusted_domains/${e[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(e[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(e[`trusted-domain-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.emailSecurity.settings.trustedDomains.get(i,e[`trusted-domain-id`])),{successLabel:`Loaded`})}};function gt(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`order`,{type:`string`,description:`The field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`}).option(`search`,{type:`string`,description:`Allows searching in multiple properties of a record simultaneously.
58
- This parameter is intended for human users, not automation. Its exact
59
- behavior is intentionally left unspecified and is subject to change
60
- in the future.`}).option(`is-recent`,{type:`boolean`,description:`Is recent`}).option(`is-similarity`,{type:`boolean`,description:`Is similarity`}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _t={command:`list`,describe:`Lists, searches, and sorts an account’s trusted email domains.`,builder:gt,handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,search:e.search,is_recent:e[`is-recent`],is_similarity:e[`is-similarity`],pattern:e.pattern};if(e.dryRun){l({command:`cf email-security settings trusted-domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.settings.trustedDomains.list(o,t)),{successLabel:`Loaded`})}},vt={command:`trusted-domains`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(ut).command(ft).command(pt).command(ht).command(_t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},yt={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(se).command(ke).command(Be).command(Ze).command(ct).command(vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function bt(e){return e.option(`start`,{type:`string`,description:"The beginning of the search date range.\nDefaults to `now - 30 days` if not provided."}).option(`end`,{type:`string`,description:"The end of the search date range.\nDefaults to `now` if not provided."}).option(`type`,{type:`string`,description:`Type`}).option(`submission-id`,{type:`string`,description:`Submission ID`}).option(`original-disposition`,{type:`string`,description:`Original disposition`}).option(`requested-disposition`,{type:`string`,description:`Requested disposition`}).option(`outcome-disposition`,{type:`string`,description:`Outcome disposition`}).option(`status`,{type:`string`,description:`Status`}).option(`query`,{type:`string`,description:`Query`}).option(`customer-status`,{type:`string`,description:`Customer status`}).option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xt={command:`list`,describe:`This endpoint returns information for submissions to made to reclassify emails.`,builder:bt,handler:async e=>{let t={start:e.start,end:e.end,type:e.type,submission_id:e[`submission-id`],original_disposition:e[`original-disposition`],requested_disposition:e[`requested-disposition`],outcome_disposition:e[`outcome-disposition`],status:e.status,query:e.query,customer_status:e[`customer-status`],page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf email-security submissions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email-security/submissions`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.emailSecurity.submissions.list(o,t)),{successLabel:`Loaded`})}},St={command:`submissions`,describe:`User and admin email submissions for classification review`,builder:e=>e.command(xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ct={command:`email-security`,describe:`Cloud email security (Area 1) — investigate threats, manage allow/block policies, and detect phishing`,builder:e=>e.command(U).command(q).command(yt).command(St).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ct as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,T as t,b as n,h as r,t as i,x as a}from"./auth-CQcAgnOy.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-CjcQ6ato.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get`,describe:`Returns the current daily sending quota for the account. Null when the quota is not yet available.`,builder:p,handler:async e=>{if(e.dryRun){l({command:`cf email-sending limits get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email/sending/limits`,pathParams:{},bodyKind:`none`});return}let t=await i(e),n=e.local?f:await r(t);e.accountId=n,c(await u(`Loading`,async()=>t.emailSending.limits.get(n)),{successLabel:`Loaded`})}},h={command:`limits`,describe:`Operations for limits`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`from`,{type:`string`,description:`Sender email address.`}).option(`mime-message`,{type:`string`,description:`The full MIME-encoded email message. Should include standard RFC 5322 headers such as From, To, Subject, and Content-Type. The from and recipients fields in the request body control SMTP envelope routing; the From and To headers in the MIME message control what the recipient's email client displays.`}).option(`recipients`,{type:`string`,array:!0,description:`List of recipient email addresses.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`send-raw`,describe:`Send a raw MIME email`,builder:g,handler:async e=>{if(e.dryRun){l({command:`cf email-sending send-raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email/sending/send_raw`,pathParams:{},bodyKind:`json`,body:{from:e.from,"mime-message":e[`mime-message`],recipients:e.recipients,body:e.body}});return}let n=await i(e),p=e.local?f:await r(n);if(e.accountId=p,e.body){let t=s(e.body);c(await u(`Creating`,async()=>n.post(`/accounts/${p}/email/sending/send_raw`,{body:t})),{successLabel:`Created`});return}if(e.from===void 0&&(e.from=await t(`from`,`Sender email address.`)),e[`mime-message`]===void 0&&(e[`mime-message`]=await t(`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={};e.from!==void 0&&o(m,[`from`],d(e.from,`from`,`text`)),e[`mime-message`]!==void 0&&o(m,[`mime_message`],d(e[`mime-message`],`mime-message`,`text`)),e.recipients!==void 0&&o(m,[`recipients`],e.recipients),c(await u(`Creating`,async()=>n.post(`/accounts/${p}/email/sending/send_raw`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function v(e){return e.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').`}).option(`html`,{type:`string`,description:`HTML body of the email. At least one of text or html must be provided.`}).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').`}).option(`subject`,{type:`string`,description:`Email subject line.`}).option(`text`,{type:`string`,description:`Plain text body of the email. At least one of text or html must be provided.`}).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)`}).implies(`from-address`,[`from-name`]).implies(`from-name`,[`from-address`]).implies(`reply-to-address`,[`reply-to-name`]).implies(`reply-to-name`,[`reply-to-address`])}const y={command:`send`,describe:`Send an email`,builder:v,handler:async e=>{if(e.dryRun){l({command:`cf email-sending send`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/email/sending/send`,pathParams:{},bodyKind:`json`,body:{"from-address":e[`from-address`],"from-name":e[`from-name`],html:e.html,"reply-to-address":e[`reply-to-address`],"reply-to-name":e[`reply-to-name`],subject:e.subject,text:e.text,body:e.body}});return}let n=await i(e),p=e.local?f:await r(n);if(e.accountId=p,e.body){let t=s(e.body);c(await u(`Creating`,async()=>n.post(`/accounts/${p}/email/sending/send`,{body:t})),{successLabel:`Created`});return}e.subject===void 0&&(e.subject=await t(`subject`,`Email subject line.`));let m={};e[`from-address`]!==void 0&&o(m,[`from`,`address`],d(e[`from-address`],`from-address`,`text`)),e[`from-name`]!==void 0&&o(m,[`from`,`name`],d(e[`from-name`],`from-name`,`text`)),e.html!==void 0&&o(m,[`html`],d(e.html,`html`,`text`)),e[`reply-to-address`]!==void 0&&o(m,[`reply_to`,`address`],d(e[`reply-to-address`],`reply-to-address`,`text`)),e[`reply-to-name`]!==void 0&&o(m,[`reply_to`,`name`],d(e[`reply-to-name`],`reply-to-name`,`text`)),e.subject!==void 0&&o(m,[`subject`],d(e.subject,`subject`,`text`)),e.text!==void 0&&o(m,[`text`],d(e.text,`text`,`text`)),c(await u(`Creating`,async()=>n.post(`/accounts/${p}/email/sending/send`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function b(e){return e.option(`name`,{type:`string`,description:`The subdomain name. Must be within the zone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Creates a new sending subdomain or re-enables sending on an existing subdomain that had it disabled. If zone-level Email Sending has not been enabled yet, the zone flag is automatically set when the entitlement is present.`,builder:b,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let r=await i(e);if(e.zoneId=await n({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Creating`,async()=>r.post(`/zones/${e.zoneId}/email/sending/subdomains`,{body:t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`The subdomain name. Must be within the zone.`));let a={};e.name!==void 0&&o(a,[`name`],d(e.name,`name`,`text`)),c(await u(`Creating`,async()=>r.post(`/zones/${e.zoneId}/email/sending/subdomains`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Created`})}};function S(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <subdomain-id>`,describe:`Disables sending on a subdomain and removes its DNS records. If routing is still active on the subdomain, only sending is disabled.`,builder:S,handler:async t=>{if(t.dryRun){l({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 r=await i(t),a=await n({zone:t.zone},r,{quiet:t.quiet});if(t.zoneId=a,!await e({force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}c(await u(`Deleting`,async()=>r.emailSending.subdomains.delete(t[`subdomain-id`],a)),{successLabel:`Deleted`})}};function w(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <subdomain-id>`,describe:`Returns the expected DNS records for a sending subdomain.`,builder:w,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains dns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}/dns`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.emailSending.subdomains.dns.get(e[`subdomain-id`],r)),{successLabel:`Loaded`})}},E={command:`dns`,describe:`Sending subdomain operations`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(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 O={command:`get <subdomain-id>`,describe:`Gets information for a specific sending subdomain.`,builder:D,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.emailSending.subdomains.get(e[`subdomain-id`],r)),{successLabel:`Loaded`})}};function k(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`Lists all sending-enabled subdomains for the zone.`,builder:k,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.emailSending.subdomains.list(r)),{successLabel:`Loaded`})}};function j(e){return e.option(`name`,{type:`string`,description:`The subdomain name. Must be within the zone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const M={command:`preview`,describe:`Returns the DNS records that would be created for a sending subdomain, flags which records are missing, and reports any conflicts with existing DNS records. This is a read-only dry-run — no records are created or modified. Use before or after creating a subdomain to check DNS status.`,builder:j,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/preview`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let r=await i(e);if(e.zoneId=await n({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Loading`,async()=>r.post(`/zones/${e.zoneId}/email/sending/subdomains/preview`,{body:t})),{successLabel:`Loaded`});return}e.name===void 0&&(e.name=await t(`name`,`The subdomain name. Must be within the zone.`));let a={};e.name!==void 0&&o(a,[`name`],d(e.name,`name`,`text`)),c(await u(`Loading`,async()=>r.post(`/zones/${e.zoneId}/email/sending/subdomains/preview`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Loaded`})}},N={command:`subdomains`,describe:`Sending subdomain operations`,builder:e=>e.command(x).command(C).command(O).command(A).command(M).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`email-sending`,describe:`Send emails and manage sending subdomains`,builder:e=>e.command(y).command(_).command(h).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,b as t,t as n}from"./auth-CQcAgnOy.mjs";import{n as r,t as i}from"./body-parser-Br-BoYk-.mjs";import{t as a}from"./output-D7_yAFVR.mjs";import{n as o,t as s}from"./progress-CjcQ6ato.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";function l(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 u={command:`bulk-delete`,describe:`Deletes one or more existing filters.`,builder:l,handler:async r=>{let i={id:r.id};if(r.dryRun){o({command:`cf filters bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},query:i,bodyKind:`none`});return}let c=await n(r),l=await t({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,!await e({force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}a(await s(`Deleting`,async()=>c.filters.bulkDelete(l,i)),{successLabel:`Deleted`})}};function d(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 f={command:`bulk-update`,describe:`Updates one or more existing filters.`,builder:d,handler:async e=>{if(e.dryRun){o({command:`cf filters bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let r=await n(e);if(e.zoneId=await t({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=i(e.body);a(await s(`Updating`,async()=>r.put(`/zones/${e.zoneId}/filters`,{body:t})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function p(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 m={command:`create`,describe:`Creates one or more filters.`,builder:p,handler:async e=>{if(e.dryRun){o({command:`cf filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let r=await n(e);if(e.zoneId=await t({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=i(e.body);a(await s(`Creating`,async()=>r.post(`/zones/${e.zoneId}/filters`,{body:t})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function h(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 g={command:`delete <filter-id>`,describe:`Deletes an existing filter.`,builder:h,handler:async r=>{if(r.dryRun){o({command:`cf filters delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/filters/${r[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(r[`filter-id`]))}`,pathParams:{"filter-id":String(r[`filter-id`]??``),"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=await t({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=c,!await e({force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}a(await s(`Deleting`,async()=>i.filters.delete(r[`filter-id`],c)),{successLabel:`Deleted`})}};function _(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 v={command:`get <filter-id>`,describe:`Fetches the details of a filter.`,builder:_,handler:async e=>{if(e.dryRun){o({command:`cf filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/filters/${e[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(e[`filter-id`]))}`,pathParams:{"filter-id":String(e[`filter-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.filters.get(e[`filter-id`],i)),{successLabel:`Loaded`})}};function y(e){return e.option(`paused`,{type:`string`,description:`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 b={command:`list`,describe:`Fetches filters in a zone. You can filter the results using several optional parameters.`,builder:y,handler:async e=>{let r={paused:e.paused,expression:e.expression,description:e.description,ref:e.ref,page:e.page,per_page:e[`per-page`],id:e.id};if(e.dryRun){o({command:`cf filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:r,bodyKind:`none`});return}let i=await n(e),c=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading`,async()=>i.filters.list(c,r)),{successLabel:`Loaded`})}};function x(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 S={command:`update <filter-id>`,describe:`Updates an existing filter.`,builder:x,handler:async e=>{if(e.dryRun){o({command:`cf filters update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/filters/${e[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(e[`filter-id`]))}`,pathParams:{"filter-id":String(e[`filter-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{description:e.description,expression:e.expression,paused:e.paused,ref:e.ref,body:e.body}});return}let l=await n(e);if(e.zoneId=await t({zone:e.zone},l,{quiet:e.quiet}),e.body){let t=i(e.body);a(await s(`Updating`,async()=>l.put(`/zones/${e.zoneId}/filters/${encodeURIComponent(String(e[`filter-id`]))}`,{body:t})),{successLabel:`Updated`});return}let u={};e.description!==void 0&&r(u,[`description`],c(e.description,`description`,`text`)),e.expression!==void 0&&r(u,[`expression`],c(e.expression,`expression`,`text`)),e.paused!==void 0&&r(u,[`paused`],e.paused),e.ref!==void 0&&r(u,[`ref`],c(e.ref,`ref`,`text`)),a(await s(`Updating`,async()=>l.put(`/zones/${e.zoneId}/filters/${encodeURIComponent(String(e[`filter-id`]))}`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}},C={command:`filters`,describe:`Filter expressions used by legacy firewall rules to match requests — prefer Rulesets for new configurations`,builder:e=>e.command(u).command(f).command(m).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{C as default};
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,b as t,h as n,t as r,w as i,x as a}from"./auth-CQcAgnOy.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-CjcQ6ato.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`create`,describe:`Creates a new IP Access rule for an account. The rule will apply to all zones in the account. Note: To create an IP Access rule that applies to a single zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.`,builder:p,handler:async e=>{if(e.dryRun){l({command:`cf firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:{"configuration-target":e[`configuration-target`],"configuration-value":e[`configuration-value`],mode:e.mode,body:e.body}});return}let t=await r(e),p=e.local?f:await n(t);if(e.accountId=p,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${p}/firewall/access_rules/rules`,{body:n})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await i(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m={};e[`configuration-target`]!==void 0&&o(m,[`configuration`,`target`],d(e[`configuration-target`],`configuration-target`,`text`)),e[`configuration-value`]!==void 0&&o(m,[`configuration`,`value`],d(e[`configuration-value`],`configuration-value`,`text`)),e.mode!==void 0&&o(m,[`mode`],d(e.mode,`mode`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${p}/firewall/access_rules/rules`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function ee(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`delete <rule-id>`,describe:`Deletes an existing IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:ee,handler:async t=>{if(t.dryRun){l({command:`cf firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`json`,body:{body:t.body}});return}let i=await r(t),o=t.local?f:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=s(t.body);c(await u(`Deleting`,async()=>i.delete(`/accounts/${o}/firewall/access_rules/rules/${encodeURIComponent(String(t[`rule-id`]))}`,{body:e})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i.firewall.accessRules.delete(t[`rule-id`],o)),{successLabel:`Deleted`})}};function h(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`edit <rule-id>`,describe:`Updates an IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:h,handler:async e=>{if(e.dryRun){l({command:`cf firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:{"configuration-target":e[`configuration-target`],"configuration-value":e[`configuration-value`],mode:e.mode,notes:e.notes,body:e.body}});return}let t=await r(e),p=e.local?f:await n(t);if(e.accountId=p,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${p}/firewall/access_rules/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:n})),{successLabel:`Updated`});return}e.mode===void 0&&(e.mode=await i(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m={};e[`configuration-target`]!==void 0&&o(m,[`configuration`,`target`],d(e[`configuration-target`],`configuration-target`,`text`)),e[`configuration-value`]!==void 0&&o(m,[`configuration`,`value`],d(e[`configuration-value`],`configuration-value`,`text`)),e.mode!==void 0&&o(m,[`mode`],d(e.mode,`mode`,`text`)),e.notes!==void 0&&o(m,[`notes`],d(e.notes,`notes`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${p}/firewall/access_rules/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}};function _(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <rule-id>`,describe:`Fetches the details of an IP Access rule defined at the account level.`,builder:_,handler:async e=>{if(e.dryRun){l({command:`cf firewall access-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?f:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.firewall.accessRules.get(e[`rule-id`],i)),{successLabel:`Loaded`})}};function y(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`Defines the target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"Defines the target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`Defines the string to search for in the notes of existing IP Access rules.
4
- Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Fetches IP Access rules of an account. These rules apply to all the zones in the account. You can filter the results using several optional parameters.`,builder:y,handler:async e=>{let t={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){l({command:`cf firewall access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?f:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.firewall.accessRules.list(o,t)),{successLabel:`Loaded`})}},x={command:`access-rules`,describe:`IP-based access rules that allow, block, challenge, or whitelist traffic globally or per-zone`,builder:e=>e.command(m).command(te).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`create`,describe:`Creates a new Zone Lockdown rule.`,builder:S,handler:async e=>{if(e.dryRun){l({command:`cf firewall lockdowns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{description:e.description,paused:e.paused,priority:e.priority,urls:e.urls,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/lockdowns`,{body:t})),{successLabel:`Created`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i={};e.description!==void 0&&o(i,[`description`],d(e.description,`description`,`text`)),e.paused!==void 0&&o(i,[`paused`],e.paused),e.priority!==void 0&&o(i,[`priority`],e.priority),e.urls!==void 0&&o(i,[`urls`],e.urls),c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/lockdowns`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`})}};function w(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`delete <lock-downs-id>`,describe:`Deletes an existing Zone Lockdown rule.`,builder:w,handler:async n=>{if(n.dryRun){l({command:`cf firewall lockdowns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/firewall/lockdowns/${n[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(n[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(n[`lock-downs-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:{body:n.body}});return}let i=await r(n),a=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=a,!await e({force:!!n.force})){process.stderr.write(`Aborted.
5
- `);return}if(n.body){let e=s(n.body);c(await u(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/firewall/lockdowns/${encodeURIComponent(String(n[`lock-downs-id`]))}`,{body:e})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i.firewall.lockdowns.delete(n[`lock-downs-id`],a)),{successLabel:`Deleted`})}};function E(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <lock-downs-id>`,describe:`Fetches the details of a Zone Lockdown rule.`,builder:E,handler:async e=>{if(e.dryRun){l({command:`cf firewall lockdowns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.firewall.lockdowns.get(e[`lock-downs-id`],i)),{successLabel:`Loaded`})}};function O(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`Description`}).option(`modified-on`,{type:`string`,description:`Modified on`}).option(`ip`,{type:`string`,description:`Ip`}).option(`priority`,{type:`string`,description:`Priority`}).option(`uri-search`,{type:`string`,description:`Uri search`}).option(`ip-range-search`,{type:`string`,description:`Ip range search`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`created-on`,{type:`string`,description:`The timestamp of when the rule was created.`}).option(`description-search`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`ip-search`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Fetches Zone Lockdown rules. You can filter the results using several optional parameters.`,builder:O,handler:async e=>{let n={page:e.page,description:e.description,modified_on:e[`modified-on`],ip:e.ip,priority:e.priority,uri_search:e[`uri-search`],ip_range_search:e[`ip-range-search`],per_page:e[`per-page`],created_on:e[`created-on`],description_search:e[`description-search`],ip_search:e[`ip-search`]};if(e.dryRun){l({command:`cf firewall lockdowns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.lockdowns.list(a,n)),{successLabel:`Loaded`})}};function A(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const j={command:`update <lock-downs-id>`,describe:`Updates an existing Zone Lockdown rule.`,builder:A,handler:async e=>{if(e.dryRun){l({command:`cf firewall lockdowns update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{urls:e.urls,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/lockdowns/${encodeURIComponent(String(e[`lock-downs-id`]))}`,{body:t})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i={};e.urls!==void 0&&o(i,[`urls`],e.urls),c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/lockdowns/${encodeURIComponent(String(e[`lock-downs-id`]))}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},M={command:`lockdowns`,describe:`Zone lockdown rules that restrict access to URLs by IP address or range`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(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 P={command:`bulk-delete`,describe:`Deletes existing firewall rules.`,builder:N,handler:async n=>{if(n.dryRun){l({command:`cf firewall rules bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:{body:n.body}});return}let i=await r(n),a=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=a,!await e({force:!!n.force})){process.stderr.write(`Aborted.
6
- `);return}if(n.body){let e=s(n.body);c(await u(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/firewall/rules`,{body:e})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i.firewall.rules.bulkDelete(a)),{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 I={command:`bulk-edit`,describe:`Updates the priority of existing firewall rules.`,builder:F,handler:async e=>{if(e.dryRun){l({command:`cf firewall rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/firewall/rules`,{body:t})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.firewall.rules.bulkEdit(i)),{successLabel:`Updated`})}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`bulk-update`,describe:`Updates one or more existing firewall rules.`,builder:L,handler:async e=>{if(e.dryRun){l({command:`cf firewall rules bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/rules`,{body:t})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.firewall.rules.bulkUpdate(i)),{successLabel:`Updated`})}};function z(e){return e.option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`create`,describe:`Create one or more firewall rules.`,builder:z,handler:async e=>{if(e.dryRun){l({command:`cf firewall rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"filter-description":e[`filter-description`],"filter-expression":e[`filter-expression`],"filter-paused":e[`filter-paused`],"filter-ref":e[`filter-ref`],body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/rules`,{body:t})),{successLabel:`Created`});return}let i={};e[`filter-description`]!==void 0&&o(i,[`filter`,`description`],d(e[`filter-description`],`filter-description`,`text`)),e[`filter-expression`]!==void 0&&o(i,[`filter`,`expression`],d(e[`filter-expression`],`filter-expression`,`text`)),e[`filter-paused`]!==void 0&&o(i,[`filter`,`paused`],e[`filter-paused`]),e[`filter-ref`]!==void 0&&o(i,[`filter`,`ref`],d(e[`filter-ref`],`filter-ref`,`text`)),c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/rules`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`})}};function V(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`delete-filter-if-unused`,{type:`boolean`,description:`When true, indicates that Cloudflare should also delete the associated filter if there are no other firewall rules referencing the filter.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const H={command:`delete <rule-id>`,describe:`Deletes an existing firewall rule.`,builder:V,handler:async n=>{if(n.dryRun){l({command:`cf firewall rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/firewall/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:{"delete-filter-if-unused":n[`delete-filter-if-unused`],body:n.body}});return}let i=await r(n);if(n.zoneId=await t({zone:n.zone},i,{quiet:n.quiet}),!await e({force:!!n.force})){process.stderr.write(`Aborted.
7
- `);return}if(n.body){let e=s(n.body);c(await u(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/firewall/rules/${encodeURIComponent(String(n[`rule-id`]))}`,{body:e})),{successLabel:`Deleted`});return}let a={};n[`delete-filter-if-unused`]!==void 0&&o(a,[`delete_filter_if_unused`],n[`delete-filter-if-unused`]),c(await u(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/firewall/rules/${encodeURIComponent(String(n[`rule-id`]))}`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function U(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`edit <rule-id>`,describe:`Updates the priority of an existing firewall rule.`,builder:U,handler:async e=>{if(e.dryRun){l({command:`cf firewall rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{body:e.body}});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/firewall/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:t})),{successLabel:`Updated`});return}c(await u(`Updating`,async()=>n.firewall.rules.edit(e[`rule-id`],i)),{successLabel:`Updated`})}};function G(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`id`,{type:`string`,description:`ID`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const K={command:`get <rule-id>`,describe:`Fetches the details of a firewall rule.`,builder:G,handler:async e=>{let n={id:e.id};if(e.dryRun){l({command:`cf firewall rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.rules.get(e[`rule-id`],a,n)),{successLabel:`Loaded`})}};function q(e){return e.option(`description`,{type:`string`,description:`A case-insensitive string to find in the description.`}).option(`action`,{type:`string`,description:`The action to search for. Must be an exact match.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of firewall rules per page.`}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the firewall rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`Fetches firewall rules in a zone. You can filter the results using several optional parameters.`,builder:q,handler:async e=>{let n={description:e.description,action:e.action,page:e.page,per_page:e[`per-page`],id:e.id,paused:e.paused};if(e.dryRun){l({command:`cf firewall rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.rules.list(a,n)),{successLabel:`Loaded`})}};function Y(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const X={command:`update <rule-id>`,describe:`Updates an existing firewall rule.`,builder:Y,handler:async e=>{if(e.dryRun){l({command:`cf firewall rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"filter-description":e[`filter-description`],"filter-expression":e[`filter-expression`],"filter-paused":e[`filter-paused`],"filter-ref":e[`filter-ref`],body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:t})),{successLabel:`Updated`});return}let i={};e[`filter-description`]!==void 0&&o(i,[`filter`,`description`],d(e[`filter-description`],`filter-description`,`text`)),e[`filter-expression`]!==void 0&&o(i,[`filter`,`expression`],d(e[`filter-expression`],`filter-expression`,`text`)),e[`filter-paused`]!==void 0&&o(i,[`filter`,`paused`],e[`filter-paused`]),e[`filter-ref`]!==void 0&&o(i,[`filter`,`ref`],d(e[`filter-ref`],`filter-ref`,`text`)),c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},Z={command:`rules`,describe:`Legacy firewall rules with filter expressions — prefer Rulesets for new configurations`,builder:e=>e.command(P).command(I).command(R).command(B).command(H).command(W).command(K).command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ua` when specifying a user agent in the rule.",choices:[`ua`]}).option(`configuration-value`,{type:`string`,description:`the user agent to exactly match`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ne={command:`create`,describe:`Creates a new User Agent Blocking rule in a zone.`,builder:Q,handler:async e=>{if(e.dryRun){l({command:`cf firewall ua-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"configuration-target":e[`configuration-target`],"configuration-value":e[`configuration-value`],description:e.description,mode:e.mode,paused:e.paused,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/ua_rules`,{body:t})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await i(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a={};e[`configuration-target`]!==void 0&&o(a,[`configuration`,`target`],d(e[`configuration-target`],`configuration-target`,`text`)),e[`configuration-value`]!==void 0&&o(a,[`configuration`,`value`],d(e[`configuration-value`],`configuration-value`,`text`)),e.description!==void 0&&o(a,[`description`],d(e.description,`description`,`text`)),e.mode!==void 0&&o(a,[`mode`],d(e.mode,`mode`,`text`)),e.paused!==void 0&&o(a,[`paused`],e.paused),c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/ua_rules`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Created`})}};function re(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`delete <ua-rule-id>`,describe:`Deletes an existing User Agent Blocking rule.`,builder:re,handler:async n=>{if(n.dryRun){l({command:`cf firewall ua-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/firewall/ua_rules/${n[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(n[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(n[`ua-rule-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:{body:n.body}});return}let i=await r(n),a=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=a,!await e({force:!!n.force})){process.stderr.write(`Aborted.
8
- `);return}if(n.body){let e=s(n.body);c(await u(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/firewall/ua_rules/${encodeURIComponent(String(n[`ua-rule-id`]))}`,{body:e})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i.firewall.uaRules.delete(n[`ua-rule-id`],a)),{successLabel:`Deleted`})}};function ae(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`get <ua-rule-id>`,describe:`Fetches the details of a User Agent Blocking rule.`,builder:ae,handler:async e=>{if(e.dryRun){l({command:`cf firewall ua-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.firewall.uaRules.get(e[`ua-rule-id`],i)),{successLabel:`Loaded`})}};function se(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`Description`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`user-agent`,{type:`string`,description:`A string to search for in the user agent values of existing rules.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`list`,describe:`Fetches User Agent Blocking rules in a zone. You can filter the results using several optional parameters.`,builder:se,handler:async e=>{let n={page:e.page,description:e.description,per_page:e[`per-page`],user_agent:e[`user-agent`],paused:e.paused};if(e.dryRun){l({command:`cf firewall ua-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.uaRules.list(a,n)),{successLabel:`Loaded`})}};function le(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`update <ua-rule-id>`,describe:`Updates an existing User Agent Blocking rule.`,builder:le,handler:async e=>{if(e.dryRun){l({command:`cf firewall ua-rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"configuration-target":e[`configuration-target`],"configuration-value":e[`configuration-value`],description:e.description,mode:e.mode,paused:e.paused,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/ua_rules/${encodeURIComponent(String(e[`ua-rule-id`]))}`,{body:t})),{successLabel:`Updated`});return}e.mode===void 0&&(e.mode=await i(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a={};e[`configuration-target`]!==void 0&&o(a,[`configuration`,`target`],d(e[`configuration-target`],`configuration-target`,`text`)),e[`configuration-value`]!==void 0&&o(a,[`configuration`,`value`],d(e[`configuration-value`],`configuration-value`,`text`)),e.description!==void 0&&o(a,[`description`],d(e.description,`description`,`text`)),e.mode!==void 0&&o(a,[`mode`],d(e.mode,`mode`,`text`)),e.paused!==void 0&&o(a,[`paused`],e.paused),c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/ua_rules/${encodeURIComponent(String(e[`ua-rule-id`]))}`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Updated`})}},de={command:`ua-rules`,describe:`Block or challenge requests based on the User-Agent header string`,builder:e=>e.command(ne).command(ie).command(oe).command(ce).command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fe(e){return e.option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const pe={command:`create`,describe:`Creates a URI-based WAF override for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:fe,handler:async e=>{if(e.dryRun){l({command:`cf firewall waf overrides create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{urls:e.urls,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/waf/overrides`,{body:t})),{successLabel:`Created`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i={};e.urls!==void 0&&o(i,[`urls`],e.urls),c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/waf/overrides`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Created`})}};function me(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const he={command:`delete <overrides-id>`,describe:`Deletes an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:me,handler:async n=>{if(n.dryRun){l({command:`cf firewall waf overrides delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/firewall/waf/overrides/${n[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(n[`overrides-id`]))}`,pathParams:{"overrides-id":String(n[`overrides-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:{body:n.body}});return}let i=await r(n),a=await t({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=a,!await e({force:!!n.force})){process.stderr.write(`Aborted.
9
- `);return}if(n.body){let e=s(n.body);c(await u(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/firewall/waf/overrides/${encodeURIComponent(String(n[`overrides-id`]))}`,{body:e})),{successLabel:`Deleted`});return}c(await u(`Deleting`,async()=>i.firewall.waf.overrides.delete(n[`overrides-id`],a)),{successLabel:`Deleted`})}};function ge(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _e={command:`get <overrides-id>`,describe:`Fetches the details of a URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ge,handler:async e=>{if(e.dryRun){l({command:`cf firewall waf overrides get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.firewall.waf.overrides.get(e[`overrides-id`],i)),{successLabel:`Loaded`})}};function ve(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of WAF overrides per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`list`,describe:`Fetches the URI-based WAF overrides in a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ve,handler:async e=>{let n={page:e.page,per_page:e[`per-page`]};if(e.dryRun){l({command:`cf firewall waf overrides list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.waf.overrides.list(a,n)),{successLabel:`Loaded`})}};function be(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const xe={command:`update <overrides-id>`,describe:`Updates an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:be,handler:async e=>{if(e.dryRun){l({command:`cf firewall waf overrides update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{urls:e.urls,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/waf/overrides/${encodeURIComponent(String(e[`overrides-id`]))}`,{body:t})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i={};e.urls!==void 0&&o(i,[`urls`],e.urls),c(await u(`Updating`,async()=>n.put(`/zones/${e.zoneId}/firewall/waf/overrides/${encodeURIComponent(String(e[`overrides-id`]))}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}},Se={command:`overrides`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(pe).command(he).command(_e).command(ye).command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(e){return e.positional(`package-id`,{type:`string`,description:`Defines a package identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`get <package-id>`,describe:`Fetches the details of a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Ce,handler:async e=>{if(e.dryRun){l({command:`cf firewall waf packages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.firewall.waf.packages.get(e[`package-id`],i)),{successLabel:`Loaded`})}};function Te(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ee={command:`edit <group-id>`,describe:"Updates a WAF rule group. You can update the state (`mode` parameter) of a rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).",builder:Te,handler:async e=>{if(e.dryRun){l({command:`cf firewall waf packages groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{mode:e.mode,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/firewall/waf/packages/${encodeURIComponent(String(e[`package-id`]))}/groups/${encodeURIComponent(String(e[`group-id`]))}`,{body:t})),{successLabel:`Updated`});return}let i={};e.mode!==void 0&&o(i,[`mode`],d(e.mode,`mode`,`text`)),c(await u(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/firewall/waf/packages/${encodeURIComponent(String(e[`package-id`]))}/groups/${encodeURIComponent(String(e[`group-id`]))}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}};function De(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Oe={command:`get <group-id>`,describe:`Fetches the details of a WAF rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:De,handler:async e=>{if(e.dryRun){l({command:`cf firewall waf packages groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.firewall.waf.packages.groups.get(e[`group-id`],e[`package-id`],i)),{successLabel:`Loaded`})}};function ke(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Mode`}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rule groups per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rule groups.`,choices:[`mode`,`rules_count`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rule groups.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the condition for search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`Defines the name of the rule group.`}).option(`rules-count`,{type:`number`,description:`Defines the number of rules in the current rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`list`,describe:`Fetches the WAF rule groups in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ke,handler:async e=>{let n={mode:e.mode,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name,rules_count:e[`rules-count`]};if(e.dryRun){l({command:`cf firewall waf packages groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.waf.packages.groups.list(e[`package-id`],a,n)),{successLabel:`Loaded`})}},je={command:`groups`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Ee).command(Oe).command(Ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Me(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of packages per page.`}).option(`order`,{type:`string`,description:`The field used to sort returned packages.`,choices:[`name`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned packages.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`The name of the WAF package.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ne={command:`list`,describe:`Fetches WAF packages for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Me,handler:async e=>{let n={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name};if(e.dryRun){l({command:`cf firewall waf packages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.waf.packages.list(a,n)),{successLabel:`Loaded`})}};function Pe(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the mode/action of the rule when triggered. You must use a value from the `allowed_modes` array of the current rule.",choices:[`default`,`disable`,`simulate`,`block`,`challenge`,`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Fe={command:`edit <rule-id>`,describe:`Updates a WAF rule. You can only update the mode/action of the rule. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Pe,handler:async e=>{if(e.dryRun){l({command:`cf firewall waf packages rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{mode:e.mode,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/firewall/waf/packages/${encodeURIComponent(String(e[`package-id`]))}/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:t})),{successLabel:`Updated`});return}let i={};e.mode!==void 0&&o(i,[`mode`],d(e.mode,`mode`,`text`)),c(await u(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/firewall/waf/packages/${encodeURIComponent(String(e[`package-id`]))}/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}};function Ie(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Le={command:`get <rule-id>`,describe:`Fetches the details of a WAF rule in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Ie,handler:async e=>{if(e.dryRun){l({command:`cf firewall waf packages rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,c(await u(`Loading`,async()=>n.firewall.waf.packages.rules.get(e[`rule-id`],e[`package-id`],i)),{successLabel:`Loaded`})}};function Re(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Defines the action/mode a rule has been overridden to perform.`,choices:[`DIS`,`CHL`,`BLK`,`SIM`]}).option(`group-id`,{type:`string`,description:`Group ID`}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rules per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`priority`,`group_id`,`description`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`description`,{type:`string`,description:`Defines the public description of the WAF rule.`}).option(`priority`,{type:`string`,description:`Defines the order in which the individual WAF rule is executed within its rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`list`,describe:`Fetches WAF rules in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Re,handler:async e=>{let n={mode:e.mode,group_id:e[`group-id`],page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,description:e.description,priority:e.priority};if(e.dryRun){l({command:`cf firewall waf packages rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.waf.packages.rules.list(e[`package-id`],a,n)),{successLabel:`Loaded`})}},Be={command:`rules`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Fe).command(Le).command(ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ve={command:`packages`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(we).command(Ne).command(je).command(Be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$={command:`waf`,describe:`Operations for waf`,builder:e=>e.command(Se).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function He(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ue={command:`create`,describe:`Creates a new IP Access rule for a zone. Note: To create an IP Access rule that applies to multiple zones, refer to [IP Access rules for a user](#ip-access-rules-for-a-user) or [IP Access rules for an account](#ip-access-rules-for-an-account) as appropriate.`,builder:He,handler:async e=>{if(e.dryRun){l({command:`cf firewall zone-access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{"configuration-target":e[`configuration-target`],"configuration-value":e[`configuration-value`],mode:e.mode,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/access_rules/rules`,{body:t})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await i(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a={};e[`configuration-target`]!==void 0&&o(a,[`configuration`,`target`],d(e[`configuration-target`],`configuration-target`,`text`)),e[`configuration-value`]!==void 0&&o(a,[`configuration`,`value`],d(e[`configuration-value`],`configuration-value`,`text`)),e.mode!==void 0&&o(a,[`mode`],d(e.mode,`mode`,`text`)),c(await u(`Creating`,async()=>n.post(`/zones/${e.zoneId}/firewall/access_rules/rules`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Created`})}};function We(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`cascade`,{type:`string`,description:"The level to attempt to delete similar rules defined for other zones with the same owner. The default value is `none`, which will only delete the current rule. Using `basic` will delete rules that match the same action (mode) and configuration, while using `aggressive` will delete rules that match the same configuration.",choices:[`none`,`basic`,`aggressive`],default:`none`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ge={command:`delete <rule-id>`,describe:"Deletes an IP Access rule defined at the zone level. Optionally, you can use the `cascade` property to specify that you wish to delete similar rules in other zones managed by the same zone owner.",builder:We,handler:async n=>{if(n.dryRun){l({command:`cf firewall zone-access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/firewall/access_rules/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"rule-id":String(n[`rule-id`]??``)},bodyKind:`json`,body:{cascade:n.cascade,body:n.body}});return}let i=await r(n);if(n.zoneId=await t({zone:n.zone},i,{quiet:n.quiet}),!await e({force:!!n.force})){process.stderr.write(`Aborted.
10
- `);return}if(n.body){let e=s(n.body);c(await u(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/firewall/access_rules/rules/${encodeURIComponent(String(n[`rule-id`]))}`,{body:e})),{successLabel:`Deleted`});return}let a={};n.cascade!==void 0&&o(a,[`cascade`],d(n.cascade,`cascade`,`text`)),c(await u(`Deleting`,async()=>i.delete(`/zones/${n.zoneId}/firewall/access_rules/rules/${encodeURIComponent(String(n[`rule-id`]))}`,{body:Object.keys(a).length>0?a:void 0})),{successLabel:`Deleted`})}};function Ke(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qe={command:`edit <rule-id>`,describe:"Updates an IP Access rule defined at the zone level. You can only update the rule action (`mode` parameter) and notes.",builder:Ke,handler:async e=>{if(e.dryRun){l({command:`cf firewall zone-access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:{mode:e.mode,notes:e.notes,body:e.body}});return}let n=await r(e);if(e.zoneId=await t({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/firewall/access_rules/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:t})),{successLabel:`Updated`});return}let i={};e.mode!==void 0&&o(i,[`mode`],d(e.mode,`mode`,`text`)),e.notes!==void 0&&o(i,[`notes`],d(e.notes,`notes`,`text`)),c(await u(`Updating`,async()=>n.patch(`/zones/${e.zoneId}/firewall/access_rules/rules/${encodeURIComponent(String(e[`rule-id`]))}`,{body:Object.keys(i).length>0?i:void 0})),{successLabel:`Updated`})}};function Je(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`The target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`The string to search for in the notes of existing IP Access rules.
11
- Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}).option(`order`,{type:`string`,description:`The field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ye={command:`list`,describe:`Fetches IP Access rules of a zone. You can filter the results using several optional parameters.`,builder:Je,handler:async e=>{let n={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){l({command:`cf firewall zone-access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading`,async()=>i.firewall.zoneAccessRules.list(a,n)),{successLabel:`Loaded`})}},Xe={command:`zone-access-rules`,describe:`Zone-scoped IP access rules for blocking or allowing traffic`,builder:e=>e.command(Ue).command(Ge).command(qe).command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ze={command:`firewall`,describe:`Legacy firewall rules, zone lockdowns, access rules, user-agent blocking, and WAF packages`,builder:e=>e.command(x).command(M).command(Z).command(de).command($).command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ze as default};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import{b as e,t}from"./auth-CQcAgnOy.mjs";import{n,t as r}from"./body-parser-Br-BoYk-.mjs";import{t as i}from"./output-D7_yAFVR.mjs";import{n as a,t as o}from"./progress-CjcQ6ato.mjs";import{n as s}from"./input-validation-zEO81MWN.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`Retrieve Fraud Detection settings for a zone.`,builder:c,handler:async n=>{if(n.dryRun){a({command:`cf fraud get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/fraud_detection/settings`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.fraud.get(s)),{successLabel:`Loaded`})}};function u(e){return e.option(`user-profiles`,{type:`string`,description:`Whether Fraud User Profiles is enabled for the zone.`,choices:[`enabled`,`disabled`]}).option(`username-expressions`,{type:`string`,array:!0,description:`List of expressions to detect usernames in write HTTP requests.
3
-
4
- - Maximum of 10 expressions.
5
- - Omit or set to null to leave unchanged on update.
6
- - Provide an empty array \`[]\` to clear all expressions on update.
7
- - Invalid expressions will result in a 10400 Bad Request with details in the \`messages\` array.
8
- `}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`update`,describe:"Update Fraud Detection settings for a zone. Notes on `username_expressions` behavior: - If omitted or set to null, expressions are not modified. - If provided as an empty array `[]`, all expressions will be cleared.",builder:u,handler:async c=>{if(c.dryRun){a({command:`cf fraud update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/fraud_detection/settings`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:{"user-profiles":c[`user-profiles`],"username-expressions":c[`username-expressions`],body:c.body}});return}let l=await t(c);if(c.zoneId=await e({zone:c.zone},l,{quiet:c.quiet}),c.body){let e=r(c.body);i(await o(`Updating`,async()=>l.put(`/zones/${c.zoneId}/fraud_detection/settings`,{body:e})),{successLabel:`Updated`});return}let u={};c[`user-profiles`]!==void 0&&n(u,[`user_profiles`],s(c[`user-profiles`],`user-profiles`,`text`)),c[`username-expressions`]!==void 0&&n(u,[`username_expressions`],c[`username-expressions`]),i(await o(`Updating`,async()=>l.put(`/zones/${c.zoneId}/fraud_detection/settings`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}},f={command:`fraud`,describe:`Fraud detection for login and signup flows — identify credential stuffing, account takeover, and fake accounts`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{T as e,b as t,t as n}from"./auth-CQcAgnOy.mjs";import{n as r,t as i}from"./body-parser-Br-BoYk-.mjs";import{t as a}from"./output-D7_yAFVR.mjs";import{n as o,t as s}from"./progress-CjcQ6ato.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Gets the Google Tag Gateway configuration for a zone.`,builder:l,handler:async e=>{if(e.dryRun){o({command:`cf google-tag-gateway config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.googleTagGateway.config.get(i)),{successLabel:`Loaded`})}};function d(e){return e.option(`enabled`,{type:`boolean`,description:`Enables or disables Google Tag Gateway for this zone.`}).option(`endpoint`,{type:`string`,description:`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`}).option(`hide-original-ip`,{type:`boolean`,description:`Hides the original client IP address from Google when enabled.`}).option(`measurement-id`,{type:`string`,description:`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`}).option(`set-up-tag`,{type:`boolean`,description:`Set up the associated Google Tag on the zone automatically when enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Google Tag Gateway configuration for a zone.`})}const f={command:`update`,describe:`Updates the Google Tag Gateway configuration for a zone.`,builder:d,handler:async l=>{if(l.dryRun){o({command:`cf google-tag-gateway config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:{enabled:l.enabled,endpoint:l.endpoint,"hide-original-ip":l[`hide-original-ip`],"measurement-id":l[`measurement-id`],"set-up-tag":l[`set-up-tag`],body:l.body}});return}let u=await n(l);if(l.zoneId=await t({zone:l.zone},u,{quiet:l.quiet}),l.body){let e=i(l.body);a(await s(`Updating`,async()=>u.put(`/zones/${l.zoneId}/settings/google-tag-gateway/config`,{body:e})),{successLabel:`Updated`});return}if(l.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);if(l.endpoint===void 0&&(l.endpoint=await e(`endpoint`,`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`)),l[`hide-original-ip`]===void 0)throw Error(`--hide-original-ip is required (or pass --body with this field set).`);l[`measurement-id`]===void 0&&(l[`measurement-id`]=await e(`measurement-id`,`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`));let d={};l.enabled!==void 0&&r(d,[`enabled`],l.enabled),l.endpoint!==void 0&&r(d,[`endpoint`],c(l.endpoint,`endpoint`,`text`)),l[`hide-original-ip`]!==void 0&&r(d,[`hideOriginalIp`],l[`hide-original-ip`]),l[`measurement-id`]!==void 0&&r(d,[`measurementId`],c(l[`measurement-id`],`measurement-id`,`text`)),l[`set-up-tag`]!==void 0&&r(d,[`setUpTag`],l[`set-up-tag`]),a(await s(`Updating`,async()=>u.put(`/zones/${l.zoneId}/settings/google-tag-gateway/config`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}},p={command:`config`,describe:`Google Tag Gateway config operations`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`google-tag-gateway`,describe:`Google Tag Gateway operations`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};