cf 0.4.0 → 0.5.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 (220) hide show
  1. package/README.md +7 -1
  2. package/dist/{abuse-reports-Dy76QPNP.mjs → abuse-reports-Ina5TlsU.mjs} +2 -2
  3. package/dist/{accounts-CjtZ8x1z.mjs → accounts-B_joQcMi.mjs} +9 -9
  4. package/dist/{acm-C2lYIWs1.mjs → acm-_kIHqYME.mjs} +2 -2
  5. package/dist/{addressing-CHFK6uxW.mjs → addressing-CaFlw8y1.mjs} +10 -10
  6. package/dist/{agent-context-CgGCT0xU.mjs → agent-context-DMPfi54f.mjs} +1 -1
  7. package/dist/ai-CqnhNb_c.mjs +2 -0
  8. package/dist/ai-gateway-pgYGI519.mjs +8 -0
  9. package/dist/ai-search-eqQMPQol.mjs +7 -0
  10. package/dist/ai_gateway--vuVLnOm.mjs +4 -0
  11. package/dist/{alerting-Bk85NNf5.mjs → alerting-CPxHiYHb.mjs} +5 -5
  12. package/dist/{analytics-CkhhhZWZ.mjs → analytics-DSSRDZz8.mjs} +1 -1
  13. package/dist/analytics_engine-gWyfnsCs.mjs +2 -0
  14. package/dist/{api-gateway-CWdR4Ne7.mjs → api-gateway-BXXGFCVR.mjs} +10 -10
  15. package/dist/argo-aC6A3JyX.mjs +2 -0
  16. package/dist/artifacts-HD4V2xpK.mjs +4 -0
  17. package/dist/audit-logs-BuExU_nz.mjs +2 -0
  18. package/dist/auth-CSC4yhEJ.mjs +9 -0
  19. package/dist/auth-D5hNsOFq.mjs +5 -0
  20. package/dist/billing-COaghyxl.mjs +2 -0
  21. package/dist/bot-management-DmEzeV1Y.mjs +5 -0
  22. package/dist/botnet-feed-ByEAXAkw.mjs +3 -0
  23. package/dist/brand-protection-dPrGe8sL.mjs +3 -0
  24. package/dist/{browser-rendering-Rae0AUt0.mjs → browser-rendering-BiSGnpBf.mjs} +3 -3
  25. package/dist/{build-BE4o4imx.mjs → build-HuS9-R0V.mjs} +2 -2
  26. package/dist/{cache-B7pRbpTy.mjs → cache-CY-7Lt71.mjs} +4 -4
  27. package/dist/{calls-DXRWsZ8n.mjs → calls-wOQGDWPl.mjs} +3 -3
  28. package/dist/certificate-authorities-CtqzAtxQ.mjs +2 -0
  29. package/dist/client-certificates-CRf41xLe.mjs +3 -0
  30. package/dist/cloud-connector-BA5IRZUP.mjs +2 -0
  31. package/dist/{cloudforce-one-B6HYfk5Z.mjs → cloudforce-one-Bq_qPAWs.mjs} +20 -20
  32. package/dist/{completions-D_9WsLG7.mjs → completions-DOeHPdCG.mjs} +2 -2
  33. package/dist/{config-7CBz8Xm0.mjs → config-B5k-XbwS.mjs} +1 -1
  34. package/dist/connectivity-Bx3MgTHX.mjs +3 -0
  35. package/dist/connector-interrupts-D7ylweJZ.mjs +2 -0
  36. package/dist/connector-telemetry-events-6izV1kbP.mjs +2 -0
  37. package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +2 -0
  38. package/dist/connectors-DRt4e6d_.mjs +3 -0
  39. package/dist/{content-scanning-CnW2A0pv.mjs → content-scanning-Cd2vy5Sz.mjs} +3 -3
  40. package/dist/context-jpewmual.mjs +2 -0
  41. package/dist/{custom-certificates-CnYh6Yi-.mjs → custom-certificates-DYE-9epx.mjs} +3 -3
  42. package/dist/{custom-hostnames-C2upqZso.mjs → custom-hostnames-CtuTdFcX.mjs} +4 -4
  43. package/dist/custom-nameservers-CWqA51in.mjs +3 -0
  44. package/dist/custom-pages-DeUKEFGe.mjs +4 -0
  45. package/dist/d1-DvWY9Gp4.mjs +4 -0
  46. package/dist/data-security-BPo6dIWu.mjs +6 -0
  47. package/dist/dcv-delegation-Bgf86J-r.mjs +2 -0
  48. package/dist/{deploy-KBRFIatG.mjs → deploy-dVrgDUOp.mjs} +1 -1
  49. package/dist/{dev-pPazzZvt.mjs → dev-C01_Lby6.mjs} +1 -1
  50. package/dist/diagnostics-6nKPmVgz.mjs +3 -0
  51. package/dist/{dispatch-namespaces-Cz2rajnP.mjs → dispatch-namespaces-64lXx2WJ.mjs} +6 -6
  52. package/dist/{dist-DpDjsWWn.mjs → dist-C6zxsVdY.mjs} +2 -2
  53. package/dist/{dist-DA54ZQu0.mjs → dist-t_YrL25p.mjs} +1 -1
  54. package/dist/{dns-62t95Xif.mjs → dns-ClciFGxx.mjs} +13 -13
  55. package/dist/dns-firewall-DfUmXDCe.mjs +57 -0
  56. package/dist/durable-objects-CMaYZ-YU.mjs +2 -0
  57. package/dist/{email-routing-BDUYYeV3.mjs → email-routing-CGXhFqF5.mjs} +9 -9
  58. package/dist/{email-security-ChHA6eqQ.mjs → email-security-D5viPq8S.mjs} +7 -7
  59. package/dist/email-sending-C2jpc3gh.mjs +3 -0
  60. package/dist/{filters-qJpU9uAS.mjs → filters-bzsFcWt0.mjs} +3 -3
  61. package/dist/{firewall-C3DDwfwh.mjs → firewall-DYZcTtIC.mjs} +10 -10
  62. package/dist/{fraud-DY3YXFVf.mjs → fraud-C03MtdZb.mjs} +1 -1
  63. package/dist/google-tag-gateway-Dfy887yA.mjs +2 -0
  64. package/dist/{healthchecks-Drvb79v0.mjs → healthchecks-DRoAlWgr.mjs} +3 -3
  65. package/dist/hostnames-CFgIVI3s.mjs +3 -0
  66. package/dist/hyperdrive-C7-gwTSV.mjs +18 -0
  67. package/dist/iam-DqVPzGrb.mjs +6 -0
  68. package/dist/{images-D1jI3r3O.mjs → images-BYfl4YgR.mjs} +6 -6
  69. package/dist/index.mjs +1 -1
  70. package/dist/intel-duTEPIHc.mjs +3 -0
  71. package/dist/{ips-B6JETVOY.mjs → ips-nv9INuWZ.mjs} +1 -1
  72. package/dist/keyless-certificates-CRCDVd3g.mjs +3 -0
  73. package/dist/{kv-CSWoD9ks.mjs → kv-CZoV4tiv.mjs} +4 -4
  74. package/dist/leaked-credential-checks-DNIBg7Pe.mjs +3 -0
  75. package/dist/{load-balancers-Du1tNuUt.mjs → load-balancers--OMg0HNt.mjs} +5 -5
  76. package/dist/{logpush-SuJyO-uX.mjs → logpush-C0_lZTyY.mjs} +3 -3
  77. package/dist/{logs-DcDNRPRl.mjs → logs-BtpWZQfV.mjs} +2 -2
  78. package/dist/magic-cloud-networking-u6rwYbGg.mjs +5 -0
  79. package/dist/{magic-network-monitoring-CqtvOePQ.mjs → magic-network-monitoring-CKgQyRj4.mjs} +3 -3
  80. package/dist/{magic-transit-BTbkhBtF.mjs → magic-transit-CLhMcJ_-.mjs} +32 -32
  81. package/dist/managed-transforms-D0Z2mlth.mjs +3 -0
  82. package/dist/mtls-certificates-BL65NK5T.mjs +3 -0
  83. package/dist/{network-interconnects-DsiNytOU.mjs → network-interconnects-Bgu9gmaG.mjs} +5 -5
  84. package/dist/oauth-Bk-F-tIO.mjs +52 -0
  85. package/dist/{observability-CLqZ7OSi.mjs → observability-BynRbTF4.mjs} +3 -3
  86. package/dist/{open-YWOUIZ5Y-BpqIuBsR.mjs → open-YWOUIZ5Y-3jqSKAB1.mjs} +1 -1
  87. package/dist/{organizations-aRi1bhFC.mjs → organizations-BqJHyvMK.mjs} +3 -3
  88. package/dist/origin-ca-certificates-BGvYwm3C.mjs +3 -0
  89. package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +2 -0
  90. package/dist/{origin-tls-client-auth-CnQNy9-l.mjs → origin-tls-client-auth-d3snC3vr.mjs} +3 -3
  91. package/dist/{output-CUxZRM5A.mjs → output-B6fBFRqe.mjs} +1 -1
  92. package/dist/{page-rules-CYqtPU1p.mjs → page-rules-EZHJePmn.mjs} +4 -4
  93. package/dist/{page-shield-D8l9ZMUl.mjs → page-shield-CXJioWPs.mjs} +5 -5
  94. package/dist/{pages-ChurJ2H7.mjs → pages-D4aYteKk.mjs} +8 -8
  95. package/dist/{pipelines-CeyujvRf.mjs → pipelines-G8Iusxq-.mjs} +5 -5
  96. package/dist/progress-DrDErV9w.mjs +2 -0
  97. package/dist/queues-DEkbKqZX.mjs +6 -0
  98. package/dist/{r2-BtuTO3vQ.mjs → r2-CV0IkCAW.mjs} +9 -9
  99. package/dist/r2-data-catalog-NtqGC_a_.mjs +14 -0
  100. package/dist/{radar-CzGM92uM.mjs → radar-D986zPJr.mjs} +1 -1
  101. package/dist/{rate-limits-Bbk7HxP7.mjs → rate-limits-B2wRsUX1.mjs} +3 -3
  102. package/dist/raw-fetch-_n0lMAnD.mjs +2 -0
  103. package/dist/{realtime-kit-CivLpkpg.mjs → realtime-kit-Ld3c5eU6.mjs} +9 -9
  104. package/dist/{registrar-8IeA5DKd.mjs → registrar-CDIwTz3G.mjs} +6 -6
  105. package/dist/request-tracers-D7SFMDik.mjs +2 -0
  106. package/dist/{resource-sharing-B-Pcto7-.mjs → resource-sharing-YIQ04jXE.mjs} +4 -4
  107. package/dist/{resource-tagging-Bpb6Qq1M.mjs → resource-tagging-Bd6Y03sg.mjs} +7 -7
  108. package/dist/rules-DHjLP5Kx.mjs +4 -0
  109. package/dist/{rulesets-lYczEcJp.mjs → rulesets-q4QABpKs.mjs} +7 -7
  110. package/dist/rum-SmT4HZmM.mjs +4 -0
  111. package/dist/{schema-hefO-tzo.mjs → schema-BR31o4P6.mjs} +1 -1
  112. package/dist/{schema-validation-DTq517Em.mjs → schema-validation-vVetgC_P.mjs} +5 -5
  113. package/dist/{scim-BiLfOQ89.mjs → scim-ChOkZpNx.mjs} +2 -2
  114. package/dist/{session-CsvPYFj8.mjs → sdk-DhIhH6GB.mjs} +4 -4
  115. package/dist/{secrets-store-CBX0dvHL.mjs → secrets-store-BAK9G12O.mjs} +12 -12
  116. package/dist/security-center-eScuYDKP.mjs +2 -0
  117. package/dist/security-txt-x7R4gmQu.mjs +3 -0
  118. package/dist/session-DHYCE-PM.mjs +93 -0
  119. package/dist/shared-BAjo72Lz.mjs +2 -0
  120. package/dist/{smart-shield-DblHIce0.mjs → smart-shield-CWlSsNi8.mjs} +2 -2
  121. package/dist/snippets-DrlgYJYp.mjs +4 -0
  122. package/dist/{spawn-DK7pott_.mjs → spawn-CCGzKlC4.mjs} +1 -1
  123. package/dist/{spectrum-CnrG0jIC.mjs → spectrum-pVGxb7u5.mjs} +6 -6
  124. package/dist/speed-ZFrMWDgd.mjs +4 -0
  125. package/dist/src-DU7FBCOX.mjs +108 -0
  126. package/dist/ssl-9JY05sYt.mjs +15 -0
  127. package/dist/{stream-CGTRN4ZN.mjs → stream-tRU39b8K.mjs} +13 -13
  128. package/dist/{tenants-o_M62Y1n.mjs → tenants-HLGUazms.mjs} +1 -1
  129. package/dist/{token-validation-Ca5AGEns.mjs → token-validation-_VdamKpz.mjs} +4 -4
  130. package/dist/{tools-DtNNmO6l.mjs → tools-D_hfUU_Z.mjs} +1 -1
  131. package/dist/{turnstile-l7mo9BWL.mjs → turnstile-BRzXd28B.mjs} +4 -4
  132. package/dist/{ui-B97lRnOv.mjs → ui-erjBdVKL.mjs} +1 -1
  133. package/dist/url-normalization-D-NxuLtN.mjs +3 -0
  134. package/dist/url-scanner-BzzR6iDx.mjs +2 -0
  135. package/dist/{user-CiyYZ69X.mjs → user-C4omq__w.mjs} +1 -1
  136. package/dist/vectorize-By6EqcNR.mjs +4 -0
  137. package/dist/{versions-B6E8WQyA.mjs → versions-CBHwWPAM.mjs} +1 -1
  138. package/dist/{waiting-rooms-Bhy_nuV3.mjs → waiting-rooms-u6KwrzWd.mjs} +6 -6
  139. package/dist/{web3-DlHE0CZc.mjs → web3-DQ5dmE9W.mjs} +3 -3
  140. package/dist/{workers-DRAkU6YR.mjs → workers-D8Be7_as.mjs} +14 -14
  141. package/dist/workers-builds-BE3W3qNk.mjs +7 -0
  142. package/dist/{workflows-z6oapEJs.mjs → workflows-BWWufqFA.mjs} +3 -3
  143. package/dist/zaraz-Bsa9AvVL.mjs +2 -0
  144. package/dist/{zero-trust-fyyIelWx.mjs → zero-trust-UNVZFnKu.mjs} +87 -87
  145. package/dist/zero_trust-B0_Rk4p2.mjs +3 -0
  146. package/dist/{zones-MSULnDwW.mjs → zones-BXtdwt6E.mjs} +6 -6
  147. package/package.json +1 -1
  148. package/dist/ai-DS3i-I1a.mjs +0 -2
  149. package/dist/ai-gateway-RIsegO2x.mjs +0 -8
  150. package/dist/ai-search-Dcj4BauG.mjs +0 -7
  151. package/dist/ai_gateway-w7YwfcPE.mjs +0 -4
  152. package/dist/analytics_engine-B7qgDJCA.mjs +0 -2
  153. package/dist/argo-DnJRVnGX.mjs +0 -2
  154. package/dist/artifacts-BVWKiJUl.mjs +0 -4
  155. package/dist/audit-logs-DjTstbzL.mjs +0 -2
  156. package/dist/auth-BqDOIrKX.mjs +0 -150
  157. package/dist/auth-DKkSwnxh.mjs +0 -5
  158. package/dist/billing-3rEqF83h.mjs +0 -2
  159. package/dist/bot-management-CJxD1pqi.mjs +0 -5
  160. package/dist/botnet-feed-MG91D7BR.mjs +0 -3
  161. package/dist/brand-protection-CK7gJi06.mjs +0 -3
  162. package/dist/certificate-authorities-BR3gXBLs.mjs +0 -2
  163. package/dist/client-certificates-B0ebLJdk.mjs +0 -3
  164. package/dist/cloud-connector-BOjaggJk.mjs +0 -2
  165. package/dist/connectivity-welFvZ7X.mjs +0 -3
  166. package/dist/connector-interrupts-DTV3F-50.mjs +0 -2
  167. package/dist/connector-telemetry-events-kDqb_AGm.mjs +0 -2
  168. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +0 -2
  169. package/dist/connectors-3vjrdFLB.mjs +0 -3
  170. package/dist/context-CONbNKO-.mjs +0 -2
  171. package/dist/custom-nameservers-BGkAD_PZ.mjs +0 -3
  172. package/dist/custom-pages-5fCSP8in.mjs +0 -4
  173. package/dist/d1-CyiRbZZn.mjs +0 -4
  174. package/dist/data-security-Casx4OS_.mjs +0 -6
  175. package/dist/dcv-delegation-DVYO10oA.mjs +0 -2
  176. package/dist/diagnostics-BqYDoDfw.mjs +0 -3
  177. package/dist/dns-firewall-Coy8d47t.mjs +0 -57
  178. package/dist/durable-objects-BSuRERkw.mjs +0 -2
  179. package/dist/email-sending-CVrRqn6S.mjs +0 -3
  180. package/dist/google-tag-gateway-B00MHDfB.mjs +0 -2
  181. package/dist/hostnames-BdAQo1Mr.mjs +0 -3
  182. package/dist/hyperdrive-99OJV9nl.mjs +0 -18
  183. package/dist/iam-BRbpg3lN.mjs +0 -6
  184. package/dist/intel-C3ajLpXd.mjs +0 -3
  185. package/dist/keyless-certificates-C4MZ4xnf.mjs +0 -3
  186. package/dist/leaked-credential-checks-Dgs2oKm9.mjs +0 -3
  187. package/dist/magic-cloud-networking-D-T0RCvi.mjs +0 -5
  188. package/dist/managed-transforms-CfUBSz9p.mjs +0 -3
  189. package/dist/mtls-certificates-Cf1O8c2E.mjs +0 -3
  190. package/dist/origin-ca-certificates-BB4H89a_.mjs +0 -3
  191. package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +0 -2
  192. package/dist/progress-Cent9Lsg.mjs +0 -2
  193. package/dist/queues-Rf_n11Cx.mjs +0 -6
  194. package/dist/r2-data-catalog-Debz38kv.mjs +0 -14
  195. package/dist/raw-fetch-DnbAMFBp.mjs +0 -2
  196. package/dist/request-tracers-D1aH4NmL.mjs +0 -2
  197. package/dist/rules-B10XWY10.mjs +0 -4
  198. package/dist/rum-B5GUKa4I.mjs +0 -4
  199. package/dist/security-center-AVpTOBK3.mjs +0 -2
  200. package/dist/security-txt-DVlh8y9l.mjs +0 -3
  201. package/dist/shared-0bwWVDLo.mjs +0 -2
  202. package/dist/snippets-DrpqSXYC.mjs +0 -4
  203. package/dist/speed-BzRY3Xlh.mjs +0 -4
  204. package/dist/src-D9_Gq68b.mjs +0 -108
  205. package/dist/ssl-Cp6tQkZH.mjs +0 -15
  206. package/dist/url-normalization-D1CogSIG.mjs +0 -3
  207. package/dist/url-scanner-BnJHJqcz.mjs +0 -2
  208. package/dist/vectorize-D3LgMLOn.mjs +0 -4
  209. package/dist/workers-builds-BmNjiHDZ.mjs +0 -7
  210. package/dist/zaraz-CyzfYOEU.mjs +0 -2
  211. package/dist/zero_trust-BAhlNkjo.mjs +0 -3
  212. /package/dist/{body-parser-CBpeIUns.mjs → body-parser-DWSy7uZ8.mjs} +0 -0
  213. /package/dist/{chunk-6IEM75FG-U3L9fKgi.mjs → chunk-6IEM75FG-BEjRFMGh.mjs} +0 -0
  214. /package/dist/{cli-types-CMNMD1V7.mjs → cli-types-BeyOc81z.mjs} +0 -0
  215. /package/dist/{input-validation-CTqtyiY9.mjs → input-validation-_fMCApaH.mjs} +0 -0
  216. /package/dist/{lib-B6xvCJjc.mjs → lib-4PQI6yRW.mjs} +0 -0
  217. /package/dist/{local-D8bhHUMK.mjs → local-CYc9q7l2.mjs} +0 -0
  218. /package/dist/{metadata-jh2EIan8.mjs → metadata-OOwvpR8m.mjs} +0 -0
  219. /package/dist/{resolve-D1mG0REg.mjs → resolve-C3h-mwp7.mjs} +0 -0
  220. /package/dist/{theme-CFHr0Dh9.mjs → theme-DbNbIY4d.mjs} +0 -0
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,D as t,E as n,T as r,_ as i,n as a}from"./auth-BqDOIrKX.mjs";import{n as o,t as s}from"./body-parser-CBpeIUns.mjs";import{t as c}from"./output-CUxZRM5A.mjs";import{n as l,t as u}from"./progress-Cent9Lsg.mjs";import{n as d}from"./input-validation-CTqtyiY9.mjs";import{t as f}from"./local-D8bhHUMK.mjs";function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`list`,describe:`Gets a list of all alert types for which an account is eligible.`,builder:p,handler:async t=>{if(t.dryRun){l({command:`cf alerting available-alerts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/available_alerts`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.availableAlerts.list({account_id:r})),{successLabel:`Loaded`})}},h={command:`available-alerts`,describe:`List the alert types available for your account based on enabled products`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ee(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Get a list of all delivery mechanism types for which an account is eligible.`,builder:ee,handler:async t=>{if(t.dryRun){l({command:`cf alerting destinations eligible get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/eligible`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.destinations.eligible.get({account_id:r})),{successLabel:`Loaded`})}},_={command:`eligible`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`create`,describe:`Creates a new token for integrating with PagerDuty.`,builder:v,handler:async t=>{if(t.dryRun){l({command:`cf alerting destinations pagerduty create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Creating`,async()=>n.alerting.destinations.pagerduty.create({account_id:r})),{successLabel:`Created`})}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete`,describe:`Deletes all the PagerDuty Services connected to the account.`,builder:b,handler:async t=>{if(t.dryRun){l({command:`cf alerting destinations pagerduty delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}c(await u(`Deleting`,async()=>n.alerting.destinations.pagerduty.delete({account_id:o})),{successLabel:`Deleted`})}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Get a list of all configured PagerDuty services.`,builder:S,handler:async t=>{if(t.dryRun){l({command:`cf alerting destinations pagerduty get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.destinations.pagerduty.get({account_id:r})),{successLabel:`Loaded`})}};function w(e){return e.positional(`token-id`,{type:`string`,description:`The token integration key`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`link <token-id>`,describe:`Links PagerDuty with the account using the integration token.`,builder:w,handler:async t=>{if(t.dryRun){l({command:`cf alerting destinations pagerduty link`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect/${t[`token-id`]==null?`<token-id>`:encodeURIComponent(String(t[`token-id`]))}`,pathParams:{"token-id":String(t[`token-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.destinations.pagerduty.link({account_id:r,token_id:t[`token-id`]})),{successLabel:`Loaded`})}},E={command:`pagerduty`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(y).command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return 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)`})}const O={command:`create`,describe:`Creates a new webhook destination.`,builder:D,handler:async n=>{if(n.dryRun){l({command:`cf alerting destinations webhooks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`),secret:d(n.secret,`secret`,`text`),url:d(n.url,`url`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>r.alerting.destinations.webhooks.create({...e,account_id:p})),{successLabel:`Created`});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 m=s({name:d(n.name,`name`,`text`),secret:d(n.secret,`secret`,`text`),url:d(n.url,`url`,`text`)});c(await u(`Creating`,async()=>r.alerting.destinations.webhooks.create({...m,account_id:p})),{successLabel:`Created`})}};function k(e){return e.positional(`webhook-id`,{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})}const A={command:`delete <webhook-id>`,describe:`Delete a configured webhook destination.`,builder:k,handler:async t=>{if(t.dryRun){l({command:`cf alerting destinations webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/webhooks/${t[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(t[`webhook-id`]))}`,pathParams:{"webhook-id":String(t[`webhook-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}c(await u(`Deleting`,async()=>n.alerting.destinations.webhooks.delete({account_id:o,webhook_id:t[`webhook-id`]})),{successLabel:`Deleted`})}};function j(e){return e.positional(`webhook-id`,{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})}const M={command:`get <webhook-id>`,describe:`Get details for a single webhooks destination.`,builder:j,handler:async t=>{if(t.dryRun){l({command:`cf alerting destinations webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/webhooks/${t[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(t[`webhook-id`]))}`,pathParams:{"webhook-id":String(t[`webhook-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.destinations.webhooks.get({account_id:r,webhook_id:t[`webhook-id`]})),{successLabel:`Loaded`})}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`list`,describe:`Gets a list of all configured webhook destinations.`,builder:N,handler:async t=>{if(t.dryRun){l({command:`cf alerting destinations webhooks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.destinations.webhooks.list({account_id:r})),{successLabel:`Loaded`})}};function F(e){return e.positional(`webhook-id`,{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)`})}const I={command:`update <webhook-id>`,describe:`Update a webhook destination.`,builder:F,handler:async n=>{if(n.dryRun){l({command:`cf alerting destinations webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/destinations/webhooks/${n[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(n[`webhook-id`]))}`,pathParams:{"webhook-id":String(n[`webhook-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`),secret:d(n.secret,`secret`,`text`),url:d(n.url,`url`,`text`)}):o(n.body)});return}let r=await a(n),p=n.local?f:await i(r);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>r.alerting.destinations.webhooks.update({...e,account_id:p,webhook_id:n[`webhook-id`]})),{successLabel:`Updated`});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 m=s({name:d(n.name,`name`,`text`),secret:d(n.secret,`secret`,`text`),url:d(n.url,`url`,`text`)});c(await u(`Updating`,async()=>r.alerting.destinations.webhooks.update({...m,account_id:p,webhook_id:n[`webhook-id`]})),{successLabel:`Updated`})}},L={command:`webhooks`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(O).command(A).command(M).command(P).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(_).command(E).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return e.option(`per-page`,{type:`number`,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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={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:z,handler:async t=>{let n={per_page:t[`per-page`],before:t.before,page:t.page,since:t.since};if(t.dryRun){l({command:`cf alerting history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/history`,pathParams:{},query:n,bodyKind:`none`});return}let r=await a(t),o=t.local?f:await i(r);t.accountId=o,c(await u(`Loading`,async()=>r.alerting.history.list({account_id:o,...n})),{successLabel:`Loaded`})}},B={command:`history`,describe:`Browse previously sent alert notifications and their delivery status`,builder:e=>e.command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return 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)`})}const H={command:`create`,describe:`Creates a new Notification policy.`,builder:V,handler:async r=>{if(r.dryRun){l({command:`cf alerting policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`json`,body:r.body===void 0?s({alert_interval:d(r[`alert-interval`],`alert-interval`,`text`),alert_type:d(r[`alert-type`],`alert-type`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled,filters:{actions:r[`filters-actions`],affected_asns:r[`filters-affected-asns`],affected_components:r[`filters-affected-components`],affected_locations:r[`filters-affected-locations`],airport_code:r[`filters-airport-code`],alert_trigger_preferences:r[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:r[`filters-alert-trigger-preferences-value`],enabled:r[`filters-enabled`],environment:r[`filters-environment`],event:r[`filters-event`],event_source:r[`filters-event-source`],event_type:r[`filters-event-type`],group_by:r[`filters-group-by`],health_check_id:r[`filters-health-check-id`],incident_impact:r[`filters-incident-impact`],input_id:r[`filters-input-id`],insight_class:r[`filters-insight-class`],limit:r[`filters-limit`],logo_tag:r[`filters-logo-tag`],megabits_per_second:r[`filters-megabits-per-second`],new_health:r[`filters-new-health`],new_status:r[`filters-new-status`],packets_per_second:r[`filters-packets-per-second`],pool_id:r[`filters-pool-id`],pop_names:r[`filters-pop-names`],product:r[`filters-product`],project_id:r[`filters-project-id`],protocol:r[`filters-protocol`],query_tag:r[`filters-query-tag`],requests_per_second:r[`filters-requests-per-second`],selectors:r[`filters-selectors`],services:r[`filters-services`],slo:r[`filters-slo`],status:r[`filters-status`],target_hostname:r[`filters-target-hostname`],target_ip:r[`filters-target-ip`],target_zone_name:r[`filters-target-zone-name`],traffic_exclusions:r[`filters-traffic-exclusions`],tunnel_id:r[`filters-tunnel-id`],tunnel_name:r[`filters-tunnel-name`],type:r[`filters-type`],where:r[`filters-where`],zones:r[`filters-zones`]},name:d(r.name,`name`,`text`)}):o(r.body)});return}let p=await a(r),m=r.local?f:await i(p);if(r.accountId=m,r.body){let e=o(r.body);c(await u(`Creating`,async()=>p.alerting.policies.create({...e,account_id:m})),{successLabel:`Created`});return}if(r[`alert-type`]===void 0&&(r[`alert-type`]=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(`.`))),r.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await t(`name`,`Name of the policy.`));let h=s({alert_interval:d(r[`alert-interval`],`alert-interval`,`text`),alert_type:d(r[`alert-type`],`alert-type`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled,filters:{actions:r[`filters-actions`],affected_asns:r[`filters-affected-asns`],affected_components:r[`filters-affected-components`],affected_locations:r[`filters-affected-locations`],airport_code:r[`filters-airport-code`],alert_trigger_preferences:r[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:r[`filters-alert-trigger-preferences-value`],enabled:r[`filters-enabled`],environment:r[`filters-environment`],event:r[`filters-event`],event_source:r[`filters-event-source`],event_type:r[`filters-event-type`],group_by:r[`filters-group-by`],health_check_id:r[`filters-health-check-id`],incident_impact:r[`filters-incident-impact`],input_id:r[`filters-input-id`],insight_class:r[`filters-insight-class`],limit:r[`filters-limit`],logo_tag:r[`filters-logo-tag`],megabits_per_second:r[`filters-megabits-per-second`],new_health:r[`filters-new-health`],new_status:r[`filters-new-status`],packets_per_second:r[`filters-packets-per-second`],pool_id:r[`filters-pool-id`],pop_names:r[`filters-pop-names`],product:r[`filters-product`],project_id:r[`filters-project-id`],protocol:r[`filters-protocol`],query_tag:r[`filters-query-tag`],requests_per_second:r[`filters-requests-per-second`],selectors:r[`filters-selectors`],services:r[`filters-services`],slo:r[`filters-slo`],status:r[`filters-status`],target_hostname:r[`filters-target-hostname`],target_ip:r[`filters-target-ip`],target_zone_name:r[`filters-target-zone-name`],traffic_exclusions:r[`filters-traffic-exclusions`],tunnel_id:r[`filters-tunnel-id`],tunnel_name:r[`filters-tunnel-name`],type:r[`filters-type`],where:r[`filters-where`],zones:r[`filters-zones`]},name:d(r.name,`name`,`text`)});c(await u(`Creating`,async()=>p.alerting.policies.create({...h,account_id:m})),{successLabel:`Created`})}};function U(e){return e.positional(`policy-id`,{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})}const W={command:`delete <policy-id>`,describe:`Delete a Notification policy.`,builder:U,handler:async t=>{if(t.dryRun){l({command:`cf alerting policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/policies/${t[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(t[`policy-id`]))}`,pathParams:{"policy-id":String(t[`policy-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}c(await u(`Deleting`,async()=>n.alerting.policies.delete({account_id:o,policy_id:t[`policy-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`policy-id`,{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})}const K={command:`get <policy-id>`,describe:`Get details for a single policy.`,builder:G,handler:async t=>{if(t.dryRun){l({command:`cf alerting policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/policies/${t[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(t[`policy-id`]))}`,pathParams:{"policy-id":String(t[`policy-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.policies.get({account_id:r,policy_id:t[`policy-id`]})),{successLabel:`Loaded`})}};function q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`Get a list of all Notification policies.`,builder:q,handler:async t=>{if(t.dryRun){l({command:`cf alerting policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.policies.list({account_id:r})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`policy-id`,{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.`}).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)`})}const X={command:`update <policy-id>`,describe:`Update a Notification policy.`,builder:Y,handler:async t=>{if(t.dryRun){l({command:`cf alerting policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/policies/${t[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(t[`policy-id`]))}`,pathParams:{"policy-id":String(t[`policy-id`]??``)},bodyKind:`json`,body:t.body===void 0?s({alert_interval:d(t[`alert-interval`],`alert-interval`,`text`),alert_type:d(t[`alert-type`],`alert-type`,`text`),description:d(t.description,`description`,`text`),enabled:t.enabled,filters:{actions:t[`filters-actions`],affected_asns:t[`filters-affected-asns`],affected_components:t[`filters-affected-components`],affected_locations:t[`filters-affected-locations`],airport_code:t[`filters-airport-code`],alert_trigger_preferences:t[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:t[`filters-alert-trigger-preferences-value`],enabled:t[`filters-enabled`],environment:t[`filters-environment`],event:t[`filters-event`],event_source:t[`filters-event-source`],event_type:t[`filters-event-type`],group_by:t[`filters-group-by`],health_check_id:t[`filters-health-check-id`],incident_impact:t[`filters-incident-impact`],input_id:t[`filters-input-id`],insight_class:t[`filters-insight-class`],limit:t[`filters-limit`],logo_tag:t[`filters-logo-tag`],megabits_per_second:t[`filters-megabits-per-second`],new_health:t[`filters-new-health`],new_status:t[`filters-new-status`],packets_per_second:t[`filters-packets-per-second`],pool_id:t[`filters-pool-id`],pop_names:t[`filters-pop-names`],product:t[`filters-product`],project_id:t[`filters-project-id`],protocol:t[`filters-protocol`],query_tag:t[`filters-query-tag`],requests_per_second:t[`filters-requests-per-second`],selectors:t[`filters-selectors`],services:t[`filters-services`],slo:t[`filters-slo`],status:t[`filters-status`],target_hostname:t[`filters-target-hostname`],target_ip:t[`filters-target-ip`],target_zone_name:t[`filters-target-zone-name`],traffic_exclusions:t[`filters-traffic-exclusions`],tunnel_id:t[`filters-tunnel-id`],tunnel_name:t[`filters-tunnel-name`],type:t[`filters-type`],where:t[`filters-where`],zones:t[`filters-zones`]},name:d(t.name,`name`,`text`)}):o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.alerting.policies.update({...e,account_id:r,policy_id:t[`policy-id`]})),{successLabel:`Updated`});return}let p=s({alert_interval:d(t[`alert-interval`],`alert-interval`,`text`),alert_type:d(t[`alert-type`],`alert-type`,`text`),description:d(t.description,`description`,`text`),enabled:t.enabled,filters:{actions:t[`filters-actions`],affected_asns:t[`filters-affected-asns`],affected_components:t[`filters-affected-components`],affected_locations:t[`filters-affected-locations`],airport_code:t[`filters-airport-code`],alert_trigger_preferences:t[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:t[`filters-alert-trigger-preferences-value`],enabled:t[`filters-enabled`],environment:t[`filters-environment`],event:t[`filters-event`],event_source:t[`filters-event-source`],event_type:t[`filters-event-type`],group_by:t[`filters-group-by`],health_check_id:t[`filters-health-check-id`],incident_impact:t[`filters-incident-impact`],input_id:t[`filters-input-id`],insight_class:t[`filters-insight-class`],limit:t[`filters-limit`],logo_tag:t[`filters-logo-tag`],megabits_per_second:t[`filters-megabits-per-second`],new_health:t[`filters-new-health`],new_status:t[`filters-new-status`],packets_per_second:t[`filters-packets-per-second`],pool_id:t[`filters-pool-id`],pop_names:t[`filters-pop-names`],product:t[`filters-product`],project_id:t[`filters-project-id`],protocol:t[`filters-protocol`],query_tag:t[`filters-query-tag`],requests_per_second:t[`filters-requests-per-second`],selectors:t[`filters-selectors`],services:t[`filters-services`],slo:t[`filters-slo`],status:t[`filters-status`],target_hostname:t[`filters-target-hostname`],target_ip:t[`filters-target-ip`],target_zone_name:t[`filters-target-zone-name`],traffic_exclusions:t[`filters-traffic-exclusions`],tunnel_id:t[`filters-tunnel-id`],tunnel_name:t[`filters-tunnel-name`],type:t[`filters-type`],where:t[`filters-where`],zones:t[`filters-zones`]},name:d(t.name,`name`,`text`)});c(await u(`Updating`,async()=>n.alerting.policies.update({...p,account_id:r,policy_id:t[`policy-id`]})),{successLabel:`Updated`})}},Z={command:`policies`,describe:`Notification policies that define which events trigger alerts and where they are delivered`,builder:e=>e.command(H).command(W).command(K).command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ne={command:`create`,describe:`Creates a new silence for an account.`,builder:Q,handler:async t=>{if(t.dryRun){l({command:`cf alerting silences create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Creating`,async()=>n.alerting.silences.create({body:e,account_id:r})),{successLabel:`Created`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function re(e){return e.positional(`silence-id`,{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})}const ie={command:`delete <silence-id>`,describe:`Deletes an existing silence for an account.`,builder:re,handler:async t=>{if(t.dryRun){l({command:`cf alerting silences delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/silences/${t[`silence-id`]==null?`<silence-id>`:encodeURIComponent(String(t[`silence-id`]))}`,pathParams:{"silence-id":String(t[`silence-id`]??``)},bodyKind:`none`});return}let n=await a(t),o=t.local?f:await i(n);if(t.accountId=o,!await r({force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}c(await u(`Deleting`,async()=>n.alerting.silences.delete({account_id:o,silence_id:t[`silence-id`]})),{successLabel:`Deleted`})}};function ae(e){return e.positional(`silence-id`,{type:`string`,description:`Silence ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`get <silence-id>`,describe:`Gets a specific silence for an account.`,builder:ae,handler:async t=>{if(t.dryRun){l({command:`cf alerting silences get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/silences/${t[`silence-id`]==null?`<silence-id>`:encodeURIComponent(String(t[`silence-id`]))}`,pathParams:{"silence-id":String(t[`silence-id`]??``)},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.silences.get({account_id:r,silence_id:t[`silence-id`]})),{successLabel:`Loaded`})}};function $(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`list`,describe:`Gets a list of silences for an account.`,builder:$,handler:async t=>{if(t.dryRun){l({command:`cf alerting silences list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`none`});return}let n=await a(t),r=t.local?f:await i(n);t.accountId=r,c(await u(`Loading`,async()=>n.alerting.silences.list({account_id:r})),{successLabel:`Loaded`})}};function ce(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const le={command:`update`,describe:`Updates existing silences for an account.`,builder:ce,handler:async t=>{if(t.dryRun){l({command:`cf alerting silences update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:t.body===void 0?void 0:o(t.body)});return}let n=await a(t),r=t.local?f:await i(n);if(t.accountId=r,t.body){let e=o(t.body);c(await u(`Updating`,async()=>n.alerting.silences.update({body:e,account_id:r})),{successLabel:`Updated`});return}if(t.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ue={command:`silences`,describe:`Silence windows that temporarily suppress alert notifications during maintenance`,builder:e=>e.command(ne).command(ie).command(oe).command(se).command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},de={command:`alerting`,describe:`Notification policies, delivery destinations, silence windows, and alert history`,builder:e=>e.command(h).command(R).command(B).command(Z).command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{de as default};
2
+ import{E as e,S as t,T as n,g as r,w as i}from"./oauth-Bk-F-tIO.mjs";import{n as a}from"./auth-CSC4yhEJ.mjs";import{n as o,t as s}from"./body-parser-DWSy7uZ8.mjs";import{t as c}from"./output-B6fBFRqe.mjs";import{n as l,t as u}from"./progress-DrDErV9w.mjs";import{n as d}from"./input-validation-_fMCApaH.mjs";import{t as f}from"./local-CYc9q7l2.mjs";function p(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`list`,describe:`Gets a list of all alert types for which an account is eligible.`,builder:p,handler:async e=>{if(e.dryRun){l({command:`cf alerting available-alerts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/available_alerts`,pathParams:{},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.availableAlerts.list({account_id:i})),{successLabel:`Loaded`})}},h={command:`available-alerts`,describe:`List the alert types available for your account based on enabled products`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ee(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get`,describe:`Get a list of all delivery mechanism types for which an account is eligible.`,builder:ee,handler:async e=>{if(e.dryRun){l({command:`cf alerting destinations eligible get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/destinations/eligible`,pathParams:{},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.destinations.eligible.get({account_id:i})),{successLabel:`Loaded`})}},_={command:`eligible`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`create`,describe:`Creates a new token for integrating with PagerDuty.`,builder:v,handler:async e=>{if(e.dryRun){l({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`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Creating`,async()=>n.alerting.destinations.pagerduty.create({account_id:i})),{successLabel:`Created`})}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete`,describe:`Deletes all the PagerDuty Services connected to the account.`,builder:b,handler:async e=>{if(e.dryRun){l({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`});return}let n=await a(e),o=e.local?f:await r(n);if(e.accountId=o,!await i({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}c(await u(`Deleting`,async()=>n.alerting.destinations.pagerduty.delete({account_id:o})),{successLabel:`Deleted`})}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get`,describe:`Get a list of all configured PagerDuty services.`,builder:S,handler:async e=>{if(e.dryRun){l({command:`cf alerting destinations pagerduty get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/destinations/pagerduty`,pathParams:{},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.destinations.pagerduty.get({account_id:i})),{successLabel:`Loaded`})}};function w(e){return e.positional(`token-id`,{type:`string`,description:`The token integration key`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`link <token-id>`,describe:`Links PagerDuty with the account using the integration token.`,builder:w,handler:async e=>{if(e.dryRun){l({command:`cf alerting destinations pagerduty link`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/destinations/pagerduty/connect/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.destinations.pagerduty.link({account_id:i,token_id:e[`token-id`]})),{successLabel:`Loaded`})}},E={command:`pagerduty`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(y).command(x).command(C).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return 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)`})}const O={command:`create`,describe:`Creates a new webhook destination.`,builder:D,handler:async n=>{if(n.dryRun){l({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:n.body===void 0?s({name:d(n.name,`name`,`text`),secret:d(n.secret,`secret`,`text`),url:d(n.url,`url`,`text`)}):o(n.body)});return}let i=await a(n),p=n.local?f:await r(i);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Creating`,async()=>i.alerting.destinations.webhooks.create({...e,account_id:p})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await e(`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 e(`url`,`The POST endpoint to call when dispatching a notification.`));let m=s({name:d(n.name,`name`,`text`),secret:d(n.secret,`secret`,`text`),url:d(n.url,`url`,`text`)});c(await u(`Creating`,async()=>i.alerting.destinations.webhooks.create({...m,account_id:p})),{successLabel:`Created`})}};function k(e){return e.positional(`webhook-id`,{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})}const A={command:`delete <webhook-id>`,describe:`Delete a configured webhook destination.`,builder:k,handler:async e=>{if(e.dryRun){l({command:`cf alerting destinations webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/destinations/webhooks/${e[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(e[`webhook-id`]))}`,pathParams:{"webhook-id":String(e[`webhook-id`]??``)},bodyKind:`none`});return}let n=await a(e),o=e.local?f:await r(n);if(e.accountId=o,!await i({force:!!e.force})){process.stderr.write(`Aborted.
4
+ `);return}c(await u(`Deleting`,async()=>n.alerting.destinations.webhooks.delete({account_id:o,webhook_id:e[`webhook-id`]})),{successLabel:`Deleted`})}};function j(e){return e.positional(`webhook-id`,{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})}const M={command:`get <webhook-id>`,describe:`Get details for a single webhooks destination.`,builder:j,handler:async e=>{if(e.dryRun){l({command:`cf alerting destinations webhooks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/destinations/webhooks/${e[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(e[`webhook-id`]))}`,pathParams:{"webhook-id":String(e[`webhook-id`]??``)},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.destinations.webhooks.get({account_id:i,webhook_id:e[`webhook-id`]})),{successLabel:`Loaded`})}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`list`,describe:`Gets a list of all configured webhook destinations.`,builder:N,handler:async e=>{if(e.dryRun){l({command:`cf alerting destinations webhooks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.destinations.webhooks.list({account_id:i})),{successLabel:`Loaded`})}};function F(e){return e.positional(`webhook-id`,{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)`})}const I={command:`update <webhook-id>`,describe:`Update a webhook destination.`,builder:F,handler:async n=>{if(n.dryRun){l({command:`cf alerting destinations webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/destinations/webhooks/${n[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(n[`webhook-id`]))}`,pathParams:{"webhook-id":String(n[`webhook-id`]??``)},bodyKind:`json`,body:n.body===void 0?s({name:d(n.name,`name`,`text`),secret:d(n.secret,`secret`,`text`),url:d(n.url,`url`,`text`)}):o(n.body)});return}let i=await a(n),p=n.local?f:await r(i);if(n.accountId=p,n.body){let e=o(n.body);c(await u(`Updating`,async()=>i.alerting.destinations.webhooks.update({...e,account_id:p,webhook_id:n[`webhook-id`]})),{successLabel:`Updated`});return}n.name===void 0&&(n.name=await e(`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 e(`url`,`The POST endpoint to call when dispatching a notification.`));let m=s({name:d(n.name,`name`,`text`),secret:d(n.secret,`secret`,`text`),url:d(n.url,`url`,`text`)});c(await u(`Updating`,async()=>i.alerting.destinations.webhooks.update({...m,account_id:p,webhook_id:n[`webhook-id`]})),{successLabel:`Updated`})}},L={command:`webhooks`,describe:`Delivery mechanisms for alerts — email, PagerDuty integrations, and webhook endpoints`,builder:e=>e.command(O).command(A).command(M).command(P).command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},R={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(_).command(E).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function z(e){return e.option(`per-page`,{type:`number`,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.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={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:z,handler:async e=>{let n={per_page:e[`per-page`],before:e.before,page:e.page,since:e.since};if(e.dryRun){l({command:`cf alerting history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/history`,pathParams:{},query:n,bodyKind:`none`});return}let i=await a(e),o=e.local?f:await r(i);e.accountId=o,c(await u(`Loading`,async()=>i.alerting.history.list({account_id:o,...n})),{successLabel:`Loaded`})}},B={command:`history`,describe:`Browse previously sent alert notifications and their delivery status`,builder:e=>e.command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return 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)`})}const H={command:`create`,describe:`Creates a new Notification policy.`,builder:V,handler:async i=>{if(i.dryRun){l({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:i.body===void 0?s({alert_interval:d(i[`alert-interval`],`alert-interval`,`text`),alert_type:d(i[`alert-type`],`alert-type`,`text`),description:d(i.description,`description`,`text`),enabled:i.enabled,filters:{actions:i[`filters-actions`],affected_asns:i[`filters-affected-asns`],affected_components:i[`filters-affected-components`],affected_locations:i[`filters-affected-locations`],airport_code:i[`filters-airport-code`],alert_trigger_preferences:i[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:i[`filters-alert-trigger-preferences-value`],enabled:i[`filters-enabled`],environment:i[`filters-environment`],event:i[`filters-event`],event_source:i[`filters-event-source`],event_type:i[`filters-event-type`],group_by:i[`filters-group-by`],health_check_id:i[`filters-health-check-id`],incident_impact:i[`filters-incident-impact`],input_id:i[`filters-input-id`],insight_class:i[`filters-insight-class`],limit:i[`filters-limit`],logo_tag:i[`filters-logo-tag`],megabits_per_second:i[`filters-megabits-per-second`],new_health:i[`filters-new-health`],new_status:i[`filters-new-status`],packets_per_second:i[`filters-packets-per-second`],pool_id:i[`filters-pool-id`],pop_names:i[`filters-pop-names`],product:i[`filters-product`],project_id:i[`filters-project-id`],protocol:i[`filters-protocol`],query_tag:i[`filters-query-tag`],requests_per_second:i[`filters-requests-per-second`],selectors:i[`filters-selectors`],services:i[`filters-services`],slo:i[`filters-slo`],status:i[`filters-status`],target_hostname:i[`filters-target-hostname`],target_ip:i[`filters-target-ip`],target_zone_name:i[`filters-target-zone-name`],traffic_exclusions:i[`filters-traffic-exclusions`],tunnel_id:i[`filters-tunnel-id`],tunnel_name:i[`filters-tunnel-name`],type:i[`filters-type`],where:i[`filters-where`],zones:i[`filters-zones`]},name:d(i.name,`name`,`text`)}):o(i.body)});return}let p=await a(i),m=i.local?f:await r(p);if(i.accountId=m,i.body){let e=o(i.body);c(await u(`Creating`,async()=>p.alerting.policies.create({...e,account_id:m})),{successLabel:`Created`});return}if(i[`alert-type`]===void 0&&(i[`alert-type`]=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 e(`name`,`Name of the policy.`));let h=s({alert_interval:d(i[`alert-interval`],`alert-interval`,`text`),alert_type:d(i[`alert-type`],`alert-type`,`text`),description:d(i.description,`description`,`text`),enabled:i.enabled,filters:{actions:i[`filters-actions`],affected_asns:i[`filters-affected-asns`],affected_components:i[`filters-affected-components`],affected_locations:i[`filters-affected-locations`],airport_code:i[`filters-airport-code`],alert_trigger_preferences:i[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:i[`filters-alert-trigger-preferences-value`],enabled:i[`filters-enabled`],environment:i[`filters-environment`],event:i[`filters-event`],event_source:i[`filters-event-source`],event_type:i[`filters-event-type`],group_by:i[`filters-group-by`],health_check_id:i[`filters-health-check-id`],incident_impact:i[`filters-incident-impact`],input_id:i[`filters-input-id`],insight_class:i[`filters-insight-class`],limit:i[`filters-limit`],logo_tag:i[`filters-logo-tag`],megabits_per_second:i[`filters-megabits-per-second`],new_health:i[`filters-new-health`],new_status:i[`filters-new-status`],packets_per_second:i[`filters-packets-per-second`],pool_id:i[`filters-pool-id`],pop_names:i[`filters-pop-names`],product:i[`filters-product`],project_id:i[`filters-project-id`],protocol:i[`filters-protocol`],query_tag:i[`filters-query-tag`],requests_per_second:i[`filters-requests-per-second`],selectors:i[`filters-selectors`],services:i[`filters-services`],slo:i[`filters-slo`],status:i[`filters-status`],target_hostname:i[`filters-target-hostname`],target_ip:i[`filters-target-ip`],target_zone_name:i[`filters-target-zone-name`],traffic_exclusions:i[`filters-traffic-exclusions`],tunnel_id:i[`filters-tunnel-id`],tunnel_name:i[`filters-tunnel-name`],type:i[`filters-type`],where:i[`filters-where`],zones:i[`filters-zones`]},name:d(i.name,`name`,`text`)});c(await u(`Creating`,async()=>p.alerting.policies.create({...h,account_id:m})),{successLabel:`Created`})}};function U(e){return e.positional(`policy-id`,{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})}const W={command:`delete <policy-id>`,describe:`Delete a Notification policy.`,builder:U,handler:async e=>{if(e.dryRun){l({command:`cf alerting policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/policies/${e[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(e[`policy-id`]))}`,pathParams:{"policy-id":String(e[`policy-id`]??``)},bodyKind:`none`});return}let n=await a(e),o=e.local?f:await r(n);if(e.accountId=o,!await i({force:!!e.force})){process.stderr.write(`Aborted.
5
+ `);return}c(await u(`Deleting`,async()=>n.alerting.policies.delete({account_id:o,policy_id:e[`policy-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`policy-id`,{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})}const K={command:`get <policy-id>`,describe:`Get details for a single policy.`,builder:G,handler:async e=>{if(e.dryRun){l({command:`cf alerting policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/policies/${e[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(e[`policy-id`]))}`,pathParams:{"policy-id":String(e[`policy-id`]??``)},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.policies.get({account_id:i,policy_id:e[`policy-id`]})),{successLabel:`Loaded`})}};function q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`list`,describe:`Get a list of all Notification policies.`,builder:q,handler:async e=>{if(e.dryRun){l({command:`cf alerting policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/policies`,pathParams:{},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.policies.list({account_id:i})),{successLabel:`Loaded`})}};function Y(e){return e.positional(`policy-id`,{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.`}).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)`})}const X={command:`update <policy-id>`,describe:`Update a Notification policy.`,builder:Y,handler:async e=>{if(e.dryRun){l({command:`cf alerting policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/policies/${e[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(e[`policy-id`]))}`,pathParams:{"policy-id":String(e[`policy-id`]??``)},bodyKind:`json`,body:e.body===void 0?s({alert_interval:d(e[`alert-interval`],`alert-interval`,`text`),alert_type:d(e[`alert-type`],`alert-type`,`text`),description:d(e.description,`description`,`text`),enabled:e.enabled,filters:{actions:e[`filters-actions`],affected_asns:e[`filters-affected-asns`],affected_components:e[`filters-affected-components`],affected_locations:e[`filters-affected-locations`],airport_code:e[`filters-airport-code`],alert_trigger_preferences:e[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:e[`filters-alert-trigger-preferences-value`],enabled:e[`filters-enabled`],environment:e[`filters-environment`],event:e[`filters-event`],event_source:e[`filters-event-source`],event_type:e[`filters-event-type`],group_by:e[`filters-group-by`],health_check_id:e[`filters-health-check-id`],incident_impact:e[`filters-incident-impact`],input_id:e[`filters-input-id`],insight_class:e[`filters-insight-class`],limit:e[`filters-limit`],logo_tag:e[`filters-logo-tag`],megabits_per_second:e[`filters-megabits-per-second`],new_health:e[`filters-new-health`],new_status:e[`filters-new-status`],packets_per_second:e[`filters-packets-per-second`],pool_id:e[`filters-pool-id`],pop_names:e[`filters-pop-names`],product:e[`filters-product`],project_id:e[`filters-project-id`],protocol:e[`filters-protocol`],query_tag:e[`filters-query-tag`],requests_per_second:e[`filters-requests-per-second`],selectors:e[`filters-selectors`],services:e[`filters-services`],slo:e[`filters-slo`],status:e[`filters-status`],target_hostname:e[`filters-target-hostname`],target_ip:e[`filters-target-ip`],target_zone_name:e[`filters-target-zone-name`],traffic_exclusions:e[`filters-traffic-exclusions`],tunnel_id:e[`filters-tunnel-id`],tunnel_name:e[`filters-tunnel-name`],type:e[`filters-type`],where:e[`filters-where`],zones:e[`filters-zones`]},name:d(e.name,`name`,`text`)}):o(e.body)});return}let n=await a(e),i=e.local?f:await r(n);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>n.alerting.policies.update({...t,account_id:i,policy_id:e[`policy-id`]})),{successLabel:`Updated`});return}let p=s({alert_interval:d(e[`alert-interval`],`alert-interval`,`text`),alert_type:d(e[`alert-type`],`alert-type`,`text`),description:d(e.description,`description`,`text`),enabled:e.enabled,filters:{actions:e[`filters-actions`],affected_asns:e[`filters-affected-asns`],affected_components:e[`filters-affected-components`],affected_locations:e[`filters-affected-locations`],airport_code:e[`filters-airport-code`],alert_trigger_preferences:e[`filters-alert-trigger-preferences`],alert_trigger_preferences_value:e[`filters-alert-trigger-preferences-value`],enabled:e[`filters-enabled`],environment:e[`filters-environment`],event:e[`filters-event`],event_source:e[`filters-event-source`],event_type:e[`filters-event-type`],group_by:e[`filters-group-by`],health_check_id:e[`filters-health-check-id`],incident_impact:e[`filters-incident-impact`],input_id:e[`filters-input-id`],insight_class:e[`filters-insight-class`],limit:e[`filters-limit`],logo_tag:e[`filters-logo-tag`],megabits_per_second:e[`filters-megabits-per-second`],new_health:e[`filters-new-health`],new_status:e[`filters-new-status`],packets_per_second:e[`filters-packets-per-second`],pool_id:e[`filters-pool-id`],pop_names:e[`filters-pop-names`],product:e[`filters-product`],project_id:e[`filters-project-id`],protocol:e[`filters-protocol`],query_tag:e[`filters-query-tag`],requests_per_second:e[`filters-requests-per-second`],selectors:e[`filters-selectors`],services:e[`filters-services`],slo:e[`filters-slo`],status:e[`filters-status`],target_hostname:e[`filters-target-hostname`],target_ip:e[`filters-target-ip`],target_zone_name:e[`filters-target-zone-name`],traffic_exclusions:e[`filters-traffic-exclusions`],tunnel_id:e[`filters-tunnel-id`],tunnel_name:e[`filters-tunnel-name`],type:e[`filters-type`],where:e[`filters-where`],zones:e[`filters-zones`]},name:d(e.name,`name`,`text`)});c(await u(`Updating`,async()=>n.alerting.policies.update({...p,account_id:i,policy_id:e[`policy-id`]})),{successLabel:`Updated`})}},Z={command:`policies`,describe:`Notification policies that define which events trigger alerts and where they are delivered`,builder:e=>e.command(H).command(W).command(K).command(J).command(X).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ne={command:`create`,describe:`Creates a new silence for an account.`,builder:Q,handler:async e=>{if(e.dryRun){l({command:`cf alerting silences create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let n=await a(e),i=e.local?f:await r(n);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Creating`,async()=>n.alerting.silences.create({body:t,account_id:i})),{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function re(e){return e.positional(`silence-id`,{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})}const ie={command:`delete <silence-id>`,describe:`Deletes an existing silence for an account.`,builder:re,handler:async e=>{if(e.dryRun){l({command:`cf alerting silences delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/silences/${e[`silence-id`]==null?`<silence-id>`:encodeURIComponent(String(e[`silence-id`]))}`,pathParams:{"silence-id":String(e[`silence-id`]??``)},bodyKind:`none`});return}let n=await a(e),o=e.local?f:await r(n);if(e.accountId=o,!await i({force:!!e.force})){process.stderr.write(`Aborted.
6
+ `);return}c(await u(`Deleting`,async()=>n.alerting.silences.delete({account_id:o,silence_id:e[`silence-id`]})),{successLabel:`Deleted`})}};function ae(e){return e.positional(`silence-id`,{type:`string`,description:`Silence ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`get <silence-id>`,describe:`Gets a specific silence for an account.`,builder:ae,handler:async e=>{if(e.dryRun){l({command:`cf alerting silences get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/silences/${e[`silence-id`]==null?`<silence-id>`:encodeURIComponent(String(e[`silence-id`]))}`,pathParams:{"silence-id":String(e[`silence-id`]??``)},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.silences.get({account_id:i,silence_id:e[`silence-id`]})),{successLabel:`Loaded`})}};function $(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`list`,describe:`Gets a list of silences for an account.`,builder:$,handler:async e=>{if(e.dryRun){l({command:`cf alerting silences list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`none`});return}let n=await a(e),i=e.local?f:await r(n);e.accountId=i,c(await u(`Loading`,async()=>n.alerting.silences.list({account_id:i})),{successLabel:`Loaded`})}};function ce(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const le={command:`update`,describe:`Updates existing silences for an account.`,builder:ce,handler:async e=>{if(e.dryRun){l({command:`cf alerting silences update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t()??`<account-id>`}/alerting/v3/silences`,pathParams:{},bodyKind:`json`,body:e.body===void 0?void 0:o(e.body)});return}let n=await a(e),i=e.local?f:await r(n);if(e.accountId=i,e.body){let t=o(e.body);c(await u(`Updating`,async()=>n.alerting.silences.update({body:t,account_id:i})),{successLabel:`Updated`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},ue={command:`silences`,describe:`Silence windows that temporarily suppress alert notifications during maintenance`,builder:e=>e.command(ne).command(ie).command(oe).command(se).command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},de={command:`alerting`,describe:`Notification policies, delivery destinations, silence windows, and alert history`,builder:e=>e.command(h).command(R).command(B).command(Z).command(ue).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{de as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{S as e,n as t}from"./auth-BqDOIrKX.mjs";import{t as n}from"./output-CUxZRM5A.mjs";import{n as r,t as i}from"./progress-Cent9Lsg.mjs";import{t as a}from"./cli-types-CMNMD1V7.mjs";function o(e){return e.positional(`zone-identifier`,{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.
2
+ import{x as e}from"./oauth-Bk-F-tIO.mjs";import{n as t}from"./auth-CSC4yhEJ.mjs";import{t as n}from"./output-B6fBFRqe.mjs";import{n as r,t as i}from"./progress-DrDErV9w.mjs";import{t as a}from"./cli-types-BeyOc81z.mjs";function o(e){return e.positional(`zone-identifier`,{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.
3
3
 
4
4
  Ranges that the Cloudflare web application provides will provide the following period length for each point:
5
5
  - Last 60 minutes (from -59 to -1): 1 minute resolution
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{S as e,g as t}from"./oauth-Bk-F-tIO.mjs";import{i as n,n as r}from"./auth-CSC4yhEJ.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-DrDErV9w.mjs";import{n as s,t as c}from"./input-validation-_fMCApaH.mjs";import{t as l}from"./local-CYc9q7l2.mjs";function u(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const d={command:`query`,describe:`Executes a SQL query against Workers Analytics Engine data. Pass the SQL query in the request body as plain text. The response uses newline-delimited JSON (NDJSON) by default, or a single JSON object when the query includes a FORMAT JSON clause. Prefer this method for longer queries that may exceed URL length limits.`,builder:u,handler:async u=>{if(u.dryRun){a({command:`cf analytics_engine sql query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e()??`<account-id>`}/analytics_engine/sql`,pathParams:{},bodyKind:`octet-stream`,body:u.body});return}let d=await r(u),f=u.local?l:await t(d);if(u.accountId=f,u.file){let e=c(u.file);i(await o(`Loading`,async()=>n(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}if(u.body){let e=s(u.body,`body`,`binary`);i(await o(`Loading`,async()=>n(d,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}})),{successLabel:`Loaded`});return}i(await o(`Loading`,async()=>d.analyticsEngine.sql.query({account_id:f})),{successLabel:`Loaded`})}},f={command:`sql`,describe:`Operations for sql`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`analytics_engine`,describe:`analytics_engine`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};