cf 0.0.6 → 0.2.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 (276) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +89 -89
  4. package/dist/_meta/commands.json +12866 -4982
  5. package/dist/_meta/schemas.json +33572 -1148
  6. package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
  7. package/dist/accounts-BopMfODC.mjs +21 -0
  8. package/dist/acm-BT4vlnEJ.mjs +3 -0
  9. package/dist/addressing-B3uFxHst.mjs +13 -0
  10. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  11. package/dist/ai-DWHqwMap.mjs +2 -0
  12. package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
  13. package/dist/ai-search-VnOQ5n--.mjs +7 -0
  14. package/dist/alerting-BmmgIlIO.mjs +6 -0
  15. package/dist/analytics-isY03taL.mjs +20 -0
  16. package/dist/api-gateway-DXurEbA-.mjs +33 -0
  17. package/dist/argo-B02BL_hp.mjs +2 -0
  18. package/dist/audit-logs-DcgR9xUc.mjs +2 -0
  19. package/dist/auth-CQcAgnOy.mjs +135 -0
  20. package/dist/auth-DenWm_X0.mjs +6 -0
  21. package/dist/autorag-CmrwnGVj.mjs +2 -0
  22. package/dist/billing-CaW1ZAB1.mjs +2 -0
  23. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  24. package/dist/bot-management-CeBsFx68.mjs +5 -0
  25. package/dist/botnet-feed-B396vQeQ.mjs +3 -0
  26. package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
  27. package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
  28. package/dist/build-5jmmOZhm.mjs +1054 -0
  29. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  30. package/dist/cache-DmXizSMi.mjs +5 -0
  31. package/dist/calls-x4KQpTB4.mjs +4 -0
  32. package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
  33. package/dist/chunk-DH-VkVmc.mjs +2 -0
  34. package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
  35. package/dist/cloud-connector-BClQpEzI.mjs +2 -0
  36. package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
  37. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  38. package/dist/config-DYzlVxcB.mjs +2 -0
  39. package/dist/connectivity-G0NP6LtW.mjs +3 -0
  40. package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
  41. package/dist/context-CC0Rhkhy.mjs +2 -0
  42. package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
  43. package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
  44. package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
  45. package/dist/custom-pages-D-oErw57.mjs +4 -0
  46. package/dist/d1-C95ckPKI.mjs +3 -0
  47. package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
  48. package/dist/delegate.mjs +2 -0
  49. package/dist/deploy-DbkiIzUr.mjs +2 -0
  50. package/dist/dev-C6iSuQZm.mjs +6 -0
  51. package/dist/diagnostics-DEEhPnXj.mjs +3 -0
  52. package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
  53. package/dist/dist-CnSubA1Z.mjs +82 -0
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
  56. package/dist/dns-qW-3TZOT.mjs +29 -0
  57. package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
  58. package/dist/email-routing-tdNJaCpJ.mjs +10 -0
  59. package/dist/email-security-DTVHNr2h.mjs +60 -0
  60. package/dist/email-sending-DsFTvE31.mjs +3 -0
  61. package/dist/filters-DO1Is_tI.mjs +4 -0
  62. package/dist/firewall-DbUhVTCg.mjs +11 -0
  63. package/dist/fraud-Bzr4njYb.mjs +8 -0
  64. package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
  65. package/dist/healthchecks-BBAs-lS_.mjs +4 -0
  66. package/dist/hostnames-Dz9PEUKS.mjs +3 -0
  67. package/dist/hyperdrive-B1iUJddG.mjs +18 -0
  68. package/dist/iam-CJM8gHpG.mjs +6 -0
  69. package/dist/images-DEoBmtFS.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/input-validation-zEO81MWN.mjs +2 -0
  72. package/dist/intel-BM6xkZ0C.mjs +3 -0
  73. package/dist/ips-B8fwxKZD.mjs +2 -0
  74. package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
  75. package/dist/kv-BTceLtWZ.mjs +5 -0
  76. package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
  77. package/dist/lib-Eu1wXxuh.mjs +68 -0
  78. package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
  79. package/dist/local-VJaJ3BZ1.mjs +2 -0
  80. package/dist/logpush-CSYhgevA.mjs +4 -0
  81. package/dist/logs-DlIwmMpt.mjs +3 -0
  82. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
  83. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
  84. package/dist/magic-transit-qQmA-981.mjs +89 -0
  85. package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
  86. package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
  87. package/dist/network-interconnects-CxG2deY0.mjs +36 -0
  88. package/dist/organizations-DyEAiGiR.mjs +41 -0
  89. package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
  90. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
  91. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
  92. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  93. package/dist/page-rules-DP-w6TAm.mjs +18 -0
  94. package/dist/page-shield-Bf7kFp8c.mjs +37 -0
  95. package/dist/pages-D0Y_XRqW.mjs +10 -0
  96. package/dist/pipelines-C-SPESAk.mjs +6 -0
  97. package/dist/progress-CjcQ6ato.mjs +2 -0
  98. package/dist/queues-wv6CZsi8.mjs +6 -0
  99. package/dist/r2-DuXjp9n5.mjs +21 -0
  100. package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
  101. package/dist/radar-BW_ZHP8X.mjs +2 -0
  102. package/dist/rate-limits-DLTkIvwr.mjs +5 -0
  103. package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
  104. package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
  105. package/dist/registrar-DIIv6fWd.mjs +46 -0
  106. package/dist/request-tracers-DMej0Drs.mjs +2 -0
  107. package/dist/resolve-BuJRWSk0.mjs +2 -0
  108. package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
  109. package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
  110. package/dist/rules-DLJpOYbC.mjs +4 -0
  111. package/dist/rulesets-D9nqEJT5.mjs +8 -0
  112. package/dist/rum-DBVmdPkp.mjs +4 -0
  113. package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
  114. package/dist/schema-validation-MCd3xdtX.mjs +4 -0
  115. package/dist/scim-DZA3VXog.mjs +3 -0
  116. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  117. package/dist/secrets-store-BrvcZSOM.mjs +21 -0
  118. package/dist/security-center-BU6f3Cm1.mjs +2 -0
  119. package/dist/security-txt-BPIbP3dG.mjs +3 -0
  120. package/dist/session-H7IV2BrM.mjs +2 -0
  121. package/dist/shared-DEzmTsEC.mjs +2 -0
  122. package/dist/smart-shield-e8XFBkiF.mjs +3 -0
  123. package/dist/snippets-B4M3MMb8.mjs +4 -0
  124. package/dist/spawn-13QQ0IwO.mjs +10 -0
  125. package/dist/spectrum-B0adfSRI.mjs +59 -0
  126. package/dist/speed-BVcUtkAz.mjs +4 -0
  127. package/dist/src-B9cKsgsg.mjs +108 -0
  128. package/dist/ssl-BAa91gsc.mjs +15 -0
  129. package/dist/stream-D53sxKb3.mjs +14 -0
  130. package/dist/tenants-bH5pt3dJ.mjs +2 -0
  131. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  132. package/dist/token-validation-M61Vx_Tw.mjs +4 -0
  133. package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
  134. package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
  135. package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
  136. package/dist/url-normalization-DZrWDgB5.mjs +3 -0
  137. package/dist/url-scanner-Zo49edNp.mjs +2 -0
  138. package/dist/user-DbXlVReB.mjs +10 -0
  139. package/dist/vectorize-CUnTM0DT.mjs +4 -0
  140. package/dist/versions-DzyrlUAi.mjs +2 -0
  141. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  142. package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
  143. package/dist/web3-DueyOQtx.mjs +4 -0
  144. package/dist/workers-builds-BM_aoeUR.mjs +7 -0
  145. package/dist/workers-nV_vBCfV.mjs +16 -0
  146. package/dist/workflows-CQITmo-s.mjs +4 -0
  147. package/dist/zaraz-DIbpF5Op.mjs +2 -0
  148. package/dist/zero-trust-CKp8j512.mjs +119 -0
  149. package/dist/zones-BZ5tZDbH.mjs +28 -0
  150. package/package.json +13 -3
  151. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  152. package/dist/accounts-BjGtCB8T.mjs +0 -6
  153. package/dist/acm-h4YPDN7k.mjs +0 -3
  154. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  155. package/dist/ai-BPln2Yka.mjs +0 -2
  156. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  157. package/dist/ai-search-EjrONI5a.mjs +0 -7
  158. package/dist/alerting-CPWMKr-m.mjs +0 -6
  159. package/dist/analytics-3dX9-scQ.mjs +0 -2
  160. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  161. package/dist/argo-Dxz9P37E.mjs +0 -2
  162. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  163. package/dist/auth-BHD_B2p9.mjs +0 -277
  164. package/dist/auth-caVo2j1K.mjs +0 -6
  165. package/dist/autorag-D7nMweNF.mjs +0 -2
  166. package/dist/billing-yaIBp1Xq.mjs +0 -2
  167. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  168. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  169. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  170. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  171. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  172. package/dist/cache-B6M_pm_D.mjs +0 -5
  173. package/dist/calls-C5XCC0i1.mjs +0 -4
  174. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  175. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  176. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  177. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  178. package/dist/config-BmTd_qeU.mjs +0 -2
  179. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  180. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  181. package/dist/context-6lBIck1r.mjs +0 -2
  182. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  183. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  184. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  185. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  186. package/dist/d1-c_zhZGWf.mjs +0 -3
  187. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  188. package/dist/dev-Bu26u5Jm.mjs +0 -14
  189. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  190. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  191. package/dist/dns-CrvIxztB.mjs +0 -11
  192. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  193. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  194. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  195. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  196. package/dist/email-security-CnpAHWpj.mjs +0 -8
  197. package/dist/email-sending-MeCKsktR.mjs +0 -3
  198. package/dist/filters-Sx2Po1UP.mjs +0 -4
  199. package/dist/firewall-B0_012XO.mjs +0 -9
  200. package/dist/fraud-CG0G_VG-.mjs +0 -2
  201. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  202. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  203. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  204. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  205. package/dist/iam-4LhJianW.mjs +0 -6
  206. package/dist/images-BqXyIycX.mjs +0 -5
  207. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  208. package/dist/intel-CiO3Sy4x.mjs +0 -3
  209. package/dist/ips-DLuGN7Mr.mjs +0 -2
  210. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  211. package/dist/kv-CVYCrk7L.mjs +0 -5
  212. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  213. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  214. package/dist/local-OqhVQbv0.mjs +0 -2
  215. package/dist/logpush-BX7z2xWz.mjs +0 -4
  216. package/dist/logs-C7vxr6Kp.mjs +0 -3
  217. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  218. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  219. package/dist/magic-transit-troGMFb9.mjs +0 -30
  220. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  221. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  222. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  223. package/dist/organizations-BtlEchi-.mjs +0 -4
  224. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  225. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  226. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  227. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  228. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  229. package/dist/pages-F1vdzqgC.mjs +0 -6
  230. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  231. package/dist/progress-5sHFvwez.mjs +0 -2
  232. package/dist/queues-BuvkxFPX.mjs +0 -6
  233. package/dist/r2-Du-fgHiT.mjs +0 -9
  234. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  235. package/dist/radar-C0eqNmWR.mjs +0 -2
  236. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  237. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  238. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  239. package/dist/registrar-B7V7i89n.mjs +0 -2
  240. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  241. package/dist/resolve-GtphSYWh.mjs +0 -2
  242. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  243. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  244. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  245. package/dist/rules-DzJFHGW1.mjs +0 -4
  246. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  247. package/dist/rum-CQ_rJ96u.mjs +0 -4
  248. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  249. package/dist/scim-ByZ5kqXS.mjs +0 -3
  250. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  251. package/dist/security-center-OUrILUnx.mjs +0 -2
  252. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  253. package/dist/session-Dxi_LbAk.mjs +0 -2
  254. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  255. package/dist/snippets-FDPiBMWc.mjs +0 -4
  256. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  257. package/dist/speed-BuEappVX.mjs +0 -4
  258. package/dist/src-D8_cWUwt.mjs +0 -104
  259. package/dist/ssl-bJbzEoRv.mjs +0 -3
  260. package/dist/stream-DuYGiGk6.mjs +0 -13
  261. package/dist/tenants-BYqEutrr.mjs +0 -2
  262. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  263. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  264. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  265. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  266. package/dist/user-Cduf3VRi.mjs +0 -7
  267. package/dist/vectorize-CMLobU9V.mjs +0 -4
  268. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  269. package/dist/web3-Bcx68Kq3.mjs +0 -4
  270. package/dist/workers-D5fOQsUA.mjs +0 -16
  271. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  272. package/dist/workflows-qFD80noW.mjs +0 -4
  273. package/dist/zaraz-C0iJimA4.mjs +0 -2
  274. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  275. package/dist/zones-Nu3wMtds.mjs +0 -5
  276. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,o as t,p as n,t as r}from"./auth-BHD_B2p9.mjs";import{n as i,r as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./local-OqhVQbv0.mjs";import{t as d}from"./progress-5sHFvwez.mjs";const f={command:`get <dnsFirewallId>`,describe:`Retrieves a list of aggregate metrics grouped by time interval. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters.`,builder:e=>e.positional(`dnsFirewallId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`metrics`,{type:`string`,description:`A comma-separated list of metrics to query.`}).option(`dimensions`,{type:`string`,description:`A comma-separated list of dimensions to group results by.`}).option(`since`,{type:`string`,description:`Start date and time of requesting data period in ISO 8601 format.`}).option(`until`,{type:`string`,description:`End date and time of requesting data period in ISO 8601 format.`}).option(`limit`,{type:`string`,description:`Limit number of returned metrics.`}).option(`sort`,{type:`string`,description:`A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending).`}).option(`filters`,{type:`string`,description:`Segmentation filter in 'attribute operator value' format.`}).option(`time-delta`,{type:`string`,description:`Unit of time to group data by.`,choices:[`all`,`auto`,`year`,`quarter`,`month`,`week`,`day`,`hour`,`dekaminute`,`minute`]}),handler:async e=>{a(e.dnsFirewallId,`dnsFirewallId`);let n={};e.metrics!==void 0&&(n.metrics=e.metrics),e.dimensions!==void 0&&(n.dimensions=e.dimensions),e.since!==void 0&&(n.since=e.since),e.until!==void 0&&(n.until=e.until),e.limit!==void 0&&(n.limit=e.limit),e.sort!==void 0&&(n.sort=e.sort),e.filters!==void 0&&(n.filters=e.filters),e.timeDelta!==void 0&&(n.time_delta=e.timeDelta);let i=await r(e),o=e.local?u:await t(i);e.accountId=o,c(await d(`Loading bytime`,async()=>i.dnsFirewall.analytics.reports.bytimes.get(e.dnsFirewallId,o,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded bytime`})}},p={command:`bytimes`,describe:`Query volume, latency, and response code analytics for DNS Firewall clusters`,builder:e=>e.command(f).demandCommand(1),handler:()=>{}},m={command:`get <dnsFirewallId>`,describe:`Retrieves a list of summarised aggregate metrics over a given time period. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters.`,builder:e=>e.positional(`dnsFirewallId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`metrics`,{type:`string`,description:`A comma-separated list of metrics to query.`}).option(`dimensions`,{type:`string`,description:`A comma-separated list of dimensions to group results by.`}).option(`since`,{type:`string`,description:`Start date and time of requesting data period in ISO 8601 format.`}).option(`until`,{type:`string`,description:`End date and time of requesting data period in ISO 8601 format.`}).option(`limit`,{type:`string`,description:`Limit number of returned metrics.`}).option(`sort`,{type:`string`,description:`A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending).`}).option(`filters`,{type:`string`,description:`Segmentation filter in 'attribute operator value' format.`}),handler:async e=>{a(e.dnsFirewallId,`dnsFirewallId`);let n={};e.metrics!==void 0&&(n.metrics=e.metrics),e.dimensions!==void 0&&(n.dimensions=e.dimensions),e.since!==void 0&&(n.since=e.since),e.until!==void 0&&(n.until=e.until),e.limit!==void 0&&(n.limit=e.limit),e.sort!==void 0&&(n.sort=e.sort),e.filters!==void 0&&(n.filters=e.filters);let i=await r(e),o=e.local?u:await t(i);e.accountId=o,c(await d(`Loading report`,async()=>i.dnsFirewall.analytics.reports.get(e.dnsFirewallId,o,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded report`})}},h={command:`reports`,describe:`Query volume, latency, and response code analytics for DNS Firewall clusters`,builder:e=>e.command(m).command(p).demandCommand(1),handler:()=>{}},g={command:`analytics`,describe:`Operations for analytics`,builder:e=>e.command(h).demandCommand(1),handler:()=>{}},_={command:`create`,describe:`Create a DNS Firewall cluster`,builder:e=>e.option(`attack-mitigation-enabled`,{type:`boolean`,description:`When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers`}).option(`attack-mitigation-only-when-upstream-unhealthy`,{type:`boolean`,description:`Only mitigate attacks when upstream servers seem unhealthy`,default:!0}).option(`deprecate-any-requests`,{type:`boolean`,description:`Whether to refuse to answer queries for the ANY type`}).option(`ecs-fallback`,{type:`boolean`,description:`Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent`}).option(`maximum-cache-ttl`,{type:`number`,description:`By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. `,default:900}).option(`minimum-cache-ttl`,{type:`number`,description:`By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. `,default:60}).option(`name`,{type:`string`,description:`DNS Firewall cluster name`}).option(`negative-cache-ttl`,{type:`number`,description:`This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. `}).option(`ratelimit`,{type:`number`,description:`Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster)`}).option(`retries`,{type:`number`,description:`Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt)`,default:2}).option(`upstream-ips`,{type:`string`,array:!0,description:`The upstream_ips 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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf dns-firewall create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/dns_firewall`,pathParams:{},bodyKind:`json`,body:{attackMitigationEnabled:n.attackMitigationEnabled,attackMitigationOnlyWhenUpstreamUnhealthy:n.attackMitigationOnlyWhenUpstreamUnhealthy,deprecateAnyRequests:n.deprecateAnyRequests,ecsFallback:n.ecsFallback,maximumCacheTtl:n.maximumCacheTtl,minimumCacheTtl:n.minimumCacheTtl,name:n.name,negativeCacheTtl:n.negativeCacheTtl,ratelimit:n.ratelimit,retries:n.retries,upstreamIps:n.upstreamIps,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Creating dns firewall`,async()=>f.post(`/accounts/${p}/dns_firewall`,{body:e})),{successLabel:`Created dns firewall`});return}let m={};n.attackMitigationEnabled!==void 0&&o(m,[`attack_mitigation`,`enabled`],n.attackMitigationEnabled),n.attackMitigationOnlyWhenUpstreamUnhealthy!==void 0&&o(m,[`attack_mitigation`,`only_when_upstream_unhealthy`],n.attackMitigationOnlyWhenUpstreamUnhealthy),n.deprecateAnyRequests!==void 0&&o(m,[`deprecate_any_requests`],n.deprecateAnyRequests),n.ecsFallback!==void 0&&o(m,[`ecs_fallback`],n.ecsFallback),n.maximumCacheTtl!==void 0&&o(m,[`maximum_cache_ttl`],n.maximumCacheTtl),n.minimumCacheTtl!==void 0&&o(m,[`minimum_cache_ttl`],n.minimumCacheTtl),n.name!==void 0&&o(m,[`name`],i(n.name,`name`,`text`)),n.negativeCacheTtl!==void 0&&o(m,[`negative_cache_ttl`],n.negativeCacheTtl),n.ratelimit!==void 0&&o(m,[`ratelimit`],n.ratelimit),n.retries!==void 0&&o(m,[`retries`],n.retries),n.upstreamIps!==void 0&&o(m,[`upstream_ips`],n.upstreamIps),c(await d(`Creating dns firewall`,async()=>f.post(`/accounts/${p}/dns_firewall`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created dns firewall`})}},v={command:`delete <dnsFirewallId>`,describe:`Delete a DNS Firewall cluster`,builder:e=>e.positional(`dnsFirewallId`,{type:`string`,description:`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}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async i=>{if(a(i.dnsFirewallId,`dnsFirewallId`),i.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf dns-firewall delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/dns_firewall/${i.dnsFirewallId??`<dnsFirewallId>`}`,pathParams:{dnsFirewallId:String(i.dnsFirewallId??``)},bodyKind:`json`,body:{body:i.body},validation:`passed`});return}let o=await r(i),f=i.local?u:await t(o);if(i.accountId=f,!await n(`dns firewall`,String(i.dnsFirewallId??``),{force:!!i.force})){process.stderr.write(`Aborted.
3
- `);return}if(i.body){let e=s(i.body);c(await d(`Deleting dns firewall`,async()=>o.delete(`/accounts/${f}/dns_firewall/${i.dnsFirewallId}`,{body:e})),{successLabel:`Deleted dns firewall`});return}c(await d(`Deleting dns firewall`,async()=>o.dnsFirewall.delete(i.dnsFirewallId,f)),{successLabel:`Deleted dns firewall`})}},y={command:`edit <dnsFirewallId>`,describe:`Modify the configuration of a DNS Firewall cluster`,builder:e=>e.positional(`dnsFirewallId`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`attack-mitigation-enabled`,{type:`boolean`,description:`When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers`}).option(`attack-mitigation-only-when-upstream-unhealthy`,{type:`boolean`,description:`Only mitigate attacks when upstream servers seem unhealthy`,default:!0}).option(`deprecate-any-requests`,{type:`boolean`,description:`Whether to refuse to answer queries for the ANY type`}).option(`ecs-fallback`,{type:`boolean`,description:`Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent`}).option(`maximum-cache-ttl`,{type:`number`,description:`By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. `,default:900}).option(`minimum-cache-ttl`,{type:`number`,description:`By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. `,default:60}).option(`name`,{type:`string`,description:`DNS Firewall cluster name`}).option(`negative-cache-ttl`,{type:`number`,description:`This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. `}).option(`ratelimit`,{type:`number`,description:`Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster)`}).option(`retries`,{type:`number`,description:`Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt)`,default:2}).option(`upstream-ips`,{type:`string`,array:!0,description:`The upstream_ips 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)`}),handler:async n=>{if(a(n.dnsFirewallId,`dnsFirewallId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf dns-firewall edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/dns_firewall/${n.dnsFirewallId??`<dnsFirewallId>`}`,pathParams:{dnsFirewallId:String(n.dnsFirewallId??``)},bodyKind:`json`,body:{attackMitigationEnabled:n.attackMitigationEnabled,attackMitigationOnlyWhenUpstreamUnhealthy:n.attackMitigationOnlyWhenUpstreamUnhealthy,deprecateAnyRequests:n.deprecateAnyRequests,ecsFallback:n.ecsFallback,maximumCacheTtl:n.maximumCacheTtl,minimumCacheTtl:n.minimumCacheTtl,name:n.name,negativeCacheTtl:n.negativeCacheTtl,ratelimit:n.ratelimit,retries:n.retries,upstreamIps:n.upstreamIps,body:n.body},validation:`passed`});return}let f=await r(n),p=n.local?u:await t(f);if(n.accountId=p,n.body){let e=s(n.body);c(await d(`Updating dns firewall`,async()=>f.patch(`/accounts/${p}/dns_firewall/${n.dnsFirewallId}`,{body:e})),{successLabel:`Updated dns firewall`});return}let m={};n.attackMitigationEnabled!==void 0&&o(m,[`attack_mitigation`,`enabled`],n.attackMitigationEnabled),n.attackMitigationOnlyWhenUpstreamUnhealthy!==void 0&&o(m,[`attack_mitigation`,`only_when_upstream_unhealthy`],n.attackMitigationOnlyWhenUpstreamUnhealthy),n.deprecateAnyRequests!==void 0&&o(m,[`deprecate_any_requests`],n.deprecateAnyRequests),n.ecsFallback!==void 0&&o(m,[`ecs_fallback`],n.ecsFallback),n.maximumCacheTtl!==void 0&&o(m,[`maximum_cache_ttl`],n.maximumCacheTtl),n.minimumCacheTtl!==void 0&&o(m,[`minimum_cache_ttl`],n.minimumCacheTtl),n.name!==void 0&&o(m,[`name`],i(n.name,`name`,`text`)),n.negativeCacheTtl!==void 0&&o(m,[`negative_cache_ttl`],n.negativeCacheTtl),n.ratelimit!==void 0&&o(m,[`ratelimit`],n.ratelimit),n.retries!==void 0&&o(m,[`retries`],n.retries),n.upstreamIps!==void 0&&o(m,[`upstream_ips`],n.upstreamIps),c(await d(`Updating dns firewall`,async()=>f.patch(`/accounts/${p}/dns_firewall/${n.dnsFirewallId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated dns firewall`})}},b={command:`get <dnsFirewallId>`,describe:`Show a single DNS Firewall cluster for an account`,builder:e=>e.positional(`dnsFirewallId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.dnsFirewallId,`dnsFirewallId`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading dns firewall`,async()=>n.dnsFirewall.get(e.dnsFirewallId,i)),{successLabel:`Loaded dns firewall`})}},x={command:`list`,describe:`List DNS Firewall clusters for an account`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results`}).option(`per-page`,{type:`number`,description:`Number of clusters per page`}),handler:async e=>{let n={};e.page!==void 0&&(n.page=e.page),e.perPage!==void 0&&(n.per_page=e.perPage);let i=await r(e),a=e.local?u:await t(i);e.accountId=a,c(await d(`Loading dns firewall`,async()=>i.dnsFirewall.list(a,Object.keys(n).length>0?n:void 0)),{successLabel:`Loaded dns firewall`})}},S={command:`edit <dnsFirewallId>`,describe:`Update reverse DNS configuration (PTR records) for a DNS Firewall cluster`,builder:e=>e.positional(`dnsFirewallId`,{type:`string`,description:`Identifier.`,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)`}),handler:async n=>{if(a(n.dnsFirewallId,`dnsFirewallId`),n.dryRun){let t=e();t&&a(t,`accountId`),l({command:`cf dns-firewall reverse-dns edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/dns_firewall/${n.dnsFirewallId??`<dnsFirewallId>`}/reverse_dns`,pathParams:{dnsFirewallId:String(n.dnsFirewallId??``)},bodyKind:`json`,body:{body:n.body},validation:`passed`});return}let i=await r(n),o=n.local?u:await t(i);if(n.accountId=o,n.body){let e=s(n.body);c(await d(`Updating reverse dn`,async()=>i.patch(`/accounts/${o}/dns_firewall/${n.dnsFirewallId}/reverse_dns`,{body:e})),{successLabel:`Updated reverse dn`});return}c(await d(`Updating reverse dn`,async()=>i.dnsFirewall.reverseDNS.edit(n.dnsFirewallId,o)),{successLabel:`Updated reverse dn`})}},C={command:`get <dnsFirewallId>`,describe:`Show reverse DNS configuration (PTR records) for a DNS Firewall cluster`,builder:e=>e.positional(`dnsFirewallId`,{type:`string`,description:`Identifier.`,demandOption:!0}),handler:async e=>{a(e.dnsFirewallId,`dnsFirewallId`);let n=await r(e),i=e.local?u:await t(n);e.accountId=i,c(await d(`Loading reverse dn`,async()=>n.dnsFirewall.reverseDNS.get(e.dnsFirewallId,i)),{successLabel:`Loaded reverse dn`})}},w={command:`reverse-dns`,describe:`PTR record configuration for reverse DNS lookups on DNS Firewall cluster IPs`,builder:e=>e.command(S).command(C).demandCommand(1),handler:()=>{}},T={command:`dns-firewall`,describe:`DNS proxy clusters that filter and forward DNS queries with DDoS protection and caching`,builder:e=>e.command(_).command(v).command(y).command(b).command(x).command(g).command(w).demandCommand(1),handler:()=>{}};export{T as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e}from"./output-CqGQp2r6.mjs";function t(t){e(t)}export{t};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{o as e,t}from"./auth-BHD_B2p9.mjs";import{t as n}from"./output-CqGQp2r6.mjs";import{t as r}from"./local-OqhVQbv0.mjs";import{t as i}from"./progress-5sHFvwez.mjs";const a={command:`list`,describe:`Returns the Durable Object namespaces owned by an account.`,builder:e=>e.option(`page`,{type:`number`,description:`Current page.`}).option(`per-page`,{type:`number`,description:`Items per-page.`}),handler:async a=>{let o={};a.page!==void 0&&(o.page=a.page),a.perPage!==void 0&&(o.per_page=a.perPage);let s=await t(a),c=a.local?r:await e(s);a.accountId=c,n(await i(`Loading namespaces`,async()=>s.durableObjects.namespaces.list(c,Object.keys(o).length>0?o:void 0)),{successLabel:`Loaded namespaces`})}},o={command:`list`,describe:`Returns the Durable Objects in a given namespace.`,builder:e=>e.option(`id`,{type:`string`,description:`ID of the namespace.`,demandOption:!0}).option(`limit`,{type:`number`,description:`The number of objects to return. The cursor attribute may be used to iterate over the next batch of objects if there are more than the limit.`}).option(`cursor`,{type:`string`,description:`Opaque token indicating the position from which to continue when requesting the next set of records. A valid value for the cursor can be obtained from the cursors object in the result_info structure.`}),handler:async a=>{let o={};a.limit!==void 0&&(o.limit=a.limit),a.cursor!==void 0&&(o.cursor=a.cursor);let s=await t(a),c=a.local?r:await e(s);a.accountId=c,n(await i(`Loading objects`,async()=>s.durableObjects.namespaces.objects.list(c,a.id,Object.keys(o).length>0?o:void 0)),{successLabel:`Loaded objects`})}},s={command:`objects`,describe:`List Durable Object namespaces and inspect individual object instances within them`,builder:e=>e.command(o).demandCommand(1),handler:()=>{}},c={command:`namespaces`,describe:`List Durable Object namespaces and inspect individual object instances within them`,builder:e=>e.command(a).command(s).demandCommand(1),handler:()=>{}},l={command:`durable-objects`,describe:`Stateful serverless objects with transactional storage, ideal for coordination, sessions, and real-time collaboration`,builder:e=>e.command(c).demandCommand(1),handler:()=>{}};export{l as default};
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,p as r,t as i,u as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`create`,describe:`Create a destination address to forward your emails to. Destination addresses need to be verified before they can be used.`,builder:e=>e.option(`email`,{type:`string`,description:`The contact email address of the user.`}).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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-routing addresses create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email/routing/addresses`,pathParams:{},bodyKind:`json`,body:{email:r.email,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating address`,async()=>a.post(`/accounts/${m}/email/routing/addresses`,{body:e})),{successLabel:`Created address`});return}r.email===void 0&&(r.email=await t(`email`,`The contact email address of the user.`));let h={};r.email!==void 0&&c(h,[`email`],o(r.email,`email`,`text`)),u(await p(`Creating address`,async()=>a.post(`/accounts/${m}/email/routing/addresses`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created address`})}},h={command:`delete <destinationAddressIdentifier>`,describe:`Deletes a specific destination address.`,builder:e=>e.positional(`destinationAddressIdentifier`,{type:`string`,description:`Destination address 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}),handler:async t=>{if(s(t.destinationAddressIdentifier,`destinationAddressIdentifier`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-routing addresses delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email/routing/addresses/${t.destinationAddressIdentifier??`<destinationAddressIdentifier>`}`,pathParams:{destinationAddressIdentifier:String(t.destinationAddressIdentifier??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,!await r(`address`,String(t.destinationAddressIdentifier??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting address`,async()=>a.emailRouting.addresses.delete(t.destinationAddressIdentifier,o)),{successLabel:`Deleted address`})}},g={command:`get <destinationAddressIdentifier>`,describe:`Gets information for a specific destination email already created.`,builder:e=>e.positional(`destinationAddressIdentifier`,{type:`string`,description:`Destination address identifier.`,demandOption:!0}),handler:async e=>{s(e.destinationAddressIdentifier,`destinationAddressIdentifier`);let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading address`,async()=>t.emailRouting.addresses.get(e.destinationAddressIdentifier,r)),{successLabel:`Loaded address`})}},_={command:`list`,describe:`Lists existing destination addresses.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Sorts results in an ascending or descending order.`,choices:[`asc`,`desc`]}).option(`verified`,{type:`boolean`,description:`Filter by verified destination addresses.`,default:!1}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.direction!==void 0&&(t.direction=e.direction),e.verified!==void 0&&(t.verified=e.verified);let r=await i(e),a=e.local?f:await n(r);e.accountId=a,u(await p(`Loading addresses`,async()=>r.emailRouting.addresses.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded addresses`})}},v={command:`addresses`,describe:`Verified destination email addresses that can receive forwarded mail`,builder:e=>e.command(m).command(h).command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`disable`,describe:`Disable your Email Routing zone. Also removes additional MX records previously required for Email Routing to work.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing disable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/disable`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`email routing`,String(n??``),{force:!!e.force,message:`This operation turns off email routing for a zone.`})){process.stderr.write(`Aborted.
4
- `);return}if(e.body){let n=l(e.body);u(await p(`Deleting email routing`,async()=>t.post(`/zones/${e.zoneId}/email/routing/disable`,{body:n})),{successLabel:`Deleted email routing`});return}u(await p(`Deleting email routing`,async()=>t.emailRouting.disable(n)),{successLabel:`Deleted email routing`})}},b={command:`create`,describe:`Enable you Email Routing zone. Add and lock the necessary MX and SPF records.`,builder:e=>e.option(`name`,{type:`string`,description:`Domain of your 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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing dns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/dns`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{name:e.name,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Creating dn`,async()=>t.post(`/zones/${e.zoneId}/email/routing/dns`,{body:n})),{successLabel:`Created dn`});return}let n={};e.name!==void 0&&c(n,[`name`],o(e.name,`name`,`text`)),u(await p(`Creating dn`,async()=>t.post(`/zones/${e.zoneId}/email/routing/dns`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created dn`})}},x={command:`delete`,describe:`Disable your Email Routing zone. Also removes additional MX records previously required for Email Routing to work.`,builder:e=>e.option(`name`,{type:`string`,description:`Domain of your zone.`}).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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing dns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/dns`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{name:e.name,body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`dn`,String(n??``),{force:!!e.force})){process.stderr.write(`Aborted.
5
- `);return}if(e.body){let n=l(e.body);u(await p(`Deleting dn`,async()=>t.delete(`/zones/${e.zoneId}/email/routing/dns`,{body:n})),{successLabel:`Deleted dn`});return}let s={};e.name!==void 0&&c(s,[`name`],o(e.name,`name`,`text`)),u(await p(`Deleting dn`,async()=>t.delete(`/zones/${e.zoneId}/email/routing/dns`,{body:Object.keys(s).length>0?s:void 0})),{successLabel:`Deleted dn`})}},S={command:`edit`,describe:`Unlock MX Records previously locked by Email Routing.`,builder:e=>e.option(`name`,{type:`string`,description:`Domain of your 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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing dns edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/dns`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{name:e.name,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating dn`,async()=>t.patch(`/zones/${e.zoneId}/email/routing/dns`,{body:n})),{successLabel:`Updated dn`});return}let n={};e.name!==void 0&&c(n,[`name`],o(e.name,`name`,`text`)),u(await p(`Updating dn`,async()=>t.patch(`/zones/${e.zoneId}/email/routing/dns`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated dn`})}},C={command:`get`,describe:`Show the DNS records needed to configure your Email Routing zone.`,builder:e=>e.option(`subdomain`,{type:`string`,description:`Domain of your zone.`}),handler:async e=>{let t={};e.subdomain!==void 0&&(t.subdomain=e.subdomain);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading dn`,async()=>n.emailRouting.dns.get(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded dn`})}},w={command:`dns`,describe:`DNS records required for email routing (MX, SPF, DKIM) — enable, lock, or disable`,builder:e=>e.command(b).command(x).command(S).command(C).demandCommand(1),handler:()=>{}},T={command:`enable`,describe:`Enable you Email Routing zone. Add and lock the necessary MX and SPF records.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing enable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/enable`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Creating email routing`,async()=>t.post(`/zones/${e.zoneId}/email/routing/enable`,{body:n})),{successLabel:`Created email routing`});return}u(await p(`Creating email routing`,async()=>t.emailRouting.enable(n)),{successLabel:`Created email routing`})}},E={command:`get`,describe:`Get information about the settings for your Email Routing zone.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading email routing`,async()=>t.emailRouting.get(n)),{successLabel:`Loaded email routing`})}},D={command:`get`,describe:`Get information on the default catch-all routing rule.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading catch all`,async()=>t.emailRouting.rules.catchAlls.get(n)),{successLabel:`Loaded catch all`})}},O={command:`update`,describe:`Enable or disable catch-all routing rule, or change action to forward to specific destination address. Forward actions require all destination addresses to be verified.`,builder:e=>e.option(`enabled`,{type:`boolean`,description:`Routing rule status.`,default:!0}).option(`name`,{type:`string`,description:`Routing rule name.`}).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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing rules catch-alls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/rules/catch_all`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{enabled:e.enabled,name:e.name,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating catch all`,async()=>t.put(`/zones/${e.zoneId}/email/routing/rules/catch_all`,{body:n})),{successLabel:`Updated catch all`});return}let n={};e.enabled!==void 0&&c(n,[`enabled`],e.enabled),e.name!==void 0&&c(n,[`name`],o(e.name,`name`,`text`)),u(await p(`Updating catch all`,async()=>t.put(`/zones/${e.zoneId}/email/routing/rules/catch_all`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated catch all`})}},k={command:`catch-alls`,describe:`Routing rules that match incoming email addresses and forward to destination mailboxes`,builder:e=>e.command(D).command(O).demandCommand(1),handler:()=>{}},A={command:`create`,describe:`Rules consist of a set of criteria for matching emails (such as an email being sent to a specific custom email address) plus a set of actions to take on the email (like forwarding it to a specific destination address). Forward actions require all destination addresses to be verified.`,builder:e=>e.option(`enabled`,{type:`boolean`,description:`Routing rule status.`,default:!0}).option(`name`,{type:`string`,description:`Routing rule name.`}).option(`priority`,{type:`number`,description:`Priority of the routing rule.`,default: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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{enabled:e.enabled,name:e.name,priority:e.priority,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Creating rule`,async()=>t.post(`/zones/${e.zoneId}/email/routing/rules`,{body:n})),{successLabel:`Created rule`});return}let n={};e.enabled!==void 0&&c(n,[`enabled`],e.enabled),e.name!==void 0&&c(n,[`name`],o(e.name,`name`,`text`)),e.priority!==void 0&&c(n,[`priority`],e.priority),u(await p(`Creating rule`,async()=>t.post(`/zones/${e.zoneId}/email/routing/rules`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created rule`})}},j={command:`delete <ruleIdentifier>`,describe:`Delete a specific routing rule.`,builder:e=>e.positional(`ruleIdentifier`,{type:`string`,description:`Routing rule 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}),handler:async e=>{if(s(e.ruleIdentifier,`ruleIdentifier`),e.dryRun){d({command:`cf email-routing rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/rules/${e.ruleIdentifier??`<ruleIdentifier>`}`,pathParams:{ruleIdentifier:String(e.ruleIdentifier??``),zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`rule`,String(e.ruleIdentifier??``),{force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}u(await p(`Deleting rule`,async()=>t.emailRouting.rules.delete(e.ruleIdentifier,n)),{successLabel:`Deleted rule`})}},M={command:`get <ruleIdentifier>`,describe:`Get information for a specific routing rule already created.`,builder:e=>e.positional(`ruleIdentifier`,{type:`string`,description:`Routing rule identifier.`,demandOption:!0}),handler:async e=>{s(e.ruleIdentifier,`ruleIdentifier`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading rule`,async()=>t.emailRouting.rules.get(e.ruleIdentifier,n)),{successLabel:`Loaded rule`})}},N={command:`list`,describe:`Lists existing routing rules.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`enabled`,{type:`boolean`,description:`Filter by enabled routing rules.`,default:!1}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.enabled!==void 0&&(t.enabled=e.enabled);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading rules`,async()=>n.emailRouting.rules.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded rules`})}},P={command:`update <ruleIdentifier>`,describe:`Update actions and matches, or enable/disable specific routing rules. Forward actions require all destination addresses to be verified.`,builder:e=>e.positional(`ruleIdentifier`,{type:`string`,description:`Routing rule identifier.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`Routing rule status.`,default:!0}).option(`name`,{type:`string`,description:`Routing rule name.`}).option(`priority`,{type:`number`,description:`Priority of the routing rule.`,default: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)`}),handler:async e=>{if(s(e.ruleIdentifier,`ruleIdentifier`),e.dryRun){d({command:`cf email-routing rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/rules/${e.ruleIdentifier??`<ruleIdentifier>`}`,pathParams:{ruleIdentifier:String(e.ruleIdentifier??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{enabled:e.enabled,name:e.name,priority:e.priority,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating rule`,async()=>t.put(`/zones/${e.zoneId}/email/routing/rules/${e.ruleIdentifier}`,{body:n})),{successLabel:`Updated rule`});return}let n={};e.enabled!==void 0&&c(n,[`enabled`],e.enabled),e.name!==void 0&&c(n,[`name`],o(e.name,`name`,`text`)),e.priority!==void 0&&c(n,[`priority`],e.priority),u(await p(`Updating rule`,async()=>t.put(`/zones/${e.zoneId}/email/routing/rules/${e.ruleIdentifier}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated rule`})}},F={command:`rules`,describe:`Routing rules that match incoming email addresses and forward to destination mailboxes`,builder:e=>e.command(A).command(j).command(M).command(N).command(P).command(k).demandCommand(1),handler:()=>{}},I={command:`create`,describe:`Create a routing suppression entry`,builder:e=>e.option(`email`,{type:`string`,description:`The email field`}).option(`expires-at`,{type:`string`,description:`The expires_at 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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-routing suppression routing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email/routing/suppression`,pathParams:{},bodyKind:`json`,body:{email:r.email,expiresAt:r.expiresAt,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating routing`,async()=>a.post(`/accounts/${m}/email/routing/suppression`,{body:e})),{successLabel:`Created routing`});return}r.email===void 0&&(r.email=await t(`email`,``));let h={};r.email!==void 0&&c(h,[`email`],o(r.email,`email`,`text`)),r.expiresAt!==void 0&&c(h,[`expires_at`],o(r.expiresAt,`expiresAt`,`text`)),u(await p(`Creating routing`,async()=>a.post(`/accounts/${m}/email/routing/suppression`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created routing`})}},ee={command:`delete <suppressionId>`,describe:`Delete a routing suppression entry`,builder:e=>e.positional(`suppressionId`,{type:`string`,description:`Suppression ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.suppressionId,`suppressionId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-routing suppression routing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email/routing/suppression/${t.suppressionId??`<suppressionId>`}`,pathParams:{suppressionId:String(t.suppressionId??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,!await r(`routing`,String(t.suppressionId??``),{force:!!t.force})){process.stderr.write(`Aborted.
7
- `);return}u(await p(`Deleting routing`,async()=>a.emailRouting.suppression.routing.delete(o,t.suppressionId)),{successLabel:`Deleted routing`})}},L={command:`get <suppressionId>`,describe:`Get a routing suppression entry`,builder:e=>e.positional(`suppressionId`,{type:`string`,description:`Suppression ID`,demandOption:!0}),handler:async e=>{s(e.suppressionId,`suppressionId`);let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading routing`,async()=>t.emailRouting.suppression.routing.get(r,e.suppressionId)),{successLabel:`Loaded routing`})}},R={command:`list`,describe:`List routing suppression entries`,builder:e=>e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order`,{type:`string`,description:`Order`,choices:[`email`,`expires_at`,`created_at`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let r=await i(e),a=e.local?f:await n(r);e.accountId=a,u(await p(`Loading routing`,async()=>r.emailRouting.suppression.routing.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded routing`})}},z={command:`routing`,describe:`Email suppression list management for routing and sending`,builder:e=>e.command(I).command(ee).command(L).command(R).demandCommand(1),handler:()=>{}},B={command:`create`,describe:`Create a sending suppression entry`,builder:e=>e.option(`email`,{type:`string`,description:`The email field`}).option(`expires-at`,{type:`string`,description:`The expires_at 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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-routing suppression sending create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email/sending/suppression`,pathParams:{},bodyKind:`json`,body:{email:r.email,expiresAt:r.expiresAt,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating sending`,async()=>a.post(`/accounts/${m}/email/sending/suppression`,{body:e})),{successLabel:`Created sending`});return}r.email===void 0&&(r.email=await t(`email`,``));let h={};r.email!==void 0&&c(h,[`email`],o(r.email,`email`,`text`)),r.expiresAt!==void 0&&c(h,[`expires_at`],o(r.expiresAt,`expiresAt`,`text`)),u(await p(`Creating sending`,async()=>a.post(`/accounts/${m}/email/sending/suppression`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created sending`})}},V={command:`delete <suppressionId>`,describe:`Delete a sending suppression entry`,builder:e=>e.positional(`suppressionId`,{type:`string`,description:`Suppression ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.suppressionId,`suppressionId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-routing suppression sending delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email/sending/suppression/${t.suppressionId??`<suppressionId>`}`,pathParams:{suppressionId:String(t.suppressionId??``)},bodyKind:`none`,validation:`passed`});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,!await r(`sending`,String(t.suppressionId??``),{force:!!t.force})){process.stderr.write(`Aborted.
8
- `);return}u(await p(`Deleting sending`,async()=>a.emailRouting.suppression.sending.delete(o,t.suppressionId)),{successLabel:`Deleted sending`})}},H={command:`get <suppressionId>`,describe:`Get a sending suppression entry`,builder:e=>e.positional(`suppressionId`,{type:`string`,description:`Suppression ID`,demandOption:!0}),handler:async e=>{s(e.suppressionId,`suppressionId`);let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading sending`,async()=>t.emailRouting.suppression.sending.get(r,e.suppressionId)),{successLabel:`Loaded sending`})}},U={command:`list`,describe:`List sending suppression entries`,builder:e=>e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order`,{type:`string`,description:`Order`,choices:[`email`,`expires_at`,`created_at`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let r=await i(e),a=e.local?f:await n(r);e.accountId=a,u(await p(`Loading sending`,async()=>r.emailRouting.suppression.sending.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded sending`})}},W={command:`sending`,describe:`Email suppression list management for routing and sending`,builder:e=>e.command(B).command(V).command(H).command(U).demandCommand(1),handler:()=>{}},G={command:`create`,describe:`Create a zone routing suppression entry`,builder:e=>e.option(`email`,{type:`string`,description:`The email field`}).option(`expires-at`,{type:`string`,description:`The expires_at 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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing suppression zone routing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/suppression`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{email:e.email,expiresAt:e.expiresAt,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Creating routing`,async()=>n.post(`/zones/${e.zoneId}/email/routing/suppression`,{body:t})),{successLabel:`Created routing`});return}e.email===void 0&&(e.email=await t(`email`,``));let r={};e.email!==void 0&&c(r,[`email`],o(e.email,`email`,`text`)),e.expiresAt!==void 0&&c(r,[`expires_at`],o(e.expiresAt,`expiresAt`,`text`)),u(await p(`Creating routing`,async()=>n.post(`/zones/${e.zoneId}/email/routing/suppression`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created routing`})}},K={command:`delete <suppressionId>`,describe:`Delete a zone routing suppression entry`,builder:e=>e.positional(`suppressionId`,{type:`string`,description:`Suppression ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(s(e.suppressionId,`suppressionId`),e.dryRun){d({command:`cf email-routing suppression zone routing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/routing/suppression/${e.suppressionId??`<suppressionId>`}`,pathParams:{zoneId:String(e.zoneId??``),suppressionId:String(e.suppressionId??``)},bodyKind:`none`,validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`routing`,String(e.suppressionId??``),{force:!!e.force})){process.stderr.write(`Aborted.
9
- `);return}u(await p(`Deleting routing`,async()=>t.emailRouting.suppression.zone.routing.delete(n,e.suppressionId)),{successLabel:`Deleted routing`})}},q={command:`get <suppressionId>`,describe:`Get a zone routing suppression entry`,builder:e=>e.positional(`suppressionId`,{type:`string`,description:`Suppression ID`,demandOption:!0}),handler:async e=>{s(e.suppressionId,`suppressionId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading routing`,async()=>t.emailRouting.suppression.zone.routing.get(n,e.suppressionId)),{successLabel:`Loaded routing`})}},J={command:`list`,describe:`List zone routing suppression entries`,builder:e=>e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order`,{type:`string`,description:`Order`,choices:[`email`,`expires_at`,`created_at`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading routing`,async()=>n.emailRouting.suppression.zone.routing.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded routing`})}},Y={command:`routing`,describe:`Email suppression list management for routing and sending`,builder:e=>e.command(G).command(K).command(q).command(J).demandCommand(1),handler:()=>{}},X={command:`create`,describe:`Create a zone sending suppression entry`,builder:e=>e.option(`email`,{type:`string`,description:`The email field`}).option(`expires-at`,{type:`string`,description:`The expires_at 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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-routing suppression zone sending create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/sending/suppression`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{email:e.email,expiresAt:e.expiresAt,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Creating sending`,async()=>n.post(`/zones/${e.zoneId}/email/sending/suppression`,{body:t})),{successLabel:`Created sending`});return}e.email===void 0&&(e.email=await t(`email`,``));let r={};e.email!==void 0&&c(r,[`email`],o(e.email,`email`,`text`)),e.expiresAt!==void 0&&c(r,[`expires_at`],o(e.expiresAt,`expiresAt`,`text`)),u(await p(`Creating sending`,async()=>n.post(`/zones/${e.zoneId}/email/sending/suppression`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created sending`})}},Z={command:`delete <suppressionId>`,describe:`Delete a zone sending suppression entry`,builder:e=>e.positional(`suppressionId`,{type:`string`,description:`Suppression ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(s(e.suppressionId,`suppressionId`),e.dryRun){d({command:`cf email-routing suppression zone sending delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/sending/suppression/${e.suppressionId??`<suppressionId>`}`,pathParams:{zoneId:String(e.zoneId??``),suppressionId:String(e.suppressionId??``)},bodyKind:`none`,validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`sending`,String(e.suppressionId??``),{force:!!e.force})){process.stderr.write(`Aborted.
10
- `);return}u(await p(`Deleting sending`,async()=>t.emailRouting.suppression.zone.sending.delete(n,e.suppressionId)),{successLabel:`Deleted sending`})}},Q={command:`get <suppressionId>`,describe:`Get a zone sending suppression entry`,builder:e=>e.positional(`suppressionId`,{type:`string`,description:`Suppression ID`,demandOption:!0}),handler:async e=>{s(e.suppressionId,`suppressionId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading sending`,async()=>t.emailRouting.suppression.zone.sending.get(n,e.suppressionId)),{successLabel:`Loaded sending`})}},$={command:`list`,describe:`List zone sending suppression entries`,builder:e=>e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order`,{type:`string`,description:`Order`,choices:[`email`,`expires_at`,`created_at`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading sending`,async()=>n.emailRouting.suppression.zone.sending.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded sending`})}},te={command:`sending`,describe:`Email suppression list management for routing and sending`,builder:e=>e.command(X).command(Z).command(Q).command($).demandCommand(1),handler:()=>{}},ne={command:`zone`,describe:`Operations for suppression.zone`,builder:e=>e.command(Y).command(te).demandCommand(1),handler:()=>{}},re={command:`suppression`,describe:`Operations for suppression`,builder:e=>e.command(z).command(W).command(ne).demandCommand(1),handler:()=>{}},ie={command:`email-routing`,describe:`Route incoming emails to destination addresses using custom rules, catch-all handlers, and DNS configuration`,builder:e=>e.command(y).command(T).command(E).command(v).command(w).command(F).command(re).demandCommand(1),handler:()=>{}};export{ie as default};
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`get <postfixId>`,describe:`Returns detection details such as threat categories and sender information for non-benign messages.`,builder:e=>e.positional(`postfixId`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}),handler:async e=>{s(e.postfixId,`postfixId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading detection`,async()=>t.emailSecurity.investigate.detections.get(n,e.postfixId)),{successLabel:`Loaded detection`})}},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),handler:()=>{}},g={command:`log <investigateId>`,describe:`Returns the list of post-delivery actions (moves, quarantine releases, previews, etc.) that have been applied to a specific email message.`,builder:e=>e.positional(`investigateId`,{type:`string`,description:`The investigation identifier for an email message.`,demandOption:!0}),handler:async e=>{s(e.investigateId,`investigateId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading get action`,async()=>t.emailSecurity.investigate.getAction.log(n,e.investigateId)),{successLabel:`Loaded get action`})}},_={command:`get-action`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(g).demandCommand(1),handler:()=>{}},ee={command:`get <postfixId>`,describe:`Retrieves detailed information about a specific email message, including headers, metadata, and security scan results.`,builder:e=>e.positional(`postfixId`,{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 regular datastore only.`,default:!1}),handler:async e=>{s(e.postfixId,`postfixId`);let t={};e.submission!==void 0&&(t.submission=e.submission);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading investigate`,async()=>n.emailSecurity.investigate.get(i,e.postfixId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded investigate`})}},te={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:e=>e.option(`start`,{type:`string`,description:"The beginning of the search date range. Defaults to `now - 30 days` if not provided."}).option(`end`,{type:`string`,description:"The end of the search date range. Defaults to `now` if not provided."}).option(`query`,{type:`string`,description:`The space-delimited term used in the query. The search is case-insensitive. The content of the following email metadata fields are searched: * alert_id * CC * From (envelope_from) * From Name * final_disposition * md5 hash (of any attachment) * sha1 hash (of any attachment) * sha256 hash (of any attachment) * name (of any attachment) * Reason * Received DateTime (yyyy-mm-ddThh:mm:ss) * Sent DateTime (yyyy-mm-ddThh:mm:ss) * ReplyTo * To (envelope_to) * To Name * Message-ID * smtp_helo_server_ip * smtp_previous_hop_ip * x_originating_ip * Subject`}).option(`detections-only`,{type:`boolean`,description:`Determines if the search results will include detections or not.`,default:!1}).option(`action-log`,{type:`boolean`,description:`Determines if the message action log is included in the response.`,default:!1}).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`,default:!1}).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.`}),handler:async e=>{let t={};e.start!==void 0&&(t.start=e.start),e.end!==void 0&&(t.end=e.end),e.query!==void 0&&(t.query=e.query),e.detectionsOnly!==void 0&&(t.detections_only=e.detectionsOnly),e.actionLog!==void 0&&(t.action_log=e.actionLog),e.finalDisposition!==void 0&&(t.final_disposition=e.finalDisposition),e.metric!==void 0&&(t.metric=e.metric),e.messageAction!==void 0&&(t.message_action=e.messageAction),e.recipient!==void 0&&(t.recipient=e.recipient),e.sender!==void 0&&(t.sender=e.sender),e.alertId!==void 0&&(t.alert_id=e.alertId),e.domain!==void 0&&(t.domain=e.domain),e.messageId!==void 0&&(t.message_id=e.messageId),e.subject!==void 0&&(t.subject=e.subject),e.exactSubject!==void 0&&(t.exact_subject=e.exactSubject),e.submissions!==void 0&&(t.submissions=e.submissions),e.cursor!==void 0&&(t.cursor=e.cursor),e.perPage!==void 0&&(t.per_page=e.perPage),e.page!==void 0&&(t.page=e.page);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading investigate`,async()=>n.emailSecurity.investigate.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded investigate`})}},v={command:`bulk`,describe:`Maximum batch size: 1000 messages per request`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security investigate move bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/investigate/move`,pathParams:{},bodyKind:`json`,body:{destination:t.destination,ids:t.ids,postfixIds:t.postfixIds,body:t.body},validation:`passed`});return}let i=await a(t),m=t.local?f:await r(i);if(t.accountId=m,t.body){let e=l(t.body);u(await p(`Creating move`,async()=>i.post(`/accounts/${m}/email-security/investigate/move`,{body:e})),{successLabel:`Created move`});return}t.destination===void 0&&(t.destination=await n(`destination`,``,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let h={};t.destination!==void 0&&c(h,[`destination`],o(t.destination,`destination`,`text`)),t.ids!==void 0&&c(h,[`ids`],t.ids),t.postfixIds!==void 0&&c(h,[`postfix_ids`],t.postfixIds),u(await p(`Creating move`,async()=>i.post(`/accounts/${m}/email-security/investigate/move`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created move`})}},y={command:`create <postfixId>`,describe:`Moves a single email message to a different folder or changes its quarantine status.`,builder:e=>e.positional(`postfixId`,{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 regular datastore only.`,default:!1}).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)`}),handler:async t=>{s(t.postfixId,`postfixId`);let i={};if(t.submission!==void 0&&(i.submission=t.submission),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security investigate move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/investigate/${t.postfixId??`<postfixId>`}/move`,pathParams:{postfixId:String(t.postfixId??``)},bodyKind:`json`,body:{...i,destination:t.destination,body:t.body},validation:`passed`});return}let m=await a(t),h=t.local?f:await r(m);if(t.accountId=h,t.body){let e=l(t.body),n=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating move`,async()=>m.post(`/accounts/${h}/email-security/investigate/${t.postfixId}/move${n?`?`+n:``}`,{body:e})),{successLabel:`Created move`});return}t.destination===void 0&&(t.destination=await n(`destination`,``,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let g={};t.destination!==void 0&&c(g,[`destination`],o(t.destination,`destination`,`text`));let _=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating move`,async()=>m.post(`/accounts/${h}/email-security/investigate/${t.postfixId}/move${_?`?`+_:``}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created move`})}},b={command:`move`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(v).command(y).demandCommand(1),handler:()=>{}},x={command:`create`,describe:`Generates a preview of an email message for safe viewing without executing any embedded content.`,builder:e=>e.option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the regular datastore only.`,default:!1}).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)`}),handler:async n=>{let i={};if(n.submission!==void 0&&(i.submission=n.submission),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-security investigate preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email-security/investigate/preview`,pathParams:{},bodyKind:`json`,body:{...i,postfixId:n.postfixId,body:n.body},validation:`passed`});return}let m=await a(n),h=n.local?f:await r(m);if(n.accountId=h,n.body){let e=l(n.body),t=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating preview`,async()=>m.post(`/accounts/${h}/email-security/investigate/preview${t?`?`+t:``}`,{body:e})),{successLabel:`Created preview`});return}n.postfixId===void 0&&(n.postfixId=await t(`postfix-id`,`The identifier of the message.`));let g={};n.postfixId!==void 0&&c(g,[`postfix_id`],o(n.postfixId,`postfixId`,`text`));let _=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating preview`,async()=>m.post(`/accounts/${h}/email-security/investigate/preview${_?`?`+_:``}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created preview`})}},S={command:`get <postfixId>`,describe:`Returns a preview of the message body as a base64 encoded PNG image for non-benign messages.`,builder:e=>e.positional(`postfixId`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}),handler:async e=>{s(e.postfixId,`postfixId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading preview`,async()=>t.emailSecurity.investigate.preview.get(n,e.postfixId)),{successLabel:`Loaded preview`})}},C={command:`preview`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(x).command(S).demandCommand(1),handler:()=>{}},w={command:`get <postfixId>`,describe:`Returns the raw eml of any non-benign message.`,builder:e=>e.positional(`postfixId`,{type:`string`,description:`The identifier of the message.`,demandOption:!0}),handler:async e=>{s(e.postfixId,`postfixId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading raw`,async()=>t.emailSecurity.investigate.raw.get(n,e.postfixId)),{successLabel:`Loaded raw`})}},T={command:`raw`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(w).demandCommand(1),handler:()=>{}},E={command:`create <postfixId>`,describe:`Submits an email message for reclassification, updating its threat assessment based on new analysis.`,builder:e=>e.positional(`postfixId`,{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 regular datastore only.`,default:!1}).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)`}),handler:async t=>{s(t.postfixId,`postfixId`);let i={};if(t.submission!==void 0&&(i.submission=t.submission),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security investigate reclassify create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/investigate/${t.postfixId??`<postfixId>`}/reclassify`,pathParams:{postfixId:String(t.postfixId??``)},bodyKind:`json`,body:{...i,emlContent:t.emlContent,escalatedSubmissionId:t.escalatedSubmissionId,expectedDisposition:t.expectedDisposition,body:t.body},validation:`passed`});return}let m=await a(t),h=t.local?f:await r(m);if(t.accountId=h,t.body){let e=l(t.body),n=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating investigate`,async()=>m.post(`/accounts/${h}/email-security/investigate/${t.postfixId}/reclassify${n?`?`+n:``}`,{body:e})),{successLabel:`Created investigate`});return}t.expectedDisposition===void 0&&(t.expectedDisposition=await n(`expected-disposition`,``,[`NONE`,`BULK`,`MALICIOUS`,`SPAM`,`SPOOF`,`SUSPICIOUS`]));let g={};t.emlContent!==void 0&&c(g,[`eml_content`],o(t.emlContent,`emlContent`,`text`)),t.escalatedSubmissionId!==void 0&&c(g,[`escalated_submission_id`],o(t.escalatedSubmissionId,`escalatedSubmissionId`,`text`)),t.expectedDisposition!==void 0&&c(g,[`expected_disposition`],o(t.expectedDisposition,`expectedDisposition`,`text`));let _=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();u(await p(`Creating investigate`,async()=>m.post(`/accounts/${h}/email-security/investigate/${t.postfixId}/reclassify${_?`?`+_:``}`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created investigate`})}},D={command:`reclassify`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(E).demandCommand(1),handler:()=>{}},O={command:`bulk`,describe:`Releases a quarantined email message, allowing it to be delivered to the recipient.`,builder:e=>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."}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security investigate release bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/investigate/release`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating release`,async()=>n.post(`/accounts/${i}/email-security/investigate/release`,{body:e})),{successLabel:`Created release`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},k={command:`release`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(O).demandCommand(1),handler:()=>{}},A={command:`get <postfixId>`,describe:`Gets the delivery trace for an email message, showing its path through email security processing.`,builder:e=>e.positional(`postfixId`,{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 regular datastore only.`,default:!1}),handler:async e=>{s(e.postfixId,`postfixId`);let t={};e.submission!==void 0&&(t.submission=e.submission);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading trace`,async()=>n.emailSecurity.investigate.trace.get(i,e.postfixId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded trace`})}},j={command:`trace`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(A).demandCommand(1),handler:()=>{}},M={command:`investigate`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(ee).command(te).command(h).command(_).command(b).command(C).command(T).command(D).command(k).command(j).demandCommand(1),handler:()=>{}},N={command:`list`,describe:"Retrieves `PhishGuard` reports showing phishing attempts and suspicious email patterns detected.",builder:e=>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).`}),handler:async e=>{let t={};e.fromDate!==void 0&&(t.from_date=e.fromDate),e.toDate!==void 0&&(t.to_date=e.toDate),e.start!==void 0&&(t.start=e.start),e.end!==void 0&&(t.end=e.end);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading reports`,async()=>n.emailSecurity.phishguard.reports.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded reports`})}},P={command:`reports`,describe:`PhishGuard user-reported phishing submissions and analysis reports`,builder:e=>e.command(N).demandCommand(1),handler:()=>{}},F={command:`phishguard`,describe:`Operations for phishguard`,builder:e=>e.command(P).demandCommand(1),handler:()=>{}},I={command:`create`,describe:`Creates a new email allow policy that permits specific senders, domains, or patterns to bypass security scanning.`,builder:e=>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. 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. 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)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-security settings allow-policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},bodyKind:`json`,body:{comments:i.comments,isAcceptableSender:i.isAcceptableSender,isExemptRecipient:i.isExemptRecipient,isRecipient:i.isRecipient,isRegex:i.isRegex,isSender:i.isSender,isSpoof:i.isSpoof,isTrustedSender:i.isTrustedSender,pattern:i.pattern,patternType:i.patternType,verifySender:i.verifySender,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating allow policy`,async()=>m.post(`/accounts/${h}/email-security/settings/allow_policies`,{body:e})),{successLabel:`Created allow policy`});return}if(i.isAcceptableSender===void 0)throw Error(`--is-acceptable-sender is required (or pass --body with this field set).`);if(i.isExemptRecipient===void 0)throw Error(`--is-exempt-recipient is required (or pass --body with this field set).`);if(i.isRegex===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);if(i.isTrustedSender===void 0)throw Error(`--is-trusted-sender is required (or pass --body with this field set).`);if(i.pattern===void 0&&(i.pattern=await t(`pattern`,``)),i.patternType===void 0&&(i.patternType=await n(`pattern-type`,``,[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`])),i.verifySender===void 0)throw Error(`--verify-sender is required (or pass --body with this field set).`);let g={};i.comments!==void 0&&c(g,[`comments`],o(i.comments,`comments`,`text`)),i.isAcceptableSender!==void 0&&c(g,[`is_acceptable_sender`],i.isAcceptableSender),i.isExemptRecipient!==void 0&&c(g,[`is_exempt_recipient`],i.isExemptRecipient),i.isRecipient!==void 0&&c(g,[`is_recipient`],i.isRecipient),i.isRegex!==void 0&&c(g,[`is_regex`],i.isRegex),i.isSender!==void 0&&c(g,[`is_sender`],i.isSender),i.isSpoof!==void 0&&c(g,[`is_spoof`],i.isSpoof),i.isTrustedSender!==void 0&&c(g,[`is_trusted_sender`],i.isTrustedSender),i.pattern!==void 0&&c(g,[`pattern`],o(i.pattern,`pattern`,`text`)),i.patternType!==void 0&&c(g,[`pattern_type`],o(i.patternType,`patternType`,`text`)),i.verifySender!==void 0&&c(g,[`verify_sender`],i.verifySender),u(await p(`Creating allow policy`,async()=>m.post(`/accounts/${h}/email-security/settings/allow_policies`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created allow policy`})}},L={command:`delete <policyId>`,describe:`Removes an email allow policy. Previously allowed senders will be subject to normal security scanning.`,builder:e=>e.positional(`policyId`,{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}),handler:async t=>{if(s(t.policyId,`policyId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings allow-policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/allow_policies/${t.policyId??`<policyId>`}`,pathParams:{policyId:String(t.policyId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`allow policy`,String(t.policyId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting allow policy`,async()=>n.emailSecurity.settings.allowPolicies.delete(o,t.policyId)),{successLabel:`Deleted allow policy`})}},R={command:`edit <policyId>`,describe:`Updates an existing email allow policy, modifying its matching criteria or scope.`,builder:e=>e.positional(`policyId`,{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. 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. 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)`}),handler:async t=>{if(s(t.policyId,`policyId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings allow-policies edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/allow_policies/${t.policyId??`<policyId>`}`,pathParams:{policyId:String(t.policyId??``)},bodyKind:`json`,body:{comments:t.comments,isAcceptableSender:t.isAcceptableSender,isExemptRecipient:t.isExemptRecipient,isRegex:t.isRegex,isTrustedSender:t.isTrustedSender,pattern:t.pattern,verifySender:t.verifySender,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating allow policy`,async()=>n.patch(`/accounts/${i}/email-security/settings/allow_policies/${t.policyId}`,{body:e})),{successLabel:`Updated allow policy`});return}let m={};t.comments!==void 0&&c(m,[`comments`],o(t.comments,`comments`,`text`)),t.isAcceptableSender!==void 0&&c(m,[`is_acceptable_sender`],t.isAcceptableSender),t.isExemptRecipient!==void 0&&c(m,[`is_exempt_recipient`],t.isExemptRecipient),t.isRegex!==void 0&&c(m,[`is_regex`],t.isRegex),t.isTrustedSender!==void 0&&c(m,[`is_trusted_sender`],t.isTrustedSender),t.pattern!==void 0&&c(m,[`pattern`],o(t.pattern,`pattern`,`text`)),t.verifySender!==void 0&&c(m,[`verify_sender`],t.verifySender),u(await p(`Updating allow policy`,async()=>n.patch(`/accounts/${i}/email-security/settings/allow_policies/${t.policyId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated allow policy`})}},z={command:`get <policyId>`,describe:`Retrieves details for a specific email allow policy, including its matching criteria and scope.`,builder:e=>e.positional(`policyId`,{type:`string`,description:`The unique identifier for the allow policy.`,demandOption:!0}),handler:async e=>{s(e.policyId,`policyId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading allow policy`,async()=>t.emailSecurity.settings.allowPolicies.get(n,e.policyId)),{successLabel:`Loaded allow policy`})}},B={command:`list`,describe:`Lists, searches, and sorts an account’s email allow policies.`,builder:e=>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. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future.`}).option(`is-sender`,{type:`boolean`,description:`Is sender`,default:!1}).option(`is-trusted-sender`,{type:`boolean`,description:`Is trusted sender`,default:!1}).option(`is-recipient`,{type:`boolean`,description:`Is recipient`,default:!1}).option(`is-exempt-recipient`,{type:`boolean`,description:`Is exempt recipient`,default:!1}).option(`is-spoof`,{type:`boolean`,description:`Is spoof`,default:!1}).option(`is-acceptable-sender`,{type:`boolean`,description:`Is acceptable sender`,default:!1}).option(`verify-sender`,{type:`boolean`,description:`Verify sender`,default:!1}).option(`pattern-type`,{type:`string`,description:`Pattern type`}).option(`pattern`,{type:`string`,description:`Pattern`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.search!==void 0&&(t.search=e.search),e.isSender!==void 0&&(t.is_sender=e.isSender),e.isTrustedSender!==void 0&&(t.is_trusted_sender=e.isTrustedSender),e.isRecipient!==void 0&&(t.is_recipient=e.isRecipient),e.isExemptRecipient!==void 0&&(t.is_exempt_recipient=e.isExemptRecipient),e.isSpoof!==void 0&&(t.is_spoof=e.isSpoof),e.isAcceptableSender!==void 0&&(t.is_acceptable_sender=e.isAcceptableSender),e.verifySender!==void 0&&(t.verify_sender=e.verifySender),e.patternType!==void 0&&(t.pattern_type=e.patternType),e.pattern!==void 0&&(t.pattern=e.pattern);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading allow policies`,async()=>n.emailSecurity.settings.allowPolicies.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded allow policies`})}},V={command:`allow-policies`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(I).command(L).command(R).command(z).command(B).demandCommand(1),handler:()=>{}},H={command:`create`,describe:`Send a Batch of Allow Policies API calls to be executed together.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings batch allow policies batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/allow_policies/batch`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating batch`,async()=>n.post(`/accounts/${i}/email-security/settings/allow_policies/batch`,{body:e})),{successLabel:`Created batch`});return}u(await p(`Creating batch`,async()=>n.emailSecurity.settings.batch.allow.policies.batch.create(i)),{successLabel:`Created batch`})}},U={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(H).demandCommand(1),handler:()=>{}},W={command:`policies`,describe:`Operations for settings.batch.allow.policies`,builder:e=>e.command(U).demandCommand(1),handler:()=>{}},G={command:`allow`,describe:`Operations for settings.batch.allow`,builder:e=>e.command(W).demandCommand(1),handler:()=>{}},K={command:`create`,describe:`Send a Batch of Block Senders API calls to be executed together.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings batch block senders batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/block_senders/batch`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating batch`,async()=>n.post(`/accounts/${i}/email-security/settings/block_senders/batch`,{body:e})),{successLabel:`Created batch`});return}u(await p(`Creating batch`,async()=>n.emailSecurity.settings.batch.block.senders.batch.create(i)),{successLabel:`Created batch`})}},q={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(K).demandCommand(1),handler:()=>{}},J={command:`senders`,describe:`Operations for settings.batch.block.senders`,builder:e=>e.command(q).demandCommand(1),handler:()=>{}},Y={command:`block`,describe:`Operations for settings.batch.block`,builder:e=>e.command(J).demandCommand(1),handler:()=>{}},X={command:`create`,describe:"Send a Batch of `sending_domain_restrictions` API calls to be executed together.",builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings batch sending domain restrictions batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/sending_domain_restrictions/batch`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating batch`,async()=>n.post(`/accounts/${i}/email-security/settings/sending_domain_restrictions/batch`,{body:e})),{successLabel:`Created batch`});return}u(await p(`Creating batch`,async()=>n.emailSecurity.settings.batch.sending.domain.restrictions.batch.create(i)),{successLabel:`Created batch`})}},Z={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(X).demandCommand(1),handler:()=>{}},Q={command:`restrictions`,describe:`Operations for settings.batch.sending.domain.restrictions`,builder:e=>e.command(Z).demandCommand(1),handler:()=>{}},ne={command:`domain`,describe:`Operations for settings.batch.sending.domain`,builder:e=>e.command(Q).demandCommand(1),handler:()=>{}},re={command:`sending`,describe:`Operations for settings.batch.sending`,builder:e=>e.command(ne).demandCommand(1),handler:()=>{}},ie={command:`create`,describe:`Send a Batch of Trusted Domains API calls to be executed together.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings batch trusted domains batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/trusted_domains/batch`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating batch`,async()=>n.post(`/accounts/${i}/email-security/settings/trusted_domains/batch`,{body:e})),{successLabel:`Created batch`});return}u(await p(`Creating batch`,async()=>n.emailSecurity.settings.batch.trusted.domains.batch.create(i)),{successLabel:`Created batch`})}},ae={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(ie).demandCommand(1),handler:()=>{}},oe={command:`domains`,describe:`Operations for settings.batch.trusted.domains`,builder:e=>e.command(ae).demandCommand(1),handler:()=>{}},se={command:`trusted`,describe:`Operations for settings.batch.trusted`,builder:e=>e.command(oe).demandCommand(1),handler:()=>{}},ce={command:`batch`,describe:`Operations for settings.batch`,builder:e=>e.command(G).command(Y).command(re).command(se).demandCommand(1),handler:()=>{}},le={command:`create`,describe:`Adds a sender pattern to the email block list, preventing messages from matching senders from being delivered.`,builder:e=>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)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-security settings block-senders create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},bodyKind:`json`,body:{comments:i.comments,isRegex:i.isRegex,pattern:i.pattern,patternType:i.patternType,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating block sender`,async()=>m.post(`/accounts/${h}/email-security/settings/block_senders`,{body:e})),{successLabel:`Created block sender`});return}if(i.isRegex===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);i.pattern===void 0&&(i.pattern=await t(`pattern`,``)),i.patternType===void 0&&(i.patternType=await n(`pattern-type`,``,[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]));let g={};i.comments!==void 0&&c(g,[`comments`],o(i.comments,`comments`,`text`)),i.isRegex!==void 0&&c(g,[`is_regex`],i.isRegex),i.pattern!==void 0&&c(g,[`pattern`],o(i.pattern,`pattern`,`text`)),i.patternType!==void 0&&c(g,[`pattern_type`],o(i.patternType,`patternType`,`text`)),u(await p(`Creating block sender`,async()=>m.post(`/accounts/${h}/email-security/settings/block_senders`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created block sender`})}},ue={command:`delete <patternId>`,describe:`Removes a sender from the email block list, allowing their messages to be delivered normally.`,builder:e=>e.positional(`patternId`,{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}),handler:async t=>{if(s(t.patternId,`patternId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings block-senders delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/block_senders/${t.patternId??`<patternId>`}`,pathParams:{patternId:String(t.patternId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`block sender`,String(t.patternId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting block sender`,async()=>n.emailSecurity.settings.blockSenders.delete(o,t.patternId)),{successLabel:`Deleted block sender`})}},de={command:`edit <patternId>`,describe:`Modifies a blocked sender entry, updating its pattern or block reason.`,builder:e=>e.positional(`patternId`,{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)`}),handler:async t=>{if(s(t.patternId,`patternId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings block-senders edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/block_senders/${t.patternId??`<patternId>`}`,pathParams:{patternId:String(t.patternId??``)},bodyKind:`json`,body:{comments:t.comments,isRegex:t.isRegex,pattern:t.pattern,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating block sender`,async()=>n.patch(`/accounts/${i}/email-security/settings/block_senders/${t.patternId}`,{body:e})),{successLabel:`Updated block sender`});return}let m={};t.comments!==void 0&&c(m,[`comments`],o(t.comments,`comments`,`text`)),t.isRegex!==void 0&&c(m,[`is_regex`],t.isRegex),t.pattern!==void 0&&c(m,[`pattern`],o(t.pattern,`pattern`,`text`)),u(await p(`Updating block sender`,async()=>n.patch(`/accounts/${i}/email-security/settings/block_senders/${t.patternId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated block sender`})}},fe={command:`get <patternId>`,describe:`Gets information about a specific blocked sender entry, including the pattern and block reason.`,builder:e=>e.positional(`patternId`,{type:`string`,description:`The unique identifier for the allow policy.`,demandOption:!0}),handler:async e=>{s(e.patternId,`patternId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading block sender`,async()=>t.emailSecurity.settings.blockSenders.get(n,e.patternId)),{successLabel:`Loaded block sender`})}},pe={command:`list`,describe:`Lists all blocked sender entries with their patterns and block reasons.`,builder:e=>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. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future.`}).option(`pattern-type`,{type:`string`,description:`Pattern type`}).option(`pattern`,{type:`string`,description:`Pattern`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.search!==void 0&&(t.search=e.search),e.patternType!==void 0&&(t.pattern_type=e.patternType),e.pattern!==void 0&&(t.pattern=e.pattern);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading block senders`,async()=>n.emailSecurity.settings.blockSenders.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded block senders`})}},me={command:`block-senders`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(le).command(ue).command(de).command(fe).command(pe).demandCommand(1),handler:()=>{}},he={command:`bulk-delete`,describe:`Bulk removes multiple domains from email security configuration in a single request.`,builder:e=>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)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings domains bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/domains`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`domains`,``,{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}if(t.body){let e=l(t.body);u(await p(`Deleting domains`,async()=>n.delete(`/accounts/${o}/email-security/settings/domains`,{body:e})),{successLabel:`Deleted domains`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ge={command:`delete <domainId>`,describe:`Removes a domain from the email security configuration.`,builder:e=>e.positional(`domainId`,{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}),handler:async t=>{if(s(t.domainId,`domainId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/domains/${t.domainId??`<domainId>`}`,pathParams:{domainId:String(t.domainId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`domain`,String(t.domainId??``),{force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}u(await p(`Deleting domain`,async()=>n.emailSecurity.settings.domains.delete(o,t.domainId)),{successLabel:`Deleted domain`})}},_e={command:`edit <domainId>`,describe:`Updates configuration for a domain in email security.`,builder:e=>e.positional(`domainId`,{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)`}),handler:async t=>{if(s(t.domainId,`domainId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/domains/${t.domainId??`<domainId>`}`,pathParams:{domainId:String(t.domainId??``)},bodyKind:`json`,body:{allowedDeliveryModes:t.allowedDeliveryModes,domain:t.domain,dropDispositions:t.dropDispositions,integrationId:t.integrationId,ipRestrictions:t.ipRestrictions,lookbackHops:t.lookbackHops,regions:t.regions,requireTlsInbound:t.requireTlsInbound,requireTlsOutbound:t.requireTlsOutbound,transport:t.transport,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating domain`,async()=>n.patch(`/accounts/${i}/email-security/settings/domains/${t.domainId}`,{body:e})),{successLabel:`Updated domain`});return}if(t.ipRestrictions===void 0)throw Error(`--ip-restrictions is required (or pass --body with this field set).`);let m={};t.allowedDeliveryModes!==void 0&&c(m,[`allowed_delivery_modes`],t.allowedDeliveryModes),t.domain!==void 0&&c(m,[`domain`],o(t.domain,`domain`,`text`)),t.dropDispositions!==void 0&&c(m,[`drop_dispositions`],t.dropDispositions),t.integrationId!==void 0&&c(m,[`integration_id`],o(t.integrationId,`integrationId`,`text`)),t.ipRestrictions!==void 0&&c(m,[`ip_restrictions`],t.ipRestrictions),t.lookbackHops!==void 0&&c(m,[`lookback_hops`],t.lookbackHops),t.regions!==void 0&&c(m,[`regions`],t.regions),t.requireTlsInbound!==void 0&&c(m,[`require_tls_inbound`],t.requireTlsInbound),t.requireTlsOutbound!==void 0&&c(m,[`require_tls_outbound`],t.requireTlsOutbound),t.transport!==void 0&&c(m,[`transport`],o(t.transport,`transport`,`text`)),u(await p(`Updating domain`,async()=>n.patch(`/accounts/${i}/email-security/settings/domains/${t.domainId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated domain`})}},ve={command:`get <domainId>`,describe:`Gets configuration details for a specific domain in email security.`,builder:e=>e.positional(`domainId`,{type:`string`,description:`The unique identifier for the domain.`,demandOption:!0}),handler:async e=>{s(e.domainId,`domainId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading domain`,async()=>t.emailSecurity.settings.domains.get(n,e.domainId)),{successLabel:`Loaded domain`})}},ye={command:`list`,describe:`Lists, searches, and sorts an account’s email domains.`,builder:e=>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. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change 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.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.search!==void 0&&(t.search=e.search),e.allowedDeliveryMode!==void 0&&(t.allowed_delivery_mode=e.allowedDeliveryMode),e.domain!==void 0&&(t.domain=e.domain),e.activeDeliveryMode!==void 0&&(t.active_delivery_mode=e.activeDeliveryMode),e.integrationId!==void 0&&(t.integration_id=e.integrationId);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading domains`,async()=>n.emailSecurity.settings.domains.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded domains`})}},be={command:`domains`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(he).command(ge).command(_e).command(ve).command(ye).demandCommand(1),handler:()=>{}},xe={command:`create`,describe:`Creates a display name entry for email security impersonation protection.`,builder:e=>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)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-security settings impersonation-registry create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email-security/settings/impersonation_registry`,pathParams:{},bodyKind:`json`,body:{email:n.email,isEmailRegex:n.isEmailRegex,name:n.name,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating impersonation registry`,async()=>i.post(`/accounts/${m}/email-security/settings/impersonation_registry`,{body:e})),{successLabel:`Created impersonation registry`});return}if(n.email===void 0&&(n.email=await t(`email`,``)),n.isEmailRegex===void 0)throw Error(`--is-email-regex is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await t(`name`,``));let h={};n.email!==void 0&&c(h,[`email`],o(n.email,`email`,`text`)),n.isEmailRegex!==void 0&&c(h,[`is_email_regex`],n.isEmailRegex),n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),u(await p(`Creating impersonation registry`,async()=>i.post(`/accounts/${m}/email-security/settings/impersonation_registry`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created impersonation registry`})}},Se={command:`delete <displayNameId>`,describe:`Removes a display name from impersonation protection monitoring.`,builder:e=>e.positional(`displayNameId`,{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}),handler:async t=>{if(s(t.displayNameId,`displayNameId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings impersonation-registry delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/impersonation_registry/${t.displayNameId??`<displayNameId>`}`,pathParams:{displayNameId:String(t.displayNameId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`impersonation registry`,String(t.displayNameId??``),{force:!!t.force})){process.stderr.write(`Aborted.
7
- `);return}u(await p(`Deleting impersonation registry`,async()=>n.emailSecurity.settings.impersonationRegistry.delete(o,t.displayNameId)),{successLabel:`Deleted impersonation registry`})}},Ce={command:`edit <displayNameId>`,describe:`Updates a display name entry used for impersonation protection.`,builder:e=>e.positional(`displayNameId`,{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)`}),handler:async t=>{if(s(t.displayNameId,`displayNameId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings impersonation-registry edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/impersonation_registry/${t.displayNameId??`<displayNameId>`}`,pathParams:{displayNameId:String(t.displayNameId??``)},bodyKind:`json`,body:{email:t.email,isEmailRegex:t.isEmailRegex,name:t.name,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating impersonation registry`,async()=>n.patch(`/accounts/${i}/email-security/settings/impersonation_registry/${t.displayNameId}`,{body:e})),{successLabel:`Updated impersonation registry`});return}let m={};t.email!==void 0&&c(m,[`email`],o(t.email,`email`,`text`)),t.isEmailRegex!==void 0&&c(m,[`is_email_regex`],t.isEmailRegex),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),u(await p(`Updating impersonation registry`,async()=>n.patch(`/accounts/${i}/email-security/settings/impersonation_registry/${t.displayNameId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated impersonation registry`})}},we={command:`get <displayNameId>`,describe:`Retrieves a display name entry used for impersonation protection.`,builder:e=>e.positional(`displayNameId`,{type:`string`,description:`Display name ID`,demandOption:!0}),handler:async e=>{s(e.displayNameId,`displayNameId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading impersonation registry`,async()=>t.emailSecurity.settings.impersonationRegistry.get(n,e.displayNameId)),{successLabel:`Loaded impersonation registry`})}},Te={command:`list`,describe:`Lists, searches, and sorts entries in the impersonation registry.`,builder:e=>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. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future.`}).option(`provenance`,{type:`string`,description:`Provenance`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.search!==void 0&&(t.search=e.search),e.provenance!==void 0&&(t.provenance=e.provenance);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading impersonation registry`,async()=>n.emailSecurity.settings.impersonationRegistry.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded impersonation registry`})}},Ee={command:`impersonation-registry`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(xe).command(Se).command(Ce).command(we).command(Te).demandCommand(1),handler:()=>{}},De={command:`create`,describe:`Adds a domain to the trusted domains list for email security, reducing false positive detections.`,builder:e=>e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-recent`,{type:`boolean`,description:`Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`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`]),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings trusted-domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},bodyKind:`json`,body:{comments:t.comments,isRecent:t.isRecent,isRegex:t.isRegex,isSimilarity:t.isSimilarity,pattern:t.pattern,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating trusted domain`,async()=>n.post(`/accounts/${i}/email-security/settings/trusted_domains`,{body:e})),{successLabel:`Created trusted domain`});return}let m={};t.comments!==void 0&&c(m,[`comments`],o(t.comments,`comments`,`text`)),t.isRecent!==void 0&&c(m,[`is_recent`],t.isRecent),t.isRegex!==void 0&&c(m,[`is_regex`],t.isRegex),t.isSimilarity!==void 0&&c(m,[`is_similarity`],t.isSimilarity),t.pattern!==void 0&&c(m,[`pattern`],o(t.pattern,`pattern`,`text`)),u(await p(`Creating trusted domain`,async()=>n.post(`/accounts/${i}/email-security/settings/trusted_domains`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created trusted domain`})}},$={command:`delete <trustedDomainId>`,describe:`Removes a domain from the trusted domains list, subjecting it to normal security scanning.`,builder:e=>e.positional(`trustedDomainId`,{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}),handler:async t=>{if(s(t.trustedDomainId,`trustedDomainId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings trusted-domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/trusted_domains/${t.trustedDomainId??`<trustedDomainId>`}`,pathParams:{trustedDomainId:String(t.trustedDomainId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`trusted domain`,String(t.trustedDomainId??``),{force:!!t.force})){process.stderr.write(`Aborted.
8
- `);return}u(await p(`Deleting trusted domain`,async()=>n.emailSecurity.settings.trustedDomains.delete(o,t.trustedDomainId)),{successLabel:`Deleted trusted domain`})}},Oe={command:`edit <trustedDomainId>`,describe:`Modifies a trusted domain entry's configuration.`,builder:e=>e.positional(`trustedDomainId`,{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 Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.trustedDomainId,`trustedDomainId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf email-security settings trusted-domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/email-security/settings/trusted_domains/${t.trustedDomainId??`<trustedDomainId>`}`,pathParams:{trustedDomainId:String(t.trustedDomainId??``)},bodyKind:`json`,body:{comments:t.comments,isRecent:t.isRecent,isRegex:t.isRegex,isSimilarity:t.isSimilarity,pattern:t.pattern,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating trusted domain`,async()=>n.patch(`/accounts/${i}/email-security/settings/trusted_domains/${t.trustedDomainId}`,{body:e})),{successLabel:`Updated trusted domain`});return}let m={};t.comments!==void 0&&c(m,[`comments`],o(t.comments,`comments`,`text`)),t.isRecent!==void 0&&c(m,[`is_recent`],t.isRecent),t.isRegex!==void 0&&c(m,[`is_regex`],t.isRegex),t.isSimilarity!==void 0&&c(m,[`is_similarity`],t.isSimilarity),t.pattern!==void 0&&c(m,[`pattern`],o(t.pattern,`pattern`,`text`)),u(await p(`Updating trusted domain`,async()=>n.patch(`/accounts/${i}/email-security/settings/trusted_domains/${t.trustedDomainId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated trusted domain`})}},ke={command:`get <trustedDomainId>`,describe:`Gets information about a specific trusted domain entry.`,builder:e=>e.positional(`trustedDomainId`,{type:`string`,description:`The unique identifier for the trusted domain.`,demandOption:!0}),handler:async e=>{s(e.trustedDomainId,`trustedDomainId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading trusted domain`,async()=>t.emailSecurity.settings.trustedDomains.get(n,e.trustedDomainId)),{successLabel:`Loaded trusted domain`})}},Ae={command:`list`,describe:`Lists, searches, and sorts an account’s trusted email domains.`,builder:e=>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. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future.`}).option(`is-recent`,{type:`boolean`,description:`Is recent`,default:!1}).option(`is-similarity`,{type:`boolean`,description:`Is similarity`,default:!1}).option(`pattern`,{type:`string`,description:`Pattern`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.search!==void 0&&(t.search=e.search),e.isRecent!==void 0&&(t.is_recent=e.isRecent),e.isSimilarity!==void 0&&(t.is_similarity=e.isSimilarity),e.pattern!==void 0&&(t.pattern=e.pattern);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading trusted domains`,async()=>n.emailSecurity.settings.trustedDomains.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded trusted domains`})}},je={command:`trusted-domains`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(De).command($).command(Oe).command(ke).command(Ae).demandCommand(1),handler:()=>{}},Me={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(V).command(ce).command(me).command(be).command(Ee).command(je).demandCommand(1),handler:()=>{}},Ne={command:`list`,describe:`This endpoint returns information for submissions to made to reclassify emails.`,builder:e=>e.option(`start`,{type:`string`,description:"The beginning of the search date range. Defaults to `now - 30 days` if not provided."}).option(`end`,{type:`string`,description:"The end of the search date range. Defaults 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.`}),handler:async e=>{let t={};e.start!==void 0&&(t.start=e.start),e.end!==void 0&&(t.end=e.end),e.type!==void 0&&(t.type=e.type),e.submissionId!==void 0&&(t.submission_id=e.submissionId),e.originalDisposition!==void 0&&(t.original_disposition=e.originalDisposition),e.requestedDisposition!==void 0&&(t.requested_disposition=e.requestedDisposition),e.outcomeDisposition!==void 0&&(t.outcome_disposition=e.outcomeDisposition),e.status!==void 0&&(t.status=e.status),e.query!==void 0&&(t.query=e.query),e.customerStatus!==void 0&&(t.customer_status=e.customerStatus),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading submissions`,async()=>n.emailSecurity.submissions.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded submissions`})}},Pe={command:`submissions`,describe:`User and admin email submissions for classification review`,builder:e=>e.command(Ne).demandCommand(1),handler:()=>{}},Fe={command:`email-security`,describe:`Cloud email security (Area 1) — investigate threats, manage allow/block policies, and detect phishing`,builder:e=>e.command(M).command(F).command(Me).command(Pe).demandCommand(1),handler:()=>{}};export{Fe as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,o as n,p as r,t as i,u as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`get`,describe:`Returns the current daily sending quota for the account. Null when the quota is not yet available.`,builder:e=>e,handler:async e=>{let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading limit`,async()=>t.emailSending.limits.get(r)),{successLabel:`Loaded limit`})}},h={command:`limits`,describe:`Operations for limits`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`send-raw`,describe:`Send a raw MIME email`,builder:e=>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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-sending send-raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email/sending/send_raw`,pathParams:{},bodyKind:`json`,body:{from:r.from,mimeMessage:r.mimeMessage,recipients:r.recipients,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating raw`,async()=>a.post(`/accounts/${m}/email/sending/send_raw`,{body:e})),{successLabel:`Created raw`});return}if(r.from===void 0&&(r.from=await t(`from`,`Sender email address.`)),r.mimeMessage===void 0&&(r.mimeMessage=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.`)),r.recipients===void 0)throw Error(`--recipients is required (or pass --body with this field set).`);let h={};r.from!==void 0&&c(h,[`from`],o(r.from,`from`,`text`)),r.mimeMessage!==void 0&&c(h,[`mime_message`],o(r.mimeMessage,`mimeMessage`,`text`)),r.recipients!==void 0&&c(h,[`recipients`],r.recipients),u(await p(`Creating raw`,async()=>a.post(`/accounts/${m}/email/sending/send_raw`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created raw`})}},_={command:`send`,describe:`Send an email`,builder:e=>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`]),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf email-sending send`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/email/sending/send`,pathParams:{},bodyKind:`json`,body:{fromAddress:r.fromAddress,fromName:r.fromName,html:r.html,replyToAddress:r.replyToAddress,replyToName:r.replyToName,subject:r.subject,text:r.text,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating email sending`,async()=>a.post(`/accounts/${m}/email/sending/send`,{body:e})),{successLabel:`Created email sending`});return}r.subject===void 0&&(r.subject=await t(`subject`,`Email subject line.`));let h={};r.fromAddress!==void 0&&c(h,[`from`,`address`],o(r.fromAddress,`fromAddress`,`text`)),r.fromName!==void 0&&c(h,[`from`,`name`],o(r.fromName,`fromName`,`text`)),r.html!==void 0&&c(h,[`html`],o(r.html,`html`,`text`)),r.replyToAddress!==void 0&&c(h,[`reply_to`,`address`],o(r.replyToAddress,`replyToAddress`,`text`)),r.replyToName!==void 0&&c(h,[`reply_to`,`name`],o(r.replyToName,`replyToName`,`text`)),r.subject!==void 0&&c(h,[`subject`],o(r.subject,`subject`,`text`)),r.text!==void 0&&c(h,[`text`],o(r.text,`text`,`text`)),u(await p(`Creating email sending`,async()=>a.post(`/accounts/${m}/email/sending/send`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created email sending`})}},v={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:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-sending subdomains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/sending/subdomains`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{name:e.name,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Creating subdomain`,async()=>n.post(`/zones/${e.zoneId}/email/sending/subdomains`,{body:t})),{successLabel:`Created subdomain`});return}e.name===void 0&&(e.name=await t(`name`,`The subdomain name. Must be within the zone.`));let r={};e.name!==void 0&&c(r,[`name`],o(e.name,`name`,`text`)),u(await p(`Creating subdomain`,async()=>n.post(`/zones/${e.zoneId}/email/sending/subdomains`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created subdomain`})}},y={command:`delete <subdomainId>`,describe:`Disables sending on a subdomain and removes its DNS records. If routing is still active on the subdomain, only sending is disabled.`,builder:e=>e.positional(`subdomainId`,{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}),handler:async e=>{if(s(e.subdomainId,`subdomainId`),e.dryRun){d({command:`cf email-sending subdomains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/sending/subdomains/${e.subdomainId??`<subdomainId>`}`,pathParams:{subdomainId:String(e.subdomainId??``),zoneId:String(e.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`subdomain`,String(e.subdomainId??``),{force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting subdomain`,async()=>t.emailSending.subdomains.delete(e.subdomainId,n)),{successLabel:`Deleted subdomain`})}},b={command:`get <subdomainId>`,describe:`Returns the expected DNS records for a sending subdomain.`,builder:e=>e.positional(`subdomainId`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}),handler:async e=>{s(e.subdomainId,`subdomainId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading dn`,async()=>t.emailSending.subdomains.dns.get(e.subdomainId,n)),{successLabel:`Loaded dn`})}},x={command:`dns`,describe:`Sending subdomain operations`,builder:e=>e.command(b).demandCommand(1),handler:()=>{}},S={command:`get <subdomainId>`,describe:`Gets information for a specific sending subdomain.`,builder:e=>e.positional(`subdomainId`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}),handler:async e=>{s(e.subdomainId,`subdomainId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading subdomain`,async()=>t.emailSending.subdomains.get(e.subdomainId,n)),{successLabel:`Loaded subdomain`})}},C={command:`list`,describe:`Lists all sending-enabled subdomains for the zone.`,builder:e=>e,handler:async e=>{let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading subdomains`,async()=>t.emailSending.subdomains.list(n)),{successLabel:`Loaded subdomains`})}},w={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:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf email-sending subdomains preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/email/sending/subdomains/preview`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{name:e.name,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Loading subdomain`,async()=>n.post(`/zones/${e.zoneId}/email/sending/subdomains/preview`,{body:t})),{successLabel:`Loaded subdomain`});return}e.name===void 0&&(e.name=await t(`name`,`The subdomain name. Must be within the zone.`));let r={};e.name!==void 0&&c(r,[`name`],o(e.name,`name`,`text`)),u(await p(`Loading subdomain`,async()=>n.post(`/zones/${e.zoneId}/email/sending/subdomains/preview`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Loaded subdomain`})}},T={command:`subdomains`,describe:`Sending subdomain operations`,builder:e=>e.command(v).command(y).command(S).command(C).command(w).command(x).demandCommand(1),handler:()=>{}},E={command:`email-sending`,describe:`Send emails and manage sending subdomains`,builder:e=>e.command(_).command(g).command(h).command(T).demandCommand(1),handler:()=>{}};export{E as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{p as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r,r as i}from"./input-validation-BpVQi9rR.mjs";import{n as a,t as o}from"./body-parser-iA3vRFmh.mjs";import{t as s}from"./output-CqGQp2r6.mjs";import{t as c}from"./dry-run-FV0pZwdg.mjs";import{t as l}from"./progress-5sHFvwez.mjs";const u={command:`bulk-delete`,describe:`Deletes one or more existing filters.`,builder:e=>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}),handler:async r=>{let i={};if(r.id!==void 0&&(i.id=r.id),r.dryRun){c({command:`cf filters bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/filters`,pathParams:{zoneId:String(r.zoneId??``)},bodyKind:`json`,body:{...i},validation:`passed`});return}let a=await t(r),o=await n({zone:r.zone},a,{quiet:r.quiet});if(r.zoneId=o,!await e(`filters`,String(o??``),{force:!!r.force})){process.stderr.write(`Aborted.
3
- `);return}s(await l(`Deleting filters`,async()=>a.filters.bulkDelete(o,Object.keys(i).length>0?i:void 0)),{successLabel:`Deleted filters`})}},d={command:`bulk-update`,describe:`Updates one or more existing filters.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){c({command:`cf filters bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/filters`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let r=await t(e);if(e.zoneId=await n({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Updating filters`,async()=>r.put(`/zones/${e.zoneId}/filters`,{body:t})),{successLabel:`Updated filters`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},f={command:`create`,describe:`Creates one or more filters.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){c({command:`cf filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/filters`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let r=await t(e);if(e.zoneId=await n({zone:e.zone},r,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Creating filter`,async()=>r.post(`/zones/${e.zoneId}/filters`,{body:t})),{successLabel:`Created filter`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},p={command:`delete <filterId>`,describe:`Deletes an existing filter.`,builder:e=>e.positional(`filterId`,{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}),handler:async r=>{if(i(r.filterId,`filterId`),r.dryRun){c({command:`cf filters delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zoneId??`<zoneId>`}/filters/${r.filterId??`<filterId>`}`,pathParams:{filterId:String(r.filterId??``),zoneId:String(r.zoneId??``)},bodyKind:`none`,validation:`passed`});return}let a=await t(r),o=await n({zone:r.zone},a,{quiet:r.quiet});if(r.zoneId=o,!await e(`filter`,String(r.filterId??``),{force:!!r.force})){process.stderr.write(`Aborted.
4
- `);return}s(await l(`Deleting filter`,async()=>a.filters.delete(r.filterId,o)),{successLabel:`Deleted filter`})}},m={command:`get <filterId>`,describe:`Fetches the details of a filter.`,builder:e=>e.positional(`filterId`,{type:`string`,description:`The unique identifier of the filter.`,demandOption:!0}),handler:async e=>{i(e.filterId,`filterId`);let r=await t(e),a=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading filter`,async()=>r.filters.get(e.filterId,a)),{successLabel:`Loaded filter`})}},h={command:`list`,describe:`Fetches filters in a zone. You can filter the results using several optional parameters.`,builder:e=>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.`}),handler:async e=>{let r={};e.paused!==void 0&&(r.paused=e.paused),e.expression!==void 0&&(r.expression=e.expression),e.description!==void 0&&(r.description=e.description),e.ref!==void 0&&(r.ref=e.ref),e.page!==void 0&&(r.page=e.page),e.perPage!==void 0&&(r.per_page=e.perPage),e.id!==void 0&&(r.id=e.id);let i=await t(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,s(await l(`Loading filters`,async()=>i.filters.list(a,Object.keys(r).length>0?r:void 0)),{successLabel:`Loaded filters`})}},g={command:`update <filterId>`,describe:`Updates an existing filter.`,builder:e=>e.positional(`filterId`,{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)`}),handler:async e=>{if(i(e.filterId,`filterId`),e.dryRun){c({command:`cf filters update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/filters/${e.filterId??`<filterId>`}`,pathParams:{filterId:String(e.filterId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{description:e.description,expression:e.expression,paused:e.paused,ref:e.ref,body:e.body},validation:`passed`});return}let u=await t(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=o(e.body);s(await l(`Updating filter`,async()=>u.put(`/zones/${e.zoneId}/filters/${e.filterId}`,{body:t})),{successLabel:`Updated filter`});return}let d={};e.description!==void 0&&a(d,[`description`],r(e.description,`description`,`text`)),e.expression!==void 0&&a(d,[`expression`],r(e.expression,`expression`,`text`)),e.paused!==void 0&&a(d,[`paused`],e.paused),e.ref!==void 0&&a(d,[`ref`],r(e.ref,`ref`,`text`)),s(await l(`Updating filter`,async()=>u.put(`/zones/${e.zoneId}/filters/${e.filterId}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated filter`})}},_={command:`filters`,describe:`Filter expressions used by legacy firewall rules to match requests — prefer Rulesets for new configurations`,builder:e=>e.command(u).command(d).command(f).command(p).command(m).command(h).command(g).demandCommand(1),handler:()=>{}};export{_ as default};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,m as t,o as n,p as r,t as i,u as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";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:e=>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)`}),handler:async r=>{if(r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:{configurationTarget:r.configurationTarget,configurationValue:r.configurationValue,mode:r.mode,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Creating access rule`,async()=>a.post(`/accounts/${m}/firewall/access_rules/rules`,{body:e})),{successLabel:`Created access rule`});return}r.mode===void 0&&(r.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let h={};r.configurationTarget!==void 0&&c(h,[`configuration`,`target`],o(r.configurationTarget,`configurationTarget`,`text`)),r.configurationValue!==void 0&&c(h,[`configuration`,`value`],o(r.configurationValue,`configurationValue`,`text`)),r.mode!==void 0&&c(h,[`mode`],o(r.mode,`mode`,`text`)),u(await p(`Creating access rule`,async()=>a.post(`/accounts/${m}/firewall/access_rules/rules`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created access rule`})}},h={command:`delete <ruleId>`,describe:`Deletes an existing IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:e=>e.positional(`ruleId`,{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)`}),handler:async t=>{if(s(t.ruleId,`ruleId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/firewall/access_rules/rules/${t.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(t.ruleId??``)},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let a=await i(t),o=t.local?f:await n(a);if(t.accountId=o,!await r(`access rule`,String(t.ruleId??``),{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}if(t.body){let e=l(t.body);u(await p(`Deleting access rule`,async()=>a.delete(`/accounts/${o}/firewall/access_rules/rules/${t.ruleId}`,{body:e})),{successLabel:`Deleted access rule`});return}u(await p(`Deleting access rule`,async()=>a.firewall.accessRules.delete(t.ruleId,o)),{successLabel:`Deleted access rule`})}},ee={command:`edit <ruleId>`,describe:`Updates an IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:e=>e.positional(`ruleId`,{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)`}),handler:async r=>{if(s(r.ruleId,`ruleId`),r.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/firewall/access_rules/rules/${r.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(r.ruleId??``)},bodyKind:`json`,body:{configurationTarget:r.configurationTarget,configurationValue:r.configurationValue,mode:r.mode,notes:r.notes,body:r.body},validation:`passed`});return}let a=await i(r),m=r.local?f:await n(a);if(r.accountId=m,r.body){let e=l(r.body);u(await p(`Updating access rule`,async()=>a.patch(`/accounts/${m}/firewall/access_rules/rules/${r.ruleId}`,{body:e})),{successLabel:`Updated access rule`});return}r.mode===void 0&&(r.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let h={};r.configurationTarget!==void 0&&c(h,[`configuration`,`target`],o(r.configurationTarget,`configurationTarget`,`text`)),r.configurationValue!==void 0&&c(h,[`configuration`,`value`],o(r.configurationValue,`configurationValue`,`text`)),r.mode!==void 0&&c(h,[`mode`],o(r.mode,`mode`,`text`)),r.notes!==void 0&&c(h,[`notes`],o(r.notes,`notes`,`text`)),u(await p(`Updating access rule`,async()=>a.patch(`/accounts/${m}/firewall/access_rules/rules/${r.ruleId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated access rule`})}},g={command:`get <ruleId>`,describe:`Fetches the details of an IP Access rule defined at the account level.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}),handler:async e=>{s(e.ruleId,`ruleId`);let t=await i(e),r=e.local?f:await n(t);e.accountId=r,u(await p(`Loading access rule`,async()=>t.firewall.accessRules.get(e.ruleId,r)),{successLabel:`Loaded access rule`})}},_={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:e=>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`. Notes: 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. 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`]}),handler:async e=>{let t={};e.mode!==void 0&&(t.mode=e.mode),e.configurationTarget!==void 0&&(t.configurationTarget=e.configurationTarget),e.configurationValue!==void 0&&(t.configurationValue=e.configurationValue),e.notes!==void 0&&(t.notes=e.notes),e.match!==void 0&&(t.match=e.match),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let r=await i(e),a=e.local?f:await n(r);e.accountId=a,u(await p(`Loading access rules`,async()=>r.firewall.accessRules.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded access rules`})}},v={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(h).command(ee).command(g).command(_).demandCommand(1),handler:()=>{}},y={command:`create`,describe:`Creates a new Zone Lockdown rule.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf firewall lockdowns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/lockdowns`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{description:e.description,paused:e.paused,priority:e.priority,urls:e.urls,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Creating lockdown`,async()=>t.post(`/zones/${e.zoneId}/firewall/lockdowns`,{body:n})),{successLabel:`Created lockdown`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let n={};e.description!==void 0&&c(n,[`description`],o(e.description,`description`,`text`)),e.paused!==void 0&&c(n,[`paused`],e.paused),e.priority!==void 0&&c(n,[`priority`],e.priority),e.urls!==void 0&&c(n,[`urls`],e.urls),u(await p(`Creating lockdown`,async()=>t.post(`/zones/${e.zoneId}/firewall/lockdowns`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created lockdown`})}},b={command:`delete <lockDownsId>`,describe:`Deletes an existing Zone Lockdown rule.`,builder:e=>e.positional(`lockDownsId`,{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)`}),handler:async e=>{if(s(e.lockDownsId,`lockDownsId`),e.dryRun){d({command:`cf firewall lockdowns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/lockdowns/${e.lockDownsId??`<lockDownsId>`}`,pathParams:{lockDownsId:String(e.lockDownsId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`lockdown`,String(e.lockDownsId??``),{force:!!e.force})){process.stderr.write(`Aborted.
4
- `);return}if(e.body){let n=l(e.body);u(await p(`Deleting lockdown`,async()=>t.delete(`/zones/${e.zoneId}/firewall/lockdowns/${e.lockDownsId}`,{body:n})),{successLabel:`Deleted lockdown`});return}u(await p(`Deleting lockdown`,async()=>t.firewall.lockdowns.delete(e.lockDownsId,n)),{successLabel:`Deleted lockdown`})}},x={command:`get <lockDownsId>`,describe:`Fetches the details of a Zone Lockdown rule.`,builder:e=>e.positional(`lockDownsId`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}),handler:async e=>{s(e.lockDownsId,`lockDownsId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading lockdown`,async()=>t.firewall.lockdowns.get(e.lockDownsId,n)),{successLabel:`Loaded lockdown`})}},S={command:`list`,describe:`Fetches Zone Lockdown rules. You can filter the results using several optional parameters.`,builder:e=>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.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.description!==void 0&&(t.description=e.description),e.modifiedOn!==void 0&&(t.modified_on=e.modifiedOn),e.ip!==void 0&&(t.ip=e.ip),e.priority!==void 0&&(t.priority=e.priority),e.uriSearch!==void 0&&(t.uri_search=e.uriSearch),e.ipRangeSearch!==void 0&&(t.ip_range_search=e.ipRangeSearch),e.perPage!==void 0&&(t.per_page=e.perPage),e.createdOn!==void 0&&(t.created_on=e.createdOn),e.descriptionSearch!==void 0&&(t.description_search=e.descriptionSearch),e.ipSearch!==void 0&&(t.ip_search=e.ipSearch);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading lockdowns`,async()=>n.firewall.lockdowns.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded lockdowns`})}},C={command:`update <lockDownsId>`,describe:`Updates an existing Zone Lockdown rule.`,builder:e=>e.positional(`lockDownsId`,{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)`}),handler:async e=>{if(s(e.lockDownsId,`lockDownsId`),e.dryRun){d({command:`cf firewall lockdowns update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/lockdowns/${e.lockDownsId??`<lockDownsId>`}`,pathParams:{lockDownsId:String(e.lockDownsId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{urls:e.urls,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating lockdown`,async()=>t.put(`/zones/${e.zoneId}/firewall/lockdowns/${e.lockDownsId}`,{body:n})),{successLabel:`Updated lockdown`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let n={};e.urls!==void 0&&c(n,[`urls`],e.urls),u(await p(`Updating lockdown`,async()=>t.put(`/zones/${e.zoneId}/firewall/lockdowns/${e.lockDownsId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated lockdown`})}},w={command:`lockdowns`,describe:`Zone lockdown rules that restrict access to URLs by IP address or range`,builder:e=>e.command(y).command(b).command(x).command(S).command(C).demandCommand(1),handler:()=>{}},T={command:`bulk-delete`,describe:`Deletes existing firewall rules.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf firewall rules bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`rules`,String(n??``),{force:!!e.force})){process.stderr.write(`Aborted.
5
- `);return}if(e.body){let n=l(e.body);u(await p(`Deleting rules`,async()=>t.delete(`/zones/${e.zoneId}/firewall/rules`,{body:n})),{successLabel:`Deleted rules`});return}u(await p(`Deleting rules`,async()=>t.firewall.rules.bulkDelete(n)),{successLabel:`Deleted rules`})}},E={command:`bulk-edit`,describe:`Updates the priority of existing firewall rules.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf firewall rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Updating rules`,async()=>t.patch(`/zones/${e.zoneId}/firewall/rules`,{body:n})),{successLabel:`Updated rules`});return}u(await p(`Updating rules`,async()=>t.firewall.rules.bulkEdit(n)),{successLabel:`Updated rules`})}},D={command:`bulk-update`,describe:`Updates one or more existing firewall rules.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf firewall rules bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Updating rules`,async()=>t.put(`/zones/${e.zoneId}/firewall/rules`,{body:n})),{successLabel:`Updated rules`});return}u(await p(`Updating rules`,async()=>t.firewall.rules.bulkUpdate(n)),{successLabel:`Updated rules`})}},O={command:`create`,describe:`Create one or more firewall rules.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf firewall rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{filterDescription:e.filterDescription,filterExpression:e.filterExpression,filterPaused:e.filterPaused,filterRef:e.filterRef,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Creating rule`,async()=>t.post(`/zones/${e.zoneId}/firewall/rules`,{body:n})),{successLabel:`Created rule`});return}let n={};e.filterDescription!==void 0&&c(n,[`filter`,`description`],o(e.filterDescription,`filterDescription`,`text`)),e.filterExpression!==void 0&&c(n,[`filter`,`expression`],o(e.filterExpression,`filterExpression`,`text`)),e.filterPaused!==void 0&&c(n,[`filter`,`paused`],e.filterPaused),e.filterRef!==void 0&&c(n,[`filter`,`ref`],o(e.filterRef,`filterRef`,`text`)),u(await p(`Creating rule`,async()=>t.post(`/zones/${e.zoneId}/firewall/rules`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created rule`})}},k={command:`delete <ruleId>`,describe:`Deletes an existing firewall rule.`,builder:e=>e.positional(`ruleId`,{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)`}),handler:async e=>{if(s(e.ruleId,`ruleId`),e.dryRun){d({command:`cf firewall rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/rules/${e.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(e.ruleId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{deleteFilterIfUnused:e.deleteFilterIfUnused,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),!await r(`rule`,String(e.ruleId??``),{force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}if(e.body){let n=l(e.body);u(await p(`Deleting rule`,async()=>t.delete(`/zones/${e.zoneId}/firewall/rules/${e.ruleId}`,{body:n})),{successLabel:`Deleted rule`});return}let n={};e.deleteFilterIfUnused!==void 0&&c(n,[`delete_filter_if_unused`],e.deleteFilterIfUnused),u(await p(`Deleting rule`,async()=>t.delete(`/zones/${e.zoneId}/firewall/rules/${e.ruleId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted rule`})}},A={command:`edit <ruleId>`,describe:`Updates the priority of an existing firewall rule.`,builder:e=>e.positional(`ruleId`,{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)`}),handler:async e=>{if(s(e.ruleId,`ruleId`),e.dryRun){d({command:`cf firewall rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/rules/${e.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(e.ruleId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=l(e.body);u(await p(`Updating rule`,async()=>t.patch(`/zones/${e.zoneId}/firewall/rules/${e.ruleId}`,{body:n})),{successLabel:`Updated rule`});return}u(await p(`Updating rule`,async()=>t.firewall.rules.edit(e.ruleId,n)),{successLabel:`Updated rule`})}},j={command:`get <ruleId>`,describe:`Fetches the details of a firewall rule.`,builder:e=>e.positional(`ruleId`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`id`,{type:`string`,description:`ID`}),handler:async e=>{s(e.ruleId,`ruleId`);let t={};e.id!==void 0&&(t.id=e.id);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading rule`,async()=>n.firewall.rules.get(e.ruleId,r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded rule`})}},M={command:`list`,describe:`Fetches firewall rules in a zone. You can filter the results using several optional parameters.`,builder:e=>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.`,default:!1}),handler:async e=>{let t={};e.description!==void 0&&(t.description=e.description),e.action!==void 0&&(t.action=e.action),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.id!==void 0&&(t.id=e.id),e.paused!==void 0&&(t.paused=e.paused);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading rules`,async()=>n.firewall.rules.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded rules`})}},N={command:`update <ruleId>`,describe:`Updates an existing firewall rule.`,builder:e=>e.positional(`ruleId`,{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)`}),handler:async e=>{if(s(e.ruleId,`ruleId`),e.dryRun){d({command:`cf firewall rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/rules/${e.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(e.ruleId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{filterDescription:e.filterDescription,filterExpression:e.filterExpression,filterPaused:e.filterPaused,filterRef:e.filterRef,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating rule`,async()=>t.put(`/zones/${e.zoneId}/firewall/rules/${e.ruleId}`,{body:n})),{successLabel:`Updated rule`});return}let n={};e.filterDescription!==void 0&&c(n,[`filter`,`description`],o(e.filterDescription,`filterDescription`,`text`)),e.filterExpression!==void 0&&c(n,[`filter`,`expression`],o(e.filterExpression,`filterExpression`,`text`)),e.filterPaused!==void 0&&c(n,[`filter`,`paused`],e.filterPaused),e.filterRef!==void 0&&c(n,[`filter`,`ref`],o(e.filterRef,`filterRef`,`text`)),u(await p(`Updating rule`,async()=>t.put(`/zones/${e.zoneId}/firewall/rules/${e.ruleId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated rule`})}},P={command:`rules`,describe:`Legacy firewall rules with filter expressions — prefer Rulesets for new configurations`,builder:e=>e.command(T).command(E).command(D).command(O).command(k).command(A).command(j).command(M).command(N).demandCommand(1),handler:()=>{}},F={command:`create`,describe:`Creates a new User Agent Blocking rule in a zone.`,builder:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf firewall ua-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/ua_rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{configurationTarget:e.configurationTarget,configurationValue:e.configurationValue,description:e.description,mode:e.mode,paused:e.paused,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Creating ua rule`,async()=>n.post(`/zones/${e.zoneId}/firewall/ua_rules`,{body:t})),{successLabel:`Created ua rule`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let r={};e.configurationTarget!==void 0&&c(r,[`configuration`,`target`],o(e.configurationTarget,`configurationTarget`,`text`)),e.configurationValue!==void 0&&c(r,[`configuration`,`value`],o(e.configurationValue,`configurationValue`,`text`)),e.description!==void 0&&c(r,[`description`],o(e.description,`description`,`text`)),e.mode!==void 0&&c(r,[`mode`],o(e.mode,`mode`,`text`)),e.paused!==void 0&&c(r,[`paused`],e.paused),u(await p(`Creating ua rule`,async()=>n.post(`/zones/${e.zoneId}/firewall/ua_rules`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created ua rule`})}},I={command:`delete <uaRuleId>`,describe:`Deletes an existing User Agent Blocking rule.`,builder:e=>e.positional(`uaRuleId`,{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)`}),handler:async e=>{if(s(e.uaRuleId,`uaRuleId`),e.dryRun){d({command:`cf firewall ua-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/ua_rules/${e.uaRuleId??`<uaRuleId>`}`,pathParams:{uaRuleId:String(e.uaRuleId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`ua rule`,String(e.uaRuleId??``),{force:!!e.force})){process.stderr.write(`Aborted.
7
- `);return}if(e.body){let n=l(e.body);u(await p(`Deleting ua rule`,async()=>t.delete(`/zones/${e.zoneId}/firewall/ua_rules/${e.uaRuleId}`,{body:n})),{successLabel:`Deleted ua rule`});return}u(await p(`Deleting ua rule`,async()=>t.firewall.uaRules.delete(e.uaRuleId,n)),{successLabel:`Deleted ua rule`})}},L={command:`get <uaRuleId>`,describe:`Fetches the details of a User Agent Blocking rule.`,builder:e=>e.positional(`uaRuleId`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}),handler:async e=>{s(e.uaRuleId,`uaRuleId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading ua rule`,async()=>t.firewall.uaRules.get(e.uaRuleId,n)),{successLabel:`Loaded ua rule`})}},R={command:`list`,describe:`Fetches User Agent Blocking rules in a zone. You can filter the results using several optional parameters.`,builder:e=>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.`,default:!1}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.description!==void 0&&(t.description=e.description),e.perPage!==void 0&&(t.per_page=e.perPage),e.userAgent!==void 0&&(t.user_agent=e.userAgent),e.paused!==void 0&&(t.paused=e.paused);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading ua rules`,async()=>n.firewall.uaRules.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded ua rules`})}},z={command:`update <uaRuleId>`,describe:`Updates an existing User Agent Blocking rule.`,builder:e=>e.positional(`uaRuleId`,{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)`}),handler:async e=>{if(s(e.uaRuleId,`uaRuleId`),e.dryRun){d({command:`cf firewall ua-rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/ua_rules/${e.uaRuleId??`<uaRuleId>`}`,pathParams:{uaRuleId:String(e.uaRuleId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{configurationTarget:e.configurationTarget,configurationValue:e.configurationValue,description:e.description,mode:e.mode,paused:e.paused,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Updating ua rule`,async()=>n.put(`/zones/${e.zoneId}/firewall/ua_rules/${e.uaRuleId}`,{body:t})),{successLabel:`Updated ua rule`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let r={};e.configurationTarget!==void 0&&c(r,[`configuration`,`target`],o(e.configurationTarget,`configurationTarget`,`text`)),e.configurationValue!==void 0&&c(r,[`configuration`,`value`],o(e.configurationValue,`configurationValue`,`text`)),e.description!==void 0&&c(r,[`description`],o(e.description,`description`,`text`)),e.mode!==void 0&&c(r,[`mode`],o(e.mode,`mode`,`text`)),e.paused!==void 0&&c(r,[`paused`],e.paused),u(await p(`Updating ua rule`,async()=>n.put(`/zones/${e.zoneId}/firewall/ua_rules/${e.uaRuleId}`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Updated ua rule`})}},te={command:`ua-rules`,describe:`Block or challenge requests based on the User-Agent header string`,builder:e=>e.command(F).command(I).command(L).command(R).command(z).demandCommand(1),handler:()=>{}},B={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:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf firewall waf overrides create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/waf/overrides`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{urls:e.urls,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Creating override`,async()=>t.post(`/zones/${e.zoneId}/firewall/waf/overrides`,{body:n})),{successLabel:`Created override`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let n={};e.urls!==void 0&&c(n,[`urls`],e.urls),u(await p(`Creating override`,async()=>t.post(`/zones/${e.zoneId}/firewall/waf/overrides`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created override`})}},V={command:`delete <overridesId>`,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:e=>e.positional(`overridesId`,{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)`}),handler:async e=>{if(s(e.overridesId,`overridesId`),e.dryRun){d({command:`cf firewall waf overrides delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/waf/overrides/${e.overridesId??`<overridesId>`}`,pathParams:{overridesId:String(e.overridesId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await r(`override`,String(e.overridesId??``),{force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}if(e.body){let n=l(e.body);u(await p(`Deleting override`,async()=>t.delete(`/zones/${e.zoneId}/firewall/waf/overrides/${e.overridesId}`,{body:n})),{successLabel:`Deleted override`});return}u(await p(`Deleting override`,async()=>t.firewall.waf.overrides.delete(e.overridesId,n)),{successLabel:`Deleted override`})}},H={command:`get <overridesId>`,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:e=>e.positional(`overridesId`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}),handler:async e=>{s(e.overridesId,`overridesId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading override`,async()=>t.firewall.waf.overrides.get(e.overridesId,n)),{successLabel:`Loaded override`})}},U={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:e=>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.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading overrides`,async()=>n.firewall.waf.overrides.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded overrides`})}},W={command:`update <overridesId>`,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:e=>e.positional(`overridesId`,{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)`}),handler:async e=>{if(s(e.overridesId,`overridesId`),e.dryRun){d({command:`cf firewall waf overrides update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/waf/overrides/${e.overridesId??`<overridesId>`}`,pathParams:{overridesId:String(e.overridesId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{urls:e.urls,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating override`,async()=>t.put(`/zones/${e.zoneId}/firewall/waf/overrides/${e.overridesId}`,{body:n})),{successLabel:`Updated override`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let n={};e.urls!==void 0&&c(n,[`urls`],e.urls),u(await p(`Updating override`,async()=>t.put(`/zones/${e.zoneId}/firewall/waf/overrides/${e.overridesId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated override`})}},G={command:`overrides`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(B).command(V).command(H).command(U).command(W).demandCommand(1),handler:()=>{}},K={command:`get <packageId>`,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:e=>e.positional(`packageId`,{type:`string`,description:`Defines a package identifier.`,demandOption:!0}),handler:async e=>{s(e.packageId,`packageId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading package`,async()=>t.firewall.waf.packages.get(e.packageId,n)),{successLabel:`Loaded package`})}},q={command:`edit <groupId>`,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:e=>e.positional(`groupId`,{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`],default:`on`}).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)`}),handler:async e=>{if(s(e.groupId,`groupId`),e.dryRun){d({command:`cf firewall waf packages groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/waf/packages/${e.packageId??`<packageId>`}/groups/${e.groupId??`<groupId>`}`,pathParams:{groupId:String(e.groupId??``),packageId:String(e.packageId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{mode:e.mode,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating group`,async()=>t.patch(`/zones/${e.zoneId}/firewall/waf/packages/${e.packageId}/groups/${e.groupId}`,{body:n})),{successLabel:`Updated group`});return}let n={};e.mode!==void 0&&c(n,[`mode`],o(e.mode,`mode`,`text`)),u(await p(`Updating group`,async()=>t.patch(`/zones/${e.zoneId}/firewall/waf/packages/${e.packageId}/groups/${e.groupId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated group`})}},J={command:`get <groupId>`,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:e=>e.positional(`groupId`,{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}),handler:async e=>{s(e.groupId,`groupId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading group`,async()=>t.firewall.waf.packages.groups.get(e.groupId,e.packageId,n)),{successLabel:`Loaded group`})}},Y={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:e=>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.`}),handler:async e=>{let t={};e.mode!==void 0&&(t.mode=e.mode),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.match!==void 0&&(t.match=e.match),e.name!==void 0&&(t.name=e.name),e.rulesCount!==void 0&&(t.rules_count=e.rulesCount);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading groups`,async()=>n.firewall.waf.packages.groups.list(e.packageId,r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded groups`})}},X={command:`groups`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(q).command(J).command(Y).demandCommand(1),handler:()=>{}},Z={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:e=>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.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.match!==void 0&&(t.match=e.match),e.name!==void 0&&(t.name=e.name);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading packages`,async()=>n.firewall.waf.packages.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded packages`})}},Q={command:`edit <ruleId>`,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:e=>e.positional(`ruleId`,{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)`}),handler:async e=>{if(s(e.ruleId,`ruleId`),e.dryRun){d({command:`cf firewall waf packages rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/waf/packages/${e.packageId??`<packageId>`}/rules/${e.ruleId??`<ruleId>`}`,pathParams:{ruleId:String(e.ruleId??``),packageId:String(e.packageId??``),zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{mode:e.mode,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating rule`,async()=>t.patch(`/zones/${e.zoneId}/firewall/waf/packages/${e.packageId}/rules/${e.ruleId}`,{body:n})),{successLabel:`Updated rule`});return}let n={};e.mode!==void 0&&c(n,[`mode`],o(e.mode,`mode`,`text`)),u(await p(`Updating rule`,async()=>t.patch(`/zones/${e.zoneId}/firewall/waf/packages/${e.packageId}/rules/${e.ruleId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated rule`})}},ne={command:`get <ruleId>`,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:e=>e.positional(`ruleId`,{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}),handler:async e=>{s(e.ruleId,`ruleId`);let t=await i(e),n=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,u(await p(`Loading rule`,async()=>t.firewall.waf.packages.rules.get(e.ruleId,e.packageId,n)),{successLabel:`Loaded rule`})}},re={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:e=>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.`}),handler:async e=>{let t={};e.mode!==void 0&&(t.mode=e.mode),e.groupId!==void 0&&(t.group_id=e.groupId),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.match!==void 0&&(t.match=e.match),e.description!==void 0&&(t.description=e.description),e.priority!==void 0&&(t.priority=e.priority);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading rules`,async()=>n.firewall.waf.packages.rules.list(e.packageId,r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded rules`})}},ie={command:`rules`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Q).command(ne).command(re).demandCommand(1),handler:()=>{}},ae={command:`packages`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(K).command(Z).command(X).command(ie).demandCommand(1),handler:()=>{}},oe={command:`waf`,describe:`Operations for waf`,builder:e=>e.command(G).command(ae).demandCommand(1),handler:()=>{}},$={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:e=>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)`}),handler:async e=>{if(e.dryRun){d({command:`cf firewall zone-access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/access_rules/rules`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{configurationTarget:e.configurationTarget,configurationValue:e.configurationValue,mode:e.mode,body:e.body},validation:`passed`});return}let n=await i(e);if(e.zoneId=await a({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=l(e.body);u(await p(`Creating zone access rule`,async()=>n.post(`/zones/${e.zoneId}/firewall/access_rules/rules`,{body:t})),{successLabel:`Created zone access rule`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let r={};e.configurationTarget!==void 0&&c(r,[`configuration`,`target`],o(e.configurationTarget,`configurationTarget`,`text`)),e.configurationValue!==void 0&&c(r,[`configuration`,`value`],o(e.configurationValue,`configurationValue`,`text`)),e.mode!==void 0&&c(r,[`mode`],o(e.mode,`mode`,`text`)),u(await p(`Creating zone access rule`,async()=>n.post(`/zones/${e.zoneId}/firewall/access_rules/rules`,{body:Object.keys(r).length>0?r:void 0})),{successLabel:`Created zone access rule`})}},se={command:`delete <ruleId>`,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:e=>e.positional(`ruleId`,{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)`}),handler:async e=>{if(s(e.ruleId,`ruleId`),e.dryRun){d({command:`cf firewall zone-access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/access_rules/rules/${e.ruleId??`<ruleId>`}`,pathParams:{zoneId:String(e.zoneId??``),ruleId:String(e.ruleId??``)},bodyKind:`json`,body:{cascade:e.cascade,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),!await r(`zone access rule`,String(e.ruleId??``),{force:!!e.force})){process.stderr.write(`Aborted.
9
- `);return}if(e.body){let n=l(e.body);u(await p(`Deleting zone access rule`,async()=>t.delete(`/zones/${e.zoneId}/firewall/access_rules/rules/${e.ruleId}`,{body:n})),{successLabel:`Deleted zone access rule`});return}let n={};e.cascade!==void 0&&c(n,[`cascade`],o(e.cascade,`cascade`,`text`)),u(await p(`Deleting zone access rule`,async()=>t.delete(`/zones/${e.zoneId}/firewall/access_rules/rules/${e.ruleId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Deleted zone access rule`})}},ce={command:`edit <ruleId>`,describe:"Updates an IP Access rule defined at the zone level. You can only update the rule action (`mode` parameter) and notes.",builder:e=>e.positional(`ruleId`,{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)`}),handler:async e=>{if(s(e.ruleId,`ruleId`),e.dryRun){d({command:`cf firewall zone-access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/firewall/access_rules/rules/${e.ruleId??`<ruleId>`}`,pathParams:{zoneId:String(e.zoneId??``),ruleId:String(e.ruleId??``)},bodyKind:`json`,body:{mode:e.mode,notes:e.notes,body:e.body},validation:`passed`});return}let t=await i(e);if(e.zoneId=await a({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=l(e.body);u(await p(`Updating zone access rule`,async()=>t.patch(`/zones/${e.zoneId}/firewall/access_rules/rules/${e.ruleId}`,{body:n})),{successLabel:`Updated zone access rule`});return}let n={};e.mode!==void 0&&c(n,[`mode`],o(e.mode,`mode`,`text`)),e.notes!==void 0&&c(n,[`notes`],o(e.notes,`notes`,`text`)),u(await p(`Updating zone access rule`,async()=>t.patch(`/zones/${e.zoneId}/firewall/access_rules/rules/${e.ruleId}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated zone access rule`})}},le={command:`list`,describe:`Fetches IP Access rules of a zone. You can filter the results using several optional parameters.`,builder:e=>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`. Notes: 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. 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`]}),handler:async e=>{let t={};e.mode!==void 0&&(t.mode=e.mode),e.configurationTarget!==void 0&&(t.configurationTarget=e.configurationTarget),e.configurationValue!==void 0&&(t.configurationValue=e.configurationValue),e.notes!==void 0&&(t.notes=e.notes),e.match!==void 0&&(t.match=e.match),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction);let n=await i(e),r=await a({zone:e.zone},n,{quiet:e.quiet});e.zoneId=r,u(await p(`Loading zone access rules`,async()=>n.firewall.zoneAccessRules.list(r,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded zone access rules`})}},ue={command:`zone-access-rules`,describe:`Zone-scoped IP access rules for blocking or allowing traffic`,builder:e=>e.command($).command(se).command(ce).command(le).demandCommand(1),handler:()=>{}},de={command:`firewall`,describe:`Legacy firewall rules, zone lockdowns, access rules, user-agent blocking, and WAF packages`,builder:e=>e.command(v).command(w).command(P).command(te).command(oe).command(ue).demandCommand(1),handler:()=>{}};export{de as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e,u as t}from"./auth-BHD_B2p9.mjs";import{n}from"./input-validation-BpVQi9rR.mjs";import{n as r,t as i}from"./body-parser-iA3vRFmh.mjs";import{t as a}from"./output-CqGQp2r6.mjs";import{t as o}from"./dry-run-FV0pZwdg.mjs";import{t as s}from"./progress-5sHFvwez.mjs";const c={command:`get`,describe:`Retrieve Fraud Detection settings for a zone.`,builder:e=>e,handler:async n=>{let r=await e(n),i=await t({zone:n.zone},r,{quiet:n.quiet});n.zoneId=i,a(await s(`Loading fraud`,async()=>r.fraud.get(i)),{successLabel:`Loaded fraud`})}},l={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:e=>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. - Maximum of 10 expressions. - Omit or set to null to leave unchanged on update. - Provide an empty array `[]` to clear all expressions on update. - Invalid expressions will result in a 10400 Bad Request with details in the `messages` array. "}).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)`}),handler:async c=>{if(c.dryRun){o({command:`cf fraud update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zoneId??`<zoneId>`}/fraud_detection/settings`,pathParams:{zoneId:String(c.zoneId??``)},bodyKind:`json`,body:{userProfiles:c.userProfiles,usernameExpressions:c.usernameExpressions,body:c.body},validation:`passed`});return}let l=await e(c);if(c.zoneId=await t({zone:c.zone},l,{quiet:c.quiet}),c.body){let e=i(c.body);a(await s(`Updating fraud`,async()=>l.put(`/zones/${c.zoneId}/fraud_detection/settings`,{body:e})),{successLabel:`Updated fraud`});return}let u={};c.userProfiles!==void 0&&r(u,[`user_profiles`],n(c.userProfiles,`userProfiles`,`text`)),c.usernameExpressions!==void 0&&r(u,[`username_expressions`],c.usernameExpressions),a(await s(`Updating fraud`,async()=>l.put(`/zones/${c.zoneId}/fraud_detection/settings`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated fraud`})}},u={command:`fraud`,describe:`Fraud detection for login and signup flows — identify credential stuffing, account takeover, and fake accounts`,builder:e=>e.command(c).command(l).demandCommand(1),handler:()=>{}};export{u as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{h as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./input-validation-BpVQi9rR.mjs";import{n as i,t as a}from"./body-parser-iA3vRFmh.mjs";import{t as o}from"./output-CqGQp2r6.mjs";import{t as s}from"./dry-run-FV0pZwdg.mjs";import{t as c}from"./progress-5sHFvwez.mjs";const l={command:`get`,describe:`Gets the Google Tag Gateway configuration for a zone.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading config`,async()=>r.googleTagGateway.config.get(i)),{successLabel:`Loaded config`})}},u={command:`update`,describe:`Updates the Google Tag Gateway configuration for a zone.`,builder:e=>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.`}),handler:async l=>{if(l.dryRun){s({command:`cf google-tag-gateway config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zoneId??`<zoneId>`}/settings/google-tag-gateway/config`,pathParams:{zoneId:String(l.zoneId??``)},bodyKind:`json`,body:{enabled:l.enabled,endpoint:l.endpoint,hideOriginalIp:l.hideOriginalIp,measurementId:l.measurementId,setUpTag:l.setUpTag,body:l.body},validation:`passed`});return}let u=await t(l);if(l.zoneId=await n({zone:l.zone},u,{quiet:l.quiet}),l.body){let e=a(l.body);o(await c(`Updating config`,async()=>u.put(`/zones/${l.zoneId}/settings/google-tag-gateway/config`,{body:e})),{successLabel:`Updated config`});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.hideOriginalIp===void 0)throw Error(`--hide-original-ip is required (or pass --body with this field set).`);l.measurementId===void 0&&(l.measurementId=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&&i(d,[`enabled`],l.enabled),l.endpoint!==void 0&&i(d,[`endpoint`],r(l.endpoint,`endpoint`,`text`)),l.hideOriginalIp!==void 0&&i(d,[`hideOriginalIp`],l.hideOriginalIp),l.measurementId!==void 0&&i(d,[`measurementId`],r(l.measurementId,`measurementId`,`text`)),l.setUpTag!==void 0&&i(d,[`setUpTag`],l.setUpTag),o(await c(`Updating config`,async()=>u.put(`/zones/${l.zoneId}/settings/google-tag-gateway/config`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated config`})}},d={command:`config`,describe:`Google Tag Gateway config operations`,builder:e=>e.command(l).command(u).demandCommand(1),handler:()=>{}},f={command:`google-tag-gateway`,describe:`Google Tag Gateway operations`,builder:e=>e.command(d).demandCommand(1),handler:()=>{}};export{f as default};