cf 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/dist/_meta/agent-context.json +96 -95
  2. package/dist/_meta/commands.json +16558 -13965
  3. package/dist/_meta/schemas.json +52979 -16753
  4. package/dist/abuse-reports-dMIfUJ8v.mjs +8 -0
  5. package/dist/accounts-Kx1epdA1.mjs +22 -0
  6. package/dist/acm-Utu252kC.mjs +3 -0
  7. package/dist/addressing-CBq7Z7Vq.mjs +12 -0
  8. package/dist/{agent-context-D26woB9J.mjs → agent-context-BGTU299M.mjs} +1 -1
  9. package/dist/ai-DOOKLPkG.mjs +2 -0
  10. package/dist/ai-gateway-Cj1T3avF.mjs +8 -0
  11. package/dist/ai-search-CQF_Sn7d.mjs +7 -0
  12. package/dist/ai_gateway-C3fH22C0.mjs +4 -0
  13. package/dist/alerting-CqmEIaKn.mjs +6 -0
  14. package/dist/analytics-Dv-X8x7D.mjs +20 -0
  15. package/dist/analytics_engine-DdXVR8z2.mjs +2 -0
  16. package/dist/api-gateway-CNv0IHTU.mjs +33 -0
  17. package/dist/argo-CX_A4kcn.mjs +2 -0
  18. package/dist/audit-logs-BfBf3oo-.mjs +2 -0
  19. package/dist/auth-SyWhMmPu.mjs +6 -0
  20. package/dist/auth-ffdf9yR0.mjs +135 -0
  21. package/dist/autorag-BuGhGTeZ.mjs +2 -0
  22. package/dist/billing-PoG81XaQ.mjs +2 -0
  23. package/dist/body-parser-DKa8Ipg1.mjs +2 -0
  24. package/dist/bot-management-CFvtVx62.mjs +5 -0
  25. package/dist/botnet-feed-B-M4Yu0W.mjs +3 -0
  26. package/dist/brand-protection-D05Eg-_6.mjs +3 -0
  27. package/dist/browser-rendering-xu8F_Rrv.mjs +4 -0
  28. package/dist/build-DYkGW4dh.mjs +1054 -0
  29. package/dist/cache-DsoW6Xwv.mjs +5 -0
  30. package/dist/calls-CZbO7TyR.mjs +4 -0
  31. package/dist/certificate-authorities-D2yr7_3t.mjs +2 -0
  32. package/dist/cli-types-CRIDdDw3.mjs +2 -0
  33. package/dist/client-certificates-MJcDsTId.mjs +3 -0
  34. package/dist/cloud-connector-DWOrN2eM.mjs +2 -0
  35. package/dist/cloudforce-one-2Bhz8YdW.mjs +21 -0
  36. package/dist/{completions-BKrxcfhN.mjs → completions-BwRpZQVn.mjs} +1 -1
  37. package/dist/{config-BIfdEY0E.mjs → config-DYzlVxcB.mjs} +1 -1
  38. package/dist/connectivity-BX8C7tvK.mjs +3 -0
  39. package/dist/content-scanning-r6uzMO1r.mjs +4 -0
  40. package/dist/context-DGlHRGWM.mjs +2 -0
  41. package/dist/custom-certificates-aAiEguR7.mjs +5 -0
  42. package/dist/custom-hostnames-AG5yBHIi.mjs +5 -0
  43. package/dist/custom-nameservers-D1DtlRue.mjs +3 -0
  44. package/dist/custom-pages-DQCi2plU.mjs +4 -0
  45. package/dist/d1-DbnYhw45.mjs +4 -0
  46. package/dist/data-security-D_EtYBfo.mjs +6 -0
  47. package/dist/dcv-delegation-CHspSzTI.mjs +2 -0
  48. package/dist/delegate.mjs +1 -1
  49. package/dist/deploy-CQial3kN.mjs +2 -0
  50. package/dist/{dev-BfKYB-R_.mjs → dev-B38LfCTl.mjs} +1 -1
  51. package/dist/diagnostics-BJQGjVJn.mjs +3 -0
  52. package/dist/dispatch-namespaces-DmHvoBOg.mjs +7 -0
  53. package/dist/{dist-C_bu5HwZ.mjs → dist-AIcZFk0U.mjs} +7 -7
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-VMhQSr5n.mjs +29 -0
  56. package/dist/dns-firewall-B4DVXFBQ.mjs +57 -0
  57. package/dist/durable-objects-CTboySEo.mjs +2 -0
  58. package/dist/email-routing-tIR2SFu-.mjs +10 -0
  59. package/dist/email-security-Ca1id3rZ.mjs +8 -0
  60. package/dist/email-sending-DwWKc5jC.mjs +3 -0
  61. package/dist/filters-A4dg_a68.mjs +4 -0
  62. package/dist/firewall-DWPQgYd9.mjs +11 -0
  63. package/dist/fraud-BMkSsJGU.mjs +20 -0
  64. package/dist/google-tag-gateway-BGD49nRC.mjs +2 -0
  65. package/dist/healthchecks-CtIfrFql.mjs +4 -0
  66. package/dist/hostnames-BiomxukN.mjs +3 -0
  67. package/dist/hyperdrive-Da104VaQ.mjs +18 -0
  68. package/dist/iam-BIGKo0WW.mjs +6 -0
  69. package/dist/images-BO8FbDAa.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/intel-CY6_79v8.mjs +3 -0
  72. package/dist/{ips-B0cK7D0_.mjs → ips-K4bzaGqd.mjs} +1 -1
  73. package/dist/keyless-certificates-CZC-L8gM.mjs +3 -0
  74. package/dist/kv-8o27w_pY.mjs +5 -0
  75. package/dist/leaked-credential-checks-qLzRyu85.mjs +3 -0
  76. package/dist/load-balancers-DtG8nj25.mjs +6 -0
  77. package/dist/logpush-4L0njy1d.mjs +4 -0
  78. package/dist/logs-B_Yp95hv.mjs +3 -0
  79. package/dist/magic-cloud-networking-CSOM3EM-.mjs +5 -0
  80. package/dist/magic-network-monitoring-BnwvM4-I.mjs +4 -0
  81. package/dist/magic-transit-CXDyvhxq.mjs +90 -0
  82. package/dist/managed-transforms-D15yVbZx.mjs +3 -0
  83. package/dist/mtls-certificates-D8k0AXWK.mjs +3 -0
  84. package/dist/network-interconnects-rrr7red3.mjs +36 -0
  85. package/dist/observability-DWvpqnQJ.mjs +4 -0
  86. package/dist/organizations-T77D50Sq.mjs +41 -0
  87. package/dist/origin-ca-certificates-DXIvD8H5.mjs +3 -0
  88. package/dist/origin-post-quantum-encryption-C8oOczyV.mjs +2 -0
  89. package/dist/origin-tls-client-auth-CaVW1Ztp.mjs +4 -0
  90. package/dist/output-BJFNwj7b.mjs +2 -0
  91. package/dist/page-rules-CjZPTMQX.mjs +18 -0
  92. package/dist/page-shield-D5RRNJCY.mjs +37 -0
  93. package/dist/pages-CWJtJnL0.mjs +11 -0
  94. package/dist/pipelines-B0L_7j9e.mjs +6 -0
  95. package/dist/{progress-DZfTxbrx.mjs → progress-CrCGTq7N.mjs} +1 -1
  96. package/dist/queues-CN6DPhRR.mjs +6 -0
  97. package/dist/r2-DQIcyRtA.mjs +21 -0
  98. package/dist/r2-data-catalog-Bbo93TJx.mjs +14 -0
  99. package/dist/radar-Bxb0WX8V.mjs +2 -0
  100. package/dist/rate-limits-DcrQV6Ar.mjs +5 -0
  101. package/dist/raw-fetch-Dlccg0Tr.mjs +2 -0
  102. package/dist/realtime-kit-CaquuVOE.mjs +18 -0
  103. package/dist/registrar-Ko-xZemf.mjs +46 -0
  104. package/dist/request-tracers-DOW_reTJ.mjs +2 -0
  105. package/dist/{resolve-BuJRWSk0.mjs → resolve-4-OSeHlK.mjs} +1 -1
  106. package/dist/resource-sharing-D7TX0JV0.mjs +5 -0
  107. package/dist/resource-tagging-C3qtLzCz.mjs +16 -0
  108. package/dist/rules-BXRADHL5.mjs +4 -0
  109. package/dist/rulesets-CBgpeSvJ.mjs +8 -0
  110. package/dist/rum-BjPptTUP.mjs +4 -0
  111. package/dist/{schema-D0_cbcDt.mjs → schema-D16TgWBg.mjs} +1 -1
  112. package/dist/schema-validation-Dgv_opM3.mjs +24 -0
  113. package/dist/scim-DdSEr4kZ.mjs +3 -0
  114. package/dist/secrets-store-7BfyvJLb.mjs +25 -0
  115. package/dist/security-center-DAy6AKtT.mjs +2 -0
  116. package/dist/security-txt-xAMb7K6Y.mjs +3 -0
  117. package/dist/session-COHHdS7A.mjs +5 -0
  118. package/dist/shared-AGtpXwwL.mjs +2 -0
  119. package/dist/smart-shield-TeWZFnH2.mjs +3 -0
  120. package/dist/snippets-CCSsCXVs.mjs +4 -0
  121. package/dist/{spawn-D_cjG87Z.mjs → spawn-DcppKGI5.mjs} +1 -1
  122. package/dist/spectrum-CTTZID8u.mjs +63 -0
  123. package/dist/speed-CuzTE0AL.mjs +4 -0
  124. package/dist/{src-C5qivNKH.mjs → src-BW6vfAwE.mjs} +15 -15
  125. package/dist/ssl-BWA2LdwC.mjs +15 -0
  126. package/dist/stream-GFsIZ-pP.mjs +14 -0
  127. package/dist/tenants-Bd7NGQ_m.mjs +2 -0
  128. package/dist/token-validation-DAgtFOvs.mjs +10 -0
  129. package/dist/{tools-CtKbk6VS.mjs → tools-DXQmfFuE.mjs} +1 -1
  130. package/dist/turnstile-cfdaO4ca.mjs +23 -0
  131. package/dist/{ui-mP_arYIg.mjs → ui-D4KtlMh9.mjs} +1 -1
  132. package/dist/url-normalization-B5RN4nLD.mjs +3 -0
  133. package/dist/url-scanner-BrZ1L9OC.mjs +2 -0
  134. package/dist/user-CAo-yCJA.mjs +10 -0
  135. package/dist/vectorize-C7_oQlaI.mjs +4 -0
  136. package/dist/versions-CUwWJWmy.mjs +2 -0
  137. package/dist/waiting-rooms-Dln5ICg5.mjs +11 -0
  138. package/dist/web3-HQJRm38W.mjs +4 -0
  139. package/dist/workers-Dg7ddG2Q.mjs +18 -0
  140. package/dist/workers-builds-AVfx8IyL.mjs +7 -0
  141. package/dist/workflows-VquuSh2J.mjs +4 -0
  142. package/dist/zaraz-xYSWIV4P.mjs +2 -0
  143. package/dist/zero-trust-CP96wnSh.mjs +118 -0
  144. package/dist/zones-BSgmZ9WC.mjs +21 -0
  145. package/package.json +7 -6
  146. package/dist/abuse-reports-ChV_yD7f.mjs +0 -8
  147. package/dist/accounts-BCYecXFh.mjs +0 -21
  148. package/dist/acm-DD8zSds2.mjs +0 -3
  149. package/dist/addressing-D4Eqw5Bi.mjs +0 -13
  150. package/dist/ai-DfXMOMx_.mjs +0 -2
  151. package/dist/ai-gateway-DdRFthMo.mjs +0 -8
  152. package/dist/ai-search-C_68CDj1.mjs +0 -7
  153. package/dist/alerting-DbhqhVCp.mjs +0 -6
  154. package/dist/analytics-BSBBc7ep.mjs +0 -20
  155. package/dist/api-gateway-CZ4swbkQ.mjs +0 -33
  156. package/dist/argo-tms9ZwHO.mjs +0 -2
  157. package/dist/audit-logs-24qyW8cl.mjs +0 -2
  158. package/dist/auth-BlSmtIKd.mjs +0 -112
  159. package/dist/auth-DQ8miey6.mjs +0 -6
  160. package/dist/autorag-kgNt06GD.mjs +0 -2
  161. package/dist/billing-lwBHNTXC.mjs +0 -2
  162. package/dist/body-parser-Br-BoYk-.mjs +0 -2
  163. package/dist/bot-management-LKf7BqUr.mjs +0 -5
  164. package/dist/botnet-feed-nQ-gErTS.mjs +0 -3
  165. package/dist/brand-protection-DOKv9GRr.mjs +0 -3
  166. package/dist/browser-rendering-CBExtgGt.mjs +0 -4
  167. package/dist/build-C_48VvoK.mjs +0 -1056
  168. package/dist/builds-C_ySULja.mjs +0 -2
  169. package/dist/cache-BBiiNZHP.mjs +0 -5
  170. package/dist/calls-DA5Xzwev.mjs +0 -4
  171. package/dist/certificate-authorities-sXyR_yGp.mjs +0 -2
  172. package/dist/client-certificates-tV0aCLQJ.mjs +0 -3
  173. package/dist/cloud-connector-DZfHcSso.mjs +0 -2
  174. package/dist/cloudforce-one-y1PgQmI9.mjs +0 -21
  175. package/dist/connectivity-8SOqaFDn.mjs +0 -3
  176. package/dist/content-scanning-B9y6K_G5.mjs +0 -4
  177. package/dist/context-DTIbtQn5.mjs +0 -2
  178. package/dist/custom-certificates-sWksR8Ys.mjs +0 -5
  179. package/dist/custom-hostnames-91QZkdqN.mjs +0 -5
  180. package/dist/custom-nameservers-DajZaZvE.mjs +0 -3
  181. package/dist/custom-pages-Cu7gmwzT.mjs +0 -4
  182. package/dist/d1-H_VRsVmF.mjs +0 -3
  183. package/dist/dcv-delegation-C-qhEYEZ.mjs +0 -2
  184. package/dist/deploy--9wYOkHg.mjs +0 -2
  185. package/dist/diagnostics-D2B2LPZZ.mjs +0 -3
  186. package/dist/dispatch-namespaces-CyrXBU_w.mjs +0 -7
  187. package/dist/dist-DvKjT2TT.mjs +0 -303
  188. package/dist/dns-Bn9Uz_Nj.mjs +0 -29
  189. package/dist/dns-firewall-BslP4p-j.mjs +0 -57
  190. package/dist/durable-objects-BN1ZnHhm.mjs +0 -2
  191. package/dist/email-routing-n2TnTaRR.mjs +0 -10
  192. package/dist/email-security-C9SEx0kh.mjs +0 -60
  193. package/dist/email-sending-DayZ7u3I.mjs +0 -3
  194. package/dist/filters-CI_XTgfQ.mjs +0 -4
  195. package/dist/firewall-CcaayGig.mjs +0 -11
  196. package/dist/fraud-Cr7aPCV8.mjs +0 -8
  197. package/dist/google-tag-gateway-B3GpYgQ4.mjs +0 -2
  198. package/dist/healthchecks-CVTsR_OC.mjs +0 -4
  199. package/dist/hostnames-Bd_Wa5l6.mjs +0 -3
  200. package/dist/hyperdrive-BBJhEDZd.mjs +0 -18
  201. package/dist/iam-D_FN0pDF.mjs +0 -6
  202. package/dist/images-CAP2hAlZ.mjs +0 -5
  203. package/dist/intel-CkxfzqmJ.mjs +0 -3
  204. package/dist/keyless-certificates-LcLmHZsX.mjs +0 -3
  205. package/dist/kv-_TkUQ6fs.mjs +0 -5
  206. package/dist/leaked-credential-checks-Dhvaen22.mjs +0 -3
  207. package/dist/load-balancers-Ckr0UIpk.mjs +0 -6
  208. package/dist/logpush-Cj946hxT.mjs +0 -4
  209. package/dist/logs-DgC9hjvJ.mjs +0 -3
  210. package/dist/magic-cloud-networking-WbDvPzuG.mjs +0 -5
  211. package/dist/magic-network-monitoring-BcHShvGQ.mjs +0 -4
  212. package/dist/magic-transit-B8sCOkt_.mjs +0 -89
  213. package/dist/managed-transforms-BpOr-8HY.mjs +0 -3
  214. package/dist/mtls-certificates-fOul8D5g.mjs +0 -3
  215. package/dist/network-interconnects-BSW65xlh.mjs +0 -36
  216. package/dist/organizations-T4vKGFAb.mjs +0 -41
  217. package/dist/origin-ca-certificates-ChM0lZ64.mjs +0 -3
  218. package/dist/origin-post-quantum-encryption-C7o26ARh.mjs +0 -2
  219. package/dist/origin-tls-client-auth-D32dpZk_.mjs +0 -5
  220. package/dist/output-D7_yAFVR.mjs +0 -2
  221. package/dist/page-rules-RFoj8CjN.mjs +0 -18
  222. package/dist/page-shield-VTktzKDN.mjs +0 -37
  223. package/dist/pages-L1ITjXDZ.mjs +0 -10
  224. package/dist/pipelines-BPO0Lnil.mjs +0 -6
  225. package/dist/queues-B0C06L9r.mjs +0 -6
  226. package/dist/r2-DP020Tmq.mjs +0 -21
  227. package/dist/r2-data-catalog-Dmipvz5F.mjs +0 -14
  228. package/dist/radar-DR3VMknH.mjs +0 -2
  229. package/dist/rate-limits-DnHPBPgU.mjs +0 -5
  230. package/dist/raw-fetch-DlXYwVA8.mjs +0 -2
  231. package/dist/realtime-kit-C430aq2d.mjs +0 -6
  232. package/dist/registrar-7Qy50zbW.mjs +0 -46
  233. package/dist/request-tracers-sv99NDIl.mjs +0 -2
  234. package/dist/resource-sharing-uEjC7lnQ.mjs +0 -5
  235. package/dist/resource-tagging-CiODdP3N.mjs +0 -16
  236. package/dist/rules-FXAyTrwk.mjs +0 -4
  237. package/dist/rulesets-B6aUsFFB.mjs +0 -8
  238. package/dist/rum-CyyGJhp5.mjs +0 -4
  239. package/dist/schema-validation-ByU49h--.mjs +0 -4
  240. package/dist/scim-DdTS65_C.mjs +0 -3
  241. package/dist/scm-CilfPOue.mjs +0 -2
  242. package/dist/secrets-store-ClOUVhBJ.mjs +0 -18
  243. package/dist/security-center-4iSBqTrf.mjs +0 -2
  244. package/dist/security-txt-kGxdkDY6.mjs +0 -3
  245. package/dist/session-mW-s8ghP.mjs +0 -2
  246. package/dist/smart-shield-B-SQd2Qp.mjs +0 -3
  247. package/dist/snippets-Aq58ojqw.mjs +0 -4
  248. package/dist/spectrum-0gFvGI6y.mjs +0 -59
  249. package/dist/speed-DAZU8w3T.mjs +0 -4
  250. package/dist/ssl-BRlXa-5w.mjs +0 -15
  251. package/dist/stream-BAxsVeBX.mjs +0 -14
  252. package/dist/tenants-Df6xDqoA.mjs +0 -2
  253. package/dist/token-validation-pO4dCjCy.mjs +0 -4
  254. package/dist/turnstile-B1dmO8wE.mjs +0 -23
  255. package/dist/url-normalization-sUDVmrUt.mjs +0 -3
  256. package/dist/url-scanner-CwOKRkYo.mjs +0 -2
  257. package/dist/user-D_UrIdNq.mjs +0 -10
  258. package/dist/vectorize-BEbBn9G9.mjs +0 -4
  259. package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
  260. package/dist/waiting-rooms-BQC-urV4.mjs +0 -11
  261. package/dist/web3-CIH2iQeX.mjs +0 -4
  262. package/dist/workers-B9EvrpH3.mjs +0 -16
  263. package/dist/workers-builds-DzWSiRd2.mjs +0 -7
  264. package/dist/workflows-aD81gA4k.mjs +0 -4
  265. package/dist/zaraz-Cg1dsvrZ.mjs +0 -2
  266. package/dist/zero-trust-D-xQXWcy.mjs +0 -119
  267. package/dist/zones-DQzucJDd.mjs +0 -28
  268. /package/dist/{metadata-DGdCpUxn.mjs → metadata-5VwHPW6C.mjs} +0 -0
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,E as n,T as r,_ as i,i as a,n as o}from"./auth-ffdf9yR0.mjs";import{n as s,t as c}from"./body-parser-DKa8Ipg1.mjs";import{t as l}from"./output-BJFNwj7b.mjs";import{n as u,t as d}from"./progress-CrCGTq7N.mjs";import{n as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";import{t as m}from"./cli-types-CRIDdDw3.mjs";function ee(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`get <investigate-id>`,describe:`Returns detection details such as threat categories and sender information for non-benign messages.`,builder:ee,handler:async t=>{if(t.dryRun){u({command:`cf email-security investigate detections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/${t[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(t[`investigate-id`]))}/detections`,pathParams:{"investigate-id":String(t[`investigate-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.investigate.detections.get({account_id:r,investigate_id:t[`investigate-id`]})),{successLabel:`Loaded`})}},h={command:`detections`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`log <investigate-id>`,describe:`Returns the list of post-delivery actions (moves, quarantine releases, previews, etc.) that have been applied to a specific email message.`,builder:g,handler:async t=>{if(t.dryRun){u({command:`cf email-security investigate get-action log`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/${t[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(t[`investigate-id`]))}/action_log`,pathParams:{"investigate-id":String(t[`investigate-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.investigate.getAction.log({account_id:r,investigate_id:t[`investigate-id`]})),{successLabel:`Loaded`})}},v={command:`get-action`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation`,demandOption:!0}).option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the
3
+ regular datastore only.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <investigate-id>`,describe:`Retrieves comprehensive details for a specific email message including headers, recipients, sender information, and current quarantine status. Use the investigate_id from search results to fetch detailed information.`,builder:y,handler:async t=>{let n={submission:t.submission};if(t.dryRun){u({command:`cf email-security investigate get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/${t[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(t[`investigate-id`]))}`,pathParams:{"investigate-id":String(t[`investigate-id`]??``)},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.emailSecurity.investigate.get({account_id:a,investigate_id:t[`investigate-id`],...n})),{successLabel:`Loaded`})}};function x(e){return e.option(`start`,{type:`string`,description:"The beginning of the search date range. Defaults to `now - 30 days`. Must not be in the future."}).option(`end`,{type:`string`,description:"The end of the search date range. Defaults to `now`."}).option(`query`,{type:`string`,description:`Space-delimited search term. Case-insensitive.`}).option(`detections-only`,{type:`boolean`,description:`Whether to include only detections in search results.`}).option(`final-disposition`,{type:`string`,description:`Dispositions to filter by.`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`metric`,{type:`string`,description:`Metric`}).option(`message-action`,{type:`string`,description:`Message actions to filter by.`,choices:[`PREVIEW`,`QUARANTINE_RELEASED`,`MOVED`]}).option(`recipient`,{type:`string`,description:`Recipient`}).option(`sender`,{type:`string`,description:`Sender`}).option(`alert-id`,{type:`string`,description:`Alert ID`}).option(`domain`,{type:`string`,description:`Sender domains to filter by.`}).option(`message-id`,{type:`string`,description:`Message ID`}).option(`subject`,{type:`string`,description:`Subject`}).option(`delivery-status`,{type:`string`,description:`Delivery status to filter by.`,choices:[`delivered`,`moved`,`quarantined`,`rejected`,`deferred`,`bounced`,`queued`]}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`page`,{type:`number`,description:`Deprecated: Use cursor pagination instead. End of life: November 1, 2026.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Returns information for each email that matches the search parameter(s).`,builder:m(x),handler:async t=>{let n={start:t.start,end:t.end,query:t.query,detections_only:t[`detections-only`],final_disposition:t[`final-disposition`],metric:t.metric,message_action:t[`message-action`],recipient:t.recipient,sender:t.sender,alert_id:t[`alert-id`],domain:t.domain,message_id:t[`message-id`],subject:t.subject,delivery_status:t[`delivery-status`],cursor:t.cursor,per_page:t[`per-page`],page:t.page};if(t.dryRun){u({command:`cf email-security investigate list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.emailSecurity.investigate.list({account_id:a,...n})),{successLabel:`Loaded`})}};function C(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation`,demandOption:!0}).option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={command:`create <investigate-id>`,describe:`Moves a single message to a specified mailbox folder (Inbox, JunkEmail, DeletedItems, RecoverableItemsDeletions, or RecoverableItemsPurges). Requires active integration.`,builder:C,handler:async t=>{if(t.dryRun){u({command:`cf email-security investigate move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/${t[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(t[`investigate-id`]))}/move`,pathParams:{"investigate-id":String(t[`investigate-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({destination:f(t.destination,`destination`,`text`),expected_disposition:f(t[`expected-disposition`],`expected-disposition`,`text`)}):s(t.body)});return}let r=await o(t),a=t.local?p:await i(r);if(t.accountId=a,t.body){let e=s(t.body);l(await d(`Creating`,async()=>r.emailSecurity.investigate.move.create({...e,account_id:a,investigate_id:t[`investigate-id`]})),{successLabel:`Created`});return}t.destination===void 0&&(t.destination=await n(`destination`,`The destination field`,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let m=c({destination:f(t.destination,`destination`,`text`),expected_disposition:f(t[`expected-disposition`],`expected-disposition`,`text`)});l(await d(`Creating`,async()=>r.emailSecurity.investigate.move.create({...m,account_id:a,investigate_id:t[`investigate-id`]})),{successLabel:`Created`})}},T={command:`move`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`postfix-id`,{type:`string`,description:`The identifier of the message`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`create`,describe:`Generates a preview image for a message that was not flagged as a detection. Useful for investigating benign messages. Returns a base64-encoded PNG screenshot of the email body.`,builder:E,handler:async n=>{if(n.dryRun){u({command:`cf email-security investigate preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/preview`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({postfix_id:f(n[`postfix-id`],`postfix-id`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?p:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>r.emailSecurity.investigate.preview.create({...e,account_id:a})),{successLabel:`Created`});return}n[`postfix-id`]===void 0&&(n[`postfix-id`]=await t(`postfix-id`,`The identifier of the message`));let m=c({postfix_id:f(n[`postfix-id`],`postfix-id`,`text`)});l(await d(`Creating`,async()=>r.emailSecurity.investigate.preview.create({...m,account_id:a})),{successLabel:`Created`})}};function O(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <investigate-id>`,describe:`Returns a preview of the message body as a base64 encoded PNG image for non-benign messages.`,builder:O,handler:async t=>{if(t.dryRun){u({command:`cf email-security investigate preview get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/${t[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(t[`investigate-id`]))}/preview`,pathParams:{"investigate-id":String(t[`investigate-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.investigate.preview.get({account_id:r,investigate_id:t[`investigate-id`]})),{successLabel:`Loaded`})}},A={command:`preview`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(D).command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <investigate-id>`,describe:`Returns the raw eml of any non-benign message.`,builder:j,handler:async t=>{if(t.dryRun){u({command:`cf email-security investigate raw get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/${t[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(t[`investigate-id`]))}/raw`,pathParams:{"investigate-id":String(t[`investigate-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.investigate.raw.get({account_id:r,investigate_id:t[`investigate-id`]})),{successLabel:`Loaded`})}},N={command:`raw`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function P(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation`,demandOption:!0}).option(`eml-content`,{type:`string`,description:`Base64 encoded content of the EML file.`}).option(`escalated-submission-id`,{type:`string`,description:`The escalated_submission_id field`}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`NONE`,`BULK`,`MALICIOUS`,`SPAM`,`SPOOF`,`SUSPICIOUS`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const F={command:`create <investigate-id>`,describe:`Submits a request to reclassify an email's disposition. Use for reporting false positives or false negatives. Optionally provide the raw EML content for reanalysis. The reclassification is processed asynchronously.`,builder:P,handler:async t=>{if(t.dryRun){u({command:`cf email-security investigate reclassify create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/${t[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(t[`investigate-id`]))}/reclassify`,pathParams:{"investigate-id":String(t[`investigate-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({eml_content:f(t[`eml-content`],`eml-content`,`text`),escalated_submission_id:f(t[`escalated-submission-id`],`escalated-submission-id`,`text`),expected_disposition:f(t[`expected-disposition`],`expected-disposition`,`text`)}):s(t.body)});return}let r=await o(t),a=t.local?p:await i(r);if(t.accountId=a,t.body){let e=s(t.body);l(await d(`Creating`,async()=>r.emailSecurity.investigate.reclassify.create({...e,account_id:a,investigate_id:t[`investigate-id`]})),{successLabel:`Created`});return}t[`expected-disposition`]===void 0&&(t[`expected-disposition`]=await n(`expected-disposition`,`The expected_disposition field`,[`NONE`,`BULK`,`MALICIOUS`,`SPAM`,`SPOOF`,`SUSPICIOUS`]));let m=c({eml_content:f(t[`eml-content`],`eml-content`,`text`),escalated_submission_id:f(t[`escalated-submission-id`],`escalated-submission-id`,`text`),expected_disposition:f(t[`expected-disposition`],`expected-disposition`,`text`)});l(await d(`Creating`,async()=>r.emailSecurity.investigate.reclassify.create({...m,account_id:a,investigate_id:t[`investigate-id`]})),{successLabel:`Created`})}},I={command:`reclassify`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A list of investigate IDs identifying the messages to release.`})}const R={command:`bulk`,describe:`Releases one or more quarantined messages, delivering them to the intended recipients. Use when a message was incorrectly quarantined. Returns delivery status for each recipient.`,builder:L,handler:async t=>{if(t.dryRun){u({command:`cf email-security investigate release bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/release`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.emailSecurity.investigate.release.bulk({body:e,account_id:r})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},z={command:`release`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function B(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get <investigate-id>`,describe:`Retrieves delivery and processing trace information for an email message. Shows the delivery path, retraction history, and move operations performed on the message. Useful for debugging delivery issues.`,builder:B,handler:async t=>{if(t.dryRun){u({command:`cf email-security investigate trace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/investigate/${t[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(t[`investigate-id`]))}/trace`,pathParams:{"investigate-id":String(t[`investigate-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.investigate.trace.get({account_id:r,investigate_id:t[`investigate-id`]})),{successLabel:`Loaded`})}},H={command:`trace`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},U={command:`investigate`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(b).command(S).command(h).command(v).command(T).command(A).command(N).command(I).command(z).command(H).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function W(e){return e.option(`start`,{type:`string`,description:`Start of the time range (RFC3339). Takes precedence over from_date.`}).option(`end`,{type:`string`,description:`End of the time range (RFC3339). Takes precedence over to_date.`}).option(`from-date`,{type:`string`,description:"Deprecated, use `start` instead. Start date in YYYY-MM-DD format."}).option(`to-date`,{type:`string`,description:"Deprecated, use `end` instead. End date in YYYY-MM-DD format."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`list`,describe:`Retrieves PhishGuard security alert reports for a specified date range. Reports include detected threats, dispositions, and contextual information. Use for security monitoring and threat analysis.`,builder:W,handler:async t=>{let n={start:t.start,end:t.end,from_date:t[`from-date`],to_date:t[`to-date`]};if(t.dryRun){u({command:`cf email-security phishguard reports list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/phishguard/reports`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.emailSecurity.phishguard.reports.list({account_id:a,...n})),{successLabel:`Loaded`})}},K={command:`reports`,describe:`PhishGuard user-reported phishing submissions and analysis reports`,builder:e=>e.command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},q={command:`phishguard`,describe:`Operations for phishguard`,builder:e=>e.command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. 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:"Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026."}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-sender`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026."}).option(`is-spoof`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026."}).option(`is-trusted-sender`,{type:`boolean`,description:`Messages from this sender will bypass all detections and link following`}).option(`pattern`,{type:`string`,description:"The pattern value to match against. Format depends on `pattern_type`:\n- EMAIL: a valid email address, e.g. `user@example.com`\n- DOMAIN: a valid domain name, e.g. `example.com`\n- IP: a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted; private, loopback, link-local, and unspecified addresses are rejected.\n"}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted.\n- UNKNOWN: deprecated, cannot be used when creating or updating policies, but may be returned for existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create an allow policy`})}const Y={command:`create`,describe:`Creates a new allow policy that exempts matching emails from security detections. Use with caution as this bypasses email security scanning. Policies can match on sender patterns and apply to specific detections or all detections.`,builder:J,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings allow-policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({comments:f(t.comments,`comments`,`text`),is_acceptable_sender:t[`is-acceptable-sender`],is_exempt_recipient:t[`is-exempt-recipient`],is_recipient:t[`is-recipient`],is_regex:t[`is-regex`],is_sender:t[`is-sender`],is_spoof:t[`is-spoof`],is_trusted_sender:t[`is-trusted-sender`],pattern:f(t.pattern,`pattern`,`text`),pattern_type:f(t[`pattern-type`],`pattern-type`,`text`),verify_sender:t[`verify-sender`]}):s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.emailSecurity.settings.allowPolicies.create({body:e,account_id:r})),{successLabel:`Created`});return}let a=c({comments:f(t.comments,`comments`,`text`),is_acceptable_sender:t[`is-acceptable-sender`],is_exempt_recipient:t[`is-exempt-recipient`],is_recipient:t[`is-recipient`],is_regex:t[`is-regex`],is_sender:t[`is-sender`],is_spoof:t[`is-spoof`],is_trusted_sender:t[`is-trusted-sender`],pattern:f(t.pattern,`pattern`,`text`),pattern_type:f(t[`pattern-type`],`pattern-type`,`text`),verify_sender:t[`verify-sender`]});l(await d(`Creating`,async()=>n.emailSecurity.settings.allowPolicies.create({body:a,account_id:r})),{successLabel:`Created`})}};function X(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Z={command:`delete <policy-id>`,describe:`Removes an allow policy. After deletion, emails matching this pattern will be subject to normal security scanning and disposition actions.`,builder:X,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings allow-policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/allow_policies/${t[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(t[`policy-id`]))}`,pathParams:{"policy-id":String(t[`policy-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?p:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
+ `);return}l(await d(`Deleting`,async()=>n.emailSecurity.settings.allowPolicies.delete({account_id:a,policy_id:t[`policy-id`]})),{successLabel:`Deleted`})}};function Q(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`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:"Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026."}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-sender`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026."}).option(`is-spoof`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026."}).option(`is-trusted-sender`,{type:`boolean`,description:`Messages from this sender will bypass all detections and link following`}).option(`pattern`,{type:`string`,description:"The pattern value to match against. Format depends on `pattern_type`:\n- EMAIL: a valid email address, e.g. `user@example.com`\n- DOMAIN: a valid domain name, e.g. `example.com`\n- IP: a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted; private, loopback, link-local, and unspecified addresses are rejected.\n"}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted.\n- UNKNOWN: deprecated, cannot be used when creating or updating policies, but may be returned for existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update an allow policy`})}const ne={command:`edit <policy-id>`,describe:`Updates an existing allow policy. Only provided fields will be modified. Changes take effect for new emails matching the pattern.`,builder:Q,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings allow-policies edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/allow_policies/${t[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(t[`policy-id`]))}`,pathParams:{"policy-id":String(t[`policy-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({comments:f(t.comments,`comments`,`text`),is_acceptable_sender:t[`is-acceptable-sender`],is_exempt_recipient:t[`is-exempt-recipient`],is_recipient:t[`is-recipient`],is_regex:t[`is-regex`],is_sender:t[`is-sender`],is_spoof:t[`is-spoof`],is_trusted_sender:t[`is-trusted-sender`],pattern:f(t.pattern,`pattern`,`text`),pattern_type:f(t[`pattern-type`],`pattern-type`,`text`),verify_sender:t[`verify-sender`]}):s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.emailSecurity.settings.allowPolicies.edit({body:e,account_id:r,policy_id:t[`policy-id`]})),{successLabel:`Updated`});return}let a=c({comments:f(t.comments,`comments`,`text`),is_acceptable_sender:t[`is-acceptable-sender`],is_exempt_recipient:t[`is-exempt-recipient`],is_recipient:t[`is-recipient`],is_regex:t[`is-regex`],is_sender:t[`is-sender`],is_spoof:t[`is-spoof`],is_trusted_sender:t[`is-trusted-sender`],pattern:f(t.pattern,`pattern`,`text`),pattern_type:f(t[`pattern-type`],`pattern-type`,`text`),verify_sender:t[`verify-sender`]});l(await d(`Updating`,async()=>n.emailSecurity.settings.allowPolicies.edit({body:a,account_id:r,policy_id:t[`policy-id`]})),{successLabel:`Updated`})}};function re(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get <policy-id>`,describe:`Retrieves details for a specific allow policy including its pattern, dispositions that are exempted, and whether it applies to all detections.`,builder:re,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings allow-policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/allow_policies/${t[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(t[`policy-id`]))}`,pathParams:{"policy-id":String(t[`policy-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.settings.allowPolicies.get({account_id:r,policy_id:t[`policy-id`]})),{successLabel:`Loaded`})}};function ae(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`is-exempt-recipient`,{type:`boolean`,description:`Filter to show only policies where messages to the recipient bypass all detections.`}).option(`is-trusted-sender`,{type:`boolean`,description:`Filter to show only policies where messages from the sender bypass all detections and link following.`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Filter to show only policies where messages from the sender are exempted from Spam, Spoof, and Bulk dispositions (not Malicious or Suspicious).`}).option(`verify-sender`,{type:`boolean`,description:`Filter to show only policies that enforce DMARC, SPF, or DKIM authentication.`}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted.\n- UNKNOWN: deprecated, cannot be used when creating or updating policies, but may be returned for existing entries.",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:`Returns a paginated list of email allow policies. These policies exempt matching emails from security detection, allowing them to bypass disposition actions. Supports filtering by pattern type and policy attributes.`,builder:m(ae),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],search:t.search,order:t.order,direction:t.direction,is_exempt_recipient:t[`is-exempt-recipient`],is_trusted_sender:t[`is-trusted-sender`],is_acceptable_sender:t[`is-acceptable-sender`],verify_sender:t[`verify-sender`],pattern_type:t[`pattern-type`],pattern:t.pattern};if(t.dryRun){u({command:`cf email-security settings allow-policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.emailSecurity.settings.allowPolicies.list({account_id:a,...n})),{successLabel:`Loaded`})}},se={command:`allow-policies`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(Y).command(Z).command(ne).command(ie).command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const le={command:`create`,describe:`Execute multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:ce,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings batch allow policies batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/allow_policies/batch`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.emailSecurity.settings.batch.allow.policies.batch.create({...e,account_id:r})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/email-security/settings/allow_policies/batch`)),{successLabel:`Created`})}},ue={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},de={command:`policies`,describe:`Operations for settings.batch.allow.policies`,builder:e=>e.command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},fe={command:`allow`,describe:`Operations for settings.batch.allow`,builder:e=>e.command(de).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const me={command:`create`,describe:`Execute multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:pe,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings batch block senders batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/block_senders/batch`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.emailSecurity.settings.batch.block.senders.batch.create({...e,account_id:r})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/email-security/settings/block_senders/batch`)),{successLabel:`Created`})}},he={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ge={command:`senders`,describe:`Operations for settings.batch.block.senders`,builder:e=>e.command(he).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},_e={command:`block`,describe:`Operations for settings.batch.block`,builder:e=>e.command(ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ve(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ye={command:`create`,describe:`Executes multiple delete operations on sending domain restrictions atomically. All operations succeed or fail together as a transaction. Currently only supports batch deletion. Removes TLS enforcement requirements for the specified domains.`,builder:ve,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings batch sending domain restrictions batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/sending_domain_restrictions/batch`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.emailSecurity.settings.batch.sending.domain.restrictions.batch.create({...e,account_id:r})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/email-security/settings/sending_domain_restrictions/batch`)),{successLabel:`Created`})}},be={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},xe={command:`restrictions`,describe:`Operations for settings.batch.sending.domain.restrictions`,builder:e=>e.command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Se={command:`domain`,describe:`Operations for settings.batch.sending.domain`,builder:e=>e.command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ce={command:`sending`,describe:`Operations for settings.batch.sending`,builder:e=>e.command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Te={command:`create`,describe:`Execute multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:we,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings batch trusted domains batch create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/trusted_domains/batch`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.emailSecurity.settings.batch.trusted.domains.batch.create({...e,account_id:r})),{successLabel:`Created`});return}l(await d(`Creating`,async()=>a(n,`POST`,`/accounts/${r}/email-security/settings/trusted_domains/batch`)),{successLabel:`Created`})}},Ee={command:`batch`,describe:`Batch operations for email security settings — allow policies, blocked senders, domain restrictions, trusted domains`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},De={command:`domains`,describe:`Operations for settings.batch.trusted.domains`,builder:e=>e.command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Oe={command:`trusted`,describe:`Operations for settings.batch.trusted`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ke={command:`batch`,describe:`Operations for settings.batch`,builder:e=>e.command(fe).command(_e).command(Ce).command(Oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ae(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`pattern`,{type:`string`,description:"The pattern value to match against. Format depends on `pattern_type`:\n- EMAIL: a valid email address, e.g. `user@example.com`\n- DOMAIN: a valid domain name, e.g. `example.com`\n- IP: a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted; private, loopback, link-local, and unspecified addresses are rejected.\n"}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted.\n- UNKNOWN: deprecated, cannot be used when creating or updating policies, but may be returned for existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a blocked sender pattern`})}const je={command:`create`,describe:`Creates a new blocked sender pattern. Emails matching this pattern will be blocked from delivery. Patterns can be email addresses, domains, or IP addresses, and support regular expressions.`,builder:Ae,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings block-senders create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({comments:f(t.comments,`comments`,`text`),is_regex:t[`is-regex`],pattern:f(t.pattern,`pattern`,`text`),pattern_type:f(t[`pattern-type`],`pattern-type`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.emailSecurity.settings.blockSenders.create({body:e,account_id:r})),{successLabel:`Created`});return}let a=c({comments:f(t.comments,`comments`,`text`),is_regex:t[`is-regex`],pattern:f(t.pattern,`pattern`,`text`),pattern_type:f(t[`pattern-type`],`pattern-type`,`text`)});l(await d(`Creating`,async()=>n.emailSecurity.settings.blockSenders.create({body:a,account_id:r})),{successLabel:`Created`})}};function Me(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ne={command:`delete <pattern-id>`,describe:`Removes a blocked sender pattern. After deletion, emails from this sender will no longer be automatically blocked based on this rule.`,builder:Me,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings block-senders delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/block_senders/${t[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(t[`pattern-id`]))}`,pathParams:{"pattern-id":String(t[`pattern-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?p:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
5
+ `);return}l(await d(`Deleting`,async()=>n.emailSecurity.settings.blockSenders.delete({account_id:a,pattern_id:t[`pattern-id`]})),{successLabel:`Deleted`})}};function Pe(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`pattern`,{type:`string`,description:"The pattern value to match against. Format depends on `pattern_type`:\n- EMAIL: a valid email address, e.g. `user@example.com`\n- DOMAIN: a valid domain name, e.g. `example.com`\n- IP: a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted; private, loopback, link-local, and unspecified addresses are rejected.\n"}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 address (e.g. `1.2.3.4`) or an IPv4 CIDR block (e.g. `1.2.3.0/24`). Only globally reachable addresses are accepted.\n- UNKNOWN: deprecated, cannot be used when creating or updating policies, but may be returned for existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update a blocked sender pattern`})}const Fe={command:`edit <pattern-id>`,describe:`Updates an existing blocked sender pattern. Only provided fields will be modified. The pattern will continue blocking emails until deleted.`,builder:Pe,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings block-senders edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/block_senders/${t[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(t[`pattern-id`]))}`,pathParams:{"pattern-id":String(t[`pattern-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({comments:f(t.comments,`comments`,`text`),is_regex:t[`is-regex`],pattern:f(t.pattern,`pattern`,`text`),pattern_type:f(t[`pattern-type`],`pattern-type`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.emailSecurity.settings.blockSenders.edit({body:e,account_id:r,pattern_id:t[`pattern-id`]})),{successLabel:`Updated`});return}let a=c({comments:f(t.comments,`comments`,`text`),is_regex:t[`is-regex`],pattern:f(t.pattern,`pattern`,`text`),pattern_type:f(t[`pattern-type`],`pattern-type`,`text`)});l(await d(`Updating`,async()=>n.emailSecurity.settings.blockSenders.edit({body:a,account_id:r,pattern_id:t[`pattern-id`]})),{successLabel:`Updated`})}};function Ie(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Le={command:`get <pattern-id>`,describe:`Retrieves details for a specific blocked sender pattern including its pattern type, value, and metadata.`,builder:Ie,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings block-senders get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/block_senders/${t[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(t[`pattern-id`]))}`,pathParams:{"pattern-id":String(t[`pattern-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.settings.blockSenders.get({account_id:r,pattern_id:t[`pattern-id`]})),{successLabel:`Loaded`})}};function Re(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`pattern-type`,{type:`string`,description:`Filter by pattern type.`,choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`pattern`,{type:`string`,description:`Filter by pattern value.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`list`,describe:`Returns a paginated list of blocked email sender patterns. These patterns prevent emails from matching senders from being delivered. Supports filtering by pattern type and searching across patterns.`,builder:m(Re),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],search:t.search,order:t.order,direction:t.direction,pattern_type:t[`pattern-type`],pattern:t.pattern};if(t.dryRun){u({command:`cf email-security settings block-senders list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.emailSecurity.settings.blockSenders.list({account_id:a,...n})),{successLabel:`Loaded`})}},Be={command:`block-senders`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(je).command(Ne).command(Fe).command(Le).command(ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ve(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const He={command:`bulk-delete`,describe:`Deprecated. Use the batch endpoint instead.`,builder:Ve,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings domains bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/domains`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:s(t.body)});return}let n=await o(t),a=t.local?p:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
6
+ `);return}if(t.body){let e=s(t.body);l(await d(`Deleting`,async()=>n.emailSecurity.settings.domains.bulkDelete({body:e,account_id:a})),{successLabel:`Deleted`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function Ue(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const We={command:`delete <domain-id>`,describe:`Removes email security protection from a domain. After deletion, emails for this domain will no longer be processed by Email Security. This action cannot be undone.`,builder:Ue,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/domains/${t[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(t[`domain-id`]))}`,pathParams:{"domain-id":String(t[`domain-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?p:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
7
+ `);return}l(await d(`Deleting`,async()=>n.emailSecurity.settings.domains.delete({account_id:a,domain_id:t[`domain-id`]})),{successLabel:`Deleted`})}};function Ge(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier`,demandOption:!0}).option(`allowed-delivery-modes`,{type:`string`,array:!0,description:`The allowed_delivery_modes field`}).option(`domain`,{type:`string`,description:`The domain field`}).option(`drop-dispositions`,{type:`string`,array:!0,description:`The drop_dispositions field`}).option(`folder`,{type:`string`,description:`The folder field`,choices:[`AllItems`,`Inbox`]}).option(`integration-id`,{type:`string`,description:`The integration_id field`}).option(`ip-restrictions`,{type:`string`,array:!0,description:`The ip_restrictions field`}).option(`lookback-hops`,{type:`number`,description:`The lookback_hops field`}).option(`regions`,{type:`string`,array:!0,description:`The regions field`}).option(`require-tls-inbound`,{type:`boolean`,description:`The require_tls_inbound field`}).option(`require-tls-outbound`,{type:`boolean`,description:`The require_tls_outbound field`}).option(`transport`,{type:`string`,description:`The transport field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ke={command:`edit <domain-id>`,describe:`Updates configuration for a protected email domain. Only provided fields will be modified. Changes affect delivery mode, security settings, and regional processing.`,builder:Ge,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/domains/${t[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(t[`domain-id`]))}`,pathParams:{"domain-id":String(t[`domain-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({allowed_delivery_modes:t[`allowed-delivery-modes`],domain:f(t.domain,`domain`,`text`),drop_dispositions:t[`drop-dispositions`],folder:f(t.folder,`folder`,`text`),integration_id:f(t[`integration-id`],`integration-id`,`text`),ip_restrictions:t[`ip-restrictions`],lookback_hops:t[`lookback-hops`],regions:t.regions,require_tls_inbound:t[`require-tls-inbound`],require_tls_outbound:t[`require-tls-outbound`],transport:f(t.transport,`transport`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.emailSecurity.settings.domains.edit({body:e,account_id:r,domain_id:t[`domain-id`]})),{successLabel:`Updated`});return}let a=c({allowed_delivery_modes:t[`allowed-delivery-modes`],domain:f(t.domain,`domain`,`text`),drop_dispositions:t[`drop-dispositions`],folder:f(t.folder,`folder`,`text`),integration_id:f(t[`integration-id`],`integration-id`,`text`),ip_restrictions:t[`ip-restrictions`],lookback_hops:t[`lookback-hops`],regions:t.regions,require_tls_inbound:t[`require-tls-inbound`],require_tls_outbound:t[`require-tls-outbound`],transport:f(t.transport,`transport`,`text`)});l(await d(`Updating`,async()=>n.emailSecurity.settings.domains.edit({body:a,account_id:r,domain_id:t[`domain-id`]})),{successLabel:`Updated`})}};function qe(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Je={command:`get <domain-id>`,describe:`Retrieves detailed information for a specific protected email domain including its delivery configuration, SPF/DMARC status, and authorization state.`,builder:qe,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/domains/${t[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(t[`domain-id`]))}`,pathParams:{"domain-id":String(t[`domain-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.settings.domains.get({account_id:r,domain_id:t[`domain-id`]})),{successLabel:`Loaded`})}};function Ye(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`domain`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`allowed-delivery-mode`,{type:`string`,description:`Delivery mode to filter by.`,choices:[`DIRECT`,`BCC`,`JOURNAL`,`API`,`RETRO_SCAN`]}).option(`domain`,{type:`string`,description:`Domain names to filter by.`}).option(`active-delivery-mode`,{type:`string`,description:`Currently active delivery mode to filter by.`,choices:[`DIRECT`,`BCC`,`JOURNAL`,`API`,`RETRO_SCAN`]}).option(`integration-id`,{type:`string`,description:`Integration ID to filter by.`}).option(`status`,{type:`string`,description:`Filters response to domains with the provided status.`,choices:[`pending`,`active`,`failed`,`timeout`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Xe={command:`list`,describe:`Returns a paginated list of email domains protected by Email Security. Includes domain configuration, delivery modes, and authorization status. Supports filtering by delivery mode and integration ID.`,builder:m(Ye),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],search:t.search,order:t.order,direction:t.direction,allowed_delivery_mode:t[`allowed-delivery-mode`],domain:t.domain,active_delivery_mode:t[`active-delivery-mode`],integration_id:t[`integration-id`],status:t.status};if(t.dryRun){u({command:`cf email-security settings domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/domains`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.emailSecurity.settings.domains.list({account_id:a,...n})),{successLabel:`Loaded`})}},Ze={command:`domains`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command(He).command(We).command(Ke).command(Je).command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qe(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-recent`,{type:`boolean`,description:`Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a trusted domain`})}const $e={command:`create`,describe:`Creates a new trusted domain pattern. Use for partner domains or approved senders that should bypass recent domain registration and similarity checks. Configure whether it prevents recent domain or spoof dispositions.`,builder:Qe,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings trusted-domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},bodyKind:`json`,body:t.body===void 0?c({comments:f(t.comments,`comments`,`text`),is_recent:t[`is-recent`],is_regex:t[`is-regex`],is_similarity:t[`is-similarity`],pattern:f(t.pattern,`pattern`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Creating`,async()=>n.emailSecurity.settings.trustedDomains.create({body:e,account_id:r})),{successLabel:`Created`});return}let a=c({comments:f(t.comments,`comments`,`text`),is_recent:t[`is-recent`],is_regex:t[`is-regex`],is_similarity:t[`is-similarity`],pattern:f(t.pattern,`pattern`,`text`)});l(await d(`Creating`,async()=>n.emailSecurity.settings.trustedDomains.create({body:a,account_id:r})),{successLabel:`Created`})}};function et(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const tt={command:`delete <trusted-domain-id>`,describe:`Removes a trusted domain pattern. After deletion, emails from this domain will be subject to normal recent domain and similarity checks.`,builder:et,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings trusted-domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/trusted_domains/${t[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(t[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(t[`trusted-domain-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?p:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
8
+ `);return}l(await d(`Deleting`,async()=>n.emailSecurity.settings.trustedDomains.delete({account_id:a,trusted_domain_id:t[`trusted-domain-id`]})),{successLabel:`Deleted`})}};function $(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-recent`,{type:`boolean`,description:`Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update a trusted domain`})}const nt={command:`edit <trusted-domain-id>`,describe:`Updates an existing trusted domain pattern. Only provided fields will be modified. Changes take effect for new emails matching the pattern.`,builder:$,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings trusted-domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/trusted_domains/${t[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(t[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(t[`trusted-domain-id`]??``)},bodyKind:`json`,body:t.body===void 0?c({comments:f(t.comments,`comments`,`text`),is_recent:t[`is-recent`],is_regex:t[`is-regex`],is_similarity:t[`is-similarity`],pattern:f(t.pattern,`pattern`,`text`)}):s(t.body)});return}let n=await o(t),r=t.local?p:await i(n);if(t.accountId=r,t.body){let e=s(t.body);l(await d(`Updating`,async()=>n.emailSecurity.settings.trustedDomains.edit({body:e,account_id:r,trusted_domain_id:t[`trusted-domain-id`]})),{successLabel:`Updated`});return}let a=c({comments:f(t.comments,`comments`,`text`),is_recent:t[`is-recent`],is_regex:t[`is-regex`],is_similarity:t[`is-similarity`],pattern:f(t.pattern,`pattern`,`text`)});l(await d(`Updating`,async()=>n.emailSecurity.settings.trustedDomains.edit({body:a,account_id:r,trusted_domain_id:t[`trusted-domain-id`]})),{successLabel:`Updated`})}};function rt(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const it={command:`get <trusted-domain-id>`,describe:`Retrieves details for a specific trusted domain pattern including its pattern value, whether it uses regex matching, and which detection types it affects.`,builder:rt,handler:async t=>{if(t.dryRun){u({command:`cf email-security settings trusted-domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/trusted_domains/${t[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(t[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(t[`trusted-domain-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.emailSecurity.settings.trustedDomains.get({account_id:r,trusted_domain_id:t[`trusted-domain-id`]})),{successLabel:`Loaded`})}};function at(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`is-recent`,{type:`boolean`,description:`Filter to show only recently registered domains that are trusted to prevent triggering Suspicious or Malicious dispositions.`}).option(`is-similarity`,{type:`boolean`,description:`Filter to show only proximity domains (partner or approved domains with similar spelling to connected domains) that prevent Spoof dispositions.`}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ot={command:`list`,describe:`Returns a paginated list of trusted domain patterns. Trusted domains prevent false positives for recently registered domains and lookalike domain detections. Patterns can use regular expressions for flexible matching.`,builder:m(at),handler:async t=>{let n={page:t.page,per_page:t[`per-page`],search:t.search,order:t.order,direction:t.direction,is_recent:t[`is-recent`],is_similarity:t[`is-similarity`],pattern:t.pattern};if(t.dryRun){u({command:`cf email-security settings trusted-domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.emailSecurity.settings.trustedDomains.list({account_id:a,...n})),{successLabel:`Loaded`})}},st={command:`trusted-domains`,describe:`Email security policies — allow lists, blocked senders, trusted domains, and impersonation registry`,builder:e=>e.command($e).command(tt).command(nt).command(it).command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ct={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(se).command(ke).command(Be).command(Ze).command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function lt(e){return e.option(`start`,{type:`string`,description:"The beginning of the search date range. Defaults to `now - 30 days`."}).option(`end`,{type:`string`,description:"The end of the search date range. Defaults to `now`."}).option(`type`,{type:`string`,description:`Type`,choices:[`TEAM`,`USER`]}).option(`submission-id`,{type:`string`,description:`Submission ID`}).option(`original-disposition`,{type:`string`,description:`Original disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`requested-disposition`,{type:`string`,description:`Requested disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`outcome-disposition`,{type:`string`,description:`Outcome disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`status`,{type:`string`,description:`Status`}).option(`query`,{type:`string`,description:`Query`}).option(`escalated-from-user`,{type:`boolean`,description:`When true, return only submissions that were escalated by an end user (vs. by the security team). When false, return only submissions that were not escalated by an end user. When omitted, no filter is applied.`}).option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ut={command:`list`,describe:`Returns information for submissions made to reclassify emails. Shows the status, outcome, and disposition changes for reclassification requests made by users or the security team. Useful for tracking false positive/negative reports.`,builder:m(lt),handler:async t=>{let n={start:t.start,end:t.end,type:t.type,submission_id:t[`submission-id`],original_disposition:t[`original-disposition`],requested_disposition:t[`requested-disposition`],outcome_disposition:t[`outcome-disposition`],status:t.status,query:t.query,escalated_from_user:t[`escalated-from-user`],page:t.page,per_page:t[`per-page`]};if(t.dryRun){u({command:`cf email-security submissions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email-security/submissions`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.emailSecurity.submissions.list({account_id:a,...n})),{successLabel:`Loaded`})}},dt={command:`submissions`,describe:`User and admin email submissions for classification review`,builder:e=>e.command(ut).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ft={command:`email-security`,describe:`Cloud email security (Area 1) — investigate threats, manage allow/block policies, and detect phishing`,builder:e=>e.command(U).command(q).command(ct).command(dt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ft as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,D as t,S as n,T as r,_ as i,n as a}from"./auth-ffdf9yR0.mjs";import{n as o,t as s}from"./body-parser-DKa8Ipg1.mjs";import{t as c}from"./output-BJFNwj7b.mjs";import{n as l,t as u}from"./progress-CrCGTq7N.mjs";import{n as d}from"./input-validation-zEO81MWN.mjs";import{t as f}from"./local-VJaJ3BZ1.mjs";function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get`,describe:`Returns the current daily sending quota for the account and, when a quota is resolved, the account's current usage against it. Quota is null when not yet available; usage is null when there is no resolved quota or usage is temporarily unavailable.`,builder:p,handler:async t=>{if(t.dryRun){l({command:`cf email-sending limits get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email/sending/limits`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.emailSending.limits.get({account_id:r})),{successLabel:`Loaded`})}},h={command:`limits`,describe:`Operations for limits`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function g(e){return e.option(`from`,{type:`string`,description:`Sender email address.`}).option(`mime-message`,{type:`string`,description:`The full MIME-encoded email message. Should include standard RFC 5322 headers such as From, To, Subject, and Content-Type. The from and recipients fields in the request body control SMTP envelope routing; the From and To headers in the MIME message control what the recipient's email client displays.`}).option(`recipients`,{type:`string`,array:!0,description:`List of recipient email addresses.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`send-raw`,describe:`Send a raw RFC 5322 (MIME) email for the specified account. Provide the full MIME message plus the SMTP envelope (from and recipients).`,builder:g,handler:async n=>{if(n.dryRun){l({command:`cf email-sending send-raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email/sending/send_raw`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({from:d(n.from,`from`,`text`),mime_message:d(n[`mime-message`],`mime-message`,`text`),recipients:n.recipients}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.emailSending.sendRaw({...e,account_id:p})),{successLabel:`Created`});return}if(n.from===void 0&&(n.from=await t(`from`,`Sender email address.`)),n[`mime-message`]===void 0&&(n[`mime-message`]=await t(`mime-message`,`The full MIME-encoded email message. Should include standard RFC 5322 headers such as From, To, Subject, and Content-Type. The from and recipients fields in the request body control SMTP envelope routing; the From and To headers in the MIME message control what the recipient's email client displays.`)),n.recipients===void 0)throw Error(`--recipients is required (or pass --body with this field set).`);let m=s({from:d(n.from,`from`,`text`),mime_message:d(n[`mime-message`],`mime-message`,`text`),recipients:n.recipients});c(await u(`Creating`,async()=>r.emailSending.sendRaw({...m,account_id:p})),{successLabel:`Created`})}};function v(e){return e.option(`bcc-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`bcc-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`cc-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`cc-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`from-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`from-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`html`,{type:`string`,description:`HTML body of the email. Provide at least one of text or html (non-empty).`}).option(`reply-to-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`reply-to-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`subject`,{type:`string`,description:`Email subject line.`}).option(`text`,{type:`string`,description:`Plain text body of the email. Provide at least one of text or html (non-empty).`}).option(`to-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`to-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const y={command:`send`,describe:`Send an email for the specified account using the structured builder. Provide the sender, recipients, subject, and at least one of text or html; attachments are optional.`,builder:v,handler:async n=>{if(n.dryRun){l({command:`cf email-sending send`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/email/sending/send`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({bcc:{address:d(n[`bcc-address`],`bcc-address`,`text`),name:d(n[`bcc-name`],`bcc-name`,`text`)},cc:{address:d(n[`cc-address`],`cc-address`,`text`),name:d(n[`cc-name`],`cc-name`,`text`)},from:{address:d(n[`from-address`],`from-address`,`text`),name:d(n[`from-name`],`from-name`,`text`)},html:d(n.html,`html`,`text`),reply_to:{address:d(n[`reply-to-address`],`reply-to-address`,`text`),name:d(n[`reply-to-name`],`reply-to-name`,`text`)},subject:d(n.subject,`subject`,`text`),text:d(n.text,`text`,`text`),to:{address:d(n[`to-address`],`to-address`,`text`),name:d(n[`to-name`],`to-name`,`text`)}}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.emailSending.send({...e,account_id:p})),{successLabel:`Created`});return}n.subject===void 0&&(n.subject=await t(`subject`,`Email subject line.`));let m=s({bcc:{address:d(n[`bcc-address`],`bcc-address`,`text`),name:d(n[`bcc-name`],`bcc-name`,`text`)},cc:{address:d(n[`cc-address`],`cc-address`,`text`),name:d(n[`cc-name`],`cc-name`,`text`)},from:{address:d(n[`from-address`],`from-address`,`text`),name:d(n[`from-name`],`from-name`,`text`)},html:d(n.html,`html`,`text`),reply_to:{address:d(n[`reply-to-address`],`reply-to-address`,`text`),name:d(n[`reply-to-name`],`reply-to-name`,`text`)},subject:d(n.subject,`subject`,`text`),text:d(n.text,`text`,`text`),to:{address:d(n[`to-address`],`to-address`,`text`),name:d(n[`to-name`],`to-name`,`text`)}});c(await u(`Creating`,async()=>r.emailSending.send({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.option(`name`,{type:`string`,description:`The subdomain name. Must be within the zone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Creates a new sending subdomain or re-enables sending on an existing subdomain that had it disabled. If zone-level Email Sending has not been enabled yet, the zone flag is automatically set when the entitlement is present.`,builder:b,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({name:d(e.name,`name`,`text`)}):o(e.body)});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=o(e.body);c(await u(`Creating`,async()=>r.emailSending.subdomains.create({...t,zone_id:i})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`The subdomain name. Must be within the zone.`));let f=s({name:d(e.name,`name`,`text`)});c(await u(`Creating`,async()=>r.emailSending.subdomains.create({...f,zone_id:i})),{successLabel:`Created`})}};function S(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <subdomain-id>`,describe:`Disables sending on a subdomain and removes its DNS records. If routing is still active on the subdomain, only sending is disabled.`,builder:S,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>t.emailSending.subdomains.delete({zone_id:i,subdomain_id:e[`subdomain-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`fix <subdomain-id>`,describe:`Idempotently re-applies the sending DNS records (creates missing records, re-applies the email_routing lock on records whose lock has been cleared). Refuses with a 409 if foreign MX, multiple SPF, multiple DMARC, or multiple DKIM records exist at the relevant DNS names — those require manual cleanup.`,builder:w,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains dns fix`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}/dns`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Creating`,async()=>t.emailSending.subdomains.dns.fix({zone_id:r,subdomain_id:e[`subdomain-id`]})),{successLabel:`Created`})}};function E(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get-status <subdomain-id>`,describe:`Returns the desired DNS records for a sending subdomain along with a live diff against actual DNS state. Use this to detect missing, unlocked, foreign, or multi-record conflicts before deciding whether to call the fix endpoint.`,builder:E,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains dns get-status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}/dns/status`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.emailSending.subdomains.dns.getStatus({zone_id:r,subdomain_id:e[`subdomain-id`]})),{successLabel:`Loaded`})}};function O(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <subdomain-id>`,describe:`Returns the expected DNS records for a sending subdomain.`,builder:O,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains dns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}/dns`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.emailSending.subdomains.dns.get({zone_id:r,subdomain_id:e[`subdomain-id`]})),{successLabel:`Loaded`})}},A={command:`dns`,describe:`Operations for subdomains.dns`,builder:e=>e.command(T).command(k).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get <subdomain-id>`,describe:`Gets information for a specific sending subdomain.`,builder:j,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.emailSending.subdomains.get({zone_id:r,subdomain_id:e[`subdomain-id`]})),{successLabel:`Loaded`})}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`list`,describe:`Lists all sending-enabled subdomains for the zone.`,builder:N,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,c(await u(`Loading`,async()=>t.emailSending.subdomains.list({zone_id:r})),{successLabel:`Loaded`})}};function F(e){return e.option(`name`,{type:`string`,description:`The subdomain name. Must be within the zone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`preview`,describe:`Returns the DNS records that would be created for a sending subdomain, flags which records are missing, and reports any conflicts with existing DNS records. This is a read-only dry-run — no records are created or modified. Use before or after creating a subdomain to check DNS status.`,builder:F,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/preview`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({name:d(e.name,`name`,`text`)}):o(e.body)});return}let r=await a(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=o(e.body);c(await u(`Loading`,async()=>r.emailSending.subdomains.preview({...t,zone_id:i})),{successLabel:`Loaded`});return}e.name===void 0&&(e.name=await t(`name`,`The subdomain name. Must be within the zone.`));let f=s({name:d(e.name,`name`,`text`)});c(await u(`Loading`,async()=>r.emailSending.subdomains.preview({...f,zone_id:i})),{successLabel:`Loaded`})}};function L(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`preview-enabled`,{type:`boolean`,description:`Whether sent messages from this subdomain can be previewed in the activity log.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`update <subdomain-id>`,describe:`Updates the activity-log preview preference for a sending subdomain.`,builder:L,handler:async e=>{if(e.dryRun){l({command:`cf email-sending subdomains update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({preview_enabled:e[`preview-enabled`]}):o(e.body)});return}let t=await a(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=o(e.body);c(await u(`Updating`,async()=>t.emailSending.subdomains.update({...n,zone_id:r,subdomain_id:e[`subdomain-id`]})),{successLabel:`Updated`});return}if(e[`preview-enabled`]===void 0)throw Error(`--preview-enabled is required (or pass --body with this field set).`);let i=s({preview_enabled:e[`preview-enabled`]});c(await u(`Updating`,async()=>t.emailSending.subdomains.update({...i,zone_id:r,subdomain_id:e[`subdomain-id`]})),{successLabel:`Updated`})}},z={command:`subdomains`,describe:`Operations for subdomains`,builder:e=>e.command(x).command(C).command(M).command(P).command(I).command(R).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},B={command:`email-sending`,describe:`Send emails and manage sending subdomains`,builder:e=>e.command(y).command(_).command(h).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{B as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,T as t,n}from"./auth-ffdf9yR0.mjs";import{n as r,t as i}from"./body-parser-DKa8Ipg1.mjs";import{t as a}from"./output-BJFNwj7b.mjs";import{n as o,t as s}from"./progress-CrCGTq7N.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";import{t as l}from"./cli-types-CRIDdDw3.mjs";function u(e){return e.option(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const d={command:`bulk-delete`,describe:`Deletes one or more existing filters.`,builder:u,handler:async r=>{let i={id:r.id};if(r.dryRun){o({command:`cf filters bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(r.zone??r[`zone-id`]??``)},query:i,bodyKind:`none`});return}let c=await n(r),l=await e({zone:r.zone},c,{quiet:r.quiet});if(r.zoneId=l,!await t({force:!!r.force})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>c.filters.bulkDelete({zone_id:l,...i})),{successLabel:`Deleted`})}};function f(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const p={command:`bulk-update`,describe:`Updates one or more existing filters.`,builder:f,handler:async t=>{if(t.dryRun){o({command:`cf filters bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:r(t.body)});return}let i=await n(t),c=await e({zone:t.zone},i,{quiet:t.quiet});if(t.zoneId=c,t.body){let e=r(t.body);a(await s(`Updating`,async()=>i.filters.bulkUpdate({body:e,zone_id:c})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function m(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`create`,describe:`Creates one or more filters.`,builder:m,handler:async t=>{if(t.dryRun){o({command:`cf filters create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?void 0:r(t.body)});return}let i=await n(t),c=await e({zone:t.zone},i,{quiet:t.quiet});if(t.zoneId=c,t.body){let e=r(t.body);a(await s(`Creating`,async()=>i.filters.create({body:e,zone_id:c})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function g(e){return e.positional(`filter-id`,{type:`string`,description:`The unique identifier of the filter.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <filter-id>`,describe:`Deletes an existing filter.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf filters delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${r.zone??r.zoneId??`<zone>`}/filters/${r[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(r[`filter-id`]))}`,pathParams:{"filter-id":String(r[`filter-id`]??``),"zone-id":String(r.zone??r[`zone-id`]??``)},bodyKind:`none`});return}let i=await n(r),c=await e({zone:r.zone},i,{quiet:r.quiet});if(r.zoneId=c,!await t({force:!!r.force})){process.stderr.write(`Aborted.
4
+ `);return}a(await s(`Deleting`,async()=>i.filters.delete({zone_id:c,filter_id:r[`filter-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`filter-id`,{type:`string`,description:`The unique identifier of the filter.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <filter-id>`,describe:`Fetches the details of a filter.`,builder:v,handler:async t=>{if(t.dryRun){o({command:`cf filters get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/filters/${t[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(t[`filter-id`]))}`,pathParams:{"filter-id":String(t[`filter-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(t),i=await e({zone:t.zone},r,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>r.filters.get({zone_id:i,filter_id:t[`filter-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`expression`,{type:`string`,description:`A case-insensitive string to find in the expression.`}).option(`description`,{type:`string`,description:`A case-insensitive string to find in the description.`}).option(`ref`,{type:`string`,description:`The filter ref (a short reference tag) to search for. Must be an exact match.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of filters per page.`}).option(`id`,{type:`string`,description:`The unique identifier of the filter.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Fetches filters in a zone. You can filter the results using several optional parameters.`,builder:l(b),handler:async t=>{let r={paused:t.paused,expression:t.expression,description:t.description,ref:t.ref,page:t.page,per_page:t[`per-page`],id:t.id};if(t.dryRun){o({command:`cf filters list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/filters`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:r,bodyKind:`none`});return}let i=await n(t),c=await e({zone:t.zone},i,{quiet:t.quiet});t.zoneId=c,a(await s(`Loading`,async()=>i.filters.list({zone_id:c,...r})),{successLabel:`Loaded`})}};function S(e){return e.positional(`filter-id`,{type:`string`,description:`The unique identifier of the filter.`,demandOption:!0}).option(`description`,{type:`string`,description:`An informative summary of the filter.`}).option(`expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`update <filter-id>`,describe:`Updates an existing filter.`,builder:S,handler:async t=>{if(t.dryRun){o({command:`cf filters update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/filters/${t[`filter-id`]==null?`<filter-id>`:encodeURIComponent(String(t[`filter-id`]))}`,pathParams:{"filter-id":String(t[`filter-id`]??``),"zone-id":String(t.zone??t[`zone-id`]??``)},bodyKind:`json`,body:t.body===void 0?i({description:c(t.description,`description`,`text`),expression:c(t.expression,`expression`,`text`),paused:t.paused,ref:c(t.ref,`ref`,`text`)}):r(t.body)});return}let l=await n(t),u=await e({zone:t.zone},l,{quiet:t.quiet});if(t.zoneId=u,t.body){let e=r(t.body);a(await s(`Updating`,async()=>l.filters.update({body:e,zone_id:u,filter_id:t[`filter-id`]})),{successLabel:`Updated`});return}let d=i({description:c(t.description,`description`,`text`),expression:c(t.expression,`expression`,`text`),paused:t.paused,ref:c(t.ref,`ref`,`text`)});a(await s(`Updating`,async()=>l.filters.update({body:d,zone_id:u,filter_id:t[`filter-id`]})),{successLabel:`Updated`})}},w={command:`filters`,describe:`Filter expressions used by legacy firewall rules to match requests — prefer Rulesets for new configurations`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{w as default};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import{C as e,E as t,S as n,T as r,_ as i,i as a,n as o}from"./auth-ffdf9yR0.mjs";import{n as s,t as c}from"./body-parser-DKa8Ipg1.mjs";import{t as l}from"./output-BJFNwj7b.mjs";import{n as u,t as d}from"./progress-CrCGTq7N.mjs";import{n as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";import{t as m}from"./cli-types-CRIDdDw3.mjs";function ee(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`create`,describe:`Creates a new IP Access rule for an account. The rule will apply to all zones in the account. Note: To create an IP Access rule that applies to a single zone, refer to the [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.`,builder:ee,handler:async n=>{if(n.dryRun){u({command:`cf firewall access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},bodyKind:`json`,body:n.body===void 0?c({configuration:{target:f(n[`configuration-target`],`configuration-target`,`text`),value:f(n[`configuration-value`],`configuration-value`,`text`)},mode:f(n.mode,`mode`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?p:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Creating`,async()=>r.firewall.accessRules.create({...e,account_id:a})),{successLabel:`Created`});return}n.mode===void 0&&(n.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m=c({configuration:{target:f(n[`configuration-target`],`configuration-target`,`text`),value:f(n[`configuration-value`],`configuration-value`,`text`)},mode:f(n.mode,`mode`,`text`)});l(await d(`Creating`,async()=>r.firewall.accessRules.create({...m,account_id:a})),{successLabel:`Created`})}};function h(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <rule-id>`,describe:`Deletes an existing IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:h,handler:async t=>{if(t.dryRun){u({command:`cf firewall access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await o(t),a=t.local?p:await i(n);if(t.accountId=a,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
+ `);return}l(await d(`Deleting`,async()=>n.firewall.accessRules.delete({account_id:a,rule_id:t[`rule-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`edit <rule-id>`,describe:`Updates an IP Access rule defined at the account level. Note: This operation will affect all zones in the account.`,builder:_,handler:async n=>{if(n.dryRun){u({command:`cf firewall access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${n[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(n[`rule-id`]))}`,pathParams:{"rule-id":String(n[`rule-id`]??``)},bodyKind:`json`,body:n.body===void 0?c({configuration:{target:f(n[`configuration-target`],`configuration-target`,`text`),value:f(n[`configuration-value`],`configuration-value`,`text`)},mode:f(n.mode,`mode`,`text`),notes:f(n.notes,`notes`,`text`)}):s(n.body)});return}let r=await o(n),a=n.local?p:await i(r);if(n.accountId=a,n.body){let e=s(n.body);l(await d(`Updating`,async()=>r.firewall.accessRules.edit({body:e,account_id:a,rule_id:n[`rule-id`]})),{successLabel:`Updated`});return}n.mode===void 0&&(n.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let m=c({configuration:{target:f(n[`configuration-target`],`configuration-target`,`text`),value:f(n[`configuration-value`],`configuration-value`,`text`)},mode:f(n.mode,`mode`,`text`),notes:f(n.notes,`notes`,`text`)});l(await d(`Updating`,async()=>r.firewall.accessRules.edit({body:m,account_id:a,rule_id:n[`rule-id`]})),{successLabel:`Updated`})}};function y(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <rule-id>`,describe:`Fetches the details of an IP Access rule defined at the account level.`,builder:y,handler:async t=>{if(t.dryRun){u({command:`cf firewall access-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules/${t[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(t[`rule-id`]))}`,pathParams:{"rule-id":String(t[`rule-id`]??``)},bodyKind:`none`});return}let n=await o(t),r=t.local?p:await i(n);t.accountId=r,l(await d(`Loading`,async()=>n.firewall.accessRules.get({account_id:r,rule_id:t[`rule-id`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`Defines the target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"Defines the target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`Defines the string to search for in the notes of existing IP Access rules.
4
+ Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Defines the requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Defines the maximum number of results requested.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Fetches IP Access rules of an account. These rules apply to all the zones in the account. You can filter the results using several optional parameters.`,builder:m(x),handler:async t=>{let n={mode:t.mode,"configuration.target":t[`configuration-target`],"configuration.value":t[`configuration-value`],notes:t.notes,match:t.match,page:t.page,per_page:t[`per-page`],order:t.order,direction:t.direction};if(t.dryRun){u({command:`cf firewall access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/firewall/access_rules/rules`,pathParams:{},query:n,bodyKind:`none`});return}let r=await o(t),a=t.local?p:await i(r);t.accountId=a,l(await d(`Loading`,async()=>r.firewall.accessRules.list({account_id:a,...n})),{successLabel:`Loaded`})}},C={command:`access-rules`,describe:`IP-based access rules that allow, block, challenge, or whitelist traffic globally or per-zone`,builder:e=>e.command(te).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`create`,describe:`Creates a new Zone Lockdown rule.`,builder:w,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({description:f(e.description,`description`,`text`),paused:e.paused,priority:e.priority,urls:e.urls}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Creating`,async()=>t.firewall.lockdowns.create({...n,zone_id:r})),{successLabel:`Created`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i=c({description:f(e.description,`description`,`text`),paused:e.paused,priority:e.priority,urls:e.urls});l(await d(`Creating`,async()=>t.firewall.lockdowns.create({...i,zone_id:r})),{successLabel:`Created`})}};function E(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`delete <lock-downs-id>`,describe:`Deletes an existing Zone Lockdown rule.`,builder:E,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
5
+ `);return}l(await d(`Deleting`,async()=>t.firewall.lockdowns.delete({zone_id:i,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <lock-downs-id>`,describe:`Fetches the details of a Zone Lockdown rule.`,builder:O,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.lockdowns.get({zone_id:r,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Loaded`})}};function A(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`modified-on`,{type:`string`,description:`The timestamp of when the rule was last modified.`}).option(`ip`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`priority`,{type:`number`,description:`The priority of the rule to control the processing order. A lower number indicates higher priority. If not provided, any rules with a configured priority will be processed before rules without a priority.`}).option(`uri-search`,{type:`string`,description:`A single URI to search for in the list of URLs of existing rules.`}).option(`ip-range-search`,{type:`string`,description:`A single IP address range to search for in existing rules.`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`created-on`,{type:`string`,description:`The timestamp of when the rule was created.`}).option(`description-search`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`ip-search`,{type:`string`,description:`A single IP address to search for in existing rules.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Fetches Zone Lockdown rules. You can filter the results using several optional parameters.`,builder:A,handler:async e=>{let t={page:e.page,description:e.description,modified_on:e[`modified-on`],ip:e.ip,priority:e.priority,uri_search:e[`uri-search`],ip_range_search:e[`ip-range-search`],per_page:e[`per-page`],created_on:e[`created-on`],description_search:e[`description-search`],ip_search:e[`ip-search`]};if(e.dryRun){u({command:`cf firewall lockdowns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.lockdowns.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function M(e){return e.positional(`lock-downs-id`,{type:`string`,description:`The unique identifier of the Zone Lockdown rule.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const N={command:`update <lock-downs-id>`,describe:`Updates an existing Zone Lockdown rule.`,builder:M,handler:async e=>{if(e.dryRun){u({command:`cf firewall lockdowns update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/lockdowns/${e[`lock-downs-id`]==null?`<lock-downs-id>`:encodeURIComponent(String(e[`lock-downs-id`]))}`,pathParams:{"lock-downs-id":String(e[`lock-downs-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.lockdowns.update({...n,zone_id:r,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i=c({urls:e.urls});l(await d(`Updating`,async()=>t.firewall.lockdowns.update({...i,zone_id:r,lock_downs_id:e[`lock-downs-id`]})),{successLabel:`Updated`})}},P={command:`lockdowns`,describe:`Zone lockdown rules that restrict access to URLs by IP address or range`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`bulk-delete`,describe:`Deletes existing firewall rules.`,builder:F,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
6
+ `);return}if(e.body){let n=s(e.body);l(await d(`Deleting`,async()=>t.firewall.rules.bulkDelete({...n,zone_id:i})),{successLabel:`Deleted`});return}l(await d(`Deleting`,async()=>t.firewall.rules.bulkDelete({zone_id:i})),{successLabel:`Deleted`})}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`bulk-edit`,describe:`Updates the priority of existing firewall rules.`,builder:L,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.bulkEdit({body:n,zone_id:r})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>a(t,`PATCH`,`/zones/${e.zoneId}/firewall/rules`)),{successLabel:`Updated`})}};function z(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`bulk-update`,describe:`Updates one or more existing firewall rules.`,builder:z,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.bulkUpdate({body:n,zone_id:r})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>a(t,`PUT`,`/zones/${e.zoneId}/firewall/rules`)),{successLabel:`Updated`})}};function V(e){return e.option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const H={command:`create`,describe:`Create one or more firewall rules.`,builder:V,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Creating`,async()=>t.firewall.rules.create({...n,zone_id:r})),{successLabel:`Created`});return}let i=c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}});l(await d(`Creating`,async()=>t.firewall.rules.create({...i,zone_id:r})),{successLabel:`Created`})}};function U(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`delete-filter-if-unused`,{type:`boolean`,description:`When true, indicates that Cloudflare should also delete the associated filter if there are no other firewall rules referencing the filter.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`delete <rule-id>`,describe:`Deletes an existing firewall rule.`,builder:U,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({delete_filter_if_unused:e[`delete-filter-if-unused`]}):s(e.body)});return}let t=await o(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
7
+ `);return}if(e.body){let n=s(e.body);l(await d(`Deleting`,async()=>t.firewall.rules.delete({...n,zone_id:i,rule_id:e[`rule-id`]})),{successLabel:`Deleted`});return}let a=c({delete_filter_if_unused:e[`delete-filter-if-unused`]});l(await d(`Deleting`,async()=>t.firewall.rules.delete({...a,zone_id:i,rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`edit <rule-id>`,describe:`Updates the priority of an existing firewall rule.`,builder:G,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.edit({...n,zone_id:r,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}l(await d(`Updating`,async()=>t.firewall.rules.edit({zone_id:r,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function q(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <rule-id>`,describe:`Fetches the details of a firewall rule.`,builder:q,handler:async e=>{let t={id:e.id};if(e.dryRun){u({command:`cf firewall rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.rules.get({zone_id:i,rule_id:e[`rule-id`],...t})),{successLabel:`Loaded`})}};function Y(e){return e.option(`description`,{type:`string`,description:`A case-insensitive string to find in the description.`}).option(`action`,{type:`string`,description:`The action to search for. Must be an exact match.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of firewall rules per page.`}).option(`id`,{type:`string`,description:`The unique identifier of the firewall rule.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the firewall rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Fetches firewall rules in a zone. You can filter the results using several optional parameters.`,builder:Y,handler:async e=>{let t={description:e.description,action:e.action,page:e.page,per_page:e[`per-page`],id:e.id,paused:e.paused};if(e.dryRun){u({command:`cf firewall rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.rules.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`rule-id`,{type:`string`,description:`The unique identifier of the firewall rule.`,demandOption:!0}).option(`filter-description`,{type:`string`,description:`An informative summary of the filter.`}).option(`filter-expression`,{type:`string`,description:`The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/).`}).option(`filter-paused`,{type:`boolean`,description:`When true, indicates that the filter is currently paused.`}).option(`filter-ref`,{type:`string`,description:`A short reference tag. Allows you to select related filters.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Q={command:`update <rule-id>`,describe:`Updates an existing firewall rule.`,builder:Z,handler:async e=>{if(e.dryRun){u({command:`cf firewall rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.rules.update({...n,zone_id:r,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let i=c({filter:{description:f(e[`filter-description`],`filter-description`,`text`),expression:f(e[`filter-expression`],`filter-expression`,`text`),paused:e[`filter-paused`],ref:f(e[`filter-ref`],`filter-ref`,`text`)}});l(await d(`Updating`,async()=>t.firewall.rules.update({...i,zone_id:r,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}},ne={command:`rules`,describe:`Legacy firewall rules with filter expressions — prefer Rulesets for new configurations`,builder:e=>e.command(I).command(R).command(B).command(H).command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ua` when specifying a user agent in the rule.",choices:[`ua`]}).option(`configuration-value`,{type:`string`,description:`the user agent to exactly match`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`create`,describe:`Creates a new User Agent Blocking rule in a zone.`,builder:re,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused}):s(e.body)});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>r.firewall.uaRules.create({...t,zone_id:i})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused});l(await d(`Creating`,async()=>r.firewall.uaRules.create({...a,zone_id:i})),{successLabel:`Created`})}};function ae(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const oe={command:`delete <ua-rule-id>`,describe:`Deletes an existing User Agent Blocking rule.`,builder:ae,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
8
+ `);return}l(await d(`Deleting`,async()=>t.firewall.uaRules.delete({zone_id:i,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Deleted`})}};function se(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`get <ua-rule-id>`,describe:`Fetches the details of a User Agent Blocking rule.`,builder:se,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.uaRules.get({zone_id:r,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Loaded`})}};function le(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`description`,{type:`string`,description:`A string to search for in the description of existing rules.`}).option(`per-page`,{type:`number`,description:"The maximum number of results per page. You can only set the value to `1` or to a multiple of 5 such as `5`, `10`, `15`, or `20`."}).option(`user-agent`,{type:`string`,description:`A string to search for in the user agent values of existing rules.`}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`list`,describe:`Fetches User Agent Blocking rules in a zone. You can filter the results using several optional parameters.`,builder:le,handler:async e=>{let t={page:e.page,description:e.description,per_page:e[`per-page`],user_agent:e[`user-agent`],paused:e.paused};if(e.dryRun){u({command:`cf firewall ua-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.uaRules.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function de(e){return e.positional(`ua-rule-id`,{type:`string`,description:`The unique identifier of the User Agent Blocking rule.`,demandOption:!0}).option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`description`,{type:`string`,description:`An informative summary of the rule. This value is sanitized and any tags will be removed.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`paused`,{type:`boolean`,description:`When true, indicates that the rule is currently paused.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`update <ua-rule-id>`,describe:`Updates an existing User Agent Blocking rule.`,builder:de,handler:async e=>{if(e.dryRun){u({command:`cf firewall ua-rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/ua_rules/${e[`ua-rule-id`]==null?`<ua-rule-id>`:encodeURIComponent(String(e[`ua-rule-id`]))}`,pathParams:{"ua-rule-id":String(e[`ua-rule-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused}):s(e.body)});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);l(await d(`Updating`,async()=>r.firewall.uaRules.update({...t,zone_id:i,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Updated`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},description:f(e.description,`description`,`text`),mode:f(e.mode,`mode`,`text`),paused:e.paused});l(await d(`Updating`,async()=>r.firewall.uaRules.update({...a,zone_id:i,ua_rule_id:e[`ua-rule-id`]})),{successLabel:`Updated`})}},pe={command:`ua-rules`,describe:`Block or challenge requests based on the User-Agent header string`,builder:e=>e.command(ie).command(oe).command(ce).command(ue).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const he={command:`create`,describe:`Creates a URI-based WAF override for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:me,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Creating`,async()=>t.firewall.waf.overrides.create({...n,zone_id:r})),{successLabel:`Created`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i=c({urls:e.urls});l(await d(`Creating`,async()=>t.firewall.waf.overrides.create({...i,zone_id:r})),{successLabel:`Created`})}};function ge(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _e={command:`delete <overrides-id>`,describe:`Deletes an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ge,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
9
+ `);return}l(await d(`Deleting`,async()=>t.firewall.waf.overrides.delete({zone_id:i,overrides_id:e[`overrides-id`]})),{successLabel:`Deleted`})}};function ve(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`get <overrides-id>`,describe:`Fetches the details of a URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ve,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.overrides.get({zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Loaded`})}};function be(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of WAF overrides per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`Fetches the URI-based WAF overrides in a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:be,handler:async e=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){u({command:`cf firewall waf overrides list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.overrides.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function Se(e){return e.positional(`overrides-id`,{type:`string`,description:`The unique identifier of the WAF override.`,demandOption:!0}).option(`urls`,{type:`string`,array:!0,description:`The URLs to include in the current WAF override. You can use wildcards. Each entered URL will be escaped before use, which means you can only use simple wildcard patterns.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ce={command:`update <overrides-id>`,describe:`Updates an existing URI-based WAF override. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Se,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf overrides update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/overrides/${e[`overrides-id`]==null?`<overrides-id>`:encodeURIComponent(String(e[`overrides-id`]))}`,pathParams:{"overrides-id":String(e[`overrides-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({urls:e.urls}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...n,zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`});return}if(e.urls===void 0)throw Error(`--urls is required (or pass --body with this field set).`);let i=c({urls:e.urls});l(await d(`Updating`,async()=>t.firewall.waf.overrides.update({...i,zone_id:r,overrides_id:e[`overrides-id`]})),{successLabel:`Updated`})}},we={command:`overrides`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(he).command(_e).command(ye).command(xe).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return e.positional(`package-id`,{type:`string`,description:`Defines a package identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ee={command:`get <package-id>`,describe:`Fetches the details of a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Te,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.get({zone_id:r,package_id:e[`package-id`]})),{successLabel:`Loaded`})}};function De(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oe={command:`edit <group-id>`,describe:"Updates a WAF rule group. You can update the state (`mode` parameter) of a rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).",builder:De,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...n,zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`});return}let i=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.groups.edit({...i,zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`group-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <group-id>`,describe:`Fetches the details of a WAF rule group. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages groups get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.groups.get({zone_id:r,package_id:e[`package-id`],group_id:e[`group-id`]})),{successLabel:`Loaded`})}};function je(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the state of the rules contained in the rule group. When `on`, the rules in the group are configurable/usable.",choices:[`on`,`off`]}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rule groups per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rule groups.`,choices:[`mode`,`rules_count`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rule groups.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the condition for search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`Defines the name of the rule group.`}).option(`rules-count`,{type:`number`,description:`Defines the number of rules in the current rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`Fetches the WAF rule groups in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(je),handler:async e=>{let t={mode:e.mode,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name,rules_count:e[`rules-count`]};if(e.dryRun){u({command:`cf firewall waf packages groups list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/groups`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.groups.list({zone_id:i,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},Ne={command:`groups`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Oe).command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(e){return e.option(`page`,{type:`number`,description:`The page number of paginated results.`}).option(`per-page`,{type:`number`,description:`The number of packages per page.`}).option(`order`,{type:`string`,description:`The field used to sort returned packages.`,choices:[`name`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned packages.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`name`,{type:`string`,description:`The name of the WAF package.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`list`,describe:`Fetches WAF packages for a zone. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Pe),handler:async e=>{let t={page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,name:e.name};if(e.dryRun){u({command:`cf firewall waf packages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.list({zone_id:i,...t})),{successLabel:`Loaded`})}};function Ie(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:"Defines the mode/action of the rule when triggered. You must use a value from the `allowed_modes` array of the current rule.",choices:[`default`,`disable`,`simulate`,`block`,`challenge`,`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Le={command:`edit <rule-id>`,describe:`Updates a WAF rule. You can only update the mode/action of the rule. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Ie,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...n,zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let i=c({mode:f(e.mode,`mode`,`text`)});l(await d(`Updating`,async()=>t.firewall.waf.packages.rules.edit({...i,zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function Re(e){return e.positional(`rule-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <rule-id>`,describe:`Fetches the details of a WAF rule in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:Re,handler:async e=>{if(e.dryRun){u({command:`cf firewall waf packages rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"rule-id":String(e[`rule-id`]??``),"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r,l(await d(`Loading`,async()=>t.firewall.waf.packages.rules.get({zone_id:r,package_id:e[`package-id`],rule_id:e[`rule-id`]})),{successLabel:`Loaded`})}};function Be(e){return e.option(`package-id`,{type:`string`,description:`Defines the unique identifier of a WAF package.`,demandOption:!0}).option(`mode`,{type:`string`,description:`Defines the action/mode a rule has been overridden to perform.`,choices:[`DIS`,`CHL`,`BLK`,`SIM`]}).option(`group-id`,{type:`string`,description:`Defines the unique identifier of the rule group.`}).option(`page`,{type:`number`,description:`Defines the page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Defines the number of rules per page.`}).option(`order`,{type:`string`,description:`Defines the field used to sort returned rules.`,choices:[`priority`,`group_id`,`description`]}).option(`direction`,{type:`string`,description:`Defines the direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`match`,{type:`string`,description:"Defines the search requirements. When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`description`,{type:`string`,description:`Defines the public description of the WAF rule.`}).option(`priority`,{type:`string`,description:`Defines the order in which the individual WAF rule is executed within its rule group.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Fetches WAF rules in a WAF package. **Note:** Applies only to the [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/).`,builder:m(Be),handler:async e=>{let t={mode:e.mode,group_id:e[`group-id`],page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction,match:e.match,description:e.description,priority:e.priority};if(e.dryRun){u({command:`cf firewall waf packages rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/waf/packages/${e[`package-id`]==null?`<package-id>`:encodeURIComponent(String(e[`package-id`]))}/rules`,pathParams:{"package-id":String(e[`package-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.waf.packages.rules.list({zone_id:i,package_id:e[`package-id`],...t})),{successLabel:`Loaded`})}},$={command:`rules`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Le).command(ze).command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},He={command:`packages`,describe:`Legacy WAF managed rule packages, rule groups, individual rules, and override configurations`,builder:e=>e.command(Ee).command(Fe).command(Ne).command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`waf`,describe:`Operations for waf`,builder:e=>e.command(we).command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(e){return e.option(`configuration-target`,{type:`string`,description:"The configuration target. You must set the target to `ip` when specifying an IP address in the rule.",choices:[`ip`,`ip6`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:`The IP address to match. This address will be compared to the IP address of incoming requests.`}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ge={command:`create`,describe:`Creates a new IP Access rule for a zone. Note: To create an IP Access rule that applies to multiple zones, refer to [IP Access rules for a user](#ip-access-rules-for-a-user) or [IP Access rules for an account](#ip-access-rules-for-an-account) as appropriate.`,builder:We,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)}):s(e.body)});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});if(e.zoneId=i,e.body){let t=s(e.body);l(await d(`Creating`,async()=>r.firewall.zoneAccessRules.create({...t,zone_id:i})),{successLabel:`Created`});return}e.mode===void 0&&(e.mode=await t(`mode`,`The action to apply to a matched request.`,[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]));let a=c({configuration:{target:f(e[`configuration-target`],`configuration-target`,`text`),value:f(e[`configuration-value`],`configuration-value`,`text`)},mode:f(e.mode,`mode`,`text`)});l(await d(`Creating`,async()=>r.firewall.zoneAccessRules.create({...a,zone_id:i})),{successLabel:`Created`})}};function Ke(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`cascade`,{type:`string`,description:"The level to attempt to delete similar rules defined for other zones with the same owner. The default value is `none`, which will only delete the current rule. Using `basic` will delete rules that match the same action (mode) and configuration, while using `aggressive` will delete rules that match the same configuration.",choices:[`none`,`basic`,`aggressive`],default:`none`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qe={command:`delete <rule-id>`,describe:"Deletes an IP Access rule defined at the zone level. Optionally, you can use the `cascade` property to specify that you wish to delete similar rules in other zones managed by the same zone owner.",builder:Ke,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({cascade:f(e.cascade,`cascade`,`text`)}):s(e.body)});return}let t=await o(e),i=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await r({force:!!e.force})){process.stderr.write(`Aborted.
10
+ `);return}if(e.body){let n=s(e.body);l(await d(`Deleting`,async()=>t.firewall.zoneAccessRules.delete({...n,zone_id:i,rule_id:e[`rule-id`]})),{successLabel:`Deleted`});return}let a=c({cascade:f(e.cascade,`cascade`,`text`)});l(await d(`Deleting`,async()=>t.firewall.zoneAccessRules.delete({...a,zone_id:i,rule_id:e[`rule-id`]})),{successLabel:`Deleted`})}};function Je(e){return e.positional(`rule-id`,{type:`string`,description:`Unique identifier for a rule.`,demandOption:!0}).option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`notes`,{type:`string`,description:`An informative summary of the rule, typically used as a reminder or explanation.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ye={command:`edit <rule-id>`,describe:"Updates an IP Access rule defined at the zone level. You can only update the rule action (`mode` parameter) and notes.",builder:Je,handler:async e=>{if(e.dryRun){u({command:`cf firewall zone-access-rules edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"rule-id":String(e[`rule-id`]??``)},bodyKind:`json`,body:e.body===void 0?c({mode:f(e.mode,`mode`,`text`),notes:f(e.notes,`notes`,`text`)}):s(e.body)});return}let t=await o(e),r=await n({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=s(e.body);l(await d(`Updating`,async()=>t.firewall.zoneAccessRules.edit({...n,zone_id:r,rule_id:e[`rule-id`]})),{successLabel:`Updated`});return}let i=c({mode:f(e.mode,`mode`,`text`),notes:f(e.notes,`notes`,`text`)});l(await d(`Updating`,async()=>t.firewall.zoneAccessRules.edit({...i,zone_id:r,rule_id:e[`rule-id`]})),{successLabel:`Updated`})}};function Xe(e){return e.option(`mode`,{type:`string`,description:`The action to apply to a matched request.`,choices:[`block`,`challenge`,`whitelist`,`js_challenge`,`managed_challenge`]}).option(`configuration-target`,{type:`string`,description:`The target to search in existing rules.`,choices:[`ip`,`ip_range`,`asn`,`country`]}).option(`configuration-value`,{type:`string`,description:"The target value to search for in existing rules: an IP address, an IP address range, or a country code, depending on the provided `configuration.target`.\nNotes: You can search for a single IPv4 address, an IP address range with a subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code."}).option(`notes`,{type:`string`,description:`The string to search for in the notes of existing IP Access rules.
11
+ Notes: For example, the string 'attack' would match IP Access rules with notes 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive.`}).option(`match`,{type:`string`,description:"When set to `all`, all the search requirements must match. When set to `any`, only one of the search requirements has to match.",choices:[`any`,`all`]}).option(`page`,{type:`number`,description:`Requested page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results requested.`}).option(`order`,{type:`string`,description:`The field used to sort returned rules.`,choices:[`configuration.target`,`configuration.value`,`mode`]}).option(`direction`,{type:`string`,description:`The direction used to sort returned rules.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`list`,describe:`Fetches IP Access rules of a zone. You can filter the results using several optional parameters.`,builder:m(Xe),handler:async e=>{let t={mode:e.mode,"configuration.target":e[`configuration-target`],"configuration.value":e[`configuration-value`],notes:e.notes,match:e.match,page:e.page,per_page:e[`per-page`],order:e.order,direction:e.direction};if(e.dryRun){u({command:`cf firewall zone-access-rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/firewall/access_rules/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let r=await o(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,l(await d(`Loading`,async()=>r.firewall.zoneAccessRules.list({zone_id:i,...t})),{successLabel:`Loaded`})}},Qe={command:`zone-access-rules`,describe:`Zone-scoped IP access rules for blocking or allowing traffic`,builder:e=>e.command(Ge).command(qe).command(Ye).command(Ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},$e={command:`firewall`,describe:`Legacy firewall rules, zone lockdowns, access rules, user-agent blocking, and WAF packages`,builder:e=>e.command(C).command(P).command(ne).command(pe).command(Ue).command(Qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{$e as default};
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,n as t}from"./auth-ffdf9yR0.mjs";import{n,t as r}from"./body-parser-DKa8Ipg1.mjs";import{t as i}from"./output-BJFNwj7b.mjs";import{n as a,t as o}from"./progress-CrCGTq7N.mjs";import{n as s}from"./input-validation-zEO81MWN.mjs";function c(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`Retrieve Fraud Detection settings for a zone.`,builder:c,handler:async n=>{if(n.dryRun){a({command:`cf fraud get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/fraud_detection/settings`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let r=await t(n),s=await e({zone:n.zone},r,{quiet:n.quiet});n.zoneId=s,i(await o(`Loading`,async()=>r.fraud.get({zone_id:s})),{successLabel:`Loaded`})}};function u(e){return e.option(`authentication-settings-failure-criteria-kind`,{type:`string`,description:"The type of criterion. Currently only `status_code` is supported.",choices:[`status_code`]}).option(`authentication-settings-failure-criteria-status-codes`,{type:`string`,array:!0,description:`HTTP status codes to match against the origin response.
3
+ - Maximum of 10 codes per criterion.
4
+ - Each code must be a valid HTTP status code (100-599).
5
+ - Codes are deduplicated and sorted on save.
6
+ - Omit to leave unchanged on update.
7
+ - Provide an empty array \`[]\` to clear codes on update.
8
+ `}).option(`authentication-settings-success-criteria-kind`,{type:`string`,description:"The type of criterion. Currently only `status_code` is supported.",choices:[`status_code`]}).option(`authentication-settings-success-criteria-status-codes`,{type:`string`,array:!0,description:`HTTP status codes to match against the origin response.
9
+ - Maximum of 10 codes per criterion.
10
+ - Each code must be a valid HTTP status code (100-599).
11
+ - Codes are deduplicated and sorted on save.
12
+ - Omit to leave unchanged on update.
13
+ - Provide an empty array \`[]\` to clear codes on update.
14
+ `}).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.
15
+
16
+ - Maximum of 10 expressions.
17
+ - Omit or set to null to leave unchanged on update.
18
+ - Provide an empty array \`[]\` to clear all expressions on update.
19
+ - Invalid expressions will result in a 10400 Bad Request with details in the \`messages\` array.
20
+ `}).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)`}).check(e=>{if([`authentication-settings-failure-criteria-kind`,`authentication-settings-failure-criteria-status-codes`,`authentication-settings-success-criteria-kind`,`authentication-settings-success-criteria-status-codes`].some(t=>e[t]!==void 0)){let t=[`authentication-settings-failure-criteria-kind`,`authentication-settings-success-criteria-kind`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --authentication_settings-* flag is set`)}return!0})}const d={command:`update`,describe:"Update Fraud Detection settings for a zone. Notes on `username_expressions` behavior: - If omitted or set to null, expressions are not modified. - If provided as an empty array `[]`, all expressions will be cleared.",builder:u,handler:async c=>{if(c.dryRun){a({command:`cf fraud update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/fraud_detection/settings`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?r({authentication_settings:{failure_criteria:{kind:s(c[`authentication-settings-failure-criteria-kind`],`authentication-settings-failure-criteria-kind`,`text`),status_codes:c[`authentication-settings-failure-criteria-status-codes`]},success_criteria:{kind:s(c[`authentication-settings-success-criteria-kind`],`authentication-settings-success-criteria-kind`,`text`),status_codes:c[`authentication-settings-success-criteria-status-codes`]}},user_profiles:s(c[`user-profiles`],`user-profiles`,`text`),username_expressions:c[`username-expressions`]}):n(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=n(c.body);i(await o(`Updating`,async()=>l.fraud.update({body:e,zone_id:u})),{successLabel:`Updated`});return}let d=r({authentication_settings:{failure_criteria:{kind:s(c[`authentication-settings-failure-criteria-kind`],`authentication-settings-failure-criteria-kind`,`text`),status_codes:c[`authentication-settings-failure-criteria-status-codes`]},success_criteria:{kind:s(c[`authentication-settings-success-criteria-kind`],`authentication-settings-success-criteria-kind`,`text`),status_codes:c[`authentication-settings-success-criteria-status-codes`]}},user_profiles:s(c[`user-profiles`],`user-profiles`,`text`),username_expressions:c[`username-expressions`]});i(await o(`Updating`,async()=>l.fraud.update({body:d,zone_id:u})),{successLabel:`Updated`})}},f={command:`fraud`,describe:`Fraud detection for login and signup flows — identify credential stuffing, account takeover, and fake accounts`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,S as t,n}from"./auth-ffdf9yR0.mjs";import{n as r,t as i}from"./body-parser-DKa8Ipg1.mjs";import{t as a}from"./output-BJFNwj7b.mjs";import{n as o,t as s}from"./progress-CrCGTq7N.mjs";import{n as c}from"./input-validation-zEO81MWN.mjs";function l(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Gets the Google Tag Gateway configuration for a zone.`,builder:l,handler:async e=>{if(e.dryRun){o({command:`cf google-tag-gateway config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let r=await n(e),i=await t({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,a(await s(`Loading`,async()=>r.googleTagGateway.config.get({zone_id:i})),{successLabel:`Loaded`})}};function d(e){return e.option(`enabled`,{type:`boolean`,description:`Enables or disables Google Tag Gateway for this zone.`}).option(`endpoint`,{type:`string`,description:`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`}).option(`hide-original-ip`,{type:`boolean`,description:`Hides the original client IP address from Google when enabled.`}).option(`measurement-id`,{type:`string`,description:`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`}).option(`set-up-tag`,{type:`boolean`,description:`Set up the associated Google Tag on the zone automatically when enabled.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Google Tag Gateway configuration for a zone.`})}const f={command:`update`,describe:`Updates the Google Tag Gateway configuration for a zone.`,builder:d,handler:async l=>{if(l.dryRun){o({command:`cf google-tag-gateway config update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/settings/google-tag-gateway/config`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?i({enabled:l.enabled,endpoint:c(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:c(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]}):r(l.body)});return}let u=await n(l),d=await t({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=r(l.body);a(await s(`Updating`,async()=>u.googleTagGateway.config.update({body:e,zone_id:d})),{successLabel:`Updated`});return}if(l.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);if(l.endpoint===void 0&&(l.endpoint=await e(`endpoint`,`Specifies the endpoint path for proxying Google Tag Manager requests. Use an absolute path starting with '/', with no nested paths and alphanumeric characters only (e.g. /metrics).`)),l[`hide-original-ip`]===void 0)throw Error(`--hide-original-ip is required (or pass --body with this field set).`);l[`measurement-id`]===void 0&&(l[`measurement-id`]=await e(`measurement-id`,`Specify the Google Tag Manager container or measurement ID (e.g. GTM-XXXXXXX or G-XXXXXXXXXX).`));let f=i({enabled:l.enabled,endpoint:c(l.endpoint,`endpoint`,`text`),hideOriginalIp:l[`hide-original-ip`],measurementId:c(l[`measurement-id`],`measurement-id`,`text`),setUpTag:l[`set-up-tag`]});a(await s(`Updating`,async()=>u.googleTagGateway.config.update({body:f,zone_id:d})),{successLabel:`Updated`})}},p={command:`config`,describe:`Operations for config`,builder:e=>e.command(u).command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`google-tag-gateway`,describe:`Google Tag Gateway operations`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{D as e,S as t,T as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i,t as a}from"./body-parser-DKa8Ipg1.mjs";import{t as o}from"./output-BJFNwj7b.mjs";import{n as s,t as c}from"./progress-CrCGTq7N.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:`Create a new health check.`,builder:u,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.healthchecks.create({body:e,zone_id:d})),{successLabel:`Created`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.create({body:f,zone_id:d})),{successLabel:`Created`})}};function f(e){return e.positional(`healthcheck-id`,{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})}const p={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:f,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}o(await c(`Deleting`,async()=>i.healthchecks.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`edit <healthcheck-id>`,describe:`Patch a configured health check.`,builder:m,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.healthchecks.edit({body:e,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.edit({body:f,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`})}};function g(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check.`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.healthchecks.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}};function v(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page. Must be a multiple of 5.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List configured health checks.`,builder:v,handler:async e=>{let n={page:e.page,per_page:e[`per-page`]};if(e.dryRun){s({command:`cf healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.healthchecks.list({zone_id:a,...n})),{successLabel:`Loaded`})}};function b(e){return e.option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`,default:1}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`,default:1}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`,default:!1}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`,default:``}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`,default:!1}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`],default:`GET`}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`,default:`/`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`,default:80}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`,default:60}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`,default:2}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`,default:!1}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`],default:`connection_established`}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`,default:80}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`,default:5}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`,default:`HTTP`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create`,describe:`Create a new preview health check.`,builder:b,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks previews create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/preview`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:e,zone_id:d})),{successLabel:`Created`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Creating`,async()=>u.healthchecks.previews.create({body:f,zone_id:d})),{successLabel:`Created`})}};function S(e){return e.positional(`healthcheck-id`,{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})}const C={command:`delete <healthcheck-id>`,describe:`Delete a health check.`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let i=await r(e),a=await t({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=a,!await n({force:!!e.force})){process.stderr.write(`Aborted.
4
+ `);return}o(await c(`Deleting`,async()=>i.healthchecks.previews.delete({zone_id:a,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <healthcheck-id>`,describe:`Fetch a single configured health check preview.`,builder:w,handler:async e=>{if(e.dryRun){s({command:`cf healthchecks previews get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/healthchecks/preview/${e[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(e[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(e[`healthcheck-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await r(e),i=await t({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>n.healthchecks.previews.get({zone_id:i,healthcheck_id:e[`healthcheck-id`]})),{successLabel:`Loaded`})}},E={command:`previews`,describe:`Test a health check configuration before deploying it to production`,builder:e=>e.command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`healthcheck-id`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`address`,{type:`string`,description:`The hostname or IP address of the origin server to run health checks on.`}).option(`check-regions`,{type:`string`,array:!0,description:`A list of regions from which to run health checks. Null means Cloudflare will pick a default region.`}).option(`consecutive-fails`,{type:`number`,description:`The number of consecutive fails required from a health check before changing the health to unhealthy.`}).option(`consecutive-successes`,{type:`number`,description:`The number of consecutive successes required from a health check before changing the health to healthy.`}).option(`description`,{type:`string`,description:`A human-readable description of the health check.`}).option(`http-config-allow-insecure`,{type:`boolean`,description:`Do not validate the certificate when the health check uses HTTPS.`}).option(`http-config-expected-body`,{type:`string`,description:`A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.`}).option(`http-config-expected-codes`,{type:`string`,array:!0,description:`The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.`}).option(`http-config-follow-redirects`,{type:`boolean`,description:`Follow redirects if the origin returns a 3xx status code.`}).option(`http-config-method`,{type:`string`,description:`The HTTP method to use for the health check.`,choices:[`GET`,`HEAD`]}).option(`http-config-path`,{type:`string`,description:`The endpoint path to health check against.`}).option(`http-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.`}).option(`interval`,{type:`number`,description:`The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.`}).option(`name`,{type:`string`,description:`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`}).option(`retries`,{type:`number`,description:`The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.`}).option(`suspended`,{type:`boolean`,description:`If suspended, no health checks are sent to the origin.`}).option(`tcp-config-method`,{type:`string`,description:`The TCP connection method to use for the health check.`,choices:[`connection_established`]}).option(`tcp-config-port`,{type:`number`,description:`Port number to connect to for the health check. Defaults to 80.`}).option(`timeout`,{type:`number`,description:`The timeout (in seconds) before marking the health check as failed.`}).option(`type`,{type:`string`,description:`The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`update <healthcheck-id>`,describe:`Update a configured health check.`,builder:D,handler:async n=>{if(n.dryRun){s({command:`cf healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/healthchecks/${n[`healthcheck-id`]==null?`<healthcheck-id>`:encodeURIComponent(String(n[`healthcheck-id`]))}`,pathParams:{"healthcheck-id":String(n[`healthcheck-id`]??``),"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`json`,body:n.body===void 0?a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)}):i(n.body)});return}let u=await r(n),d=await t({zone:n.zone},u,{quiet:n.quiet});if(n.zoneId=d,n.body){let e=i(n.body);o(await c(`Updating`,async()=>u.healthchecks.update({body:e,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`});return}n.address===void 0&&(n.address=await e(`address`,`The hostname or IP address of the origin server to run health checks on.`)),n.name===void 0&&(n.name=await e(`name`,`A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.`));let f=a({address:l(n.address,`address`,`text`),check_regions:n[`check-regions`],consecutive_fails:n[`consecutive-fails`],consecutive_successes:n[`consecutive-successes`],description:l(n.description,`description`,`text`),http_config:{allow_insecure:n[`http-config-allow-insecure`],expected_body:l(n[`http-config-expected-body`],`http-config-expected-body`,`text`),expected_codes:n[`http-config-expected-codes`],follow_redirects:n[`http-config-follow-redirects`],method:l(n[`http-config-method`],`http-config-method`,`text`),path:l(n[`http-config-path`],`http-config-path`,`text`),port:n[`http-config-port`]},interval:n.interval,name:l(n.name,`name`,`text`),retries:n.retries,suspended:n.suspended,tcp_config:{method:l(n[`tcp-config-method`],`tcp-config-method`,`text`),port:n[`tcp-config-port`]},timeout:n.timeout,type:l(n.type,`type`,`text`)});o(await c(`Updating`,async()=>u.healthchecks.update({body:f,zone_id:d,healthcheck_id:n[`healthcheck-id`]})),{successLabel:`Updated`})}},k={command:`healthchecks`,describe:`Standalone health checks that monitor origin server availability from Cloudflare's edge`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).command(O).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{k as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,T as t,i as n,n as r}from"./auth-ffdf9yR0.mjs";import{n as i}from"./body-parser-DKa8Ipg1.mjs";import{t as a}from"./output-BJFNwj7b.mjs";import{n as o,t as s}from"./progress-CrCGTq7N.mjs";import{t as c}from"./cli-types-CRIDdDw3.mjs";function l(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get <hostname>`,describe:`Get the requested TLS setting for the hostname.`,builder:c(l),handler:async t=>{if(t.dryRun){o({command:`cf hostnames settings tls-single get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}/${t.hostname==null?`<hostname>`:encodeURIComponent(String(t.hostname))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``),hostname:String(t.hostname??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>n.hostnames.settings.tlsSingle.get({zone_id:i,setting_id:t[`setting-id`],hostname:t.hostname})),{successLabel:`Loaded`})}},d={command:`tls-single`,describe:`Operations for settings.tls-single`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function f(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <hostname>`,describe:`Delete the tls setting value for the hostname.`,builder:c(f),handler:async n=>{if(n.dryRun){o({command:`cf hostnames settings tls delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/hostnames/settings/${n[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(n[`setting-id`]))}/${n.hostname==null?`<hostname>`:encodeURIComponent(String(n.hostname))}`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``),"setting-id":String(n[`setting-id`]??``),hostname:String(n.hostname??``)},bodyKind:`none`});return}let i=await r(n),c=await e({zone:n.zone},i,{quiet:n.quiet});if(n.zoneId=c,!await t({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>i.hostnames.settings.tls.delete({zone_id:c,setting_id:n[`setting-id`],hostname:n.hostname})),{successLabel:`Deleted`})}};function m(e){return e.positional(`setting-id`,{type:`string`,description:'The TLS Setting name. The value type depends on the setting: - `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`). - `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`). - `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get <setting-id>`,describe:`List the requested TLS setting for the hostnames under this zone.`,builder:c(m),handler:async t=>{if(t.dryRun){o({command:`cf hostnames settings tls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``)},bodyKind:`none`});return}let n=await r(t),i=await e({zone:t.zone},n,{quiet:t.quiet});t.zoneId=i,a(await s(`Loading`,async()=>n.hostnames.settings.tls.get({zone_id:i,setting_id:t[`setting-id`]})),{successLabel:`Loaded`})}};function g(e){return e.positional(`hostname`,{type:`string`,description:`The hostname for which the tls settings are set.`,demandOption:!0}).option(`setting-id`,{type:`string`,description:'The TLS Setting name.\nThe value type depends on the setting:\n- `ciphers`: value is an array of cipher suite strings (e.g., `["ECDHE-RSA-AES128-GCM-SHA256", "AES128-GCM-SHA256"]`).\n- `min_tls_version`: value is a TLS version string (`"1.0"`, `"1.1"`, `"1.2"`, or `"1.3"`).\n- `http2`: value is `"on"` or `"off"`.',demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`update <hostname>`,describe:`Update the tls setting value for the hostname.`,builder:c(g),handler:async t=>{if(t.dryRun){o({command:`cf hostnames settings tls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/hostnames/settings/${t[`setting-id`]==null?`<setting-id>`:encodeURIComponent(String(t[`setting-id`]))}/${t.hostname==null?`<hostname>`:encodeURIComponent(String(t.hostname))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"setting-id":String(t[`setting-id`]??``),hostname:String(t.hostname??``)},bodyKind:`json`,body:t.body===void 0?void 0:i(t.body)});return}let c=await r(t),l=await e({zone:t.zone},c,{quiet:t.quiet});if(t.zoneId=l,t.body){let e=i(t.body);a(await s(`Updating`,async()=>c.hostnames.settings.tls.update({...e,zone_id:l,setting_id:t[`setting-id`],hostname:t.hostname})),{successLabel:`Updated`});return}a(await s(`Updating`,async()=>n(c,`PUT`,`/zones/${t.zoneId}/hostnames/settings/${encodeURIComponent(String(t[`setting-id`]))}/${encodeURIComponent(String(t.hostname))}`)),{successLabel:`Updated`})}},v={command:`tls`,describe:`Operations for settings.tls`,builder:e=>e.command(p).command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},y={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(v).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},b={command:`hostnames`,describe:`Per-hostname TLS settings — minimum TLS version, ciphers, and certificate pinning overrides`,builder:e=>e.command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};