cf 0.0.6 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/README.md +2 -4
  2. package/bin/cf +11 -0
  3. package/dist/_meta/agent-context.json +89 -89
  4. package/dist/_meta/commands.json +12866 -4982
  5. package/dist/_meta/schemas.json +33572 -1148
  6. package/dist/abuse-reports-KtfZhi6j.mjs +8 -0
  7. package/dist/accounts-BopMfODC.mjs +21 -0
  8. package/dist/acm-BT4vlnEJ.mjs +3 -0
  9. package/dist/addressing-B3uFxHst.mjs +13 -0
  10. package/dist/{agent-context-BBJnI_Q7.mjs → agent-context-D26woB9J.mjs} +1 -1
  11. package/dist/ai-DWHqwMap.mjs +2 -0
  12. package/dist/ai-gateway-CbKEO-3o.mjs +8 -0
  13. package/dist/ai-search-VnOQ5n--.mjs +7 -0
  14. package/dist/alerting-BmmgIlIO.mjs +6 -0
  15. package/dist/analytics-isY03taL.mjs +20 -0
  16. package/dist/api-gateway-DXurEbA-.mjs +33 -0
  17. package/dist/argo-B02BL_hp.mjs +2 -0
  18. package/dist/audit-logs-DcgR9xUc.mjs +2 -0
  19. package/dist/auth-CQcAgnOy.mjs +135 -0
  20. package/dist/auth-DenWm_X0.mjs +6 -0
  21. package/dist/autorag-CmrwnGVj.mjs +2 -0
  22. package/dist/billing-CaW1ZAB1.mjs +2 -0
  23. package/dist/body-parser-Br-BoYk-.mjs +2 -0
  24. package/dist/bot-management-CeBsFx68.mjs +5 -0
  25. package/dist/botnet-feed-B396vQeQ.mjs +3 -0
  26. package/dist/brand-protection-D4V1v5Kl.mjs +3 -0
  27. package/dist/browser-rendering-GF7rNtKI.mjs +4 -0
  28. package/dist/build-5jmmOZhm.mjs +1054 -0
  29. package/dist/{builds-B5sC8Gh_.mjs → builds-C_ySULja.mjs} +1 -1
  30. package/dist/cache-DmXizSMi.mjs +5 -0
  31. package/dist/calls-x4KQpTB4.mjs +4 -0
  32. package/dist/certificate-authorities-hC0SG-Ga.mjs +2 -0
  33. package/dist/chunk-DH-VkVmc.mjs +2 -0
  34. package/dist/client-certificates-BGVsDyeJ.mjs +3 -0
  35. package/dist/cloud-connector-BClQpEzI.mjs +2 -0
  36. package/dist/cloudforce-one-BfhFrO6M.mjs +21 -0
  37. package/dist/{completions-BSRqbcrz.mjs → completions-BKrxcfhN.mjs} +1 -1
  38. package/dist/config-DYzlVxcB.mjs +2 -0
  39. package/dist/connectivity-G0NP6LtW.mjs +3 -0
  40. package/dist/content-scanning-DEtPJ7aF.mjs +4 -0
  41. package/dist/context-CC0Rhkhy.mjs +2 -0
  42. package/dist/custom-certificates-rJXFpUWu.mjs +5 -0
  43. package/dist/custom-hostnames-Be5mgLeF.mjs +5 -0
  44. package/dist/custom-nameservers-CoFdy6hD.mjs +3 -0
  45. package/dist/custom-pages-D-oErw57.mjs +4 -0
  46. package/dist/d1-C95ckPKI.mjs +3 -0
  47. package/dist/dcv-delegation-CWSkbGuc.mjs +2 -0
  48. package/dist/delegate.mjs +2 -0
  49. package/dist/deploy-DbkiIzUr.mjs +2 -0
  50. package/dist/dev-C6iSuQZm.mjs +6 -0
  51. package/dist/diagnostics-DEEhPnXj.mjs +3 -0
  52. package/dist/dispatch-namespaces-BzXeV7PH.mjs +7 -0
  53. package/dist/dist-CnSubA1Z.mjs +82 -0
  54. package/dist/dist-DNBSHor6.mjs +301 -0
  55. package/dist/dns-firewall-BQXD_NxG.mjs +57 -0
  56. package/dist/dns-qW-3TZOT.mjs +29 -0
  57. package/dist/durable-objects-CgWFYEJJ.mjs +2 -0
  58. package/dist/email-routing-tdNJaCpJ.mjs +10 -0
  59. package/dist/email-security-DTVHNr2h.mjs +60 -0
  60. package/dist/email-sending-DsFTvE31.mjs +3 -0
  61. package/dist/filters-DO1Is_tI.mjs +4 -0
  62. package/dist/firewall-DbUhVTCg.mjs +11 -0
  63. package/dist/fraud-Bzr4njYb.mjs +8 -0
  64. package/dist/google-tag-gateway-BQxkA90M.mjs +2 -0
  65. package/dist/healthchecks-BBAs-lS_.mjs +4 -0
  66. package/dist/hostnames-Dz9PEUKS.mjs +3 -0
  67. package/dist/hyperdrive-B1iUJddG.mjs +18 -0
  68. package/dist/iam-CJM8gHpG.mjs +6 -0
  69. package/dist/images-DEoBmtFS.mjs +5 -0
  70. package/dist/index.mjs +1 -1
  71. package/dist/input-validation-zEO81MWN.mjs +2 -0
  72. package/dist/intel-BM6xkZ0C.mjs +3 -0
  73. package/dist/ips-B8fwxKZD.mjs +2 -0
  74. package/dist/keyless-certificates-DffYnd4b.mjs +3 -0
  75. package/dist/kv-BTceLtWZ.mjs +5 -0
  76. package/dist/leaked-credential-checks-CALfvoCo.mjs +3 -0
  77. package/dist/lib-Eu1wXxuh.mjs +68 -0
  78. package/dist/load-balancers-C1Ho1gCF.mjs +6 -0
  79. package/dist/local-VJaJ3BZ1.mjs +2 -0
  80. package/dist/logpush-CSYhgevA.mjs +4 -0
  81. package/dist/logs-DlIwmMpt.mjs +3 -0
  82. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +5 -0
  83. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +4 -0
  84. package/dist/magic-transit-qQmA-981.mjs +89 -0
  85. package/dist/managed-transforms-Dd6AnbWE.mjs +3 -0
  86. package/dist/mtls-certificates-C0rlCRGs.mjs +3 -0
  87. package/dist/network-interconnects-CxG2deY0.mjs +36 -0
  88. package/dist/organizations-DyEAiGiR.mjs +41 -0
  89. package/dist/origin-ca-certificates-S8RcoMF6.mjs +3 -0
  90. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +2 -0
  91. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +5 -0
  92. package/dist/{output-CqGQp2r6.mjs → output-D7_yAFVR.mjs} +1 -1
  93. package/dist/page-rules-DP-w6TAm.mjs +18 -0
  94. package/dist/page-shield-Bf7kFp8c.mjs +37 -0
  95. package/dist/pages-D0Y_XRqW.mjs +10 -0
  96. package/dist/pipelines-C-SPESAk.mjs +6 -0
  97. package/dist/progress-CjcQ6ato.mjs +2 -0
  98. package/dist/queues-wv6CZsi8.mjs +6 -0
  99. package/dist/r2-DuXjp9n5.mjs +21 -0
  100. package/dist/r2-data-catalog-DQCMrmNO.mjs +14 -0
  101. package/dist/radar-BW_ZHP8X.mjs +2 -0
  102. package/dist/rate-limits-DLTkIvwr.mjs +5 -0
  103. package/dist/raw-fetch-hRv-6P3D.mjs +2 -0
  104. package/dist/realtime-kit-Ch7Vg3vj.mjs +6 -0
  105. package/dist/registrar-DIIv6fWd.mjs +46 -0
  106. package/dist/request-tracers-DMej0Drs.mjs +2 -0
  107. package/dist/resolve-BuJRWSk0.mjs +2 -0
  108. package/dist/resource-sharing-CYJ7cMWq.mjs +5 -0
  109. package/dist/resource-tagging-Dnz65MgH.mjs +16 -0
  110. package/dist/rules-DLJpOYbC.mjs +4 -0
  111. package/dist/rulesets-D9nqEJT5.mjs +8 -0
  112. package/dist/rum-DBVmdPkp.mjs +4 -0
  113. package/dist/{schema-qJlCfmo8.mjs → schema-CHBfkARI.mjs} +1 -1
  114. package/dist/schema-validation-MCd3xdtX.mjs +4 -0
  115. package/dist/scim-DZA3VXog.mjs +3 -0
  116. package/dist/{scm-C872x0C2.mjs → scm-CilfPOue.mjs} +1 -1
  117. package/dist/secrets-store-BrvcZSOM.mjs +21 -0
  118. package/dist/security-center-BU6f3Cm1.mjs +2 -0
  119. package/dist/security-txt-BPIbP3dG.mjs +3 -0
  120. package/dist/session-H7IV2BrM.mjs +2 -0
  121. package/dist/shared-DEzmTsEC.mjs +2 -0
  122. package/dist/smart-shield-e8XFBkiF.mjs +3 -0
  123. package/dist/snippets-B4M3MMb8.mjs +4 -0
  124. package/dist/spawn-13QQ0IwO.mjs +10 -0
  125. package/dist/spectrum-B0adfSRI.mjs +59 -0
  126. package/dist/speed-BVcUtkAz.mjs +4 -0
  127. package/dist/src-B9cKsgsg.mjs +108 -0
  128. package/dist/ssl-BAa91gsc.mjs +15 -0
  129. package/dist/stream-D53sxKb3.mjs +14 -0
  130. package/dist/tenants-bH5pt3dJ.mjs +2 -0
  131. package/dist/{theme-BKCxTQTe.mjs → theme-BklJDrb2.mjs} +2 -2
  132. package/dist/token-validation-M61Vx_Tw.mjs +4 -0
  133. package/dist/{tools-CawscCBu.mjs → tools-B7QiNu-d.mjs} +1 -1
  134. package/dist/turnstile-wAU0Gc2Z.mjs +23 -0
  135. package/dist/{ui-Dj3No2vN.mjs → ui-BXjU1dX1.mjs} +1 -1
  136. package/dist/url-normalization-DZrWDgB5.mjs +3 -0
  137. package/dist/url-scanner-Zo49edNp.mjs +2 -0
  138. package/dist/user-DbXlVReB.mjs +10 -0
  139. package/dist/vectorize-CUnTM0DT.mjs +4 -0
  140. package/dist/versions-DzyrlUAi.mjs +2 -0
  141. package/dist/{vuln-scanner-B1VwCIko.mjs → vuln-scanner-Br_2lQp1.mjs} +1 -1
  142. package/dist/waiting-rooms-BZW0X69-.mjs +11 -0
  143. package/dist/web3-DueyOQtx.mjs +4 -0
  144. package/dist/workers-builds-BM_aoeUR.mjs +7 -0
  145. package/dist/workers-nV_vBCfV.mjs +16 -0
  146. package/dist/workflows-CQITmo-s.mjs +4 -0
  147. package/dist/zaraz-DIbpF5Op.mjs +2 -0
  148. package/dist/zero-trust-CKp8j512.mjs +119 -0
  149. package/dist/zones-BZ5tZDbH.mjs +28 -0
  150. package/package.json +13 -3
  151. package/dist/abuse-reports-DR0yMg-Q.mjs +0 -2
  152. package/dist/accounts-BjGtCB8T.mjs +0 -6
  153. package/dist/acm-h4YPDN7k.mjs +0 -3
  154. package/dist/addressing-BiEnQ1o1.mjs +0 -11
  155. package/dist/ai-BPln2Yka.mjs +0 -2
  156. package/dist/ai-gateway-DgD9nKyd.mjs +0 -8
  157. package/dist/ai-search-EjrONI5a.mjs +0 -7
  158. package/dist/alerting-CPWMKr-m.mjs +0 -6
  159. package/dist/analytics-3dX9-scQ.mjs +0 -2
  160. package/dist/api-gateway-7FKFHdI-.mjs +0 -9
  161. package/dist/argo-Dxz9P37E.mjs +0 -2
  162. package/dist/audit-logs-D_Xw5x8Y.mjs +0 -2
  163. package/dist/auth-BHD_B2p9.mjs +0 -277
  164. package/dist/auth-caVo2j1K.mjs +0 -6
  165. package/dist/autorag-D7nMweNF.mjs +0 -2
  166. package/dist/billing-yaIBp1Xq.mjs +0 -2
  167. package/dist/body-parser-iA3vRFmh.mjs +0 -2
  168. package/dist/bot-management-C0H6U0t4.mjs +0 -2
  169. package/dist/botnet-feed-BXV9GVwF.mjs +0 -3
  170. package/dist/brand-protection-CI0NQa_l.mjs +0 -3
  171. package/dist/browser-rendering-DnKNRJJe.mjs +0 -4
  172. package/dist/cache-B6M_pm_D.mjs +0 -5
  173. package/dist/calls-C5XCC0i1.mjs +0 -4
  174. package/dist/certificate-authorities-BQuHL4dm.mjs +0 -2
  175. package/dist/client-certificates-CwpzEnCT.mjs +0 -3
  176. package/dist/cloud-connector-CU3PLNLe.mjs +0 -2
  177. package/dist/cloudforce-one-DzrArr1o.mjs +0 -21
  178. package/dist/config-BmTd_qeU.mjs +0 -2
  179. package/dist/connectivity-C4tXPkW_.mjs +0 -3
  180. package/dist/content-scanning-CH_YXdlZ.mjs +0 -4
  181. package/dist/context-6lBIck1r.mjs +0 -2
  182. package/dist/custom-certificates-pllRyU2y.mjs +0 -3
  183. package/dist/custom-hostnames-GmF0DfYA.mjs +0 -5
  184. package/dist/custom-nameservers-DPVHUlUQ.mjs +0 -3
  185. package/dist/custom-pages-XWwfn7hV.mjs +0 -4
  186. package/dist/d1-c_zhZGWf.mjs +0 -3
  187. package/dist/dcv-delegation-pXpU48A8.mjs +0 -2
  188. package/dist/dev-Bu26u5Jm.mjs +0 -14
  189. package/dist/diagnostics-BU07Jnku.mjs +0 -3
  190. package/dist/dispatch-namespaces-D_Kq_2gX.mjs +0 -7
  191. package/dist/dns-CrvIxztB.mjs +0 -11
  192. package/dist/dns-firewall-CLtGAQ9x.mjs +0 -3
  193. package/dist/dry-run-FV0pZwdg.mjs +0 -2
  194. package/dist/durable-objects-Y5rLFSQX.mjs +0 -2
  195. package/dist/email-routing-CxU5JlXT.mjs +0 -10
  196. package/dist/email-security-CnpAHWpj.mjs +0 -8
  197. package/dist/email-sending-MeCKsktR.mjs +0 -3
  198. package/dist/filters-Sx2Po1UP.mjs +0 -4
  199. package/dist/firewall-B0_012XO.mjs +0 -9
  200. package/dist/fraud-CG0G_VG-.mjs +0 -2
  201. package/dist/google-tag-gateway-BLbj1y3h.mjs +0 -2
  202. package/dist/healthchecks-C0LgExxa.mjs +0 -4
  203. package/dist/hostnames-D4K6s9EX.mjs +0 -3
  204. package/dist/hyperdrive-D7XvTRys.mjs +0 -3
  205. package/dist/iam-4LhJianW.mjs +0 -6
  206. package/dist/images-BqXyIycX.mjs +0 -5
  207. package/dist/input-validation-BpVQi9rR.mjs +0 -2
  208. package/dist/intel-CiO3Sy4x.mjs +0 -3
  209. package/dist/ips-DLuGN7Mr.mjs +0 -2
  210. package/dist/keyless-certificates-x-87T5SM.mjs +0 -3
  211. package/dist/kv-CVYCrk7L.mjs +0 -5
  212. package/dist/leaked-credential-checks-FvhVCL23.mjs +0 -3
  213. package/dist/load-balancers-cxodJuI2.mjs +0 -6
  214. package/dist/local-OqhVQbv0.mjs +0 -2
  215. package/dist/logpush-BX7z2xWz.mjs +0 -4
  216. package/dist/logs-C7vxr6Kp.mjs +0 -3
  217. package/dist/magic-cloud-networking-C3grROf-.mjs +0 -5
  218. package/dist/magic-network-monitoring-DiZ5ZXxh.mjs +0 -4
  219. package/dist/magic-transit-troGMFb9.mjs +0 -30
  220. package/dist/managed-transforms-B5w_LlVN.mjs +0 -3
  221. package/dist/mtls-certificates-C1S9MciH.mjs +0 -3
  222. package/dist/network-interconnects-CVSiv1fF.mjs +0 -4
  223. package/dist/organizations-BtlEchi-.mjs +0 -4
  224. package/dist/origin-ca-certificates-0XCi4dO6.mjs +0 -3
  225. package/dist/origin-post-quantum-encryption-CTvkdYDG.mjs +0 -2
  226. package/dist/origin-tls-client-auth-qAvRD1BQ.mjs +0 -5
  227. package/dist/page-rules-CcMmrvY4.mjs +0 -3
  228. package/dist/page-shield-Dxh4bJ-w.mjs +0 -3
  229. package/dist/pages-F1vdzqgC.mjs +0 -6
  230. package/dist/pipelines-DsF1HHMY.mjs +0 -6
  231. package/dist/progress-5sHFvwez.mjs +0 -2
  232. package/dist/queues-BuvkxFPX.mjs +0 -6
  233. package/dist/r2-Du-fgHiT.mjs +0 -9
  234. package/dist/r2-data-catalog-BUiMNSwc.mjs +0 -3
  235. package/dist/radar-C0eqNmWR.mjs +0 -2
  236. package/dist/rate-limits-CUv2cxXV.mjs +0 -3
  237. package/dist/raw-fetch-CxFs4i0R.mjs +0 -2
  238. package/dist/realtime-kit-C-jix3I_.mjs +0 -6
  239. package/dist/registrar-B7V7i89n.mjs +0 -2
  240. package/dist/request-tracers-D2V7QUrC.mjs +0 -2
  241. package/dist/resolve-GtphSYWh.mjs +0 -2
  242. package/dist/resource-sharing-BgH0w9wm.mjs +0 -5
  243. package/dist/resource-tagging-BOknFugv.mjs +0 -4
  244. package/dist/rolldown-runtime-CR7SCCRW.mjs +0 -2
  245. package/dist/rules-DzJFHGW1.mjs +0 -4
  246. package/dist/rulesets-BzI1dUiq.mjs +0 -8
  247. package/dist/rum-CQ_rJ96u.mjs +0 -4
  248. package/dist/schema-validation-TmikfxS9.mjs +0 -4
  249. package/dist/scim-ByZ5kqXS.mjs +0 -3
  250. package/dist/secrets-store-D7HL4VXw.mjs +0 -8
  251. package/dist/security-center-OUrILUnx.mjs +0 -2
  252. package/dist/security-txt-Ca13oCJ8.mjs +0 -3
  253. package/dist/session-Dxi_LbAk.mjs +0 -2
  254. package/dist/smart-shield-foPT0J9L.mjs +0 -3
  255. package/dist/snippets-FDPiBMWc.mjs +0 -4
  256. package/dist/spectrum-DPoh_BPx.mjs +0 -3
  257. package/dist/speed-BuEappVX.mjs +0 -4
  258. package/dist/src-D8_cWUwt.mjs +0 -104
  259. package/dist/ssl-bJbzEoRv.mjs +0 -3
  260. package/dist/stream-DuYGiGk6.mjs +0 -13
  261. package/dist/tenants-BYqEutrr.mjs +0 -2
  262. package/dist/token-validation-DwmtbWUB.mjs +0 -4
  263. package/dist/turnstile-Dy91RVTn.mjs +0 -3
  264. package/dist/url-normalization-DoD9iHWH.mjs +0 -3
  265. package/dist/url-scanner-qwL64FIo.mjs +0 -2
  266. package/dist/user-Cduf3VRi.mjs +0 -7
  267. package/dist/vectorize-CMLobU9V.mjs +0 -4
  268. package/dist/waiting-rooms-B4-IAJeT.mjs +0 -5
  269. package/dist/web3-Bcx68Kq3.mjs +0 -4
  270. package/dist/workers-D5fOQsUA.mjs +0 -16
  271. package/dist/workers-builds-2kdzxjlN.mjs +0 -7
  272. package/dist/workflows-qFD80noW.mjs +0 -4
  273. package/dist/zaraz-C0iJimA4.mjs +0 -2
  274. package/dist/zero-trust-Btix6zOy.mjs +0 -73
  275. package/dist/zones-Nu3wMtds.mjs +0 -5
  276. /package/dist/{metadata-DhSO1vle.mjs → metadata-DGdCpUxn.mjs} +0 -0
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import{d as e,h as t,m as n,o as r,p as i,t as a}from"./auth-BHD_B2p9.mjs";import{n as o,r as s}from"./input-validation-BpVQi9rR.mjs";import{n as c,t as l}from"./body-parser-iA3vRFmh.mjs";import{t as u}from"./output-CqGQp2r6.mjs";import{t as d}from"./dry-run-FV0pZwdg.mjs";import{t as f}from"./local-OqhVQbv0.mjs";import{t as p}from"./progress-5sHFvwez.mjs";const m={command:`list`,describe:`Gets a list of all alert types for which an account is eligible.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading available alerts`,async()=>t.alerting.availableAlerts.list(n)),{successLabel:`Loaded available alerts`})}},h={command:`available-alerts`,describe:`List the alert types available for your account based on enabled products`,builder:e=>e.command(m).demandCommand(1),handler:()=>{}},g={command:`get`,describe:`Get a list of all delivery mechanism types for which an account is eligible.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading eligible`,async()=>t.alerting.destinations.eligible.get(n)),{successLabel:`Loaded eligible`})}},_={command:`eligible`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(g).demandCommand(1),handler:()=>{}},v={command:`create`,describe:`Creates a new token for integrating with PagerDuty.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf alerting destinations pagerduty create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/alerting/v3/destinations/pagerduty/connect`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);t.accountId=i,u(await p(`Creating pagerduty`,async()=>n.alerting.destinations.pagerduty.create(i)),{successLabel:`Created pagerduty`})}},y={command:`delete`,describe:`Deletes all the PagerDuty Services connected to the account.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(t.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf alerting destinations pagerduty delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`pagerduty`,``,{force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}u(await p(`Deleting pagerduty`,async()=>n.alerting.destinations.pagerduty.delete(o)),{successLabel:`Deleted pagerduty`})}},b={command:`get`,describe:`Get a list of all configured PagerDuty services.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading pagerduty`,async()=>t.alerting.destinations.pagerduty.get(n)),{successLabel:`Loaded pagerduty`})}},x={command:`link <tokenId>`,describe:`Links PagerDuty with the account using the integration token.`,builder:e=>e.positional(`tokenId`,{type:`string`,description:`The token integration key`,demandOption:!0}),handler:async e=>{s(e.tokenId,`tokenId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading pagerduty`,async()=>t.alerting.destinations.pagerduty.link(n,e.tokenId)),{successLabel:`Loaded pagerduty`})}},S={command:`pagerduty`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(v).command(y).command(b).command(x).demandCommand(1),handler:()=>{}},C={command:`create`,describe:`Creates a new webhook destination.`,builder:e=>e.option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf alerting destinations webhooks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`json`,body:{name:n.name,secret:n.secret,url:n.url,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Creating webhook`,async()=>i.post(`/accounts/${m}/alerting/v3/destinations/webhooks`,{body:e})),{successLabel:`Created webhook`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),n.url===void 0&&(n.url=await t(`url`,`The POST endpoint to call when dispatching a notification.`));let h={};n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.secret!==void 0&&c(h,[`secret`],o(n.secret,`secret`,`text`)),n.url!==void 0&&c(h,[`url`],o(n.url,`url`,`text`)),u(await p(`Creating webhook`,async()=>i.post(`/accounts/${m}/alerting/v3/destinations/webhooks`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created webhook`})}},w={command:`delete <webhookId>`,describe:`Delete a configured webhook destination.`,builder:e=>e.positional(`webhookId`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.webhookId,`webhookId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf alerting destinations webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/alerting/v3/destinations/webhooks/${t.webhookId??`<webhookId>`}`,pathParams:{webhookId:String(t.webhookId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`webhook`,String(t.webhookId??``),{force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}u(await p(`Deleting webhook`,async()=>n.alerting.destinations.webhooks.delete(t.webhookId,o)),{successLabel:`Deleted webhook`})}},T={command:`get <webhookId>`,describe:`Get details for a single webhooks destination.`,builder:e=>e.positional(`webhookId`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}),handler:async e=>{s(e.webhookId,`webhookId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading webhook`,async()=>t.alerting.destinations.webhooks.get(n,e.webhookId)),{successLabel:`Loaded webhook`})}},E={command:`list`,describe:`Gets a list of all configured webhook destinations.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading webhooks`,async()=>t.alerting.destinations.webhooks.list(n)),{successLabel:`Loaded webhooks`})}},D={command:`update <webhookId>`,describe:`Update a webhook destination.`,builder:e=>e.positional(`webhookId`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(s(n.webhookId,`webhookId`),n.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf alerting destinations webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/alerting/v3/destinations/webhooks/${n.webhookId??`<webhookId>`}`,pathParams:{webhookId:String(n.webhookId??``)},bodyKind:`json`,body:{name:n.name,secret:n.secret,url:n.url,body:n.body},validation:`passed`});return}let i=await a(n),m=n.local?f:await r(i);if(n.accountId=m,n.body){let e=l(n.body);u(await p(`Updating webhook`,async()=>i.put(`/accounts/${m}/alerting/v3/destinations/webhooks/${n.webhookId}`,{body:e})),{successLabel:`Updated webhook`});return}n.name===void 0&&(n.name=await t(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),n.url===void 0&&(n.url=await t(`url`,`The POST endpoint to call when dispatching a notification.`));let h={};n.name!==void 0&&c(h,[`name`],o(n.name,`name`,`text`)),n.secret!==void 0&&c(h,[`secret`],o(n.secret,`secret`,`text`)),n.url!==void 0&&c(h,[`url`],o(n.url,`url`,`text`)),u(await p(`Updating webhook`,async()=>i.put(`/accounts/${m}/alerting/v3/destinations/webhooks/${n.webhookId}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated webhook`})}},O={command:`webhooks`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(C).command(w).command(T).command(E).command(D).demandCommand(1),handler:()=>{}},k={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(_).command(S).command(O).demandCommand(1),handler:()=>{}},A={command:`list`,describe:"Gets a list of history records for notifications sent to an account. The records are displayed for last `x` number of days based on the zone plan (free = 30, pro = 30, biz = 30, ent = 90).",builder:e=>e.option(`per-page`,{type:`string`,description:`Number of items per page.`}).option(`before`,{type:`string`,description:`Limit the returned results to history records older than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`since`,{type:`string`,description:`Limit the returned results to history records newer than the specified date. This must be a timestamp that conforms to RFC3339.`}),handler:async e=>{let t={};e.perPage!==void 0&&(t.per_page=e.perPage),e.before!==void 0&&(t.before=e.before),e.page!==void 0&&(t.page=e.page),e.since!==void 0&&(t.since=e.since);let n=await a(e),i=e.local?f:await r(n);e.accountId=i,u(await p(`Loading history`,async()=>n.alerting.history.list(i,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded history`})}},j={command:`history`,describe:`Browse previously sent alert notifications and their delivery status`,builder:e=>e.command(A).demandCommand(1),handler:()=>{}},M={command:`create`,describe:`Creates a new Notification policy.`,builder:e=>e.option(`alert-interval`,{type:`string`,description:`Optional specification of how often to re-alert from the same incident, not support on all alert types.`}).option(`alert-type`,{type:`string`,description:`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,choices:`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`)}).option(`description`,{type:`string`,description:`Optional description for the Notification policy.`}).option(`enabled`,{type:`boolean`,description:`Whether or not the Notification policy is enabled.`,default:!0}).option(`filters-actions`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-affected-asns`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-affected-components`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-affected-locations`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-airport-code`,{type:`string`,array:!0,description:`Used for configuring maintenance_event_notification`}).option(`filters-alert-trigger-preferences`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-alert-trigger-preferences-value`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-enabled`,{type:`string`,array:!0,description:`Used for configuring load_balancing_pool_enablement_alert`}).option(`filters-environment`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event-source`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-event-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-group-by`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-health-check-id`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-incident-impact`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-input-id`,{type:`string`,array:!0,description:`Used for configuring stream_live_notifications`}).option(`filters-insight-class`,{type:`string`,array:!0,description:`Used for configuring security_insights_alert`}).option(`filters-limit`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-logo-tag`,{type:`string`,array:!0,description:`Used for configuring logo_match_alert`}).option(`filters-megabits-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-new-health`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-new-status`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-packets-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-pool-id`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-pop-names`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-product`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-project-id`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-protocol`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-query-tag`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-requests-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-selectors`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-services`,{type:`string`,array:!0,description:`Used for configuring clickhouse_alert_fw_ent_anomaly`}).option(`filters-slo`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-status`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-target-hostname`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-target-ip`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-target-zone-name`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-traffic-exclusions`,{type:`string`,array:!0,description:`Used for configuring traffic_anomalies_alert`}).option(`filters-tunnel-id`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-tunnel-name`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-where`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-zones`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`name`,{type:`string`,description:`Name of the policy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async i=>{if(i.dryRun){let t=e();t&&s(t,`accountId`),d({command:`cf alerting policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`json`,body:{alertInterval:i.alertInterval,alertType:i.alertType,description:i.description,enabled:i.enabled,filtersActions:i.filtersActions,filtersAffectedAsns:i.filtersAffectedAsns,filtersAffectedComponents:i.filtersAffectedComponents,filtersAffectedLocations:i.filtersAffectedLocations,filtersAirportCode:i.filtersAirportCode,filtersAlertTriggerPreferences:i.filtersAlertTriggerPreferences,filtersAlertTriggerPreferencesValue:i.filtersAlertTriggerPreferencesValue,filtersEnabled:i.filtersEnabled,filtersEnvironment:i.filtersEnvironment,filtersEvent:i.filtersEvent,filtersEventSource:i.filtersEventSource,filtersEventType:i.filtersEventType,filtersGroupBy:i.filtersGroupBy,filtersHealthCheckId:i.filtersHealthCheckId,filtersIncidentImpact:i.filtersIncidentImpact,filtersInputId:i.filtersInputId,filtersInsightClass:i.filtersInsightClass,filtersLimit:i.filtersLimit,filtersLogoTag:i.filtersLogoTag,filtersMegabitsPerSecond:i.filtersMegabitsPerSecond,filtersNewHealth:i.filtersNewHealth,filtersNewStatus:i.filtersNewStatus,filtersPacketsPerSecond:i.filtersPacketsPerSecond,filtersPoolId:i.filtersPoolId,filtersPopNames:i.filtersPopNames,filtersProduct:i.filtersProduct,filtersProjectId:i.filtersProjectId,filtersProtocol:i.filtersProtocol,filtersQueryTag:i.filtersQueryTag,filtersRequestsPerSecond:i.filtersRequestsPerSecond,filtersSelectors:i.filtersSelectors,filtersServices:i.filtersServices,filtersSlo:i.filtersSlo,filtersStatus:i.filtersStatus,filtersTargetHostname:i.filtersTargetHostname,filtersTargetIp:i.filtersTargetIp,filtersTargetZoneName:i.filtersTargetZoneName,filtersTrafficExclusions:i.filtersTrafficExclusions,filtersTunnelId:i.filtersTunnelId,filtersTunnelName:i.filtersTunnelName,filtersType:i.filtersType,filtersWhere:i.filtersWhere,filtersZones:i.filtersZones,name:i.name,body:i.body},validation:`passed`});return}let m=await a(i),h=i.local?f:await r(m);if(i.accountId=h,i.body){let e=l(i.body);u(await p(`Creating policy`,async()=>m.post(`/accounts/${h}/alerting/v3/policies`,{body:e})),{successLabel:`Created policy`});return}if(i.alertType===void 0&&(i.alertType=await n(`alert-type`,`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`))),i.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);i.name===void 0&&(i.name=await t(`name`,`Name of the policy.`));let g={};i.alertInterval!==void 0&&c(g,[`alert_interval`],o(i.alertInterval,`alertInterval`,`text`)),i.alertType!==void 0&&c(g,[`alert_type`],o(i.alertType,`alertType`,`text`)),i.description!==void 0&&c(g,[`description`],o(i.description,`description`,`text`)),i.enabled!==void 0&&c(g,[`enabled`],i.enabled),i.filtersActions!==void 0&&c(g,[`filters`,`actions`],i.filtersActions),i.filtersAffectedAsns!==void 0&&c(g,[`filters`,`affected_asns`],i.filtersAffectedAsns),i.filtersAffectedComponents!==void 0&&c(g,[`filters`,`affected_components`],i.filtersAffectedComponents),i.filtersAffectedLocations!==void 0&&c(g,[`filters`,`affected_locations`],i.filtersAffectedLocations),i.filtersAirportCode!==void 0&&c(g,[`filters`,`airport_code`],i.filtersAirportCode),i.filtersAlertTriggerPreferences!==void 0&&c(g,[`filters`,`alert_trigger_preferences`],i.filtersAlertTriggerPreferences),i.filtersAlertTriggerPreferencesValue!==void 0&&c(g,[`filters`,`alert_trigger_preferences_value`],i.filtersAlertTriggerPreferencesValue),i.filtersEnabled!==void 0&&c(g,[`filters`,`enabled`],i.filtersEnabled),i.filtersEnvironment!==void 0&&c(g,[`filters`,`environment`],i.filtersEnvironment),i.filtersEvent!==void 0&&c(g,[`filters`,`event`],i.filtersEvent),i.filtersEventSource!==void 0&&c(g,[`filters`,`event_source`],i.filtersEventSource),i.filtersEventType!==void 0&&c(g,[`filters`,`event_type`],i.filtersEventType),i.filtersGroupBy!==void 0&&c(g,[`filters`,`group_by`],i.filtersGroupBy),i.filtersHealthCheckId!==void 0&&c(g,[`filters`,`health_check_id`],i.filtersHealthCheckId),i.filtersIncidentImpact!==void 0&&c(g,[`filters`,`incident_impact`],i.filtersIncidentImpact),i.filtersInputId!==void 0&&c(g,[`filters`,`input_id`],i.filtersInputId),i.filtersInsightClass!==void 0&&c(g,[`filters`,`insight_class`],i.filtersInsightClass),i.filtersLimit!==void 0&&c(g,[`filters`,`limit`],i.filtersLimit),i.filtersLogoTag!==void 0&&c(g,[`filters`,`logo_tag`],i.filtersLogoTag),i.filtersMegabitsPerSecond!==void 0&&c(g,[`filters`,`megabits_per_second`],i.filtersMegabitsPerSecond),i.filtersNewHealth!==void 0&&c(g,[`filters`,`new_health`],i.filtersNewHealth),i.filtersNewStatus!==void 0&&c(g,[`filters`,`new_status`],i.filtersNewStatus),i.filtersPacketsPerSecond!==void 0&&c(g,[`filters`,`packets_per_second`],i.filtersPacketsPerSecond),i.filtersPoolId!==void 0&&c(g,[`filters`,`pool_id`],i.filtersPoolId),i.filtersPopNames!==void 0&&c(g,[`filters`,`pop_names`],i.filtersPopNames),i.filtersProduct!==void 0&&c(g,[`filters`,`product`],i.filtersProduct),i.filtersProjectId!==void 0&&c(g,[`filters`,`project_id`],i.filtersProjectId),i.filtersProtocol!==void 0&&c(g,[`filters`,`protocol`],i.filtersProtocol),i.filtersQueryTag!==void 0&&c(g,[`filters`,`query_tag`],i.filtersQueryTag),i.filtersRequestsPerSecond!==void 0&&c(g,[`filters`,`requests_per_second`],i.filtersRequestsPerSecond),i.filtersSelectors!==void 0&&c(g,[`filters`,`selectors`],i.filtersSelectors),i.filtersServices!==void 0&&c(g,[`filters`,`services`],i.filtersServices),i.filtersSlo!==void 0&&c(g,[`filters`,`slo`],i.filtersSlo),i.filtersStatus!==void 0&&c(g,[`filters`,`status`],i.filtersStatus),i.filtersTargetHostname!==void 0&&c(g,[`filters`,`target_hostname`],i.filtersTargetHostname),i.filtersTargetIp!==void 0&&c(g,[`filters`,`target_ip`],i.filtersTargetIp),i.filtersTargetZoneName!==void 0&&c(g,[`filters`,`target_zone_name`],i.filtersTargetZoneName),i.filtersTrafficExclusions!==void 0&&c(g,[`filters`,`traffic_exclusions`],i.filtersTrafficExclusions),i.filtersTunnelId!==void 0&&c(g,[`filters`,`tunnel_id`],i.filtersTunnelId),i.filtersTunnelName!==void 0&&c(g,[`filters`,`tunnel_name`],i.filtersTunnelName),i.filtersType!==void 0&&c(g,[`filters`,`type`],i.filtersType),i.filtersWhere!==void 0&&c(g,[`filters`,`where`],i.filtersWhere),i.filtersZones!==void 0&&c(g,[`filters`,`zones`],i.filtersZones),i.name!==void 0&&c(g,[`name`],o(i.name,`name`,`text`)),u(await p(`Creating policy`,async()=>m.post(`/accounts/${h}/alerting/v3/policies`,{body:Object.keys(g).length>0?g:void 0})),{successLabel:`Created policy`})}},N={command:`delete <policyId>`,describe:`Delete a Notification policy.`,builder:e=>e.positional(`policyId`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.policyId,`policyId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf alerting policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/alerting/v3/policies/${t.policyId??`<policyId>`}`,pathParams:{policyId:String(t.policyId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`policy`,String(t.policyId??``),{force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}u(await p(`Deleting policy`,async()=>n.alerting.policies.delete(o,t.policyId)),{successLabel:`Deleted policy`})}},P={command:`get <policyId>`,describe:`Get details for a single policy.`,builder:e=>e.positional(`policyId`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}),handler:async e=>{s(e.policyId,`policyId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading policy`,async()=>t.alerting.policies.get(n,e.policyId)),{successLabel:`Loaded policy`})}},F={command:`list`,describe:`Get a list of all Notification policies.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading policies`,async()=>t.alerting.policies.list(n)),{successLabel:`Loaded policies`})}},I={command:`update <policyId>`,describe:`Update a Notification policy.`,builder:e=>e.positional(`policyId`,{type:`string`,description:`The unique identifier of a notification policy`,demandOption:!0}).option(`alert-interval`,{type:`string`,description:`Optional specification of how often to re-alert from the same incident, not support on all alert types.`}).option(`alert-type`,{type:`string`,description:`Refers to which event will trigger a Notification dispatch. You can use the endpoint to get available alert types which then will give you a list of possible values.`,choices:`abuse_report_alert.access_custom_certificate_expiration_type.advanced_ddos_attack_l4_alert.advanced_ddos_attack_l7_alert.advanced_http_alert_error.bgp_hijack_notification.billing_usage_alert.block_notification_block_removed.block_notification_new_block.block_notification_review_rejected.bot_traffic_basic_alert.brand_protection_alert.brand_protection_digest.clickhouse_alert_fw_anomaly.clickhouse_alert_fw_ent_anomaly.cloudforce_one_request_notification.cni_maintenance_notification.custom_analytics.custom_bot_detection_alert.custom_ssl_certificate_event_type.dedicated_ssl_certificate_event_type.device_connectivity_anomaly_alert.dos_attack_l4.dos_attack_l7.expiring_service_token_alert.failing_logpush_job_disabled_alert.fbm_auto_advertisement.fbm_dosd_attack.fbm_volumetric_attack.health_check_status_notification.hostname_aop_custom_certificate_expiration_type.http_alert_edge_error.http_alert_origin_error.image_notification.image_resizing_notification.incident_alert.load_balancing_health_alert.load_balancing_pool_enablement_alert.logo_match_alert.magic_tunnel_health_check_event.magic_wan_tunnel_health.maintenance_event_notification.mtls_certificate_store_certificate_expiration_type.pages_event_alert.radar_notification.real_origin_monitoring.scriptmonitor_alert_new_code_change_detections.scriptmonitor_alert_new_hosts.scriptmonitor_alert_new_malicious_hosts.scriptmonitor_alert_new_malicious_scripts.scriptmonitor_alert_new_malicious_url.scriptmonitor_alert_new_max_length_resource_url.scriptmonitor_alert_new_resources.secondary_dns_all_primaries_failing.secondary_dns_primaries_failing.secondary_dns_warning.secondary_dns_zone_successfully_updated.secondary_dns_zone_validation_warning.security_insights_alert.sentinel_alert.stream_live_notifications.synthetic_test_latency_alert.synthetic_test_low_availability_alert.traffic_anomalies_alert.tunnel_health_event.tunnel_update_event.universal_ssl_event_type.web_analytics_metrics_update.zone_aop_custom_certificate_expiration_type`.split(`.`)}).option(`description`,{type:`string`,description:`Optional description for the Notification policy.`}).option(`enabled`,{type:`boolean`,description:`Whether or not the Notification policy is enabled.`,default:!0}).option(`filters-actions`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-affected-asns`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-affected-components`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-affected-locations`,{type:`string`,array:!0,description:`Used for configuring radar_notification`}).option(`filters-airport-code`,{type:`string`,array:!0,description:`Used for configuring maintenance_event_notification`}).option(`filters-alert-trigger-preferences`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-alert-trigger-preferences-value`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-enabled`,{type:`string`,array:!0,description:`Used for configuring load_balancing_pool_enablement_alert`}).option(`filters-environment`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-event-source`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-event-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-group-by`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-health-check-id`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-incident-impact`,{type:`string`,array:!0,description:`Used for configuring incident_alert`}).option(`filters-input-id`,{type:`string`,array:!0,description:`Used for configuring stream_live_notifications`}).option(`filters-insight-class`,{type:`string`,array:!0,description:`Used for configuring security_insights_alert`}).option(`filters-limit`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-logo-tag`,{type:`string`,array:!0,description:`Used for configuring logo_match_alert`}).option(`filters-megabits-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-new-health`,{type:`string`,array:!0,description:`Used for configuring load_balancing_health_alert`}).option(`filters-new-status`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-packets-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-pool-id`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-pop-names`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-product`,{type:`string`,array:!0,description:`Used for configuring billing_usage_alert`}).option(`filters-project-id`,{type:`string`,array:!0,description:`Used for configuring pages_event_alert`}).option(`filters-protocol`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-query-tag`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-requests-per-second`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-selectors`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-services`,{type:`string`,array:!0,description:`Used for configuring clickhouse_alert_fw_ent_anomaly`}).option(`filters-slo`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-status`,{type:`string`,array:!0,description:`Used for configuring health_check_status_notification`}).option(`filters-target-hostname`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-target-ip`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l4_alert`}).option(`filters-target-zone-name`,{type:`string`,array:!0,description:`Used for configuring advanced_ddos_attack_l7_alert`}).option(`filters-traffic-exclusions`,{type:`string`,array:!0,description:`Used for configuring traffic_anomalies_alert`}).option(`filters-tunnel-id`,{type:`string`,array:!0,description:`Used for configuring tunnel_health_event`}).option(`filters-tunnel-name`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-type`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-where`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`filters-zones`,{type:`string`,array:!0,description:`Usage depends on specific alert type`}).option(`name`,{type:`string`,description:`Name of the policy.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(s(t.policyId,`policyId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf alerting policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/alerting/v3/policies/${t.policyId??`<policyId>`}`,pathParams:{policyId:String(t.policyId??``)},bodyKind:`json`,body:{alertInterval:t.alertInterval,alertType:t.alertType,description:t.description,enabled:t.enabled,filtersActions:t.filtersActions,filtersAffectedAsns:t.filtersAffectedAsns,filtersAffectedComponents:t.filtersAffectedComponents,filtersAffectedLocations:t.filtersAffectedLocations,filtersAirportCode:t.filtersAirportCode,filtersAlertTriggerPreferences:t.filtersAlertTriggerPreferences,filtersAlertTriggerPreferencesValue:t.filtersAlertTriggerPreferencesValue,filtersEnabled:t.filtersEnabled,filtersEnvironment:t.filtersEnvironment,filtersEvent:t.filtersEvent,filtersEventSource:t.filtersEventSource,filtersEventType:t.filtersEventType,filtersGroupBy:t.filtersGroupBy,filtersHealthCheckId:t.filtersHealthCheckId,filtersIncidentImpact:t.filtersIncidentImpact,filtersInputId:t.filtersInputId,filtersInsightClass:t.filtersInsightClass,filtersLimit:t.filtersLimit,filtersLogoTag:t.filtersLogoTag,filtersMegabitsPerSecond:t.filtersMegabitsPerSecond,filtersNewHealth:t.filtersNewHealth,filtersNewStatus:t.filtersNewStatus,filtersPacketsPerSecond:t.filtersPacketsPerSecond,filtersPoolId:t.filtersPoolId,filtersPopNames:t.filtersPopNames,filtersProduct:t.filtersProduct,filtersProjectId:t.filtersProjectId,filtersProtocol:t.filtersProtocol,filtersQueryTag:t.filtersQueryTag,filtersRequestsPerSecond:t.filtersRequestsPerSecond,filtersSelectors:t.filtersSelectors,filtersServices:t.filtersServices,filtersSlo:t.filtersSlo,filtersStatus:t.filtersStatus,filtersTargetHostname:t.filtersTargetHostname,filtersTargetIp:t.filtersTargetIp,filtersTargetZoneName:t.filtersTargetZoneName,filtersTrafficExclusions:t.filtersTrafficExclusions,filtersTunnelId:t.filtersTunnelId,filtersTunnelName:t.filtersTunnelName,filtersType:t.filtersType,filtersWhere:t.filtersWhere,filtersZones:t.filtersZones,name:t.name,body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating policy`,async()=>n.put(`/accounts/${i}/alerting/v3/policies/${t.policyId}`,{body:e})),{successLabel:`Updated policy`});return}let m={};t.alertInterval!==void 0&&c(m,[`alert_interval`],o(t.alertInterval,`alertInterval`,`text`)),t.alertType!==void 0&&c(m,[`alert_type`],o(t.alertType,`alertType`,`text`)),t.description!==void 0&&c(m,[`description`],o(t.description,`description`,`text`)),t.enabled!==void 0&&c(m,[`enabled`],t.enabled),t.filtersActions!==void 0&&c(m,[`filters`,`actions`],t.filtersActions),t.filtersAffectedAsns!==void 0&&c(m,[`filters`,`affected_asns`],t.filtersAffectedAsns),t.filtersAffectedComponents!==void 0&&c(m,[`filters`,`affected_components`],t.filtersAffectedComponents),t.filtersAffectedLocations!==void 0&&c(m,[`filters`,`affected_locations`],t.filtersAffectedLocations),t.filtersAirportCode!==void 0&&c(m,[`filters`,`airport_code`],t.filtersAirportCode),t.filtersAlertTriggerPreferences!==void 0&&c(m,[`filters`,`alert_trigger_preferences`],t.filtersAlertTriggerPreferences),t.filtersAlertTriggerPreferencesValue!==void 0&&c(m,[`filters`,`alert_trigger_preferences_value`],t.filtersAlertTriggerPreferencesValue),t.filtersEnabled!==void 0&&c(m,[`filters`,`enabled`],t.filtersEnabled),t.filtersEnvironment!==void 0&&c(m,[`filters`,`environment`],t.filtersEnvironment),t.filtersEvent!==void 0&&c(m,[`filters`,`event`],t.filtersEvent),t.filtersEventSource!==void 0&&c(m,[`filters`,`event_source`],t.filtersEventSource),t.filtersEventType!==void 0&&c(m,[`filters`,`event_type`],t.filtersEventType),t.filtersGroupBy!==void 0&&c(m,[`filters`,`group_by`],t.filtersGroupBy),t.filtersHealthCheckId!==void 0&&c(m,[`filters`,`health_check_id`],t.filtersHealthCheckId),t.filtersIncidentImpact!==void 0&&c(m,[`filters`,`incident_impact`],t.filtersIncidentImpact),t.filtersInputId!==void 0&&c(m,[`filters`,`input_id`],t.filtersInputId),t.filtersInsightClass!==void 0&&c(m,[`filters`,`insight_class`],t.filtersInsightClass),t.filtersLimit!==void 0&&c(m,[`filters`,`limit`],t.filtersLimit),t.filtersLogoTag!==void 0&&c(m,[`filters`,`logo_tag`],t.filtersLogoTag),t.filtersMegabitsPerSecond!==void 0&&c(m,[`filters`,`megabits_per_second`],t.filtersMegabitsPerSecond),t.filtersNewHealth!==void 0&&c(m,[`filters`,`new_health`],t.filtersNewHealth),t.filtersNewStatus!==void 0&&c(m,[`filters`,`new_status`],t.filtersNewStatus),t.filtersPacketsPerSecond!==void 0&&c(m,[`filters`,`packets_per_second`],t.filtersPacketsPerSecond),t.filtersPoolId!==void 0&&c(m,[`filters`,`pool_id`],t.filtersPoolId),t.filtersPopNames!==void 0&&c(m,[`filters`,`pop_names`],t.filtersPopNames),t.filtersProduct!==void 0&&c(m,[`filters`,`product`],t.filtersProduct),t.filtersProjectId!==void 0&&c(m,[`filters`,`project_id`],t.filtersProjectId),t.filtersProtocol!==void 0&&c(m,[`filters`,`protocol`],t.filtersProtocol),t.filtersQueryTag!==void 0&&c(m,[`filters`,`query_tag`],t.filtersQueryTag),t.filtersRequestsPerSecond!==void 0&&c(m,[`filters`,`requests_per_second`],t.filtersRequestsPerSecond),t.filtersSelectors!==void 0&&c(m,[`filters`,`selectors`],t.filtersSelectors),t.filtersServices!==void 0&&c(m,[`filters`,`services`],t.filtersServices),t.filtersSlo!==void 0&&c(m,[`filters`,`slo`],t.filtersSlo),t.filtersStatus!==void 0&&c(m,[`filters`,`status`],t.filtersStatus),t.filtersTargetHostname!==void 0&&c(m,[`filters`,`target_hostname`],t.filtersTargetHostname),t.filtersTargetIp!==void 0&&c(m,[`filters`,`target_ip`],t.filtersTargetIp),t.filtersTargetZoneName!==void 0&&c(m,[`filters`,`target_zone_name`],t.filtersTargetZoneName),t.filtersTrafficExclusions!==void 0&&c(m,[`filters`,`traffic_exclusions`],t.filtersTrafficExclusions),t.filtersTunnelId!==void 0&&c(m,[`filters`,`tunnel_id`],t.filtersTunnelId),t.filtersTunnelName!==void 0&&c(m,[`filters`,`tunnel_name`],t.filtersTunnelName),t.filtersType!==void 0&&c(m,[`filters`,`type`],t.filtersType),t.filtersWhere!==void 0&&c(m,[`filters`,`where`],t.filtersWhere),t.filtersZones!==void 0&&c(m,[`filters`,`zones`],t.filtersZones),t.name!==void 0&&c(m,[`name`],o(t.name,`name`,`text`)),u(await p(`Updating policy`,async()=>n.put(`/accounts/${i}/alerting/v3/policies/${t.policyId}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated policy`})}},L={command:`policies`,describe:`Notification policies that define which events trigger alerts and where they are delivered`,builder:e=>e.command(M).command(N).command(P).command(F).command(I).demandCommand(1),handler:()=>{}},R={command:`create`,describe:`Creates a new silence for an account.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf alerting silences create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Creating silence`,async()=>n.post(`/accounts/${i}/alerting/v3/silences`,{body:e})),{successLabel:`Created silence`});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:`delete <silenceId>`,describe:`Deletes an existing silence for an account.`,builder:e=>e.positional(`silenceId`,{type:`string`,description:`Silence ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async t=>{if(s(t.silenceId,`silenceId`),t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf alerting silences delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/alerting/v3/silences/${t.silenceId??`<silenceId>`}`,pathParams:{silenceId:String(t.silenceId??``)},bodyKind:`none`,validation:`passed`});return}let n=await a(t),o=t.local?f:await r(n);if(t.accountId=o,!await i(`silence`,String(t.silenceId??``),{force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}u(await p(`Deleting silence`,async()=>n.alerting.silences.delete(o,t.silenceId)),{successLabel:`Deleted silence`})}},B={command:`get <silenceId>`,describe:`Gets a specific silence for an account.`,builder:e=>e.positional(`silenceId`,{type:`string`,description:`Silence ID`,demandOption:!0}),handler:async e=>{s(e.silenceId,`silenceId`);let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading silence`,async()=>t.alerting.silences.get(n,e.silenceId)),{successLabel:`Loaded silence`})}},V={command:`list`,describe:`Gets a list of silences for an account.`,builder:e=>e,handler:async e=>{let t=await a(e),n=e.local?f:await r(t);e.accountId=n,u(await p(`Loading silences`,async()=>t.alerting.silences.list(n)),{successLabel:`Loaded silences`})}},H={command:`update`,describe:`Updates existing silences for an account.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async t=>{if(t.dryRun){let n=e();n&&s(n,`accountId`),d({command:`cf alerting silences update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:{body:t.body},validation:`passed`});return}let n=await a(t),i=t.local?f:await r(n);if(t.accountId=i,t.body){let e=l(t.body);u(await p(`Updating silence`,async()=>n.put(`/accounts/${i}/alerting/v3/silences`,{body:e})),{successLabel:`Updated silence`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},U={command:`silences`,describe:`Silence windows that temporarily suppress alert notifications during maintenance`,builder:e=>e.command(R).command(z).command(B).command(V).command(H).demandCommand(1),handler:()=>{}},W={command:`alerting`,describe:`Notification policies, delivery destinations, silence windows, and alert history`,builder:e=>e.command(h).command(k).command(j).command(L).command(U).demandCommand(1),handler:()=>{}};export{W as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{t as e,u as t}from"./auth-BHD_B2p9.mjs";import{r as n}from"./input-validation-BpVQi9rR.mjs";import{t as r}from"./output-CqGQp2r6.mjs";import{t as i}from"./progress-5sHFvwez.mjs";const a={command:`get <zoneIdentifier>`,describe:`This view provides a breakdown of analytics data by datacenter. Note: This is available to Enterprise customers only.`,builder:e=>e.positional(`zoneIdentifier`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`until`,{type:`string`,description:`The (exclusive) end of the requested time frame. This value can be a negative integer representing the number of minutes in the past relative to time the request is made, or can be an absolute timestamp that conforms to RFC 3339. If omitted, the time of the request is used.`}).option(`since`,{type:`string`,description:`The (inclusive) beginning of the requested time frame. This value can be a negative integer representing the number of minutes in the past relative to time the request is made, or can be an absolute timestamp that conforms to RFC 3339. At this point in time, it cannot exceed a time in the past greater than one year. Ranges that the Cloudflare web application provides will provide the following period length for each point: - Last 60 minutes (from -59 to -1): 1 minute resolution - Last 7 hours (from -419 to -60): 15 minutes resolution - Last 15 hours (from -899 to -420): 30 minutes resolution - Last 72 hours (from -4320 to -900): 1 hour resolution - Older than 3 days (-525600 to -4320): 1 day resolution.`}).option(`continuous`,{type:`boolean`,description:`When set to true, the API will move the requested time window backward, until it finds a region with completely aggregated data. The API response _may not represent the requested time window_.`,default:!1}),handler:async a=>{n(a.zoneIdentifier,`zoneIdentifier`);let o={};a.until!==void 0&&(o.until=a.until),a.since!==void 0&&(o.since=a.since),a.continuous!==void 0&&(o.continuous=a.continuous);let s=await e(a),c=await t({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,r(await i(`Loading colo`,async()=>s.analytics.colo.get(c,Object.keys(o).length>0?o:void 0)),{successLabel:`Loaded colo`})}},o={command:`colo`,describe:`Per-data-center (colo) traffic analytics breakdown for the zone`,builder:e=>e.command(a).demandCommand(1),handler:()=>{}},s={command:`get <zoneIdentifier>`,describe:`The dashboard view provides both totals and timeseries data for the given zone and time period across the entire Cloudflare network.`,builder:e=>e.positional(`zoneIdentifier`,{type:`string`,description:`Identifier`,demandOption:!0}).option(`until`,{type:`string`,description:`The (exclusive) end of the requested time frame. This value can be a negative integer representing the number of minutes in the past relative to time the request is made, or can be an absolute timestamp that conforms to RFC 3339. If omitted, the time of the request is used.`}).option(`since`,{type:`string`,description:`The (inclusive) beginning of the requested time frame. This value can be a negative integer representing the number of minutes in the past relative to time the request is made, or can be an absolute timestamp that conforms to RFC 3339. At this point in time, it cannot exceed a time in the past greater than one year. Ranges that the Cloudflare web application provides will provide the following period length for each point: - Last 60 minutes (from -59 to -1): 1 minute resolution - Last 7 hours (from -419 to -60): 15 minutes resolution - Last 15 hours (from -899 to -420): 30 minutes resolution - Last 72 hours (from -4320 to -900): 1 hour resolution - Older than 3 days (-525600 to -4320): 1 day resolution.`}).option(`continuous`,{type:`boolean`,description:`When set to true, the API will move the requested time window backward, until it finds a region with completely aggregated data. The API response _may not represent the requested time window_.`,default:!1}),handler:async a=>{n(a.zoneIdentifier,`zoneIdentifier`);let o={};a.until!==void 0&&(o.until=a.until),a.since!==void 0&&(o.since=a.since),a.continuous!==void 0&&(o.continuous=a.continuous);let s=await e(a),c=await t({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,r(await i(`Loading dashboard`,async()=>s.analytics.dashboard.get(c,Object.keys(o).length>0?o:void 0)),{successLabel:`Loaded dashboard`})}},c={command:`dashboard`,describe:`Aggregated zone dashboard analytics — requests, bandwidth, threats, and page views`,builder:e=>e.command(s).demandCommand(1),handler:()=>{}},l={command:`get`,describe:`Retrieves Argo Smart Routing analytics broken down by geographic points of presence (PoPs). Shows latency improvements and routing efficiency per location.`,builder:e=>e,handler:async n=>{let a=await e(n),o=await t({zone:n.zone},a,{quiet:n.quiet});n.zoneId=o,r(await i(`Loading colo`,async()=>a.analytics.latency.colos.get(o)),{successLabel:`Loaded colo`})}},u={command:`colos`,describe:`Argo Smart Routing latency analytics showing time-to-first-byte improvements`,builder:e=>e.command(l).demandCommand(1),handler:()=>{}},d={command:`get`,describe:`Retrieves aggregate Argo Smart Routing analytics for a zone, including latency improvements, bandwidth savings, and routing statistics.`,builder:e=>e.option(`bins`,{type:`string`,description:`Bins`}),handler:async n=>{let a={};n.bins!==void 0&&(a.bins=n.bins);let o=await e(n),s=await t({zone:n.zone},o,{quiet:n.quiet});n.zoneId=s,r(await i(`Loading latency`,async()=>o.analytics.latency.get(s,Object.keys(a).length>0?a:void 0)),{successLabel:`Loaded latency`})}},f={command:`latency`,describe:`Argo Smart Routing latency analytics showing time-to-first-byte improvements`,builder:e=>e.command(d).command(u).demandCommand(1),handler:()=>{}},p={command:`analytics`,describe:`Zone-level traffic analytics — dashboard summaries, per-colo breakdowns, and Argo latency metrics`,builder:e=>e.command(o).command(c).command(f).demandCommand(1),handler:()=>{}};export{p as default};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{h as e,m as t,p as n,t as r,u as i}from"./auth-BHD_B2p9.mjs";import{n as a}from"./input-validation-BpVQi9rR.mjs";import{n as o,t as s}from"./body-parser-iA3vRFmh.mjs";import{t as c}from"./output-CqGQp2r6.mjs";import{t as l}from"./dry-run-FV0pZwdg.mjs";import{t as u}from"./progress-5sHFvwez.mjs";const d={command:`get`,describe:`Gets the current API Shield configuration settings for a zone, including validation behavior and enforcement mode.`,builder:e=>e,handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading configuration`,async()=>t.apiGateway.configurations.get(n)),{successLabel:`Loaded configuration`})}},f={command:`update`,describe:`Updates API Shield configuration settings for a zone. Can modify validation strictness, enforcement mode, and other global settings.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway configurations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/configuration`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=a(e.body,`body`,`binary`);c(await u(`Updating configuration`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/configuration`,{body:n,headers:{"Content-Type":`application/octet-stream`}})),{successLabel:`Updated configuration`});return}c(await u(`Updating configuration`,async()=>t.apiGateway.configurations.update(n)),{successLabel:`Updated configuration`})}},ee={command:`configurations`,describe:`API Shield configuration — authentication requirements and session identifiers`,builder:e=>e.command(d).command(f).demandCommand(1),handler:()=>{}},p={command:`get`,describe:`Retrieve the most up to date view of discovered operations, rendered as OpenAPI schemas`,builder:e=>e,handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading discovery`,async()=>t.apiGateway.discovery.get(n)),{successLabel:`Loaded discovery`})}},m={command:`bulk-edit`,describe:"Update the `state` on one or more discovered operations",builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway discovery operations bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/discovery/operations`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=s(e.body);c(await u(`Updating operations`,async()=>t.patch(`/zones/${e.zoneId}/api_gateway/discovery/operations`,{body:n})),{successLabel:`Updated operations`});return}c(await u(`Updating operations`,async()=>t.apiGateway.discovery.operations.bulkEdit(n)),{successLabel:`Updated operations`})}},h={command:`edit`,describe:"Update the `state` on a discovered operation",builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway discovery operations edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/discovery/operations/${e.operationId??`<operationId>`}`,pathParams:{zoneId:String(e.zoneId??``),operationId:String(e.operationId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=s(e.body);c(await u(`Updating operation`,async()=>t.patch(`/zones/${e.zoneId}/api_gateway/discovery/operations/${e.operationId}`,{body:n})),{successLabel:`Updated operation`});return}c(await u(`Updating operation`,async()=>t.apiGateway.discovery.operations.edit(n,e.operationId)),{successLabel:`Updated operation`})}},g={command:`list`,describe:`Retrieve the most up to date view of discovered operations`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`order`,{type:`string`,description:`Field to order by`,choices:[`host`,`method`,`endpoint`,`traffic_stats.requests`,`traffic_stats.last_updated`]}).option(`diff`,{type:`boolean`,description:"When `true`, only return API Discovery results that are not saved into API Shield Endpoint Management",default:!1}).option(`origin`,{type:`string`,description:"Filter results to only include discovery results sourced from a particular discovery engine * `ML` - Discovered operations that were sourced using ML API Discovery * `SessionIdentifier` - Discovered operations that were sourced using Session Identifier API Discovery",choices:[`ML`,`SessionIdentifier`,`LabelDiscovery`]}).option(`state`,{type:`string`,description:"Filter results to only include discovery results in a particular state. States are as follows * `review` - Discovered operations that are not saved into API Shield Endpoint Management * `saved` - Discovered operations that are already saved into API Shield Endpoint Management * `ignored` - Discovered operations that have been marked as ignored",choices:[`review`,`saved`,`ignored`]}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.host!==void 0&&(t.host=e.host),e.method!==void 0&&(t.method=e.method),e.endpoint!==void 0&&(t.endpoint=e.endpoint),e.direction!==void 0&&(t.direction=e.direction),e.order!==void 0&&(t.order=e.order),e.diff!==void 0&&(t.diff=e.diff),e.origin!==void 0&&(t.origin=e.origin),e.state!==void 0&&(t.state=e.state);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading operations`,async()=>n.apiGateway.discovery.operations.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded operations`})}},_={command:`operations`,describe:`Auto-discovered API endpoints from traffic analysis with schema inference`,builder:e=>e.command(m).command(h).command(g).demandCommand(1),handler:()=>{}},v={command:`discovery`,describe:`Auto-discovered API endpoints from traffic analysis with schema inference`,builder:e=>e.command(p).command(_).demandCommand(1),handler:()=>{}},y={command:`create`,describe:`Creates an expression template fallthrough rule for API Shield. Used for configuring default behavior when no other expression templates match.`,builder:e=>e.option(`hosts`,{type:`string`,array:!0,description:`List of hosts to be targeted in the expression`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway expression-template fallthrough create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/expression-template/fallthrough`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{hosts:e.hosts,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Creating fallthrough`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/expression-template/fallthrough`,{body:n})),{successLabel:`Created fallthrough`});return}if(e.hosts===void 0)throw Error(`--hosts is required (or pass --body with this field set).`);let n={};e.hosts!==void 0&&o(n,[`hosts`],e.hosts),c(await u(`Creating fallthrough`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/expression-template/fallthrough`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created fallthrough`})}},b={command:`fallthrough`,describe:`Reusable expression templates for API Gateway rule configurations`,builder:e=>e.command(y).demandCommand(1),handler:()=>{}},x={command:`expression-template`,describe:`Operations for expression-template`,builder:e=>e.command(b).demandCommand(1),handler:()=>{}},S={command:`list`,describe:`Retrieve all labels`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:`Field to order by`,choices:[`name`,`description`,`created_at`,`last_updated`,`mapped_resources.operations`]}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`source`,{type:`string`,description:`Filter for labels with source`,choices:[`user`,`managed`]}).option(`filter`,{type:`string`,description:`Filter for labels where the name or description matches using substring match`}).option(`with-mapped-resource-counts`,{type:`boolean`,description:"Include `mapped_resources` for each label",default:!1}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.source!==void 0&&(t.source=e.source),e.filter!==void 0&&(t.filter=e.filter),e.withMappedResourceCounts!==void 0&&(t.with_mapped_resource_counts=e.withMappedResourceCounts);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading labels`,async()=>n.apiGateway.labels.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded labels`})}},C={command:`get`,describe:`Retrieve managed label`,builder:e=>e.option(`with-mapped-resource-counts`,{type:`boolean`,description:"Include `mapped_resources` for each label",default:!1}),handler:async e=>{let t={};e.withMappedResourceCounts!==void 0&&(t.with_mapped_resource_counts=e.withMappedResourceCounts);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading managed`,async()=>n.apiGateway.labels.managed.get(a,e.name,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded managed`})}},w={command:`update`,describe:`Replace all operations(s) attached to a managed label`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels managed resources operation update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/labels/managed/${e.name??`<name>`}/resources/operation`,pathParams:{zoneId:String(e.zoneId??``),name:String(e.name??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=s(e.body);c(await u(`Updating operation`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/labels/managed/${e.name}/resources/operation`,{body:n})),{successLabel:`Updated operation`});return}c(await u(`Updating operation`,async()=>t.apiGateway.labels.managed.resources.operation.update(n,e.name)),{successLabel:`Updated operation`})}},T={command:`operation`,describe:`Labels operations`,builder:e=>e.command(w).demandCommand(1),handler:()=>{}},E={command:`resources`,describe:`Operations for labels.managed.resources`,builder:e=>e.command(T).demandCommand(1),handler:()=>{}},D={command:`managed`,describe:`Labels operations`,builder:e=>e.command(C).command(E).demandCommand(1),handler:()=>{}},O={command:`bulk-create`,describe:`Create user labels`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/labels/user`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Creating user`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/labels/user`,{body:n})),{successLabel:`Created user`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},k={command:`bulk-delete`,describe:`Delete user labels`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/labels/user`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`user`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
3
- `);return}if(e.body){let n=s(e.body);c(await u(`Deleting user`,async()=>t.delete(`/zones/${e.zoneId}/api_gateway/labels/user`,{body:n})),{successLabel:`Deleted user`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},A={command:`delete`,describe:`Delete user label`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/labels/user/${e.name??`<name>`}`,pathParams:{zoneId:String(e.zoneId??``),name:String(e.name??``)},bodyKind:`none`,validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`user`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
4
- `);return}c(await u(`Deleting user`,async()=>t.apiGateway.labels.user.delete(a,e.name)),{successLabel:`Deleted user`})}},j={command:`edit`,describe:`Update certain fields on a label`,builder:e=>e.option(`description`,{type:`string`,description:`The description of the label`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/labels/user/${e.name??`<name>`}`,pathParams:{zoneId:String(e.zoneId??``),name:String(e.name??``)},bodyKind:`json`,body:{description:e.description,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating user`,async()=>t.patch(`/zones/${e.zoneId}/api_gateway/labels/user/${e.name}`,{body:n})),{successLabel:`Updated user`});return}let n={};e.description!==void 0&&o(n,[`description`],a(e.description,`description`,`text`)),c(await u(`Updating user`,async()=>t.patch(`/zones/${e.zoneId}/api_gateway/labels/user/${e.name}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated user`})}},M={command:`get`,describe:`Retrieve user label`,builder:e=>e.option(`with-mapped-resource-counts`,{type:`boolean`,description:"Include `mapped_resources` for each label",default:!1}),handler:async e=>{let t={};e.withMappedResourceCounts!==void 0&&(t.with_mapped_resource_counts=e.withMappedResourceCounts);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading user`,async()=>n.apiGateway.labels.user.get(a,e.name,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded user`})}},N={command:`update`,describe:`Replace all operations(s) attached to a user label`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user resources operation update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/labels/user/${e.name??`<name>`}/resources/operation`,pathParams:{zoneId:String(e.zoneId??``),name:String(e.name??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=s(e.body);c(await u(`Updating operation`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/labels/user/${e.name}/resources/operation`,{body:n})),{successLabel:`Updated operation`});return}c(await u(`Updating operation`,async()=>t.apiGateway.labels.user.resources.operation.update(n,e.name)),{successLabel:`Updated operation`})}},P={command:`operation`,describe:`Labels operations`,builder:e=>e.command(N).demandCommand(1),handler:()=>{}},F={command:`resources`,describe:`Operations for labels.user.resources`,builder:e=>e.command(P).demandCommand(1),handler:()=>{}},I={command:`update`,describe:`Update all fields on a label`,builder:e=>e.option(`description`,{type:`string`,description:`The description of the label`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway labels user update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/labels/user/${e.name??`<name>`}`,pathParams:{zoneId:String(e.zoneId??``),name:String(e.name??``)},bodyKind:`json`,body:{description:e.description,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating user`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/labels/user/${e.name}`,{body:n})),{successLabel:`Updated user`});return}let n={};e.description!==void 0&&o(n,[`description`],a(e.description,`description`,`text`)),c(await u(`Updating user`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/labels/user/${e.name}`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated user`})}},L={command:`user`,describe:`Labels operations`,builder:e=>e.command(O).command(k).command(A).command(j).command(M).command(I).command(F).demandCommand(1),handler:()=>{}},R={command:`labels`,describe:`Labels operations`,builder:e=>e.command(S).command(D).command(L).demandCommand(1),handler:()=>{}},z={command:`bulk-create`,describe:`Add one or more operations to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Creating operations`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/operations`,{body:n})),{successLabel:`Created operations`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},B={command:`bulk-delete`,describe:`Bulk removes multiple API operations from API Shield endpoint management in a single request. Efficient for cleaning up unused endpoints.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`operations`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
5
- `);return}if(e.body){let n=s(e.body);c(await u(`Deleting operations`,async()=>t.delete(`/zones/${e.zoneId}/api_gateway/operations`,{body:n})),{successLabel:`Deleted operations`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},te={command:`create`,describe:`Add one operation to a zone. Endpoints can contain path variables. Host, method, endpoint will be normalized to a canoncial form when creating an operation and must be unique on the zone. Inserting an operation that matches an existing one will return the record of the already existing operation and update its last_updated date.`,builder:e=>e.option(`endpoint`,{type:`string`,description:`The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/.`}).option(`host`,{type:`string`,description:`RFC3986-compliant host.`}).option(`method`,{type:`string`,description:`The HTTP method used to access the endpoint.`,choices:[`GET`,`POST`,`HEAD`,`OPTIONS`,`PUT`,`DELETE`,`CONNECT`,`PATCH`,`TRACE`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async n=>{if(n.dryRun){l({command:`cf api-gateway operations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${n.zoneId??`<zoneId>`}/api_gateway/operations/item`,pathParams:{zoneId:String(n.zoneId??``)},bodyKind:`json`,body:{endpoint:n.endpoint,host:n.host,method:n.method,body:n.body},validation:`passed`});return}let d=await r(n);if(n.zoneId=await i({zone:n.zone},d,{quiet:n.quiet}),n.body){let e=s(n.body);c(await u(`Creating operation`,async()=>d.post(`/zones/${n.zoneId}/api_gateway/operations/item`,{body:e})),{successLabel:`Created operation`});return}n.endpoint===void 0&&(n.endpoint=await e(`endpoint`,`The endpoint which can contain path parameter templates in curly braces, each will be replaced from left to right with {varN}, starting with {var1}, during insertion. This will further be Cloudflare-normalized upon insertion. See: https://developers.cloudflare.com/rules/normalization/how-it-works/.`)),n.host===void 0&&(n.host=await e(`host`,`RFC3986-compliant host.`)),n.method===void 0&&(n.method=await t(`method`,`The HTTP method used to access the endpoint.`,[`GET`,`POST`,`HEAD`,`OPTIONS`,`PUT`,`DELETE`,`CONNECT`,`PATCH`,`TRACE`]));let f={};n.endpoint!==void 0&&o(f,[`endpoint`],a(n.endpoint,`endpoint`,`text`)),n.host!==void 0&&o(f,[`host`],a(n.host,`host`,`text`)),n.method!==void 0&&o(f,[`method`],a(n.method,`method`,`text`)),c(await u(`Creating operation`,async()=>d.post(`/zones/${n.zoneId}/api_gateway/operations/item`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created operation`})}},V={command:`delete`,describe:`Removes a single API operation from API Shield endpoint management. The operation will no longer be tracked or protected by API Shield rules.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/${e.operationId??`<operationId>`}`,pathParams:{zoneId:String(e.zoneId??``),operationId:String(e.operationId??``)},bodyKind:`none`,validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`operation`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
6
- `);return}c(await u(`Deleting operation`,async()=>t.apiGateway.operations.delete(a,e.operationId)),{successLabel:`Deleted operation`})}},H={command:`get`,describe:`Gets detailed information about a specific API operation in API Shield, including its schema validation settings and traffic statistics.`,builder:e=>e.option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}),handler:async e=>{let t={};e.feature!==void 0&&(t.feature=e.feature);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading operation`,async()=>n.apiGateway.operations.get(a,e.operationId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded operation`})}},U={command:`bulk-create`,describe:`Bulk attach label(s) on operation(s) in endpoint management`,builder:e=>e.option(`managed-labels`,{type:`string`,array:!0,description:`List of managed label names.`}).option(`user-labels`,{type:`string`,array:!0,description:`List of user label names.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/labels`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{managedLabels:e.managedLabels,userLabels:e.userLabels,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Creating labels`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/operations/labels`,{body:n})),{successLabel:`Created labels`});return}let n={};e.managedLabels!==void 0&&o(n,[`managed`,`labels`],e.managedLabels),e.userLabels!==void 0&&o(n,[`user`,`labels`],e.userLabels),c(await u(`Creating labels`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/operations/labels`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created labels`})}},W={command:`bulk-delete`,describe:`Bulk remove label(s) on operation(s) in endpoint management`,builder:e=>e.option(`managed-labels`,{type:`string`,array:!0,description:`List of managed label names.`}).option(`user-labels`,{type:`string`,array:!0,description:`List of user label names.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/labels`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{managedLabels:e.managedLabels,userLabels:e.userLabels,body:e.body},validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`labels`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
7
- `);return}if(e.body){let n=s(e.body);c(await u(`Deleting labels`,async()=>t.delete(`/zones/${e.zoneId}/api_gateway/operations/labels`,{body:n})),{successLabel:`Deleted labels`});return}let d={};e.managedLabels!==void 0&&o(d,[`managed`,`labels`],e.managedLabels),e.userLabels!==void 0&&o(d,[`user`,`labels`],e.userLabels),c(await u(`Deleting labels`,async()=>t.delete(`/zones/${e.zoneId}/api_gateway/operations/labels`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Deleted labels`})}},G={command:`bulk-update`,describe:`Bulk replace label(s) on operation(s) in endpoint management`,builder:e=>e.option(`managed-labels`,{type:`string`,array:!0,description:`List of managed label names. Providing an empty array will result in all managed labels being removed from all affected operations`}).option(`user-labels`,{type:`string`,array:!0,description:`List of user label names. Providing an empty array will result in all user labels being removed from all affected operations`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels bulk-update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/labels`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{managedLabels:e.managedLabels,userLabels:e.userLabels,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating labels`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/operations/labels`,{body:n})),{successLabel:`Updated labels`});return}if(e.managedLabels===void 0)throw Error(`--managed-labels is required (or pass --body with this field set).`);if(e.userLabels===void 0)throw Error(`--user-labels is required (or pass --body with this field set).`);let n={};e.managedLabels!==void 0&&o(n,[`managed`,`labels`],e.managedLabels),e.userLabels!==void 0&&o(n,[`user`,`labels`],e.userLabels),c(await u(`Updating labels`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/operations/labels`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated labels`})}},K={command:`create`,describe:`Attach label(s) on an operation in endpoint management`,builder:e=>e.option(`managed`,{type:`string`,array:!0,description:`List of managed label names.`}).option(`user`,{type:`string`,array:!0,description:`List of user label names.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/${e.operationId??`<operationId>`}/labels`,pathParams:{zoneId:String(e.zoneId??``),operationId:String(e.operationId??``)},bodyKind:`json`,body:{managed:e.managed,user:e.user,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Creating label`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/operations/${e.operationId}/labels`,{body:n})),{successLabel:`Created label`});return}let n={};e.managed!==void 0&&o(n,[`managed`],e.managed),e.user!==void 0&&o(n,[`user`],e.user),c(await u(`Creating label`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/operations/${e.operationId}/labels`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Created label`})}},q={command:`delete`,describe:`Remove label(s) on an operation in endpoint management`,builder:e=>e.option(`managed`,{type:`string`,array:!0,description:`List of managed label names.`}).option(`user`,{type:`string`,array:!0,description:`List of user label names.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/${e.operationId??`<operationId>`}/labels`,pathParams:{zoneId:String(e.zoneId??``),operationId:String(e.operationId??``)},bodyKind:`json`,body:{managed:e.managed,user:e.user,body:e.body},validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`label`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
8
- `);return}if(e.body){let n=s(e.body);c(await u(`Deleting label`,async()=>t.delete(`/zones/${e.zoneId}/api_gateway/operations/${e.operationId}/labels`,{body:n})),{successLabel:`Deleted label`});return}let d={};e.managed!==void 0&&o(d,[`managed`],e.managed),e.user!==void 0&&o(d,[`user`],e.user),c(await u(`Deleting label`,async()=>t.delete(`/zones/${e.zoneId}/api_gateway/operations/${e.operationId}/labels`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Deleted label`})}},J={command:`update`,describe:`Replace label(s) on an operation in endpoint management`,builder:e=>e.option(`managed`,{type:`string`,array:!0,description:`List of managed label names. Omitting this property or passing an empty array will result in all managed labels being removed from the operation`}).option(`user`,{type:`string`,array:!0,description:`List of user label names. Omitting this property or passing an empty array will result in all user labels being removed from the operation`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations labels update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/${e.operationId??`<operationId>`}/labels`,pathParams:{zoneId:String(e.zoneId??``),operationId:String(e.operationId??``)},bodyKind:`json`,body:{managed:e.managed,user:e.user,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating label`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/operations/${e.operationId}/labels`,{body:n})),{successLabel:`Updated label`});return}let n={};e.managed!==void 0&&o(n,[`managed`],e.managed),e.user!==void 0&&o(n,[`user`],e.user),c(await u(`Updating label`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/operations/${e.operationId}/labels`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated label`})}},Y={command:`labels`,describe:`Manage labels on API Shield operations for classification and policy enforcement`,builder:e=>e.command(U).command(W).command(G).command(K).command(q).command(J).demandCommand(1),handler:()=>{}},X={command:`list`,describe:`Lists all API operations tracked by API Shield for a zone with pagination. Returns operation details including method, path, and feature configurations.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`order`,{type:`string`,description:"Field to order by. When requesting a feature, the feature keys are available for ordering as well, e.g., `thresholds.suggested_threshold`.",choices:[`method`,`host`,`endpoint`,`thresholds.$key`]}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.order!==void 0&&(t.order=e.order),e.direction!==void 0&&(t.direction=e.direction),e.host!==void 0&&(t.host=e.host),e.method!==void 0&&(t.method=e.method),e.endpoint!==void 0&&(t.endpoint=e.endpoint),e.feature!==void 0&&(t.feature=e.feature);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading operations`,async()=>n.apiGateway.operations.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded operations`})}},Z={command:`edit`,describe:`Updates multiple operation-level schema validation settings on the zone`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations schema-validation edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/schema_validation`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=s(e.body);c(await u(`Updating schema validation`,async()=>t.patch(`/zones/${e.zoneId}/api_gateway/operations/schema_validation`,{body:n})),{successLabel:`Updated schema validation`});return}c(await u(`Updating schema validation`,async()=>t.apiGateway.operations.schemaValidation.edit(n)),{successLabel:`Updated schema validation`})}},Q={command:`get`,describe:`Retrieves operation-level schema validation settings on the zone`,builder:e=>e,handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading schema validation`,async()=>t.apiGateway.operations.schemaValidation.get(n,e.operationId)),{successLabel:`Loaded schema validation`})}},ne={command:`update`,describe:`Updates operation-level schema validation settings on the zone`,builder:e=>e.option(`mitigation-action`,{type:`string`,description:"When set, this applies a mitigation action to this operation - `log` log request when request does not conform to schema for this operation - `block` deny access to the site when request does not conform to schema for this operation - `none` will skip mitigation for this operation - `null` indicates that no operation level mitigation is in place, see Zone Level Schema Validation Settings for mitigation action that will be applied ",choices:[`log`,`block`,`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)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway operations schema-validation update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/operations/${e.operationId??`<operationId>`}/schema_validation`,pathParams:{zoneId:String(e.zoneId??``),operationId:String(e.operationId??``)},bodyKind:`json`,body:{mitigationAction:e.mitigationAction,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating schema validation`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/operations/${e.operationId}/schema_validation`,{body:n})),{successLabel:`Updated schema validation`});return}let n={};e.mitigationAction!==void 0&&o(n,[`mitigation_action`],a(e.mitigationAction,`mitigationAction`,`text`)),c(await u(`Updating schema validation`,async()=>t.put(`/zones/${e.zoneId}/api_gateway/operations/${e.operationId}/schema_validation`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated schema validation`})}},re={command:`schema-validation`,describe:`Registered API operations (method + path) with traffic metrics and schema bindings`,builder:e=>e.command(Z).command(Q).command(ne).demandCommand(1),handler:()=>{}},ie={command:`operations`,describe:`Registered API operations (method + path) with traffic metrics and schema bindings`,builder:e=>e.command(z).command(B).command(te).command(V).command(H).command(X).command(Y).command(re).demandCommand(1),handler:()=>{}},ae={command:`list`,describe:`Retrieves API operations and their features exported as OpenAPI schemas.`,builder:e=>e.option(`host`,{type:`string`,description:`Receive schema only for the given host(s).`}).option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}),handler:async e=>{let t={};e.host!==void 0&&(t.host=e.host),e.feature!==void 0&&(t.feature=e.feature);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading schemas`,async()=>n.apiGateway.schemas.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded schemas`})}},oe={command:`schemas`,describe:`OpenAPI schemas learned from traffic for API endpoint validation`,builder:e=>e.command(ae).demandCommand(1),handler:()=>{}},se={command:`edit`,describe:`Updates zone level schema validation settings on the zone`,builder:e=>e.option(`validation-default-mitigation-action`,{type:`string`,description:"The default mitigation action used when there is no mitigation action defined on the operation Mitigation actions are as follows: * `log` - log request when request does not conform to schema * `block` - deny access to the site when request does not conform to schema A special value of of `none` will skip running schema validation entirely for the request when there is no mitigation action defined on the operation `null` will have no effect. ",choices:[`none`,`log`,`block`]}).option(`validation-override-mitigation-action`,{type:`string`,description:"When set, this overrides both zone level and operation level mitigation actions. - `none` will skip running schema validation entirely for the request To clear any override, use the special value `disable_override` `null` will have no effect. ",choices:[`none`,`disable_override`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway settings schema-validation edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/settings/schema_validation`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{validationDefaultMitigationAction:e.validationDefaultMitigationAction,validationOverrideMitigationAction:e.validationOverrideMitigationAction,body:e.body},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=s(e.body);c(await u(`Updating schema validation`,async()=>t.patch(`/zones/${e.zoneId}/api_gateway/settings/schema_validation`,{body:n})),{successLabel:`Updated schema validation`});return}let n={};e.validationDefaultMitigationAction!==void 0&&o(n,[`validation_default_mitigation_action`],a(e.validationDefaultMitigationAction,`validationDefaultMitigationAction`,`text`)),e.validationOverrideMitigationAction!==void 0&&o(n,[`validation_override_mitigation_action`],a(e.validationOverrideMitigationAction,`validationOverrideMitigationAction`,`text`)),c(await u(`Updating schema validation`,async()=>t.patch(`/zones/${e.zoneId}/api_gateway/settings/schema_validation`,{body:Object.keys(n).length>0?n:void 0})),{successLabel:`Updated schema validation`})}},ce={command:`get`,describe:`Retrieves zone level schema validation settings currently set on the zone`,builder:e=>e,handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading schema validation`,async()=>t.apiGateway.settings.schemaValidation.get(n)),{successLabel:`Loaded schema validation`})}},le={command:`update`,describe:`Updates zone level schema validation settings on the zone`,builder:e=>e.option(`validation-default-mitigation-action`,{type:`string`,description:"The default mitigation action used when there is no mitigation action defined on the operation Mitigation actions are as follows: * `log` - log request when request does not conform to schema * `block` - deny access to the site when request does not conform to schema A special value of of `none` will skip running schema validation entirely for the request when there is no mitigation action defined on the operation ",choices:[`none`,`log`,`block`]}).option(`validation-override-mitigation-action`,{type:`string`,description:"When set, this overrides both zone level and operation level mitigation actions. - `none` will skip running schema validation entirely for the request - `null` indicates that no override is in place To clear any override, use the special value `disable_override` or `null` ",choices:[`none`,`disable_override`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway settings schema-validation update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/settings/schema_validation`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`json`,body:{validationDefaultMitigationAction:e.validationDefaultMitigationAction,validationOverrideMitigationAction:e.validationOverrideMitigationAction,body:e.body},validation:`passed`});return}let n=await r(e);if(e.zoneId=await i({zone:e.zone},n,{quiet:e.quiet}),e.body){let t=s(e.body);c(await u(`Updating schema validation`,async()=>n.put(`/zones/${e.zoneId}/api_gateway/settings/schema_validation`,{body:t})),{successLabel:`Updated schema validation`});return}e.validationDefaultMitigationAction===void 0&&(e.validationDefaultMitigationAction=await t(`validation-default-mitigation-action`,"The default mitigation action used when there is no mitigation action defined on the operation Mitigation actions are as follows: * `log` - log request when request does not conform to schema * `block` - deny access to the site when request does not conform to schema A special value of of `none` will skip running schema validation entirely for the request when there is no mitigation action defined on the operation ",[`none`,`log`,`block`]));let d={};e.validationDefaultMitigationAction!==void 0&&o(d,[`validation_default_mitigation_action`],a(e.validationDefaultMitigationAction,`validationDefaultMitigationAction`,`text`)),e.validationOverrideMitigationAction!==void 0&&o(d,[`validation_override_mitigation_action`],a(e.validationOverrideMitigationAction,`validationOverrideMitigationAction`,`text`)),c(await u(`Updating schema validation`,async()=>n.put(`/zones/${e.zoneId}/api_gateway/settings/schema_validation`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated schema validation`})}},ue={command:`schema-validation`,describe:`Zone-level API Gateway settings including schema validation behavior`,builder:e=>e.command(se).command(ce).command(le).demandCommand(1),handler:()=>{}},de={command:`settings`,describe:`Operations for settings`,builder:e=>e.command(ue).demandCommand(1),handler:()=>{}},fe={command:`create`,describe:`Uploads a new OpenAPI schema for API Shield schema validation. The schema defines expected request/response formats for API endpoints.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`kind`,{type:`string`,description:`Kind of schema`}).option(`name`,{type:`string`,description:`Name of the schema`}).option(`validation-enabled`,{type:`string`,description:`Flag whether schema is enabled for validation.`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway user-schemas create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/user_schemas`,pathParams:{zoneId:String(e.zoneId??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,kind:e.kind,name:e.name,validationEnabled:e.validationEnabled},validation:`passed`});return}let t=await r(e);if(e.zoneId=await i({zone:e.zone},t,{quiet:e.quiet}),e.file!==void 0||e.body!==void 0||e.kind!==void 0||e.name!==void 0||e.validationEnabled!==void 0){let n=new FormData;if(e.file){let{readFileSync:t}=await import(`node:fs`),{resolve:r}=await import(`node:path`),i=t(r(e.file));n.append(`file`,new Blob([i]),e.file.split(`/`).pop())}else e.body!==void 0&&n.append(`file`,e.body);e.kind!==void 0&&n.append(`kind`,String(a(e.kind,`kind`,`text`)??``)),e.name!==void 0&&n.append(`name`,String(a(e.name,`name`,`text`)??``)),e.validationEnabled!==void 0&&n.append(`validation_enabled`,String(a(e.validationEnabled,`validationEnabled`,`text`)??``)),c(await u(`Creating user schema`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/user_schemas`,{body:n})),{successLabel:`Created user schema`});return}if(e.body){let n=a(e.body,`body`,`binary`);c(await u(`Creating user schema`,async()=>t.post(`/zones/${e.zoneId}/api_gateway/user_schemas`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created user schema`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},pe={command:`delete`,describe:`Permanently removes an uploaded OpenAPI schema from API Shield schema validation. Operations using this schema will lose their validation rules.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway user-schemas delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/user_schemas/${e.schemaId??`<schemaId>`}`,pathParams:{zoneId:String(e.zoneId??``),schemaId:String(e.schemaId??``)},bodyKind:`none`,validation:`passed`});return}let t=await r(e),a=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=a,!await n(`user schema`,String(a??``),{force:!!e.force})){process.stderr.write(`Aborted.
9
- `);return}c(await u(`Deleting user schema`,async()=>t.apiGateway.userSchemas.delete(a,e.schemaId)),{successLabel:`Deleted user schema`})}},$={command:`edit`,describe:`Activates schema validation for an uploaded OpenAPI schema. Requests to matching endpoints will be validated against the schema definitions.`,builder:e=>e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}),handler:async e=>{if(e.dryRun){l({command:`cf api-gateway user-schemas edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zoneId??`<zoneId>`}/api_gateway/user_schemas/${e.schemaId??`<schemaId>`}`,pathParams:{zoneId:String(e.zoneId??``),schemaId:String(e.schemaId??``)},bodyKind:`json`,body:{body:e.body},validation:`passed`});return}let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let n=s(e.body);c(await u(`Updating user schema`,async()=>t.patch(`/zones/${e.zoneId}/api_gateway/user_schemas/${e.schemaId}`,{body:n})),{successLabel:`Updated user schema`});return}c(await u(`Updating user schema`,async()=>t.apiGateway.userSchemas.edit(n,e.schemaId)),{successLabel:`Updated user schema`})}},me={command:`get`,describe:`Gets detailed information about a specific uploaded OpenAPI schema, including its contents and validation configuration.`,builder:e=>e.option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`,default:!1}),handler:async e=>{let t={};e.omitSource!==void 0&&(t.omit_source=e.omitSource);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading user schema`,async()=>n.apiGateway.userSchemas.get(a,e.schemaId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded user schema`})}},he={command:`list`,describe:`Lists all unique hosts found in uploaded OpenAPI schemas for the zone. Useful for understanding which domains have schema coverage.`,builder:e=>e,handler:async e=>{let t=await r(e),n=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,c(await u(`Loading hosts`,async()=>t.apiGateway.userSchemas.hosts.list(n)),{successLabel:`Loaded hosts`})}},ge={command:`hosts`,describe:`User-uploaded OpenAPI schemas for validating API request and response payloads`,builder:e=>e.command(he).demandCommand(1),handler:()=>{}},_e={command:`list`,describe:`Lists all OpenAPI schemas uploaded to API Shield for the zone, including their validation status and associated operations.`,builder:e=>e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`omit-source`,{type:`boolean`,description:`Omit the source-files of schemas and only retrieve their meta-data.`,default:!1}).option(`validation-enabled`,{type:`string`,description:`Flag whether schema is enabled for validation.`}),handler:async e=>{let t={};e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.omitSource!==void 0&&(t.omit_source=e.omitSource),e.validationEnabled!==void 0&&(t.validation_enabled=e.validationEnabled);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading user schemas`,async()=>n.apiGateway.userSchemas.list(a,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded user schemas`})}},ve={command:`list`,describe:`Retrieves all operations from the schema. Operations that already exist in API Shield Endpoint Management will be returned as full operations.`,builder:e=>e.option(`feature`,{type:`string`,description:`Add feature(s) to the results. The feature name that is given here corresponds to the resulting feature object. Have a look at the top-level object description for more details on the specific meaning.`}).option(`host`,{type:`string`,description:`Filter results to only include the specified hosts.`}).option(`method`,{type:`string`,description:`Filter results to only include the specified HTTP methods.`}).option(`endpoint`,{type:`string`,description:`Filter results to only include endpoints containing this pattern.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`operation-status`,{type:`string`,description:"Filter results by whether operations exist in API Shield Endpoint Management or not. `new` will just return operations from the schema that do not exist in API Shield Endpoint Management. `existing` will just return operations from the schema that already exist in API Shield Endpoint Management.",choices:[`new`,`existing`]}),handler:async e=>{let t={};e.feature!==void 0&&(t.feature=e.feature),e.host!==void 0&&(t.host=e.host),e.method!==void 0&&(t.method=e.method),e.endpoint!==void 0&&(t.endpoint=e.endpoint),e.page!==void 0&&(t.page=e.page),e.perPage!==void 0&&(t.per_page=e.perPage),e.operationStatus!==void 0&&(t.operation_status=e.operationStatus);let n=await r(e),a=await i({zone:e.zone},n,{quiet:e.quiet});e.zoneId=a,c(await u(`Loading operations`,async()=>n.apiGateway.userSchemas.operations.list(a,e.schemaId,Object.keys(t).length>0?t:void 0)),{successLabel:`Loaded operations`})}},ye={command:`operations`,describe:`User-uploaded OpenAPI schemas for validating API request and response payloads`,builder:e=>e.command(ve).demandCommand(1),handler:()=>{}},be={command:`user-schemas`,describe:`User-uploaded OpenAPI schemas for validating API request and response payloads`,builder:e=>e.command(fe).command(pe).command($).command(me).command(_e).command(ge).command(ye).demandCommand(1),handler:()=>{}},xe={command:`api-gateway`,describe:`Discover, monitor, and protect your API endpoints with schema validation, abuse detection, and routing`,builder:e=>e.command(ee).command(v).command(x).command(R).command(ie).command(oe).command(de).command(be).demandCommand(1),handler:()=>{}};export{xe as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{m as e,t,u as n}from"./auth-BHD_B2p9.mjs";import{n as r}from"./input-validation-BpVQi9rR.mjs";import{n as i,t as a}from"./body-parser-iA3vRFmh.mjs";import{t as o}from"./output-CqGQp2r6.mjs";import{t as s}from"./dry-run-FV0pZwdg.mjs";import{t as c}from"./progress-5sHFvwez.mjs";const l={command:`edit`,describe:`Configures the value of the Argo Smart Routing enablement setting.`,builder:e=>e.option(`value`,{type:`string`,description:`Specifies the enablement value of Argo Smart Routing.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Configures the enablement of Argo Smart Routing.`}),handler:async l=>{if(l.dryRun){s({command:`cf argo smart-routing edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zoneId??`<zoneId>`}/argo/smart_routing`,pathParams:{zoneId:String(l.zoneId??``)},bodyKind:`json`,body:{value:l.value,body:l.body},validation:`passed`});return}let u=await t(l);if(l.zoneId=await n({zone:l.zone},u,{quiet:l.quiet}),l.body){let e=a(l.body);o(await c(`Updating smart routing`,async()=>u.patch(`/zones/${l.zoneId}/argo/smart_routing`,{body:e})),{successLabel:`Updated smart routing`});return}l.value===void 0&&(l.value=await e(`value`,`Specifies the enablement value of Argo Smart Routing.`,[`on`,`off`]));let d={};l.value!==void 0&&i(d,[`value`],r(l.value,`value`,`text`)),o(await c(`Updating smart routing`,async()=>u.patch(`/zones/${l.zoneId}/argo/smart_routing`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated smart routing`})}},u={command:`get`,describe:`Retrieves the value of Argo Smart Routing enablement setting.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading smart routing`,async()=>r.argo.smartRouting.get(i)),{successLabel:`Loaded smart routing`})}},d={command:`smart-routing`,describe:`Route traffic through the fastest network paths to your origin using real-time latency data`,builder:e=>e.command(l).command(u).demandCommand(1),handler:()=>{}},f={command:`edit`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:e=>e.option(`value`,{type:`string`,description:`Enables Tiered Caching.`,choices:[`on`,`off`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Tiered Caching.`}),handler:async l=>{if(l.dryRun){s({command:`cf argo tiered-caching edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${l.zoneId??`<zoneId>`}/argo/tiered_caching`,pathParams:{zoneId:String(l.zoneId??``)},bodyKind:`json`,body:{value:l.value,body:l.body},validation:`passed`});return}let u=await t(l);if(l.zoneId=await n({zone:l.zone},u,{quiet:l.quiet}),l.body){let e=a(l.body);o(await c(`Updating tiered caching`,async()=>u.patch(`/zones/${l.zoneId}/argo/tiered_caching`,{body:e})),{successLabel:`Updated tiered caching`});return}l.value===void 0&&(l.value=await e(`value`,`Enables Tiered Caching.`,[`on`,`off`]));let d={};l.value!==void 0&&i(d,[`value`],r(l.value,`value`,`text`)),o(await c(`Updating tiered caching`,async()=>u.patch(`/zones/${l.zoneId}/argo/tiered_caching`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated tiered caching`})}},p={command:`get`,describe:`Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`,builder:e=>e,handler:async e=>{let r=await t(e),i=await n({zone:e.zone},r,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading tiered caching`,async()=>r.argo.tieredCaching.get(i)),{successLabel:`Loaded tiered caching`})}},m={command:`tiered-caching`,describe:`Reduce origin load by having upper-tier data centers serve cache misses before reaching your origin`,builder:e=>e.command(f).command(p).demandCommand(1),handler:()=>{}},h={command:`argo`,describe:`Network optimization features that speed up and improve reliability of traffic to your origins`,builder:e=>e.command(d).command(m).demandCommand(1),handler:()=>{}};export{h as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{o as e,t}from"./auth-BHD_B2p9.mjs";import{t as n}from"./output-CqGQp2r6.mjs";import{t as r}from"./local-OqhVQbv0.mjs";import{t as i}from"./progress-5sHFvwez.mjs";const a={command:`list`,describe:`Gets a list of audit logs for an account. Can be filtered by who made the change, on which zone, and the timeframe of the change.`,builder:e=>e.option(`id`,{type:`string`,description:`Finds a specific log by its ID.`}).option(`export`,{type:`boolean`,description:`Indicates that this request is an export of logs in CSV format.`,default:!1}).option(`action-type`,{type:`string`,description:`Filters by the action type.`}).option(`actor-ip`,{type:`string`,description:`Filters by the IP address of the request that made the change by specific IP address or valid CIDR Range.`}).option(`actor-email`,{type:`string`,description:`Filters by the email address of the actor that made the change.`}).option(`since`,{type:`string`,description:`Since`}).option(`before`,{type:`string`,description:`Before`}).option(`zone-name`,{type:`string`,description:`Filters by the name of the zone associated to the change.`}).option(`direction`,{type:`string`,description:`Changes the direction of the chronological sorting.`,choices:[`desc`,`asc`]}).option(`per-page`,{type:`number`,description:`Sets the number of results to return per page.`}).option(`page`,{type:`number`,description:`Defines which page of results to return.`}).option(`hide-user-logs`,{type:`boolean`,description:`Indicates whether or not to hide user level audit logs.`,default:!1}),handler:async a=>{let o={};a.id!==void 0&&(o.id=a.id),a.export!==void 0&&(o.export=a.export),a.actionType!==void 0&&(o.actionType=a.actionType),a.actorIp!==void 0&&(o.actorIp=a.actorIp),a.actorEmail!==void 0&&(o.actorEmail=a.actorEmail),a.since!==void 0&&(o.since=a.since),a.before!==void 0&&(o.before=a.before),a.zoneName!==void 0&&(o.zoneName=a.zoneName),a.direction!==void 0&&(o.direction=a.direction),a.perPage!==void 0&&(o.per_page=a.perPage),a.page!==void 0&&(o.page=a.page),a.hideUserLogs!==void 0&&(o.hide_user_logs=a.hideUserLogs);let s=await t(a),c=a.local?r:await e(s);a.accountId=c,n(await i(`Loading audit logs`,async()=>s.auditLogs.list(c,Object.keys(o).length>0?o:void 0)),{successLabel:`Loaded audit logs`})}},o={command:`audit-logs`,describe:`Immutable audit trail of actions taken by account members — who changed what and when`,builder:e=>e.command(a).demandCommand(1),handler:()=>{}};export{o as default};