cf 0.2.0 → 0.4.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 (278) hide show
  1. package/dist/_meta/agent-context.json +76 -70
  2. package/dist/_meta/commands.json +47761 -55490
  3. package/dist/_meta/schemas.json +31106 -34818
  4. package/dist/abuse-reports-Dy76QPNP.mjs +8 -0
  5. package/dist/accounts-CjtZ8x1z.mjs +22 -0
  6. package/dist/acm-C2lYIWs1.mjs +3 -0
  7. package/dist/addressing-CHFK6uxW.mjs +12 -0
  8. package/dist/{agent-context-D26woB9J.mjs → agent-context-CgGCT0xU.mjs} +1 -1
  9. package/dist/ai-DS3i-I1a.mjs +2 -0
  10. package/dist/ai-gateway-RIsegO2x.mjs +8 -0
  11. package/dist/ai-search-Dcj4BauG.mjs +7 -0
  12. package/dist/ai_gateway-w7YwfcPE.mjs +4 -0
  13. package/dist/alerting-Bk85NNf5.mjs +6 -0
  14. package/dist/analytics-CkhhhZWZ.mjs +20 -0
  15. package/dist/analytics_engine-B7qgDJCA.mjs +2 -0
  16. package/dist/api-gateway-CWdR4Ne7.mjs +33 -0
  17. package/dist/argo-DnJRVnGX.mjs +2 -0
  18. package/dist/artifacts-BVWKiJUl.mjs +4 -0
  19. package/dist/audit-logs-DjTstbzL.mjs +2 -0
  20. package/dist/auth-BqDOIrKX.mjs +150 -0
  21. package/dist/auth-DKkSwnxh.mjs +5 -0
  22. package/dist/billing-3rEqF83h.mjs +2 -0
  23. package/dist/body-parser-CBpeIUns.mjs +2 -0
  24. package/dist/bot-management-CJxD1pqi.mjs +5 -0
  25. package/dist/botnet-feed-MG91D7BR.mjs +3 -0
  26. package/dist/brand-protection-CK7gJi06.mjs +3 -0
  27. package/dist/browser-rendering-Rae0AUt0.mjs +4 -0
  28. package/dist/{build-5jmmOZhm.mjs → build-BE4o4imx.mjs} +131 -131
  29. package/dist/cache-B7pRbpTy.mjs +5 -0
  30. package/dist/calls-DXRWsZ8n.mjs +4 -0
  31. package/dist/certificate-authorities-BR3gXBLs.mjs +2 -0
  32. package/dist/chunk-6IEM75FG-U3L9fKgi.mjs +2 -0
  33. package/dist/cli-types-CMNMD1V7.mjs +2 -0
  34. package/dist/client-certificates-B0ebLJdk.mjs +3 -0
  35. package/dist/cloud-connector-BOjaggJk.mjs +2 -0
  36. package/dist/cloudforce-one-B6HYfk5Z.mjs +21 -0
  37. package/dist/{completions-BKrxcfhN.mjs → completions-D_9WsLG7.mjs} +1 -1
  38. package/dist/config-7CBz8Xm0.mjs +2 -0
  39. package/dist/connectivity-welFvZ7X.mjs +3 -0
  40. package/dist/connector-interrupts-DTV3F-50.mjs +2 -0
  41. package/dist/connector-telemetry-events-kDqb_AGm.mjs +2 -0
  42. package/dist/connector-telemetry-snapshots-DC-wD75E.mjs +2 -0
  43. package/dist/connectors-3vjrdFLB.mjs +3 -0
  44. package/dist/content-scanning-CnW2A0pv.mjs +4 -0
  45. package/dist/context-CONbNKO-.mjs +2 -0
  46. package/dist/custom-certificates-CnYh6Yi-.mjs +5 -0
  47. package/dist/custom-hostnames-C2upqZso.mjs +5 -0
  48. package/dist/custom-nameservers-BGkAD_PZ.mjs +3 -0
  49. package/dist/custom-pages-5fCSP8in.mjs +4 -0
  50. package/dist/d1-CyiRbZZn.mjs +4 -0
  51. package/dist/data-security-Casx4OS_.mjs +6 -0
  52. package/dist/dcv-delegation-DVYO10oA.mjs +2 -0
  53. package/dist/{deploy-DbkiIzUr.mjs → deploy-KBRFIatG.mjs} +1 -1
  54. package/dist/{dev-C6iSuQZm.mjs → dev-pPazzZvt.mjs} +1 -1
  55. package/dist/diagnostics-BqYDoDfw.mjs +3 -0
  56. package/dist/dispatch-namespaces-Cz2rajnP.mjs +7 -0
  57. package/dist/{dist-CnSubA1Z.mjs → dist-DA54ZQu0.mjs} +1 -1
  58. package/dist/dist-DpDjsWWn.mjs +306 -0
  59. package/dist/dns-62t95Xif.mjs +29 -0
  60. package/dist/dns-firewall-Coy8d47t.mjs +57 -0
  61. package/dist/durable-objects-BSuRERkw.mjs +2 -0
  62. package/dist/email-routing-BDUYYeV3.mjs +10 -0
  63. package/dist/email-security-ChHA6eqQ.mjs +8 -0
  64. package/dist/email-sending-CVrRqn6S.mjs +3 -0
  65. package/dist/filters-qJpU9uAS.mjs +4 -0
  66. package/dist/firewall-C3DDwfwh.mjs +11 -0
  67. package/dist/fraud-DY3YXFVf.mjs +20 -0
  68. package/dist/google-tag-gateway-B00MHDfB.mjs +2 -0
  69. package/dist/healthchecks-Drvb79v0.mjs +4 -0
  70. package/dist/hostnames-BdAQo1Mr.mjs +3 -0
  71. package/dist/hyperdrive-99OJV9nl.mjs +18 -0
  72. package/dist/iam-BRbpg3lN.mjs +6 -0
  73. package/dist/images-D1jI3r3O.mjs +7 -0
  74. package/dist/index.mjs +1 -1
  75. package/dist/intel-C3ajLpXd.mjs +3 -0
  76. package/dist/{ips-B8fwxKZD.mjs → ips-B6JETVOY.mjs} +1 -1
  77. package/dist/keyless-certificates-C4MZ4xnf.mjs +3 -0
  78. package/dist/kv-CSWoD9ks.mjs +5 -0
  79. package/dist/leaked-credential-checks-Dgs2oKm9.mjs +3 -0
  80. package/dist/load-balancers-Du1tNuUt.mjs +6 -0
  81. package/dist/logpush-SuJyO-uX.mjs +4 -0
  82. package/dist/logs-DcDNRPRl.mjs +3 -0
  83. package/dist/magic-cloud-networking-D-T0RCvi.mjs +5 -0
  84. package/dist/magic-network-monitoring-CqtvOePQ.mjs +4 -0
  85. package/dist/magic-transit-BTbkhBtF.mjs +89 -0
  86. package/dist/managed-transforms-CfUBSz9p.mjs +3 -0
  87. package/dist/mtls-certificates-Cf1O8c2E.mjs +3 -0
  88. package/dist/network-interconnects-DsiNytOU.mjs +36 -0
  89. package/dist/observability-CLqZ7OSi.mjs +4 -0
  90. package/dist/open-YWOUIZ5Y-BpqIuBsR.mjs +4 -0
  91. package/dist/organizations-aRi1bhFC.mjs +41 -0
  92. package/dist/origin-ca-certificates-BB4H89a_.mjs +3 -0
  93. package/dist/origin-post-quantum-encryption-DurP3PXG.mjs +2 -0
  94. package/dist/origin-tls-client-auth-CnQNy9-l.mjs +4 -0
  95. package/dist/output-CUxZRM5A.mjs +2 -0
  96. package/dist/page-rules-CYqtPU1p.mjs +18 -0
  97. package/dist/page-shield-D8l9ZMUl.mjs +37 -0
  98. package/dist/pages-ChurJ2H7.mjs +11 -0
  99. package/dist/pipelines-CeyujvRf.mjs +6 -0
  100. package/dist/{progress-CjcQ6ato.mjs → progress-Cent9Lsg.mjs} +1 -1
  101. package/dist/queues-Rf_n11Cx.mjs +6 -0
  102. package/dist/r2-BtuTO3vQ.mjs +21 -0
  103. package/dist/r2-data-catalog-Debz38kv.mjs +14 -0
  104. package/dist/radar-CzGM92uM.mjs +2 -0
  105. package/dist/rate-limits-Bbk7HxP7.mjs +5 -0
  106. package/dist/raw-fetch-DnbAMFBp.mjs +2 -0
  107. package/dist/realtime-kit-CivLpkpg.mjs +18 -0
  108. package/dist/registrar-8IeA5DKd.mjs +46 -0
  109. package/dist/request-tracers-D1aH4NmL.mjs +2 -0
  110. package/dist/{resolve-BuJRWSk0.mjs → resolve-D1mG0REg.mjs} +1 -1
  111. package/dist/resource-sharing-B-Pcto7-.mjs +5 -0
  112. package/dist/resource-tagging-Bpb6Qq1M.mjs +16 -0
  113. package/dist/rules-B10XWY10.mjs +4 -0
  114. package/dist/rulesets-lYczEcJp.mjs +8 -0
  115. package/dist/rum-B5GUKa4I.mjs +4 -0
  116. package/dist/{schema-CHBfkARI.mjs → schema-hefO-tzo.mjs} +1 -1
  117. package/dist/schema-validation-DTq517Em.mjs +24 -0
  118. package/dist/scim-BiLfOQ89.mjs +3 -0
  119. package/dist/secrets-store-CBX0dvHL.mjs +25 -0
  120. package/dist/security-center-AVpTOBK3.mjs +2 -0
  121. package/dist/security-txt-DVlh8y9l.mjs +3 -0
  122. package/dist/session-CsvPYFj8.mjs +5 -0
  123. package/dist/shared-0bwWVDLo.mjs +2 -0
  124. package/dist/smart-shield-DblHIce0.mjs +3 -0
  125. package/dist/snippets-DrpqSXYC.mjs +4 -0
  126. package/dist/{spawn-13QQ0IwO.mjs → spawn-DK7pott_.mjs} +1 -1
  127. package/dist/spectrum-CnrG0jIC.mjs +63 -0
  128. package/dist/speed-BzRY3Xlh.mjs +4 -0
  129. package/dist/{src-B9cKsgsg.mjs → src-D9_Gq68b.mjs} +12 -12
  130. package/dist/ssl-Cp6tQkZH.mjs +15 -0
  131. package/dist/stream-CGTRN4ZN.mjs +14 -0
  132. package/dist/tenants-o_M62Y1n.mjs +2 -0
  133. package/dist/token-validation-Ca5AGEns.mjs +10 -0
  134. package/dist/{tools-B7QiNu-d.mjs → tools-DtNNmO6l.mjs} +1 -1
  135. package/dist/turnstile-l7mo9BWL.mjs +23 -0
  136. package/dist/{ui-BXjU1dX1.mjs → ui-B97lRnOv.mjs} +1 -1
  137. package/dist/url-normalization-D1CogSIG.mjs +3 -0
  138. package/dist/url-scanner-BnJHJqcz.mjs +2 -0
  139. package/dist/user-CiyYZ69X.mjs +10 -0
  140. package/dist/vectorize-D3LgMLOn.mjs +4 -0
  141. package/dist/{versions-DzyrlUAi.mjs → versions-B6E8WQyA.mjs} +1 -1
  142. package/dist/waiting-rooms-Bhy_nuV3.mjs +11 -0
  143. package/dist/web3-DlHE0CZc.mjs +4 -0
  144. package/dist/workers-DRAkU6YR.mjs +18 -0
  145. package/dist/workers-builds-BmNjiHDZ.mjs +7 -0
  146. package/dist/workflows-z6oapEJs.mjs +4 -0
  147. package/dist/zaraz-CyzfYOEU.mjs +2 -0
  148. package/dist/zero-trust-fyyIelWx.mjs +118 -0
  149. package/dist/zero_trust-BAhlNkjo.mjs +3 -0
  150. package/dist/zones-MSULnDwW.mjs +21 -0
  151. package/package.json +7 -6
  152. package/dist/abuse-reports-KtfZhi6j.mjs +0 -8
  153. package/dist/accounts-BopMfODC.mjs +0 -21
  154. package/dist/acm-BT4vlnEJ.mjs +0 -3
  155. package/dist/addressing-B3uFxHst.mjs +0 -13
  156. package/dist/ai-DWHqwMap.mjs +0 -2
  157. package/dist/ai-gateway-CbKEO-3o.mjs +0 -8
  158. package/dist/ai-search-VnOQ5n--.mjs +0 -7
  159. package/dist/alerting-BmmgIlIO.mjs +0 -6
  160. package/dist/analytics-isY03taL.mjs +0 -20
  161. package/dist/api-gateway-DXurEbA-.mjs +0 -33
  162. package/dist/argo-B02BL_hp.mjs +0 -2
  163. package/dist/audit-logs-DcgR9xUc.mjs +0 -2
  164. package/dist/auth-CQcAgnOy.mjs +0 -135
  165. package/dist/auth-DenWm_X0.mjs +0 -6
  166. package/dist/autorag-CmrwnGVj.mjs +0 -2
  167. package/dist/billing-CaW1ZAB1.mjs +0 -2
  168. package/dist/body-parser-Br-BoYk-.mjs +0 -2
  169. package/dist/bot-management-CeBsFx68.mjs +0 -5
  170. package/dist/botnet-feed-B396vQeQ.mjs +0 -3
  171. package/dist/brand-protection-D4V1v5Kl.mjs +0 -3
  172. package/dist/browser-rendering-GF7rNtKI.mjs +0 -4
  173. package/dist/builds-C_ySULja.mjs +0 -2
  174. package/dist/cache-DmXizSMi.mjs +0 -5
  175. package/dist/calls-x4KQpTB4.mjs +0 -4
  176. package/dist/certificate-authorities-hC0SG-Ga.mjs +0 -2
  177. package/dist/client-certificates-BGVsDyeJ.mjs +0 -3
  178. package/dist/cloud-connector-BClQpEzI.mjs +0 -2
  179. package/dist/cloudforce-one-BfhFrO6M.mjs +0 -21
  180. package/dist/config-DYzlVxcB.mjs +0 -2
  181. package/dist/connectivity-G0NP6LtW.mjs +0 -3
  182. package/dist/content-scanning-DEtPJ7aF.mjs +0 -4
  183. package/dist/context-CC0Rhkhy.mjs +0 -2
  184. package/dist/custom-certificates-rJXFpUWu.mjs +0 -5
  185. package/dist/custom-hostnames-Be5mgLeF.mjs +0 -5
  186. package/dist/custom-nameservers-CoFdy6hD.mjs +0 -3
  187. package/dist/custom-pages-D-oErw57.mjs +0 -4
  188. package/dist/d1-C95ckPKI.mjs +0 -3
  189. package/dist/dcv-delegation-CWSkbGuc.mjs +0 -2
  190. package/dist/diagnostics-DEEhPnXj.mjs +0 -3
  191. package/dist/dispatch-namespaces-BzXeV7PH.mjs +0 -7
  192. package/dist/dist-DNBSHor6.mjs +0 -301
  193. package/dist/dns-firewall-BQXD_NxG.mjs +0 -57
  194. package/dist/dns-qW-3TZOT.mjs +0 -29
  195. package/dist/durable-objects-CgWFYEJJ.mjs +0 -2
  196. package/dist/email-routing-tdNJaCpJ.mjs +0 -10
  197. package/dist/email-security-DTVHNr2h.mjs +0 -60
  198. package/dist/email-sending-DsFTvE31.mjs +0 -3
  199. package/dist/filters-DO1Is_tI.mjs +0 -4
  200. package/dist/firewall-DbUhVTCg.mjs +0 -11
  201. package/dist/fraud-Bzr4njYb.mjs +0 -8
  202. package/dist/google-tag-gateway-BQxkA90M.mjs +0 -2
  203. package/dist/healthchecks-BBAs-lS_.mjs +0 -4
  204. package/dist/hostnames-Dz9PEUKS.mjs +0 -3
  205. package/dist/hyperdrive-B1iUJddG.mjs +0 -18
  206. package/dist/iam-CJM8gHpG.mjs +0 -6
  207. package/dist/images-DEoBmtFS.mjs +0 -5
  208. package/dist/intel-BM6xkZ0C.mjs +0 -3
  209. package/dist/keyless-certificates-DffYnd4b.mjs +0 -3
  210. package/dist/kv-BTceLtWZ.mjs +0 -5
  211. package/dist/leaked-credential-checks-CALfvoCo.mjs +0 -3
  212. package/dist/load-balancers-C1Ho1gCF.mjs +0 -6
  213. package/dist/logpush-CSYhgevA.mjs +0 -4
  214. package/dist/logs-DlIwmMpt.mjs +0 -3
  215. package/dist/magic-cloud-networking-Czu0pZ0a.mjs +0 -5
  216. package/dist/magic-network-monitoring-d7GJE5Yt.mjs +0 -4
  217. package/dist/magic-transit-qQmA-981.mjs +0 -89
  218. package/dist/managed-transforms-Dd6AnbWE.mjs +0 -3
  219. package/dist/mtls-certificates-C0rlCRGs.mjs +0 -3
  220. package/dist/network-interconnects-CxG2deY0.mjs +0 -36
  221. package/dist/organizations-DyEAiGiR.mjs +0 -41
  222. package/dist/origin-ca-certificates-S8RcoMF6.mjs +0 -3
  223. package/dist/origin-post-quantum-encryption-B8ZcpLu5.mjs +0 -2
  224. package/dist/origin-tls-client-auth-BlxMmQrE.mjs +0 -5
  225. package/dist/output-D7_yAFVR.mjs +0 -2
  226. package/dist/page-rules-DP-w6TAm.mjs +0 -18
  227. package/dist/page-shield-Bf7kFp8c.mjs +0 -37
  228. package/dist/pages-D0Y_XRqW.mjs +0 -10
  229. package/dist/pipelines-C-SPESAk.mjs +0 -6
  230. package/dist/queues-wv6CZsi8.mjs +0 -6
  231. package/dist/r2-DuXjp9n5.mjs +0 -21
  232. package/dist/r2-data-catalog-DQCMrmNO.mjs +0 -14
  233. package/dist/radar-BW_ZHP8X.mjs +0 -2
  234. package/dist/rate-limits-DLTkIvwr.mjs +0 -5
  235. package/dist/raw-fetch-hRv-6P3D.mjs +0 -2
  236. package/dist/realtime-kit-Ch7Vg3vj.mjs +0 -6
  237. package/dist/registrar-DIIv6fWd.mjs +0 -46
  238. package/dist/request-tracers-DMej0Drs.mjs +0 -2
  239. package/dist/resource-sharing-CYJ7cMWq.mjs +0 -5
  240. package/dist/resource-tagging-Dnz65MgH.mjs +0 -16
  241. package/dist/rules-DLJpOYbC.mjs +0 -4
  242. package/dist/rulesets-D9nqEJT5.mjs +0 -8
  243. package/dist/rum-DBVmdPkp.mjs +0 -4
  244. package/dist/schema-validation-MCd3xdtX.mjs +0 -4
  245. package/dist/scim-DZA3VXog.mjs +0 -3
  246. package/dist/scm-CilfPOue.mjs +0 -2
  247. package/dist/secrets-store-BrvcZSOM.mjs +0 -21
  248. package/dist/security-center-BU6f3Cm1.mjs +0 -2
  249. package/dist/security-txt-BPIbP3dG.mjs +0 -3
  250. package/dist/session-H7IV2BrM.mjs +0 -2
  251. package/dist/shared-DEzmTsEC.mjs +0 -2
  252. package/dist/smart-shield-e8XFBkiF.mjs +0 -3
  253. package/dist/snippets-B4M3MMb8.mjs +0 -4
  254. package/dist/spectrum-B0adfSRI.mjs +0 -59
  255. package/dist/speed-BVcUtkAz.mjs +0 -4
  256. package/dist/ssl-BAa91gsc.mjs +0 -15
  257. package/dist/stream-D53sxKb3.mjs +0 -14
  258. package/dist/tenants-bH5pt3dJ.mjs +0 -2
  259. package/dist/token-validation-M61Vx_Tw.mjs +0 -4
  260. package/dist/turnstile-wAU0Gc2Z.mjs +0 -23
  261. package/dist/url-normalization-DZrWDgB5.mjs +0 -3
  262. package/dist/url-scanner-Zo49edNp.mjs +0 -2
  263. package/dist/user-DbXlVReB.mjs +0 -10
  264. package/dist/vectorize-CUnTM0DT.mjs +0 -4
  265. package/dist/vuln-scanner-Br_2lQp1.mjs +0 -2
  266. package/dist/waiting-rooms-BZW0X69-.mjs +0 -11
  267. package/dist/web3-DueyOQtx.mjs +0 -4
  268. package/dist/workers-builds-BM_aoeUR.mjs +0 -7
  269. package/dist/workers-nV_vBCfV.mjs +0 -16
  270. package/dist/workflows-CQITmo-s.mjs +0 -4
  271. package/dist/zaraz-DIbpF5Op.mjs +0 -2
  272. package/dist/zero-trust-CKp8j512.mjs +0 -119
  273. package/dist/zones-BZ5tZDbH.mjs +0 -28
  274. /package/dist/{input-validation-zEO81MWN.mjs → input-validation-CTqtyiY9.mjs} +0 -0
  275. /package/dist/{lib-Eu1wXxuh.mjs → lib-B6xvCJjc.mjs} +0 -0
  276. /package/dist/{local-VJaJ3BZ1.mjs → local-D8bhHUMK.mjs} +0 -0
  277. /package/dist/{metadata-DGdCpUxn.mjs → metadata-jh2EIan8.mjs} +0 -0
  278. /package/dist/{theme-BklJDrb2.mjs → theme-CFHr0Dh9.mjs} +0 -0
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,h as t,t as n,x as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";import{t as u}from"./local-VJaJ3BZ1.mjs";function d(e){return e.option(`name`,{type:`string`,description:`A short description of Calls app, not shown to end users.`,default:``}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const f={command:`create`,describe:`Creates a new Cloudflare calls app. An app is an unique enviroment where each Session can access all Tracks within the app.`,builder:d,handler:async e=>{if(e.dryRun){s({command:`cf calls sfu create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let d=await n(e),f=e.local?u:await t(d);if(e.accountId=f,e.body){let t=a(e.body);o(await c(`Creating`,async()=>d.post(`/accounts/${f}/calls/apps`,{body:t})),{successLabel:`Created`});return}let p={};e.name!==void 0&&i(p,[`name`],l(e.name,`name`,`text`)),o(await c(`Creating`,async()=>d.post(`/accounts/${f}/calls/apps`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function p(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,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 m={command:`delete <app-id>`,describe:`Deletes an app from Cloudflare Calls`,builder:p,handler:async i=>{if(i.dryRun){s({command:`cf calls sfu delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/apps/${i[`app-id`]==null?`<app-id>`:encodeURIComponent(String(i[`app-id`]))}`,pathParams:{"app-id":String(i[`app-id`]??``)},bodyKind:`none`});return}let a=await n(i),l=i.local?u:await t(a);if(i.accountId=l,!await e({force:!!i.force})){process.stderr.write(`Aborted.
3
- `);return}o(await c(`Deleting`,async()=>a.calls.sfu.delete(i[`app-id`],l)),{successLabel:`Deleted`})}};function h(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`get <app-id>`,describe:`Fetches details for a single Calls app.`,builder:h,handler:async e=>{if(e.dryRun){s({command:`cf calls sfu get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/apps/${e[`app-id`]==null?`<app-id>`:encodeURIComponent(String(e[`app-id`]))}`,pathParams:{"app-id":String(e[`app-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?u:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.calls.sfu.get(e[`app-id`],a)),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`list`,describe:`Lists all apps in the Cloudflare account`,builder:_,handler:async e=>{if(e.dryRun){s({command:`cf calls sfu list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/apps`,pathParams:{},bodyKind:`none`});return}let i=await n(e),a=e.local?u:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.calls.sfu.list(a)),{successLabel:`Loaded`})}};function y(e){return e.positional(`app-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`name`,{type:`string`,description:`A short description of Calls app, not shown to end users.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`update <app-id>`,describe:`Edit details for a single app.`,builder:y,handler:async e=>{if(e.dryRun){s({command:`cf calls sfu update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/apps/${e[`app-id`]==null?`<app-id>`:encodeURIComponent(String(e[`app-id`]))}`,pathParams:{"app-id":String(e[`app-id`]??``)},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let d=await n(e),f=e.local?u:await t(d);if(e.accountId=f,e.body){let t=a(e.body);o(await c(`Updating`,async()=>d.put(`/accounts/${f}/calls/apps/${encodeURIComponent(String(e[`app-id`]))}`,{body:t})),{successLabel:`Updated`});return}let p={};e.name!==void 0&&i(p,[`name`],l(e.name,`name`,`text`)),o(await c(`Updating`,async()=>d.put(`/accounts/${f}/calls/apps/${encodeURIComponent(String(e[`app-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},x={command:`sfu`,describe:`Selective Forwarding Unit apps that route WebRTC media between participants`,builder:e=>e.command(f).command(m).command(g).command(v).command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`name`,{type:`string`,description:`A short description of a TURN key, not shown to end users.`,default:``}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`create`,describe:`Creates a new Cloudflare Calls TURN key.`,builder:S,handler:async e=>{if(e.dryRun){s({command:`cf calls turn create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let d=await n(e),f=e.local?u:await t(d);if(e.accountId=f,e.body){let t=a(e.body);o(await c(`Creating`,async()=>d.post(`/accounts/${f}/calls/turn_keys`,{body:t})),{successLabel:`Created`});return}let p={};e.name!==void 0&&i(p,[`name`],l(e.name,`name`,`text`)),o(await c(`Creating`,async()=>d.post(`/accounts/${f}/calls/turn_keys`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Created`})}};function w(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,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 T={command:`delete <key-id>`,describe:`Deletes a TURN key from Cloudflare Calls`,builder:w,handler:async i=>{if(i.dryRun){s({command:`cf calls turn delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/turn_keys/${i[`key-id`]==null?`<key-id>`:encodeURIComponent(String(i[`key-id`]))}`,pathParams:{"key-id":String(i[`key-id`]??``)},bodyKind:`none`});return}let a=await n(i),l=i.local?u:await t(a);if(i.accountId=l,!await e({force:!!i.force})){process.stderr.write(`Aborted.
4
- `);return}o(await c(`Deleting`,async()=>a.calls.turn.delete(i[`key-id`],l)),{successLabel:`Deleted`})}};function E(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <key-id>`,describe:`Fetches details for a single TURN key.`,builder:E,handler:async e=>{if(e.dryRun){s({command:`cf calls turn get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/turn_keys/${e[`key-id`]==null?`<key-id>`:encodeURIComponent(String(e[`key-id`]))}`,pathParams:{"key-id":String(e[`key-id`]??``)},bodyKind:`none`});return}let i=await n(e),a=e.local?u:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.calls.turn.get(e[`key-id`],a)),{successLabel:`Loaded`})}};function O(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`list`,describe:`Lists all TURN keys in the Cloudflare account`,builder:O,handler:async e=>{if(e.dryRun){s({command:`cf calls turn list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/turn_keys`,pathParams:{},bodyKind:`none`});return}let i=await n(e),a=e.local?u:await t(i);e.accountId=a,o(await c(`Loading`,async()=>i.calls.turn.list(a)),{successLabel:`Loaded`})}};function A(e){return e.positional(`key-id`,{type:`string`,description:`A Cloudflare-generated unique identifier for a item.`,demandOption:!0}).option(`name`,{type:`string`,description:`A short description of a TURN key, not shown to end users.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const j={command:`update <key-id>`,describe:`Edit details for a single TURN key.`,builder:A,handler:async e=>{if(e.dryRun){s({command:`cf calls turn update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${r()??`<account-id>`}/calls/turn_keys/${e[`key-id`]==null?`<key-id>`:encodeURIComponent(String(e[`key-id`]))}`,pathParams:{"key-id":String(e[`key-id`]??``)},bodyKind:`json`,body:{name:e.name,body:e.body}});return}let d=await n(e),f=e.local?u:await t(d);if(e.accountId=f,e.body){let t=a(e.body);o(await c(`Updating`,async()=>d.put(`/accounts/${f}/calls/turn_keys/${encodeURIComponent(String(e[`key-id`]))}`,{body:t})),{successLabel:`Updated`});return}let p={};e.name!==void 0&&i(p,[`name`],l(e.name,`name`,`text`)),o(await c(`Updating`,async()=>d.put(`/accounts/${f}/calls/turn_keys/${encodeURIComponent(String(e[`key-id`]))}`,{body:Object.keys(p).length>0?p:void 0})),{successLabel:`Updated`})}},M={command:`turn`,describe:`TURN relay keys that help clients traverse NATs and firewalls for peer-to-peer connectivity`,builder:e=>e.command(C).command(T).command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},N={command:`calls`,describe:`Real-time audio/video communication infrastructure — SFU apps for WebRTC and TURN relay keys`,builder:e=>e.command(x).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{N as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{b as e,t}from"./auth-CQcAgnOy.mjs";import{n,t as r}from"./body-parser-Br-BoYk-.mjs";import{t as i}from"./output-D7_yAFVR.mjs";import{n as a,t as o}from"./progress-CjcQ6ato.mjs";import{n as s}from"./input-validation-zEO81MWN.mjs";function c(e){return e.option(`mtls-certificate-id`,{type:`string`,description:`The UUID to match against for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the results will be the hostnames associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const l={command:`get`,describe:`List Hostname Associations`,builder:c,handler:async n=>{let r={mtls_certificate_id:n[`mtls-certificate-id`]};if(n.dryRun){a({command:`cf certificate-authorities hostname-associations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},query:r,bodyKind:`none`});return}let s=await t(n),c=await e({zone:n.zone},s,{quiet:n.quiet});n.zoneId=c,i(await o(`Loading`,async()=>s.certificateAuthorities.hostnameAssociations.get(c,r)),{successLabel:`Loaded`})}};function u(e){return e.option(`hostnames`,{type:`string`,array:!0,description:`The hostnames field`}).option(`mtls-certificate-id`,{type:`string`,description:`The UUID for a certificate that was uploaded to the mTLS Certificate Management endpoint. If no mtls_certificate_id is given, the hostnames will be associated to your active Cloudflare Managed CA.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`update`,describe:`Replace Hostname Associations`,builder:u,handler:async c=>{if(c.dryRun){a({command:`cf certificate-authorities hostname-associations update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/certificate_authorities/hostname_associations`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:{hostnames:c.hostnames,"mtls-certificate-id":c[`mtls-certificate-id`],body:c.body}});return}let l=await t(c);if(c.zoneId=await e({zone:c.zone},l,{quiet:c.quiet}),c.body){let e=r(c.body);i(await o(`Updating`,async()=>l.put(`/zones/${c.zoneId}/certificate_authorities/hostname_associations`,{body:e})),{successLabel:`Updated`});return}let u={};c.hostnames!==void 0&&n(u,[`hostnames`],c.hostnames),c[`mtls-certificate-id`]!==void 0&&n(u,[`mtls_certificate_id`],s(c[`mtls-certificate-id`],`mtls-certificate-id`,`text`)),i(await o(`Updating`,async()=>l.put(`/zones/${c.zoneId}/certificate_authorities/hostname_associations`,{body:Object.keys(u).length>0?u:void 0})),{successLabel:`Updated`})}},f={command:`hostname-associations`,describe:`Associate client certificates with hostnames that require mutual TLS verification`,builder:e=>e.command(l).command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},p={command:`certificate-authorities`,describe:`Map client certificates to specific hostnames for mTLS authentication`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{p as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,T as t,b as n,t as r}from"./auth-CQcAgnOy.mjs";import{n as i,t as a}from"./body-parser-Br-BoYk-.mjs";import{t as o}from"./output-D7_yAFVR.mjs";import{n as s,t as c}from"./progress-CjcQ6ato.mjs";import{n as l}from"./input-validation-zEO81MWN.mjs";function u(e){return e.option(`csr`,{type:`string`,description:`The Certificate Signing Request (CSR). Must be newline-encoded.`}).option(`validity-days`,{type:`number`,description:`The number of days the Client Certificate will be valid after the issued_on date`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:`Create a new API Shield mTLS Client Certificate`,builder:u,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:{csr:e.csr,"validity-days":e[`validity-days`],body:e.body}});return}let u=await r(e);if(e.zoneId=await n({zone:e.zone},u,{quiet:e.quiet}),e.body){let t=a(e.body);o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/client_certificates`,{body:t})),{successLabel:`Created`});return}if(e.csr===void 0&&(e.csr=await t(`csr`,`The Certificate Signing Request (CSR). Must be newline-encoded.`)),e[`validity-days`]===void 0)throw Error(`--validity-days is required (or pass --body with this field set).`);let d={};e.csr!==void 0&&i(d,[`csr`],l(e.csr,`csr`,`text`)),e[`validity-days`]!==void 0&&i(d,[`validity_days`],e[`validity-days`]),o(await c(`Creating`,async()=>u.post(`/zones/${e.zoneId}/client_certificates`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function f(e){return e.positional(`client-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const p={command:`delete <client-certificate-id>`,describe:`Set a API Shield mTLS Client Certificate to pending_revocation status for processing to revoked status.`,builder:f,handler:async t=>{if(t.dryRun){s({command:`cf client-certificates delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/client_certificates/${t[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(t[`client-certificate-id`]))}`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``),"client-certificate-id":String(t[`client-certificate-id`]??``)},bodyKind:`none`});return}let i=await r(t),a=await n({zone:t.zone},i,{quiet:t.quiet});if(t.zoneId=a,!await e({force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}o(await c(`Deleting`,async()=>i.clientCertificates.delete(a,t[`client-certificate-id`])),{successLabel:`Deleted`})}};function m(e){return e.positional(`client-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`reactivate`,{type:`boolean`,description:`The reactivate field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const h={command:`edit <client-certificate-id>`,describe:`If a API Shield mTLS Client Certificate is in a pending_revocation state, you may reactivate it with this endpoint.`,builder:m,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates/${e[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(e[`client-certificate-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"client-certificate-id":String(e[`client-certificate-id`]??``)},bodyKind:`json`,body:{reactivate:e.reactivate,body:e.body}});return}let t=await r(e);if(e.zoneId=await n({zone:e.zone},t,{quiet:e.quiet}),e.body){let n=a(e.body);o(await c(`Updating`,async()=>t.patch(`/zones/${e.zoneId}/client_certificates/${encodeURIComponent(String(e[`client-certificate-id`]))}`,{body:n})),{successLabel:`Updated`});return}let l={};e.reactivate!==void 0&&i(l,[`reactivate`],e.reactivate),o(await c(`Updating`,async()=>t.patch(`/zones/${e.zoneId}/client_certificates/${encodeURIComponent(String(e[`client-certificate-id`]))}`,{body:Object.keys(l).length>0?l:void 0})),{successLabel:`Updated`})}};function g(e){return e.positional(`client-certificate-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get <client-certificate-id>`,describe:`Get Details for a single mTLS API Shield Client Certificate`,builder:g,handler:async e=>{if(e.dryRun){s({command:`cf client-certificates get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates/${e[`client-certificate-id`]==null?`<client-certificate-id>`:encodeURIComponent(String(e[`client-certificate-id`]))}`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"client-certificate-id":String(e[`client-certificate-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=await n({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i,o(await c(`Loading`,async()=>t.clientCertificates.get(i,e[`client-certificate-id`])),{successLabel:`Loaded`})}};function v(e){return e.option(`status`,{type:`string`,description:`Client Certitifcate Status to filter results by.`,choices:[`all`,`active`,`pending_reactivation`,`pending_revocation`,`revoked`]}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of records per page.`}).option(`limit`,{type:`number`,description:`Limit to the number of records returned.`}).option(`offset`,{type:`number`,description:`Offset the results`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`list`,describe:`List all of your Zone's API Shield mTLS Client Certificates by Status and/or using Pagination`,builder:v,handler:async e=>{let t={status:e.status,page:e.page,per_page:e[`per-page`],limit:e.limit,offset:e.offset};if(e.dryRun){s({command:`cf client-certificates list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/client_certificates`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),a=await n({zone:e.zone},i,{quiet:e.quiet});e.zoneId=a,o(await c(`Loading`,async()=>i.clientCertificates.list(a,t)),{successLabel:`Loaded`})}},b={command:`client-certificates`,describe:`Issue and manage client certificates for mutual TLS (mTLS) authentication on your zone`,builder:e=>e.command(d).command(p).command(h).command(_).command(y).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{b as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{b as e,t}from"./auth-CQcAgnOy.mjs";import{t as n}from"./body-parser-Br-BoYk-.mjs";import{t as r}from"./output-D7_yAFVR.mjs";import{n as i,t as a}from"./progress-CjcQ6ato.mjs";function o(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const s={command:`list`,describe:`Retrieves the Cloud Connector rules configured for a zone. Rules define how traffic is routed to cloud services.`,builder:o,handler:async n=>{if(n.dryRun){i({command:`cf cloud-connector rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${n.zone??n.zoneId??`<zone>`}/cloud_connector/rules`,pathParams:{"zone-id":String(n.zone??n[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(n),s=await e({zone:n.zone},o,{quiet:n.quiet});n.zoneId=s,r(await a(`Loading`,async()=>o.cloudConnector.rules.list(s)),{successLabel:`Loaded`})}};function c(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 l={command:`update`,describe:`Updates Cloud Connector rules for a zone, replacing the existing rule configuration.`,builder:c,handler:async o=>{if(o.dryRun){i({command:`cf cloud-connector rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/cloud_connector/rules`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`json`,body:{body:o.body}});return}let s=await t(o);if(o.zoneId=await e({zone:o.zone},s,{quiet:o.quiet}),o.body){let e=n(o.body);r(await a(`Updating`,async()=>s.put(`/zones/${o.zoneId}/cloud_connector/rules`,{body:e})),{successLabel:`Updated`});return}if(o.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},u={command:`rules`,describe:`Routing rules that map request patterns to cloud provider endpoints`,builder:e=>e.command(s).command(l).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},d={command:`cloud-connector`,describe:`Route traffic from Cloudflare directly to cloud provider services (AWS, Azure, GCP) without origin servers`,builder:e=>e.command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{d as default};
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
- import{C as e,T as t,h as n,t as r,w as i,x as a}from"./auth-CQcAgnOy.mjs";import{n as o,t as s}from"./body-parser-Br-BoYk-.mjs";import{t as c}from"./output-D7_yAFVR.mjs";import{n as l,t as u}from"./progress-CjcQ6ato.mjs";import{n as d,t as f}from"./input-validation-zEO81MWN.mjs";import{t as p}from"./local-VJaJ3BZ1.mjs";function m(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Binary file to be uploaded to the database.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const h={command:`create`,describe:`Uploads a binary file to Cloudforce One's binary database for malware analysis and threat intelligence correlation.`,builder:m,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one binary-storage create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/binary`,pathParams:{},bodyKind:`multipart`,body:{body:e.body,file:e.file}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.file!==void 0||e.body!==void 0){let n=new FormData;if(e.file){let t=f(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/binary`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=d(e.body,`body`,`binary`);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/binary`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{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 g(e){return e.positional(`hash`,{type:`string`,description:`hash of the binary`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`get <hash>`,describe:`Retrieves a binary file from the Cloudforce One binary storage for analysis.`,builder:g,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one binary-storage get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/binary/${e.hash==null?`<hash>`:encodeURIComponent(String(e.hash))}`,pathParams:{hash:String(e.hash??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.binaryStorage.get(i,e.hash)),{successLabel:`Loaded`})}},te={command:`binary-storage`,describe:`Upload and retrieve malware samples and suspicious binaries for analysis`,builder:e=>e.command(h).command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.option(`aggregate-by`,{type:`string`,description:`Column(s) to aggregate by - single column or comma-separated list (e.g., 'attacker', 'targetIndustry', 'attacker,targetIndustry')`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID(s) to filter by. Can be a single dataset ID, comma-separated list, or array. If not provided, uses default dataset`}).option(`start-date`,{type:`string`,description:`Start date for filtering (ISO 8601 format, e.g., '2024-01-01')`}).option(`end-date`,{type:`string`,description:`End date for filtering (ISO 8601 format, e.g., '2024-12-31')`}).option(`group-by-date`,{type:`boolean`,description:`Whether to group results by date (daily aggregation)`}).option(`limit`,{type:`number`,description:`Maximum number of results to return`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Aggregate threat events by one or more columns (e.g., attacker, targetIndustry) with optional date filtering and daily grouping. Supports multi-dimensional aggregation for cross-analysis.`,builder:_,handler:async e=>{let t={aggregateBy:e[`aggregate-by`],datasetId:e[`dataset-id`],startDate:e[`start-date`],endDate:e[`end-date`],groupByDate:e[`group-by-date`],limit:e.limit};if(e.dryRun){l({command:`cf cloudforce-one events aggregate get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/aggregate`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.events.aggregate.get(o,t)),{successLabel:`Loaded`})}},y={command:`aggregate`,describe:`Events operations`,builder:e=>e.command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`get`,describe:`Lists categories`,builder:b,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events categories catalog get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/categories/catalog`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.categories.catalog.get(i)),{successLabel:`Loaded`})}},S={command:`catalog`,describe:`Events operations`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.positional(`category-id`,{type:`string`,description:`Category UUID.`,demandOption:!0}).option(`kill-chain`,{type:`number`,description:`The killChain field`}).option(`mitre-attack`,{type:`string`,array:!0,description:`The mitreAttack field`}).option(`mitre-capec`,{type:`string`,array:!0,description:`The mitreCapec field`}).option(`name`,{type:`string`,description:`The name field`}).option(`shortname`,{type:`string`,description:`The shortname field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={command:`create <category-id>`,describe:`Updates a category`,builder:C,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events categories create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/categories/${e[`category-id`]==null?`<category-id>`:encodeURIComponent(String(e[`category-id`]))}`,pathParams:{"category-id":String(e[`category-id`]??``)},bodyKind:`json`,body:{"kill-chain":e[`kill-chain`],"mitre-attack":e[`mitre-attack`],"mitre-capec":e[`mitre-capec`],name:e.name,shortname:e.shortname,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/categories/${encodeURIComponent(String(e[`category-id`]))}`,{body:n})),{successLabel:`Created`});return}let f={};e[`kill-chain`]!==void 0&&o(f,[`killChain`],e[`kill-chain`]),e[`mitre-attack`]!==void 0&&o(f,[`mitreAttack`],e[`mitre-attack`]),e[`mitre-capec`]!==void 0&&o(f,[`mitreCapec`],e[`mitre-capec`]),e.name!==void 0&&o(f,[`name`],d(e.name,`name`,`text`)),e.shortname!==void 0&&o(f,[`shortname`],d(e.shortname,`shortname`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/categories/${encodeURIComponent(String(e[`category-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}},T={command:`categories`,describe:`Events operations`,builder:e=>e.command(w).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`attacker`,{type:`string`,description:`The attacker field`}).option(`attacker-country`,{type:`string`,description:`The attackerCountry field`}).option(`category`,{type:`string`,description:`The category field`}).option(`created-at`,{type:`string`,description:`The createdAt field`}).option(`dataset-id`,{type:`string`,description:`Dataset ID containing the event to update.`}).option(`date`,{type:`string`,description:`The date field`}).option(`event`,{type:`string`,description:`The event field`}).option(`indicator`,{type:`string`,description:`The indicator field`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`insight`,{type:`string`,description:`The insight field`}).option(`raw-source`,{type:`string`,description:`The raw.source field`}).option(`raw-tlp`,{type:`string`,description:`The raw.tlp field`}).option(`target-country`,{type:`string`,description:`The targetCountry field`}).option(`target-industry`,{type:`string`,description:`The targetIndustry field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`create <event-id>`,describe:`Updates an event`,builder:E,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`json`,body:{attacker:e.attacker,"attacker-country":e[`attacker-country`],category:e.category,"created-at":e[`created-at`],"dataset-id":e[`dataset-id`],date:e.date,event:e.event,indicator:e.indicator,"indicator-type":e[`indicator-type`],insight:e.insight,"raw-source":e[`raw-source`],"raw-tlp":e[`raw-tlp`],"target-country":e[`target-country`],"target-industry":e[`target-industry`],tlp:e.tlp,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/${encodeURIComponent(String(e[`event-id`]))}`,{body:t})),{successLabel:`Created`});return}e[`dataset-id`]===void 0&&(e[`dataset-id`]=await t(`dataset-id`,`Dataset ID containing the event to update.`));let m={};e.attacker!==void 0&&o(m,[`attacker`],d(e.attacker,`attacker`,`text`)),e[`attacker-country`]!==void 0&&o(m,[`attackerCountry`],d(e[`attacker-country`],`attacker-country`,`text`)),e.category!==void 0&&o(m,[`category`],d(e.category,`category`,`text`)),e[`created-at`]!==void 0&&o(m,[`createdAt`],d(e[`created-at`],`created-at`,`text`)),e[`dataset-id`]!==void 0&&o(m,[`datasetId`],d(e[`dataset-id`],`dataset-id`,`text`)),e.date!==void 0&&o(m,[`date`],d(e.date,`date`,`text`)),e.event!==void 0&&o(m,[`event`],d(e.event,`event`,`text`)),e.indicator!==void 0&&o(m,[`indicator`],d(e.indicator,`indicator`,`text`)),e[`indicator-type`]!==void 0&&o(m,[`indicatorType`],d(e[`indicator-type`],`indicator-type`,`text`)),e.insight!==void 0&&o(m,[`insight`],d(e.insight,`insight`,`text`)),e[`raw-source`]!==void 0&&o(m,[`raw`,`source`],d(e[`raw-source`],`raw-source`,`text`)),e[`raw-tlp`]!==void 0&&o(m,[`raw`,`tlp`],d(e[`raw-tlp`],`raw-tlp`,`text`)),e[`target-country`]!==void 0&&o(m,[`targetCountry`],d(e[`target-country`],`target-country`,`text`)),e[`target-industry`]!==void 0&&o(m,[`targetIndustry`],d(e[`target-industry`],`target-industry`,`text`)),e.tlp!==void 0&&o(m,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/${encodeURIComponent(String(e[`event-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function O(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`keep-raw-data`,{type:`boolean`,description:`If true, copies raw data to the destination dataset. Default is false (raw data is stripped/not copied).`}).option(`dest-dataset-id`,{type:`string`,description:`The destDatasetId field`}).option(`event-ids`,{type:`string`,array:!0,description:`The eventIds field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const k={command:`create <dataset-id>`,describe:`Copies specified events from one dataset to another dataset`,builder:O,handler:async e=>{let i={keepRawData:e[`keep-raw-data`]};if(e.dryRun){l({command:`cf cloudforce-one events dataset copy create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/copy`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},query:i,bodyKind:`json`,body:{"dest-dataset-id":e[`dest-dataset-id`],"event-ids":e[`event-ids`],body:e.body}});return}let f=await r(e),m=e.local?p:await n(f);if(e.accountId=m,e.body){let t=s(e.body),n=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/copy${n?`?`+n:``}`,{body:t})),{successLabel:`Created`});return}if(e[`dest-dataset-id`]===void 0&&(e[`dest-dataset-id`]=await t(`dest-dataset-id`,`The destDatasetId field`)),e[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let h={};e[`dest-dataset-id`]!==void 0&&o(h,[`destDatasetId`],d(e[`dest-dataset-id`],`dest-dataset-id`,`text`)),e[`event-ids`]!==void 0&&o(h,[`eventIds`],e[`event-ids`]);let g=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/copy${g?`?`+g:``}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}},A={command:`copy`,describe:`Events operations`,builder:e=>e.command(k).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function j(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`is-public`,{type:`boolean`,description:`If true, then anyone can search the dataset. If false, then its limited to the account.`}).option(`name`,{type:`string`,description:`Used to describe the dataset within the account context.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const M={command:`create <dataset-id>`,describe:`Updates an existing dataset`,builder:j,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`json`,body:{"is-public":e[`is-public`],name:e.name,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}`,{body:t})),{successLabel:`Created`});return}if(e[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await t(`name`,`Used to describe the dataset within the account context.`));let m={};e[`is-public`]!==void 0&&o(m,[`isPublic`],e[`is-public`]),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function N(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID to delete`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const P={command:`delete <dataset-id>`,describe:`Deletes a dataset given a datasetId.`,builder:N,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one events dataset delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${t[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(t[`dataset-id`]))}`,pathParams:{"dataset-id":String(t[`dataset-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
3
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.events.dataset.delete(o,t[`dataset-id`])),{successLabel:`Deleted`})}};function F(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`get <event-id>`,describe:`Retrieves a specific event by its UUID.`,builder:F,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"event-id":String(e[`event-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.dataset.events.get(i,e[`dataset-id`],e[`event-id`])),{successLabel:`Loaded`})}},L={command:`events`,describe:`Events operations`,builder:e=>e.command(I).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`create`,describe:`Create a group`,builder:R,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset groups create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/-/groups`,pathParams:{},bodyKind:`json`,body:{description:e.description,name:e.name,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/-/groups`,{body:t})),{successLabel:`Created`});return}e.description===void 0&&(e.description=await t(`description`,`The description field`)),e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e.description!==void 0&&o(m,[`description`],d(e.description,`description`,`text`)),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/-/groups`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function B(e){return e.positional(`group-id`,{type:`string`,description:`Group 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 V={command:`delete <group-id>`,describe:`Delete a group for an account`,builder:B,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one events dataset groups delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${t[`group-id`]==null?`<group-id>`:encodeURIComponent(String(t[`group-id`]))}`,pathParams:{"group-id":String(t[`group-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
4
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.events.dataset.groups.delete(o,t[`group-id`])),{successLabel:`Deleted`})}};function H(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`group`,describe:`List groups for an account`,builder:H,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset groups get group`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/-/groups`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.dataset.groups.get.group(i)),{successLabel:`Loaded`})}};function W(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`v2 <group-id>`,describe:`Read a group for an account`,builder:W,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset groups get v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.dataset.groups.get.v2(i,e[`group-id`])),{successLabel:`Loaded`})}},K={command:`get`,describe:`Events operations`,builder:e=>e.command(U).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function q(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`account-tag`,{type:`string`,description:`The accountTag field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const J={command:`create <group-id>`,describe:`Create a group member`,builder:q,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset groups members create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}/members`,pathParams:{"group-id":String(e[`group-id`]??``)},bodyKind:`json`,body:{"account-tag":e[`account-tag`],body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/dataset/-/groups/${encodeURIComponent(String(e[`group-id`]))}/members`,{body:n})),{successLabel:`Created`});return}let f={};e[`account-tag`]!==void 0&&o(f,[`accountTag`],d(e[`account-tag`],`account-tag`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/dataset/-/groups/${encodeURIComponent(String(e[`group-id`]))}/members`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function Y(e){return e.positional(`member-id`,{type:`string`,description:`Member ID`,demandOption:!0}).option(`group-id`,{type:`string`,description:`Group 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 X={command:`delete <member-id>`,describe:`Delete a group member`,builder:Y,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one events dataset groups members delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${t[`group-id`]==null?`<group-id>`:encodeURIComponent(String(t[`group-id`]))}/members/${t[`member-id`]==null?`<member-id>`:encodeURIComponent(String(t[`member-id`]))}`,pathParams:{"group-id":String(t[`group-id`]??``),"member-id":String(t[`member-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
5
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.events.dataset.groups.members.delete(o,t[`group-id`],t[`member-id`])),{successLabel:`Deleted`})}};function Z(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <group-id>`,describe:`List group members`,builder:Z,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset groups members get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}/members`,pathParams:{"group-id":String(e[`group-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.dataset.groups.members.get(i,e[`group-id`])),{successLabel:`Loaded`})}},ne={command:`members`,describe:`Events operations`,builder:e=>e.command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`group-id`,{type:`string`,description:`Group ID`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ie={command:`update <group-id>`,describe:`Update a group`,builder:re,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset groups update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/-/groups/${e[`group-id`]==null?`<group-id>`:encodeURIComponent(String(e[`group-id`]))}`,pathParams:{"group-id":String(e[`group-id`]??``)},bodyKind:`json`,body:{description:e.description,name:e.name,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Updating`,async()=>i.put(`/accounts/${f}/cloudforce-one/events/dataset/-/groups/${encodeURIComponent(String(e[`group-id`]))}`,{body:t})),{successLabel:`Updated`});return}e.description===void 0&&(e.description=await t(`description`,`The description field`)),e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e.description!==void 0&&o(m,[`description`],d(e.description,`description`,`text`)),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),c(await u(`Updating`,async()=>i.put(`/accounts/${f}/cloudforce-one/events/dataset/-/groups/${encodeURIComponent(String(e[`group-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},ae={command:`groups`,describe:`Events operations`,builder:e=>e.command(z).command(V).command(ie).command(K).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the indicator type`}).option(`indicator-type`,{type:`string`,description:`The indicator type to create (e.g., 'DOMAIN', 'IP', 'URL', 'HASH', 'EMAIL')`}).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 se={command:`create <dataset-id>`,describe:`Creates a new indicator type and initializes its dedicated Durable Object`,builder:oe,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset indicator types create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicatorTypes/create`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`json`,body:{description:e.description,"indicator-type":e[`indicator-type`],body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/indicatorTypes/create`,{body:t})),{successLabel:`Created`});return}e[`indicator-type`]===void 0&&(e[`indicator-type`]=await t(`indicator-type`,`The indicator type to create (e.g., 'DOMAIN', 'IP', 'URL', 'HASH', 'EMAIL')`));let m={};e.description!==void 0&&o(m,[`description`],d(e.description,`description`,`text`)),e[`indicator-type`]!==void 0&&o(m,[`indicatorType`],d(e[`indicator-type`],`indicator-type`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/indicatorTypes/create`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},ce={command:`create`,describe:`Events operations`,builder:e=>e.command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},le={command:`types`,describe:`Operations for events.dataset.indicator.types`,builder:e=>e.command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ue={command:`indicator`,describe:`Operations for events.dataset.indicator`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`auto-create-type`,{type:`boolean`,description:`Global flag to automatically create indicator types if they don't exist. Individual indicators can override this with their own autoCreateType flag.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`create <dataset-id>`,describe:`Creates multiple indicators at once with their respective types and related datasets.`,builder:de,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset indicators bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/bulk`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`json`,body:{"auto-create-type":e[`auto-create-type`],body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/indicators/bulk`,{body:n})),{successLabel:`Created`});return}let d={};e[`auto-create-type`]!==void 0&&o(d,[`autoCreateType`],e[`auto-create-type`]),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/indicators/bulk`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}},pe={command:`bulk`,describe:`Events operations`,builder:e=>e.command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function me(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`auto-create-type`,{type:`boolean`,description:`If true, automatically create the indicator type if it doesn't exist. If false (default), throw an error when the indicator type doesn't exist.`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const he={command:`create <dataset-id>`,describe:`Creates a new indicator with the specified type and related datasets.`,builder:me,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset indicators create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/create`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`json`,body:{"auto-create-type":e[`auto-create-type`],"indicator-type":e[`indicator-type`],value:e.value,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/indicators/create`,{body:t})),{successLabel:`Created`});return}e[`indicator-type`]===void 0&&(e[`indicator-type`]=await t(`indicator-type`,`The indicatorType field`)),e.value===void 0&&(e.value=await t(`value`,`The value field`));let m={};e[`auto-create-type`]!==void 0&&o(m,[`autoCreateType`],e[`auto-create-type`]),e[`indicator-type`]!==void 0&&o(m,[`indicatorType`],d(e[`indicator-type`],`indicator-type`,`text`)),e.value!==void 0&&o(m,[`value`],d(e.value,`value`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/indicators/create`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},ge={command:`create`,describe:`Events operations`,builder:e=>e.command(he).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _e(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset 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 ve={command:`delete <indicator-id>`,describe:`Deletes a specific indicator by its UUID.`,builder:_e,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one events dataset indicators delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${t[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(t[`dataset-id`]))}/indicators/${t[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(t[`indicator-id`]))}`,pathParams:{"dataset-id":String(t[`dataset-id`]??``),"indicator-id":String(t[`indicator-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
6
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.events.dataset.indicators.delete(o,t[`dataset-id`],t[`indicator-id`])),{successLabel:`Deleted`})}};function ye(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`indicator <indicator-id>`,describe:`Retrieves a specific indicator by its UUID.`,builder:ye,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset indicators get indicator`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/${e[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(e[`indicator-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"indicator-id":String(e[`indicator-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.dataset.indicators.get.indicator(i,e[`dataset-id`],e[`indicator-id`])),{successLabel:`Loaded`})}},xe={command:`get`,describe:`Events operations`,builder:e=>e.command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.positional(`indicator-id`,{type:`string`,description:`Indicator UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ce={command:`patch <indicator-id>`,describe:`Updates an existing indicator's properties.`,builder:Se,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset indicators patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/${e[`indicator-id`]==null?`<indicator-id>`:encodeURIComponent(String(e[`indicator-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"indicator-id":String(e[`indicator-id`]??``)},bodyKind:`json`,body:{"indicator-type":e[`indicator-type`],value:e.value,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/indicators/${encodeURIComponent(String(e[`indicator-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e[`indicator-type`]!==void 0&&o(f,[`indicatorType`],d(e[`indicator-type`],`indicator-type`,`text`)),e.value!==void 0&&o(f,[`value`],d(e.value,`value`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/indicators/${encodeURIComponent(String(e[`indicator-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}};function we(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`get <dataset-id>`,describe:`Returns all mirrored tags from the indicator dataset (DO mirror table). No pagination.`,builder:we,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset indicators tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/indicators/tags`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.dataset.indicators.tags.get(i,e[`dataset-id`])),{successLabel:`Loaded`})}},Ee={command:`tags`,describe:`Events operations`,builder:e=>e.command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},De={command:`indicators`,describe:`Events operations`,builder:e=>e.command(ve).command(Ce).command(pe).command(ge).command(xe).command(Ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Oe(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`keep-raw-data`,{type:`boolean`,description:`If true, copies raw data to the destination dataset. Default is false (raw data is stripped/not copied). Raw data is always deleted from the source.`}).option(`dest-dataset-id`,{type:`string`,description:`The destDatasetId field`}).option(`event-ids`,{type:`string`,array:!0,description:`The eventIds field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ke={command:`create <dataset-id>`,describe:`Moves specified events from one dataset to another dataset`,builder:Oe,handler:async e=>{let i={keepRawData:e[`keep-raw-data`]};if(e.dryRun){l({command:`cf cloudforce-one events dataset move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/move`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},query:i,bodyKind:`json`,body:{"dest-dataset-id":e[`dest-dataset-id`],"event-ids":e[`event-ids`],body:e.body}});return}let f=await r(e),m=e.local?p:await n(f);if(e.accountId=m,e.body){let t=s(e.body),n=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/move${n?`?`+n:``}`,{body:t})),{successLabel:`Created`});return}if(e[`dest-dataset-id`]===void 0&&(e[`dest-dataset-id`]=await t(`dest-dataset-id`,`The destDatasetId field`)),e[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let h={};e[`dest-dataset-id`]!==void 0&&o(h,[`destDatasetId`],d(e[`dest-dataset-id`],`dest-dataset-id`,`text`)),e[`event-ids`]!==void 0&&o(h,[`eventIds`],e[`event-ids`]);let g=new URLSearchParams(Object.entries(i).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/move${g?`?`+g:``}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}},Ae={command:`move`,describe:`Events operations`,builder:e=>e.command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function je(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`role`,{type:`string`,description:`The role field`,choices:[`read`,`write`]}).option(`subject-id`,{type:`string`,description:`The subjectId field`}).option(`subject-type`,{type:`string`,description:`The subjectType field`,choices:[`account`,`group`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Me={command:`create <dataset-id>`,describe:`Create a permission`,builder:je,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset permissions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/permissions`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`json`,body:{role:e.role,"subject-id":e[`subject-id`],"subject-type":e[`subject-type`],body:e.body}});return}let f=await r(e),m=e.local?p:await n(f);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/permissions`,{body:t})),{successLabel:`Created`});return}e.role===void 0&&(e.role=await i(`role`,`The role field`,[`read`,`write`])),e[`subject-id`]===void 0&&(e[`subject-id`]=await t(`subject-id`,`The subjectId field`)),e[`subject-type`]===void 0&&(e[`subject-type`]=await i(`subject-type`,`The subjectType field`,[`account`,`group`]));let h={};e.role!==void 0&&o(h,[`role`],d(e.role,`role`,`text`)),e[`subject-id`]!==void 0&&o(h,[`subjectId`],d(e[`subject-id`],`subject-id`,`text`)),e[`subject-type`]!==void 0&&o(h,[`subjectType`],d(e[`subject-type`],`subject-type`,`text`)),c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/permissions`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function Ne(e){return e.positional(`grant-id`,{type:`string`,description:`Grant ID`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,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 Pe={command:`delete <grant-id>`,describe:`Delete a permission`,builder:Ne,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one events dataset permissions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${t[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(t[`dataset-id`]))}/permissions/${t[`grant-id`]==null?`<grant-id>`:encodeURIComponent(String(t[`grant-id`]))}`,pathParams:{"dataset-id":String(t[`dataset-id`]??``),"grant-id":String(t[`grant-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
7
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.events.dataset.permissions.delete(o,t[`dataset-id`],t[`grant-id`])),{successLabel:`Deleted`})}};function Fe(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`get <dataset-id>`,describe:`List permissions`,builder:Fe,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset permissions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/permissions`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.dataset.permissions.get(i,e[`dataset-id`])),{successLabel:`Loaded`})}};function Le(e){return e.positional(`grant-id`,{type:`string`,description:`Grant ID`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`role`,{type:`string`,description:`The role field`,choices:[`read`,`write`]}).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 Re={command:`update <grant-id>`,describe:`Update a permission`,builder:Le,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset permissions update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/permissions/${e[`grant-id`]==null?`<grant-id>`:encodeURIComponent(String(e[`grant-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``),"grant-id":String(e[`grant-id`]??``)},bodyKind:`json`,body:{role:e.role,body:e.body}});return}let t=await r(e),f=e.local?p:await n(t);if(e.accountId=f,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.put(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/permissions/${encodeURIComponent(String(e[`grant-id`]))}`,{body:n})),{successLabel:`Updated`});return}e.role===void 0&&(e.role=await i(`role`,`The role field`,[`read`,`write`]));let m={};e.role!==void 0&&o(m,[`role`],d(e.role,`role`,`text`)),c(await u(`Updating`,async()=>t.put(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}/permissions/${encodeURIComponent(String(e[`grant-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},ze={command:`permissions`,describe:`Events operations`,builder:e=>e.command(Me).command(Pe).command(Ie).command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Be(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`indicator-type`,{type:`string`,description:`IndicatorType`}).option(`related-event`,{type:`string`,description:`Filter indicators by related event UUID(s). Multiple UUIDs can be provided by repeating the parameter.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`get <tag-uuid>`,describe:`Returns indicators associated with the provided tag UUID across all indicator datasets, with pagination.`,builder:Be,handler:async e=>{let t={page:e.page,pageSize:e[`page-size`],indicatorType:e[`indicator-type`],relatedEvent:e[`related-event`]};if(e.dryRun){l({command:`cf cloudforce-one events dataset tags indicators get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/tags/${e[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(e[`tag-uuid`]))}/indicators`,pathParams:{"tag-uuid":String(e[`tag-uuid`]??``),"dataset-id":String(e[`dataset-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.events.dataset.tags.indicators.get(o,e[`tag-uuid`],e[`dataset-id`],t)),{successLabel:`Loaded`})}},He={command:`indicators`,describe:`Events operations`,builder:e=>e.command(Ve).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ue={command:`tags`,describe:`Operations for events.dataset.tags`,builder:e=>e.command(He).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function We(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ge={command:`get <dataset-id>`,describe:`Lists all target industries for a specific dataset`,builder:We,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events dataset target industries get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/targetIndustries`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.dataset.target.industries.get(i,e[`dataset-id`])),{successLabel:`Loaded`})}},Ke={command:`industries`,describe:`Events operations`,builder:e=>e.command(Ge).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},qe={command:`target`,describe:`Operations for events.dataset.target`,builder:e=>e.command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Je={command:`dataset`,describe:`Events operations`,builder:e=>e.command(M).command(P).command(A).command(L).command(ae).command(ue).command(De).command(Ae).command(ze).command(Ue).command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ye(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Xe={command:`create`,describe:`Populate dataset-specific lookup tables from existing Events data with batch processing`,builder:Ye,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events datasets populate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/datasets/populate`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Creating`,async()=>t.cloudforceOne.events.datasets.populate.create(i)),{successLabel:`Created`})}},Ze={command:`populate`,describe:`Events operations`,builder:e=>e.command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Qe={command:`datasets`,describe:`Operations for events.datasets`,builder:e=>e.command(Ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $e(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset UUID.`,demandOption:!0}).option(`event-ids`,{type:`string`,description:`Array of Event IDs to delete.`,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 et={command:`delete <dataset-id>`,describe:`Deletes one or more events`,builder:$e,handler:async t=>{let i={eventIds:t[`event-ids`]};if(t.dryRun){l({command:`cf cloudforce-one events delete delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/${t[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(t[`dataset-id`]))}/delete`,pathParams:{"dataset-id":String(t[`dataset-id`]??``)},query:i,bodyKind:`none`});return}let o=await r(t),s=t.local?p:await n(o);if(t.accountId=s,!await e({force:!!t.force})){process.stderr.write(`Aborted.
8
- `);return}c(await u(`Deleting`,async()=>o.cloudforceOne.events.delete.delete(s,t[`dataset-id`],i)),{successLabel:`Deleted`})}},tt={command:`delete`,describe:`Events operations`,builder:e=>e.command(et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function nt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const rt={command:`ql`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:nt,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events graphql create graph ql`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/graphql`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Creating`,async()=>t.cloudforceOne.events.graphql.create.graph.ql(i)),{successLabel:`Created`})}};function it(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const at={command:`qlv2`,describe:`Execute GraphQL aggregations over threat events. Supports multi-dimensional group-bys, optional date range filtering, and multi-dataset aggregation.`,builder:it,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events graphql create graph qlv2`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/v2/events/graphql`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Creating`,async()=>t.cloudforceOne.events.graphql.create.graph.qlv2(i)),{successLabel:`Created`})}},ot={command:`graph`,describe:`Events operations`,builder:e=>e.command(rt).command(at).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},st={command:`create`,describe:`Operations for events.graphql.create`,builder:e=>e.command(ot).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ct={command:`graphql`,describe:`Operations for events.graphql`,builder:e=>e.command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function lt(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query indicator types from. If not provided, queries all datasets for the account.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ut={command:`get`,describe:`Lists indicator types across multiple datasets`,builder:lt,handler:async e=>{let t={datasetIds:e[`dataset-ids`]};if(e.dryRun){l({command:`cf cloudforce-one events indicator types get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/indicator-types`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.events.indicator.types.get(o,t)),{successLabel:`Loaded`})}},dt={command:`types`,describe:`Events operations`,builder:e=>e.command(ut).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ft={command:`indicator`,describe:`Operations for events.indicator`,builder:e=>e.command(dt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pt(e){return e.option(`dataset-ids`,{type:`string`,description:`Dataset IDs to query indicators from (array of UUIDs), or special value 'all' or '*' to query all datasets. If not provided, uses the default dataset.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`search`,{type:`string`,description:`Structured search as a JSON array of {field, op, value} objects. Searchable fields: value, indicatorType. Supports operators: equals, not, contains, startsWith, endsWith, gt, lt, gte, lte, like, in, find. Use the 'in' operator with an array value to bulk-check up to 100 indicators in a single request, e.g. search=[{"field":"value","op":"in","value":["evil.com","bad.org"]}]. Multiple conditions are AND'd together. Max 10 conditions per request.`}).option(`name`,{type:`string`,description:`Filter indicators by value using substring match (LIKE). Legacy alternative to structured search.`}).option(`indicator-type`,{type:`string`,description:`IndicatorType`}).option(`related-events`,{type:`string`,description:`Filter by related event IDs`}).option(`tags`,{type:`string`,description:`Filter by tag values or UUIDs. Indicators must have at least one of the specified tags (OR logic). Supports both tag UUID and tag value.`}).option(`created-after`,{type:`string`,description:`Filter indicators created on or after this date. Must use ISO 8601 format (e.g., '2024-01-15T00:00:00Z').`}).option(`created-before`,{type:`string`,description:`Filter indicators created on or before this date. Must use ISO 8601 format (e.g., '2024-12-31T23:59:59Z').`}).option(`related-events-limit`,{type:`number`,description:`Limit the number of related events returned per indicator. Default: 2. Set to 0 for none, -1 for all events.`}).option(`include-tags`,{type:`boolean`,description:`Whether to include full tag details for each indicator. Defaults to true.`}).option(`include-total-count`,{type:`boolean`,description:`Whether to compute accurate total count via COUNT(*). Defaults to false for performance. When false, total_count is an approximation.`}).option(`format`,{type:`string`,description:`Output format for indicator data. 'json' returns the default format, 'stix2' returns STIX 2.1 Indicator SDOs.`,choices:[`json`,`stix2`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const mt={command:`get`,describe:`Retrieves a paginated list of indicators across specified datasets. Use datasetIds=all or datasetIds=* to query all datasets for the account. If no datasetIds provided, uses the default dataset.`,builder:pt,handler:async e=>{let t={datasetIds:e[`dataset-ids`],page:e.page,pageSize:e[`page-size`],search:e.search,name:e.name,indicatorType:e[`indicator-type`],relatedEvents:e[`related-events`],tags:e.tags,createdAfter:e[`created-after`],createdBefore:e[`created-before`],relatedEventsLimit:e[`related-events-limit`],includeTags:e[`include-tags`],includeTotalCount:e[`include-total-count`],format:e.format};if(e.dryRun){l({command:`cf cloudforce-one events indicators get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/indicators`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.events.indicators.get(o,t)),{successLabel:`Loaded`})}},ht={command:`indicators`,describe:`Events operations`,builder:e=>e.command(mt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gt(e){return e.option(`alert-enabled`,{type:`boolean`,description:`Enable alerts for this query`}).option(`alert-rollup-enabled`,{type:`boolean`,description:`Enable alert rollup for this query`}).option(`name`,{type:`string`,description:`Unique name for the saved query`}).option(`query-json`,{type:`string`,description:`JSON string containing the query parameters`}).option(`rule-enabled`,{type:`boolean`,description:`Enable rule for this query`}).option(`rule-scope`,{type:`string`,description:`Scope for the rule`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _t={command:`create-create`,describe:`Create a new saved event query for the account`,builder:gt,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events queries create-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/queries/create`,pathParams:{},bodyKind:`json`,body:{"alert-enabled":e[`alert-enabled`],"alert-rollup-enabled":e[`alert-rollup-enabled`],name:e.name,"query-json":e[`query-json`],"rule-enabled":e[`rule-enabled`],"rule-scope":e[`rule-scope`],body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/queries/create`,{body:t})),{successLabel:`Created`});return}if(e[`alert-enabled`]===void 0)throw Error(`--alert-enabled is required (or pass --body with this field set).`);if(e[`alert-rollup-enabled`]===void 0)throw Error(`--alert-rollup-enabled is required (or pass --body with this field set).`);if(e.name===void 0&&(e.name=await t(`name`,`Unique name for the saved query`)),e[`query-json`]===void 0&&(e[`query-json`]=await t(`query-json`,`JSON string containing the query parameters`)),e[`rule-enabled`]===void 0)throw Error(`--rule-enabled is required (or pass --body with this field set).`);let m={};e[`alert-enabled`]!==void 0&&o(m,[`alert_enabled`],e[`alert-enabled`]),e[`alert-rollup-enabled`]!==void 0&&o(m,[`alert_rollup_enabled`],e[`alert-rollup-enabled`]),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),e[`query-json`]!==void 0&&o(m,[`query_json`],d(e[`query-json`],`query-json`,`text`)),e[`rule-enabled`]!==void 0&&o(m,[`rule_enabled`],e[`rule-enabled`]),e[`rule-scope`]!==void 0&&o(m,[`rule_scope`],d(e[`rule-scope`],`rule-scope`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/queries/create`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function vt(e){return e.positional(`query-id`,{type:`string`,description:`Event query ID`,demandOption:!0}).option(`alert-enabled`,{type:`boolean`,description:`Enable alerts for this query`}).option(`alert-rollup-enabled`,{type:`boolean`,description:`Enable alert rollup for this query`}).option(`name`,{type:`string`,description:`Unique name for the saved query`}).option(`query-json`,{type:`string`,description:`JSON string containing the query parameters`}).option(`rule-enabled`,{type:`boolean`,description:`Enable rule for this query`}).option(`rule-scope`,{type:`string`,description:`Scope for the rule`}).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 yt={command:`create <query-id>`,describe:`Update an existing saved event query by its ID`,builder:vt,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events queries create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/queries/${e[`query-id`]==null?`<query-id>`:encodeURIComponent(String(e[`query-id`]))}`,pathParams:{"query-id":String(e[`query-id`]??``)},bodyKind:`json`,body:{"alert-enabled":e[`alert-enabled`],"alert-rollup-enabled":e[`alert-rollup-enabled`],name:e.name,"query-json":e[`query-json`],"rule-enabled":e[`rule-enabled`],"rule-scope":e[`rule-scope`],body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/queries/${encodeURIComponent(String(e[`query-id`]))}`,{body:n})),{successLabel:`Created`});return}let f={};e[`alert-enabled`]!==void 0&&o(f,[`alert_enabled`],e[`alert-enabled`]),e[`alert-rollup-enabled`]!==void 0&&o(f,[`alert_rollup_enabled`],e[`alert-rollup-enabled`]),e.name!==void 0&&o(f,[`name`],d(e.name,`name`,`text`)),e[`query-json`]!==void 0&&o(f,[`query_json`],d(e[`query-json`],`query-json`,`text`)),e[`rule-enabled`]!==void 0&&o(f,[`rule_enabled`],e[`rule-enabled`]),e[`rule-scope`]!==void 0&&o(f,[`rule_scope`],d(e[`rule-scope`],`rule-scope`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/queries/${encodeURIComponent(String(e[`query-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function bt(e){return e.positional(`query-id`,{type:`string`,description:`Event query 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 xt={command:`delete <query-id>`,describe:`Delete a saved event query by its ID`,builder:bt,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one events queries delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/queries/${t[`query-id`]==null?`<query-id>`:encodeURIComponent(String(t[`query-id`]))}`,pathParams:{"query-id":String(t[`query-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
9
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.events.queries.delete(o,t[`query-id`])),{successLabel:`Deleted`})}};function St(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ct={command:`event`,describe:`Retrieve all saved event queries for the account`,builder:St,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events queries get event`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/queries`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.queries.get.event(i)),{successLabel:`Loaded`})}};function wt(e){return e.positional(`query-id`,{type:`string`,description:`Event query ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Tt={command:`v2 <query-id>`,describe:`Retrieve a saved event query by its ID`,builder:wt,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events queries get v2`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/queries/${e[`query-id`]==null?`<query-id>`:encodeURIComponent(String(e[`query-id`]))}`,pathParams:{"query-id":String(e[`query-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.queries.get.v2(i,e[`query-id`])),{successLabel:`Loaded`})}},Et={command:`get`,describe:`Events operations`,builder:e=>e.command(Ct).command(Tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Dt(e){return e.positional(`query-id`,{type:`string`,description:`Event query ID`,demandOption:!0}).option(`alert-enabled`,{type:`boolean`,description:`Enable alerts for this query`}).option(`alert-rollup-enabled`,{type:`boolean`,description:`Enable alert rollup for this query`}).option(`name`,{type:`string`,description:`Unique name for the saved query`}).option(`query-json`,{type:`string`,description:`JSON string containing the query parameters`}).option(`rule-enabled`,{type:`boolean`,description:`Enable rule for this query`}).option(`rule-scope`,{type:`string`,description:`Scope for the rule`}).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 Ot={command:`patch <query-id>`,describe:`Update an existing saved event query by its ID`,builder:Dt,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events queries patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/queries/${e[`query-id`]==null?`<query-id>`:encodeURIComponent(String(e[`query-id`]))}`,pathParams:{"query-id":String(e[`query-id`]??``)},bodyKind:`json`,body:{"alert-enabled":e[`alert-enabled`],"alert-rollup-enabled":e[`alert-rollup-enabled`],name:e.name,"query-json":e[`query-json`],"rule-enabled":e[`rule-enabled`],"rule-scope":e[`rule-scope`],body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/queries/${encodeURIComponent(String(e[`query-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e[`alert-enabled`]!==void 0&&o(f,[`alert_enabled`],e[`alert-enabled`]),e[`alert-rollup-enabled`]!==void 0&&o(f,[`alert_rollup_enabled`],e[`alert-rollup-enabled`]),e.name!==void 0&&o(f,[`name`],d(e.name,`name`,`text`)),e[`query-json`]!==void 0&&o(f,[`query_json`],d(e[`query-json`],`query-json`,`text`)),e[`rule-enabled`]!==void 0&&o(f,[`rule_enabled`],e[`rule-enabled`]),e[`rule-scope`]!==void 0&&o(f,[`rule_scope`],d(e[`rule-scope`],`rule-scope`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/queries/${encodeURIComponent(String(e[`query-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},kt={command:`queries`,describe:`Events operations`,builder:e=>e.command(yt).command(_t).command(xt).command(Ot).command(Et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function At(e){return e.positional(`raw-id`,{type:`string`,description:`Raw Event UUID.`,demandOption:!0}).option(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`source`,{type:`string`,description:`The source field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const jt={command:`create <raw-id>`,describe:`Updates a raw event`,builder:At,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events raw create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/raw/${e[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(e[`raw-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``),"raw-id":String(e[`raw-id`]??``)},bodyKind:`json`,body:{source:e.source,tlp:e.tlp,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/${encodeURIComponent(String(e[`event-id`]))}/raw/${encodeURIComponent(String(e[`raw-id`]))}`,{body:n})),{successLabel:`Created`});return}let f={};e.source!==void 0&&o(f,[`source`],d(e.source,`source`,`text`)),e.tlp!==void 0&&o(f,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/${encodeURIComponent(String(e[`event-id`]))}/raw/${encodeURIComponent(String(e[`raw-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}},Mt={command:`raw`,describe:`Events operations`,builder:e=>e.command(jt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Nt(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`events`,{type:`string`,array:!0,description:`The events field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Pt={command:`create <event-id>`,describe:`Creates event references for a event`,builder:Nt,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events relate create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/relate/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/create`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`json`,body:{events:e.events,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/relate/${encodeURIComponent(String(e[`event-id`]))}/create`,{body:n})),{successLabel:`Created`});return}if(e.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);let d={};e.events!==void 0&&o(d,[`events`],e.events),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/relate/${encodeURIComponent(String(e[`event-id`]))}/create`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}},Ft={command:`create`,describe:`Events operations`,builder:e=>e.command(Pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},It={command:`relate`,describe:`Operations for events.relate`,builder:e=>e.command(Ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Lt(e){return e.option(`child-ids`,{type:`string`,array:!0,description:`Array of UUIDs for child events. Single child = 1:1 relationship, multiple = 1:many relationships`}).option(`dataset-id`,{type:`string`,description:`Dataset identifier where the events are stored`}).option(`parent-id`,{type:`string`,description:`UUID of the parent event that will be the source of the relationship`}).option(`relationship-type`,{type:`string`,description:`Type of relationship to create between parent and child events`,choices:[`related_to`,`caused_by`,`attributed_to`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Rt={command:`create`,describe:`Creates a directed relationship between two events. The relationship is from parent to child with a specified type.`,builder:Lt,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events relationships create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/relationships/create`,pathParams:{},bodyKind:`json`,body:{"child-ids":e[`child-ids`],"dataset-id":e[`dataset-id`],"parent-id":e[`parent-id`],"relationship-type":e[`relationship-type`],body:e.body}});return}let f=await r(e),m=e.local?p:await n(f);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/events/relationships/create`,{body:t})),{successLabel:`Created`});return}if(e[`child-ids`]===void 0)throw Error(`--child-ids is required (or pass --body with this field set).`);e[`dataset-id`]===void 0&&(e[`dataset-id`]=await t(`dataset-id`,`Dataset identifier where the events are stored`)),e[`parent-id`]===void 0&&(e[`parent-id`]=await t(`parent-id`,`UUID of the parent event that will be the source of the relationship`)),e[`relationship-type`]===void 0&&(e[`relationship-type`]=await i(`relationship-type`,`Type of relationship to create between parent and child events`,[`related_to`,`caused_by`,`attributed_to`]));let h={};e[`child-ids`]!==void 0&&o(h,[`childIds`],e[`child-ids`]),e[`dataset-id`]!==void 0&&o(h,[`datasetId`],d(e[`dataset-id`],`dataset-id`,`text`)),e[`parent-id`]!==void 0&&o(h,[`parentId`],d(e[`parent-id`],`parent-id`,`text`)),e[`relationship-type`]!==void 0&&o(h,[`relationshipType`],d(e[`relationship-type`],`relationship-type`,`text`)),c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/events/relationships/create`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}},zt={command:`create`,describe:`Events operations`,builder:e=>e.command(Rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Bt(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`direction`,{type:`string`,description:`The direction to traverse the graph. Defaults to 'both' to search all.`,choices:[`ancestors`,`descendants`,`both`]}).option(`max-depth`,{type:`number`,description:`The maximum depth to traverse. Defaults to 5.`}).option(`relationship-types`,{type:`string`,description:`An optional array of relationship types to filter by.`}).option(`indicator-type-ids`,{type:`string`,description:`An optional array of indicator type IDs to filter the results by.`}).option(`dataset-id`,{type:`string`,description:`The dataset ID to search within.`,demandOption:!0}).option(`include-parent`,{type:`boolean`,description:`Whether to include the starting event in the results. Defaults to true.`}).option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Vt={command:`get <event-id>`,describe:"The `event_id` must be defined (to list existing events (and their IDs), use the [`Filter and List Events`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/methods/list/) endpoint). Also, must provide query parameters.",builder:Bt,handler:async e=>{let t={direction:e.direction,maxDepth:e[`max-depth`],relationshipTypes:e[`relationship-types`],indicatorTypeIds:e[`indicator-type-ids`],datasetId:e[`dataset-id`],includeParent:e[`include-parent`],page:e.page,pageSize:e[`page-size`]};if(e.dryRun){l({command:`cf cloudforce-one events relationships get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/relationships`,pathParams:{"event-id":String(e[`event-id`]??``)},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.events.relationships.get(o,e[`event-id`],t)),{successLabel:`Loaded`})}},Ht={command:`relationships`,describe:`Events operations`,builder:e=>e.command(Vt).command(zt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ut(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Wt={command:`create`,describe:`Creates a new Source-of-Truth tag category for an account.`,builder:Ut,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events tags categories create create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/tags/categories/create`,pathParams:{},bodyKind:`json`,body:{description:e.description,name:e.name,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/tags/categories/create`,{body:t})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e.description!==void 0&&o(m,[`description`],d(e.description,`description`,`text`)),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/tags/categories/create`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},Gt={command:`create`,describe:`Events operations`,builder:e=>e.command(Wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Kt(e){return e.positional(`category-uuid`,{type:`string`,description:`Tag Category UUID.`,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 qt={command:`delete <category-uuid>`,describe:`Deletes a Source-of-Truth tag category by UUID.`,builder:Kt,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one events tags categories delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/tags/categories/${t[`category-uuid`]==null?`<category-uuid>`:encodeURIComponent(String(t[`category-uuid`]))}`,pathParams:{"category-uuid":String(t[`category-uuid`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
10
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.events.tags.categories.delete(o,t[`category-uuid`])),{successLabel:`Deleted`})}};function Jt(e){return e.option(`search`,{type:`string`,description:`Search`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Yt={command:`get`,describe:`Returns all Source-of-Truth tag categories for an account.`,builder:Jt,handler:async e=>{let t={search:e.search};if(e.dryRun){l({command:`cf cloudforce-one events tags categories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/tags/categories`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.events.tags.categories.get(o,t)),{successLabel:`Loaded`})}};function Xt(e){return e.positional(`category-uuid`,{type:`string`,description:`Tag Category UUID.`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Zt={command:`patch <category-uuid>`,describe:`Updates a Source-of-Truth tag category by UUID.`,builder:Xt,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events tags categories patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/tags/categories/${e[`category-uuid`]==null?`<category-uuid>`:encodeURIComponent(String(e[`category-uuid`]))}`,pathParams:{"category-uuid":String(e[`category-uuid`]??``)},bodyKind:`json`,body:{description:e.description,name:e.name,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/tags/categories/${encodeURIComponent(String(e[`category-uuid`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.description!==void 0&&o(f,[`description`],d(e.description,`description`,`text`)),e.name!==void 0&&o(f,[`name`],d(e.name,`name`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/tags/categories/${encodeURIComponent(String(e[`category-uuid`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},Qt={command:`categories`,describe:`Events operations`,builder:e=>e.command(qt).command(Yt).command(Zt).command(Gt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $t(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,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 en={command:`delete <tag-uuid>`,describe:`Deletes a Source-of-Truth tag by UUID.`,builder:$t,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one events tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/tags/${t[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(t[`tag-uuid`]))}`,pathParams:{"tag-uuid":String(t[`tag-uuid`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
11
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.events.tags.delete(o,t[`tag-uuid`])),{successLabel:`Deleted`})}};function tn(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`page-size`,{type:`number`,description:`PageSize`}).option(`search`,{type:`string`,description:`Search`}).option(`category-uuid`,{type:`string`,description:`CategoryUuid`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nn={command:`get`,describe:`Returns all Source-of-Truth tags for an account.`,builder:tn,handler:async e=>{let t={page:e.page,pageSize:e[`page-size`],search:e.search,categoryUuid:e[`category-uuid`]};if(e.dryRun){l({command:`cf cloudforce-one events tags get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/tags`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.events.tags.get(o,t)),{successLabel:`Loaded`})}};function rn(e){return e.positional(`tag-uuid`,{type:`string`,description:`Tag UUID.`,demandOption:!0}).option(`active-duration`,{type:`string`,description:`The activeDuration field`}).option(`actor-category`,{type:`string`,description:`The actorCategory field`}).option(`alias-group-names`,{type:`string`,array:!0,description:`The aliasGroupNames field`}).option(`alias-group-names-internal`,{type:`string`,array:!0,description:`The aliasGroupNamesInternal field`}).option(`analytic-priority`,{type:`number`,description:`The analyticPriority field`}).option(`attribution-confidence`,{type:`string`,description:`The attributionConfidence field`}).option(`attribution-organization`,{type:`string`,description:`The attributionOrganization field`}).option(`category-uuid`,{type:`string`,description:`The categoryUuid field`}).option(`external-reference-links`,{type:`string`,array:!0,description:`The externalReferenceLinks field`}).option(`internal-description`,{type:`string`,description:`The internalDescription field`}).option(`motive`,{type:`string`,description:`The motive field`}).option(`opsec-level`,{type:`string`,description:`The opsecLevel field`}).option(`origin-country-iso`,{type:`string`,description:`The originCountryISO field`}).option(`priority`,{type:`number`,description:`The priority field`}).option(`sophistication-level`,{type:`string`,description:`The sophisticationLevel field`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const an={command:`patch <tag-uuid>`,describe:`Updates a Source-of-Truth tag by UUID.`,builder:rn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events tags patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/tags/${e[`tag-uuid`]==null?`<tag-uuid>`:encodeURIComponent(String(e[`tag-uuid`]))}`,pathParams:{"tag-uuid":String(e[`tag-uuid`]??``)},bodyKind:`json`,body:{"active-duration":e[`active-duration`],"actor-category":e[`actor-category`],"alias-group-names":e[`alias-group-names`],"alias-group-names-internal":e[`alias-group-names-internal`],"analytic-priority":e[`analytic-priority`],"attribution-confidence":e[`attribution-confidence`],"attribution-organization":e[`attribution-organization`],"category-uuid":e[`category-uuid`],"external-reference-links":e[`external-reference-links`],"internal-description":e[`internal-description`],motive:e.motive,"opsec-level":e[`opsec-level`],"origin-country-iso":e[`origin-country-iso`],priority:e.priority,"sophistication-level":e[`sophistication-level`],value:e.value,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/tags/${encodeURIComponent(String(e[`tag-uuid`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e[`active-duration`]!==void 0&&o(f,[`activeDuration`],d(e[`active-duration`],`active-duration`,`text`)),e[`actor-category`]!==void 0&&o(f,[`actorCategory`],d(e[`actor-category`],`actor-category`,`text`)),e[`alias-group-names`]!==void 0&&o(f,[`aliasGroupNames`],e[`alias-group-names`]),e[`alias-group-names-internal`]!==void 0&&o(f,[`aliasGroupNamesInternal`],e[`alias-group-names-internal`]),e[`analytic-priority`]!==void 0&&o(f,[`analyticPriority`],e[`analytic-priority`]),e[`attribution-confidence`]!==void 0&&o(f,[`attributionConfidence`],d(e[`attribution-confidence`],`attribution-confidence`,`text`)),e[`attribution-organization`]!==void 0&&o(f,[`attributionOrganization`],d(e[`attribution-organization`],`attribution-organization`,`text`)),e[`category-uuid`]!==void 0&&o(f,[`categoryUuid`],d(e[`category-uuid`],`category-uuid`,`text`)),e[`external-reference-links`]!==void 0&&o(f,[`externalReferenceLinks`],e[`external-reference-links`]),e[`internal-description`]!==void 0&&o(f,[`internalDescription`],d(e[`internal-description`],`internal-description`,`text`)),e.motive!==void 0&&o(f,[`motive`],d(e.motive,`motive`,`text`)),e[`opsec-level`]!==void 0&&o(f,[`opsecLevel`],d(e[`opsec-level`],`opsec-level`,`text`)),e[`origin-country-iso`]!==void 0&&o(f,[`originCountryISO`],d(e[`origin-country-iso`],`origin-country-iso`,`text`)),e.priority!==void 0&&o(f,[`priority`],e.priority),e[`sophistication-level`]!==void 0&&o(f,[`sophisticationLevel`],d(e[`sophistication-level`],`sophistication-level`,`text`)),e.value!==void 0&&o(f,[`value`],d(e.value,`value`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/tags/${encodeURIComponent(String(e[`tag-uuid`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},on={command:`tags`,describe:`Events operations`,builder:e=>e.command(en).command(nn).command(an).command(Qt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function sn(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const cn={command:`get`,describe:`Lists all target industries from industry map catalog`,builder:sn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events target industries catalog get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/targetIndustries/catalog`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.events.target.industries.catalog.get(i)),{successLabel:`Loaded`})}},ln={command:`catalog`,describe:`Events operations`,builder:e=>e.command(cn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},un={command:`industries`,describe:`Operations for events.target.industries`,builder:e=>e.command(ln).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},dn={command:`target`,describe:`Operations for events.target`,builder:e=>e.command(un).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function fn(e){return e.option(`dataset-id`,{type:`string`,description:`Dataset ID containing the events to update. Required to prevent cross-account modifications.`}).option(`event-ids`,{type:`string`,array:!0,description:`List of event UUIDs to update (1-100)`}).option(`updates-attacker`,{type:`string`,description:`The updates.attacker field`}).option(`updates-attacker-country`,{type:`string`,description:`The updates.attackerCountry field`}).option(`updates-category`,{type:`string`,description:`The updates.category field`}).option(`updates-created-at`,{type:`string`,description:`The updates.createdAt field`}).option(`updates-event`,{type:`string`,description:`The updates.event field`}).option(`updates-indicator`,{type:`string`,description:`The updates.indicator field`}).option(`updates-indicator-type`,{type:`string`,description:`The updates.indicatorType field`}).option(`updates-insight`,{type:`string`,description:`The updates.insight field`}).option(`updates-raw-source`,{type:`string`,description:`The updates.raw.source field`}).option(`updates-raw-tlp`,{type:`string`,description:`The updates.raw.tlp field`}).option(`updates-target-country`,{type:`string`,description:`The updates.targetCountry field`}).option(`updates-target-industry`,{type:`string`,description:`The updates.targetIndustry field`}).option(`updates-tlp`,{type:`string`,description:`The updates.tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const pn={command:`patch`,describe:`Updates multiple events with the same field values. Maximum 100 events per request.`,builder:fn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one events update bulk patch`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/update/bulk`,pathParams:{},bodyKind:`json`,body:{"dataset-id":e[`dataset-id`],"event-ids":e[`event-ids`],"updates-attacker":e[`updates-attacker`],"updates-attacker-country":e[`updates-attacker-country`],"updates-category":e[`updates-category`],"updates-created-at":e[`updates-created-at`],"updates-event":e[`updates-event`],"updates-indicator":e[`updates-indicator`],"updates-indicator-type":e[`updates-indicator-type`],"updates-insight":e[`updates-insight`],"updates-raw-source":e[`updates-raw-source`],"updates-raw-tlp":e[`updates-raw-tlp`],"updates-target-country":e[`updates-target-country`],"updates-target-industry":e[`updates-target-industry`],"updates-tlp":e[`updates-tlp`],body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Updating`,async()=>i.patch(`/accounts/${f}/cloudforce-one/events/update/bulk`,{body:t})),{successLabel:`Updated`});return}if(e[`dataset-id`]===void 0&&(e[`dataset-id`]=await t(`dataset-id`,`Dataset ID containing the events to update. Required to prevent cross-account modifications.`)),e[`event-ids`]===void 0)throw Error(`--event-ids is required (or pass --body with this field set).`);let m={};e[`dataset-id`]!==void 0&&o(m,[`datasetId`],d(e[`dataset-id`],`dataset-id`,`text`)),e[`event-ids`]!==void 0&&o(m,[`eventIds`],e[`event-ids`]),e[`updates-attacker`]!==void 0&&o(m,[`updates`,`attacker`],d(e[`updates-attacker`],`updates-attacker`,`text`)),e[`updates-attacker-country`]!==void 0&&o(m,[`updates`,`attackerCountry`],d(e[`updates-attacker-country`],`updates-attacker-country`,`text`)),e[`updates-category`]!==void 0&&o(m,[`updates`,`category`],d(e[`updates-category`],`updates-category`,`text`)),e[`updates-created-at`]!==void 0&&o(m,[`updates`,`createdAt`],d(e[`updates-created-at`],`updates-created-at`,`text`)),e[`updates-event`]!==void 0&&o(m,[`updates`,`event`],d(e[`updates-event`],`updates-event`,`text`)),e[`updates-indicator`]!==void 0&&o(m,[`updates`,`indicator`],d(e[`updates-indicator`],`updates-indicator`,`text`)),e[`updates-indicator-type`]!==void 0&&o(m,[`updates`,`indicatorType`],d(e[`updates-indicator-type`],`updates-indicator-type`,`text`)),e[`updates-insight`]!==void 0&&o(m,[`updates`,`insight`],d(e[`updates-insight`],`updates-insight`,`text`)),e[`updates-raw-source`]!==void 0&&o(m,[`updates`,`raw`,`source`],d(e[`updates-raw-source`],`updates-raw-source`,`text`)),e[`updates-raw-tlp`]!==void 0&&o(m,[`updates`,`raw`,`tlp`],d(e[`updates-raw-tlp`],`updates-raw-tlp`,`text`)),e[`updates-target-country`]!==void 0&&o(m,[`updates`,`targetCountry`],d(e[`updates-target-country`],`updates-target-country`,`text`)),e[`updates-target-industry`]!==void 0&&o(m,[`updates`,`targetIndustry`],d(e[`updates-target-industry`],`updates-target-industry`,`text`)),e[`updates-tlp`]!==void 0&&o(m,[`updates`,`tlp`],d(e[`updates-tlp`],`updates-tlp`,`text`)),c(await u(`Updating`,async()=>i.patch(`/accounts/${f}/cloudforce-one/events/update/bulk`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}},mn={command:`bulk`,describe:`Events operations`,builder:e=>e.command(pn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},hn={command:`update`,describe:`Operations for events.update`,builder:e=>e.command(mn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},gn={command:`events`,describe:`Events operations`,builder:e=>e.command(D).command(y).command(T).command(Je).command(Qe).command(tt).command(ct).command(ft).command(ht).command(kt).command(Mt).command(It).command(Ht).command(on).command(dn).command(hn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _n(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`source`,{type:`string`,description:`Asset file to upload.`})}const vn={command:`create <request-id>`,describe:`Uploads a new asset to a Cloudforce One intelligence request.`,builder:_n,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests asset-new create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset/new`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,source:e.source}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.file!==void 0||e.body!==void 0||e.source!==void 0){let n=new FormData;if(e.file){let t=f(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);e.source!==void 0&&n.append(`source`,String(d(e.source,`source`,`text`)??``)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/asset/new`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=d(e.body,`body`,`binary`);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/asset/new`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{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.`)}},yn={command:`asset-new`,describe:`Additional request operations — priority listing and asset creation`,builder:e=>e.command(vn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function bn(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).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 xn={command:`create <request-id>`,describe:`Lists assets attached to a Cloudforce One intelligence request.`,builder:bn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests assets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`json`,body:{page:e.page,"per-page":e[`per-page`],body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/asset`,{body:n})),{successLabel:`Created`});return}if(e.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(e[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let d={};e.page!==void 0&&o(d,[`page`],e.page),e[`per-page`]!==void 0&&o(d,[`per_page`],e[`per-page`]),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/asset`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function Sn(e){return e.positional(`asset-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,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 Cn={command:`delete <asset-id>`,describe:`Removes an asset from a Cloudforce One intelligence request.`,builder:Sn,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one requests assets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${t[`request-id`]==null?`<request-id>`:encodeURIComponent(String(t[`request-id`]))}/asset/${t[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(t[`asset-id`]))}`,pathParams:{"request-id":String(t[`request-id`]??``),"asset-id":String(t[`asset-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
12
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.requests.assets.delete(o,t[`request-id`],t[`asset-id`])),{successLabel:`Deleted`})}};function $(e){return e.positional(`asset-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const wn={command:`get <asset-id>`,describe:`Retrieves an asset attached to a Cloudforce One intelligence request.`,builder:$,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests assets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset/${e[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(e[`asset-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``),"asset-id":String(e[`asset-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.requests.assets.get(i,e[`request-id`],e[`asset-id`])),{successLabel:`Loaded`})}};function Tn(e){return e.positional(`asset-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`source`,{type:`string`,description:`Asset file to upload.`}).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 En={command:`update <asset-id>`,describe:`Updates an asset in a Cloudforce One intelligence request.`,builder:Tn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests assets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/asset/${e[`asset-id`]==null?`<asset-id>`:encodeURIComponent(String(e[`asset-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``),"asset-id":String(e[`asset-id`]??``)},bodyKind:`json`,body:{source:e.source,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.put(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/asset/${encodeURIComponent(String(e[`asset-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.source!==void 0&&o(f,[`source`],d(e.source,`source`,`text`)),c(await u(`Updating`,async()=>t.put(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/asset/${encodeURIComponent(String(e[`asset-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},Dn={command:`assets`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(xn).command(Cn).command(wn).command(En).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function On(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kn={command:`constants`,describe:`Retrieves constant values used in Cloudforce One requests, including valid statuses and types.`,builder:On,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests constants`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/constants`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.requests.constants(i)),{successLabel:`Loaded`})}};function An(e){return e.option(`content`,{type:`string`,description:`Request content.`}).option(`priority`,{type:`string`,description:`Priority for analyzing the request.`}).option(`request-type`,{type:`string`,description:`Requested information from request.`}).option(`summary`,{type:`string`,description:`Brief description of the request.`}).option(`tlp`,{type:`string`,description:`The CISA defined Traffic Light Protocol (TLP).`,choices:[`clear`,`amber`,`amber-strict`,`green`,`red`]}).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 jn={command:`create`,describe:`Creating a request adds the request into the Cloudforce One queue for analysis. In addition to the content, a short title, type, priority, and releasability should be provided. If one is not provided, a default will be assigned.`,builder:An,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/new`,pathParams:{},bodyKind:`json`,body:{content:e.content,priority:e.priority,"request-type":e[`request-type`],summary:e.summary,tlp:e.tlp,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/new`,{body:n})),{successLabel:`Created`});return}let f={};e.content!==void 0&&o(f,[`content`],d(e.content,`content`,`text`)),e.priority!==void 0&&o(f,[`priority`],d(e.priority,`priority`,`text`)),e[`request-type`]!==void 0&&o(f,[`request_type`],d(e[`request-type`],`request-type`,`text`)),e.summary!==void 0&&o(f,[`summary`],d(e.summary,`summary`,`text`)),e.tlp!==void 0&&o(f,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/new`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function Mn(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,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 Nn={command:`delete <request-id>`,describe:`Deletes a Cloudforce One intelligence request and all associated data.`,builder:Mn,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one requests delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${t[`request-id`]==null?`<request-id>`:encodeURIComponent(String(t[`request-id`]))}`,pathParams:{"request-id":String(t[`request-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
13
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.requests.delete(o,t[`request-id`])),{successLabel:`Deleted`})}};function Pn(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fn={command:`get <request-id>`,describe:`Retrieves details for a specific Cloudforce One intelligence request.`,builder:Pn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.requests.get(i,e[`request-id`])),{successLabel:`Loaded`})}};function In(e){return e.option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`request-type`,{type:`string`,description:`Requested information from request.`}).option(`sort-by`,{type:`string`,description:`Field to sort results by.`}).option(`sort-order`,{type:`string`,description:`Sort order (asc or desc).`,choices:[`asc`,`desc`]}).option(`status`,{type:`string`,description:`Request Status.`,choices:[`open`,`accepted`,`reported`,`approved`,`completed`,`declined`]}).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 Ln={command:`list`,describe:`Lists Cloudforce One intelligence requests with filtering and pagination.`,builder:In,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests list`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests`,pathParams:{},bodyKind:`json`,body:{page:e.page,"per-page":e[`per-page`],"request-type":e[`request-type`],"sort-by":e[`sort-by`],"sort-order":e[`sort-order`],status:e.status,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests`,{body:n})),{successLabel:`Created`});return}if(e.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(e[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let f={};e.page!==void 0&&o(f,[`page`],e.page),e[`per-page`]!==void 0&&o(f,[`per_page`],e[`per-page`]),e[`request-type`]!==void 0&&o(f,[`request_type`],d(e[`request-type`],`request-type`,`text`)),e[`sort-by`]!==void 0&&o(f,[`sort_by`],d(e[`sort-by`],`sort-by`,`text`)),e[`sort-order`]!==void 0&&o(f,[`sort_order`],d(e[`sort-order`],`sort-order`,`text`)),e.status!==void 0&&o(f,[`status`],d(e.status,`status`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function Rn(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`content`,{type:`string`,description:`Content of message.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const zn={command:`create <request-id>`,describe:`Adds a message to a Cloudforce One intelligence request conversation.`,builder:Rn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests message create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/message/new`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`json`,body:{content:e.content,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/message/new`,{body:n})),{successLabel:`Created`});return}let f={};e.content!==void 0&&o(f,[`content`],d(e.content,`content`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/message/new`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function Bn(e){return e.positional(`message-id`,{type:`string`,description:`Message ID`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,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 Vn={command:`delete <message-id>`,describe:`Removes a message from a Cloudforce One intelligence request thread.`,builder:Bn,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one requests message delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${t[`request-id`]==null?`<request-id>`:encodeURIComponent(String(t[`request-id`]))}/message/${t[`message-id`]==null?`<message-id>`:encodeURIComponent(String(t[`message-id`]))}`,pathParams:{"request-id":String(t[`request-id`]??``),"message-id":String(t[`message-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
14
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.requests.message.delete(o,t[`request-id`],t[`message-id`])),{successLabel:`Deleted`})}};function Hn(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`sort-by`,{type:`string`,description:`Field to sort results by.`}).option(`sort-order`,{type:`string`,description:`Sort order (asc or desc).`,choices:[`asc`,`desc`]}).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 Un={command:`get <request-id>`,describe:`Lists messages in a Cloudforce One intelligence request conversation.`,builder:Hn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests message get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/message`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`json`,body:{page:e.page,"per-page":e[`per-page`],"sort-by":e[`sort-by`],"sort-order":e[`sort-order`],body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/message`,{body:n})),{successLabel:`Created`});return}if(e.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(e[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let f={};e.page!==void 0&&o(f,[`page`],e.page),e[`per-page`]!==void 0&&o(f,[`per_page`],e[`per-page`]),e[`sort-by`]!==void 0&&o(f,[`sort_by`],d(e[`sort-by`],`sort-by`,`text`)),e[`sort-order`]!==void 0&&o(f,[`sort_order`],d(e[`sort-order`],`sort-order`,`text`)),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/message`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Created`})}};function Wn(e){return e.positional(`message-id`,{type:`string`,description:`Message ID`,demandOption:!0}).option(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`content`,{type:`string`,description:`Content of message.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Gn={command:`update <message-id>`,describe:`Updates a message in a Cloudforce One intelligence request thread.`,builder:Wn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests message update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}/message/${e[`message-id`]==null?`<message-id>`:encodeURIComponent(String(e[`message-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``),"message-id":String(e[`message-id`]??``)},bodyKind:`json`,body:{content:e.content,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.put(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/message/${encodeURIComponent(String(e[`message-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.content!==void 0&&o(f,[`content`],d(e.content,`content`,`text`)),c(await u(`Updating`,async()=>t.put(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}/message/${encodeURIComponent(String(e[`message-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},Kn={command:`message`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(zn).command(Vn).command(Un).command(Gn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qn(e){return e.option(`labels`,{type:`string`,array:!0,description:`List of labels.`}).option(`priority`,{type:`number`,description:`Priority.`}).option(`requirement`,{type:`string`,description:`Requirement.`}).option(`tlp`,{type:`string`,description:`The CISA defined Traffic Light Protocol (TLP).`,choices:[`clear`,`amber`,`amber-strict`,`green`,`red`]}).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 Jn={command:`create`,describe:`Creates a new priority intelligence request in Cloudforce One.`,builder:qn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests priority create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/priority/new`,pathParams:{},bodyKind:`json`,body:{labels:e.labels,priority:e.priority,requirement:e.requirement,tlp:e.tlp,body:e.body}});return}let f=await r(e),m=e.local?p:await n(f);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/requests/priority/new`,{body:t})),{successLabel:`Created`});return}if(e.labels===void 0)throw Error(`--labels is required (or pass --body with this field set).`);if(e.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);e.requirement===void 0&&(e.requirement=await t(`requirement`,`Requirement.`)),e.tlp===void 0&&(e.tlp=await i(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let h={};e.labels!==void 0&&o(h,[`labels`],e.labels),e.priority!==void 0&&o(h,[`priority`],e.priority),e.requirement!==void 0&&o(h,[`requirement`],d(e.requirement,`requirement`,`text`)),e.tlp!==void 0&&o(h,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Creating`,async()=>f.post(`/accounts/${m}/cloudforce-one/requests/priority/new`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Created`})}};function Yn(e){return e.positional(`priority-id`,{type:`string`,description:`UUID.`,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 Xn={command:`delete <priority-id>`,describe:`Deletes a priority intelligence request from Cloudforce One.`,builder:Yn,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one requests priority delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/priority/${t[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(t[`priority-id`]))}`,pathParams:{"priority-id":String(t[`priority-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
15
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.requests.priority.delete(o,t[`priority-id`])),{successLabel:`Deleted`})}};function Zn(e){return e.positional(`priority-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qn={command:`get <priority-id>`,describe:`Retrieves a specific priority intelligence request from Cloudforce One.`,builder:Zn,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests priority get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/priority/${e[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(e[`priority-id`]))}`,pathParams:{"priority-id":String(e[`priority-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.requests.priority.get(i,e[`priority-id`])),{successLabel:`Loaded`})}};function $n(e){return e.option(`page`,{type:`number`,description:`Page number of results.`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).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 er={command:`list`,describe:`Lists priority intelligence requests in Cloudforce One.`,builder:$n,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests priority list`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/priority`,pathParams:{},bodyKind:`json`,body:{page:e.page,"per-page":e[`per-page`],body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/priority`,{body:n})),{successLabel:`Created`});return}if(e.page===void 0)throw Error(`--page is required (or pass --body with this field set).`);if(e[`per-page`]===void 0)throw Error(`--per-page is required (or pass --body with this field set).`);let d={};e.page!==void 0&&o(d,[`page`],e.page),e[`per-page`]!==void 0&&o(d,[`per_page`],e[`per-page`]),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/requests/priority`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function tr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nr={command:`quota`,describe:`Retrieves quota usage for Cloudforce One priority requests.`,builder:tr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests priority quota`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/priority/quota`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.requests.priority.quota(i)),{successLabel:`Loaded`})}};function rr(e){return e.positional(`priority-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`labels`,{type:`string`,array:!0,description:`List of labels.`}).option(`priority`,{type:`number`,description:`Priority.`}).option(`requirement`,{type:`string`,description:`Requirement.`}).option(`tlp`,{type:`string`,description:`The CISA defined Traffic Light Protocol (TLP).`,choices:[`clear`,`amber`,`amber-strict`,`green`,`red`]}).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 ir={command:`update <priority-id>`,describe:`Updates a priority intelligence request in Cloudforce One.`,builder:rr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests priority update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/priority/${e[`priority-id`]==null?`<priority-id>`:encodeURIComponent(String(e[`priority-id`]))}`,pathParams:{"priority-id":String(e[`priority-id`]??``)},bodyKind:`json`,body:{labels:e.labels,priority:e.priority,requirement:e.requirement,tlp:e.tlp,body:e.body}});return}let f=await r(e),m=e.local?p:await n(f);if(e.accountId=m,e.body){let t=s(e.body);c(await u(`Updating`,async()=>f.put(`/accounts/${m}/cloudforce-one/requests/priority/${encodeURIComponent(String(e[`priority-id`]))}`,{body:t})),{successLabel:`Updated`});return}if(e.labels===void 0)throw Error(`--labels is required (or pass --body with this field set).`);if(e.priority===void 0)throw Error(`--priority is required (or pass --body with this field set).`);e.requirement===void 0&&(e.requirement=await t(`requirement`,`Requirement.`)),e.tlp===void 0&&(e.tlp=await i(`tlp`,`The CISA defined Traffic Light Protocol (TLP).`,[`clear`,`amber`,`amber-strict`,`green`,`red`]));let h={};e.labels!==void 0&&o(h,[`labels`],e.labels),e.priority!==void 0&&o(h,[`priority`],e.priority),e.requirement!==void 0&&o(h,[`requirement`],d(e.requirement,`requirement`,`text`)),e.tlp!==void 0&&o(h,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Updating`,async()=>f.put(`/accounts/${m}/cloudforce-one/requests/priority/${encodeURIComponent(String(e[`priority-id`]))}`,{body:Object.keys(h).length>0?h:void 0})),{successLabel:`Updated`})}},ar={command:`priority`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(Jn).command(Xn).command(Qn).command(er).command(nr).command(ir).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function or(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const sr={command:`quota`,describe:`Retrieves quota usage for Cloudforce One standard requests.`,builder:or,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests quota`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/quota`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.requests.quota(i)),{successLabel:`Loaded`})}};function cr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const lr={command:`types`,describe:`Lists available request types for Cloudforce One intelligence requests.`,builder:cr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests types`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/types`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.requests.types(i)),{successLabel:`Loaded`})}};function ur(e){return e.positional(`request-id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`content`,{type:`string`,description:`Request content.`}).option(`priority`,{type:`string`,description:`Priority for analyzing the request.`}).option(`request-type`,{type:`string`,description:`Requested information from request.`}).option(`summary`,{type:`string`,description:`Brief description of the request.`}).option(`tlp`,{type:`string`,description:`The CISA defined Traffic Light Protocol (TLP).`,choices:[`clear`,`amber`,`amber-strict`,`green`,`red`]}).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 dr={command:`update <request-id>`,describe:`Updating a request alters the request in the Cloudforce One queue. This API may be used to update any attributes of the request after the initial submission. Only fields that you choose to update need to be add to the request body.`,builder:ur,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one requests update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/requests/${e[`request-id`]==null?`<request-id>`:encodeURIComponent(String(e[`request-id`]))}`,pathParams:{"request-id":String(e[`request-id`]??``)},bodyKind:`json`,body:{content:e.content,priority:e.priority,"request-type":e[`request-type`],summary:e.summary,tlp:e.tlp,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.put(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.content!==void 0&&o(f,[`content`],d(e.content,`content`,`text`)),e.priority!==void 0&&o(f,[`priority`],d(e.priority,`priority`,`text`)),e[`request-type`]!==void 0&&o(f,[`request_type`],d(e[`request-type`],`request-type`,`text`)),e.summary!==void 0&&o(f,[`summary`],d(e.summary,`summary`,`text`)),e.tlp!==void 0&&o(f,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Updating`,async()=>t.put(`/accounts/${i}/cloudforce-one/requests/${encodeURIComponent(String(e[`request-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}},fr={command:`requests`,describe:`Threat investigation requests — submit, track, and receive analyst findings`,builder:e=>e.command(kn).command(jn).command(Nn).command(Fn).command(Ln).command(sr).command(lr).command(dr).command(yn).command(Dn).command(Kn).command(ar).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pr(e){return e.option(`content`,{type:`string`,description:`The content field`}).option(`description`,{type:`string`,description:`Human-readable description of the rule. Auto-extracted from YARA meta if present.`}).option(`enabled`,{type:`boolean`,description:`Whether this rule is active for dice consumers.`,default:!0}).option(`is-public`,{type:`boolean`,description:`Whether this rule is visible to other internal accounts.`,default:!1}).option(`name`,{type:`string`,description:`The name field`}).option(`namespaces`,{type:`string`,array:!0,description:`The namespaces field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const mr={command:`create`,describe:`Create a new detection rule.`,builder:pr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},bodyKind:`json`,body:{content:e.content,description:e.description,enabled:e.enabled,"is-public":e[`is-public`],name:e.name,namespaces:e.namespaces,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/rules`,{body:t})),{successLabel:`Created`});return}if(e.content===void 0&&(e.content=await t(`content`,`The content field`)),e.name===void 0&&(e.name=await t(`name`,`The name field`)),e.namespaces===void 0)throw Error(`--namespaces is required (or pass --body with this field set).`);let m={};e.content!==void 0&&o(m,[`content`],d(e.content,`content`,`text`)),e.description!==void 0&&o(m,[`description`],d(e.description,`description`,`text`)),e.enabled!==void 0&&o(m,[`enabled`],e.enabled),e[`is-public`]!==void 0&&o(m,[`is_public`],e[`is-public`]),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),e.namespaces!==void 0&&o(m,[`namespaces`],e.namespaces),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/rules`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function hr(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 gr={command:`rules`,describe:`Delete all rules in an account.`,builder:hr,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one rules delete all rules`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
16
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.rules.delete.all.rules(o)),{successLabel:`Deleted`})}},_r={command:`all`,describe:`Rules operations`,builder:e=>e.command(gr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function vr(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const yr={command:`rule <id>`,describe:`Delete an existing rule.`,builder:vr,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one rules delete one rule`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules/${t.id==null?`<id>`:encodeURIComponent(String(t.id))}`,pathParams:{id:String(t.id??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
17
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.rules.delete.one.rule(o,t.id)),{successLabel:`Deleted`})}},br={command:`one`,describe:`Rules operations`,builder:e=>e.command(yr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},xr={command:`delete`,describe:`Operations for rules.delete`,builder:e=>e.command(_r).command(br).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Sr(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Cr={command:`get <id>`,describe:`Get a single rule by ID.`,builder:Sr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.rules.get(i,e.id)),{successLabel:`Loaded`})}};function wr(e){return e.option(`namespace`,{type:`string`,description:`Filter by namespace. Repeat the parameter to filter by multiple namespaces (e.g. namespace=foo&namespace=bar).`}).option(`recursive`,{type:`string`,description:`Recursive`,choices:[`true`,`false`]}).option(`search`,{type:`string`,description:`Search`}).option(`is-public`,{type:`string`,description:`Filter by public visibility.`,choices:[`true`,`false`]}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Tr={command:`list`,describe:`List all rules for an account with optional filtering.`,builder:wr,handler:async e=>{let t={namespace:e.namespace,recursive:e.recursive,search:e.search,is_public:e[`is-public`],limit:e.limit,offset:e.offset};if(e.dryRun){l({command:`cf cloudforce-one rules list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.rules.list(o,t)),{successLabel:`Loaded`})}};function Er(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Dr={command:`get`,describe:`Get statistics about rules for the dashboard.`,builder:Er,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one rules stats get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules/stats`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.rules.stats.get(i)),{successLabel:`Loaded`})}},Or={command:`stats`,describe:`Rules operations`,builder:e=>e.command(Dr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function kr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ar={command:`get`,describe:`Get the folder tree structure for rules navigation.`,builder:kr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one rules tree get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules/tree`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.rules.tree.get(i)),{successLabel:`Loaded`})}},jr={command:`tree`,describe:`Rules operations`,builder:e=>e.command(Ar).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Mr(e){return e.positional(`id`,{type:`string`,description:`The unique identifier for the rule.`,demandOption:!0}).option(`content`,{type:`string`,description:`The content field`}).option(`description`,{type:`string`,description:`Human-readable description of the rule. Auto-extracted from YARA meta if present.`}).option(`enabled`,{type:`boolean`,description:`Whether this rule is active for dice consumers.`}).option(`is-public`,{type:`boolean`,description:`Whether this rule is visible to other internal accounts.`}).option(`name`,{type:`string`,description:`The name field`}).option(`namespaces`,{type:`string`,array:!0,description:`The namespaces field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Nr={command:`update <id>`,describe:`Update an existing rule.`,builder:Mr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{id:String(e.id??``)},bodyKind:`json`,body:{content:e.content,description:e.description,enabled:e.enabled,"is-public":e[`is-public`],name:e.name,namespaces:e.namespaces,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.put(`/accounts/${i}/cloudforce-one/rules/${encodeURIComponent(String(e.id))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.content!==void 0&&o(f,[`content`],d(e.content,`content`,`text`)),e.description!==void 0&&o(f,[`description`],d(e.description,`description`,`text`)),e.enabled!==void 0&&o(f,[`enabled`],e.enabled),e[`is-public`]!==void 0&&o(f,[`is_public`],e[`is-public`]),e.name!==void 0&&o(f,[`name`],d(e.name,`name`,`text`)),e.namespaces!==void 0&&o(f,[`namespaces`],e.namespaces),c(await u(`Updating`,async()=>t.put(`/accounts/${i}/cloudforce-one/rules/${encodeURIComponent(String(e.id))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}};function Pr(e){return e.option(`content`,{type:`string`,description:`The content field`}).option(`exclude-rule-id`,{type:`string`,description:`The excludeRuleId field`}).option(`name`,{type:`string`,description:`The name field`}).option(`namespaces`,{type:`string`,array:!0,description:`The namespaces field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Fr={command:`create`,describe:`Validate rule syntax, name uniqueness, namespace, and meta checks.`,builder:Pr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one rules validate create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/rules/validate`,pathParams:{},bodyKind:`json`,body:{content:e.content,"exclude-rule-id":e[`exclude-rule-id`],name:e.name,namespaces:e.namespaces,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/rules/validate`,{body:t})),{successLabel:`Created`});return}if(e.content===void 0&&(e.content=await t(`content`,`The content field`)),e.name===void 0&&(e.name=await t(`name`,`The name field`)),e.namespaces===void 0)throw Error(`--namespaces is required (or pass --body with this field set).`);let m={};e.content!==void 0&&o(m,[`content`],d(e.content,`content`,`text`)),e[`exclude-rule-id`]!==void 0&&o(m,[`excludeRuleId`],d(e[`exclude-rule-id`],`exclude-rule-id`,`text`)),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),e.namespaces!==void 0&&o(m,[`namespaces`],e.namespaces),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/rules/validate`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},Ir={command:`validate`,describe:`Rules operations`,builder:e=>e.command(Fr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Lr={command:`rules`,describe:`Rules operations`,builder:e=>e.command(mr).command(Cr).command(Tr).command(Nr).command(xr).command(Or).command(jr).command(Ir).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Rr(e){return e.option(`frequency`,{type:`number`,description:`Defines the number of days between each scan (0 = One-off scan).`}).option(`ips`,{type:`string`,array:!0,description:`Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000.`}).option(`ports`,{type:`string`,array:!0,description:`Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports.`}).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 zr={command:`create`,describe:`Create a scan configuration`,builder:Rr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one scans config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/scans/config`,pathParams:{},bodyKind:`json`,body:{frequency:e.frequency,ips:e.ips,ports:e.ports,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/scans/config`,{body:n})),{successLabel:`Created`});return}if(e.ips===void 0)throw Error(`--ips is required (or pass --body with this field set).`);let d={};e.frequency!==void 0&&o(d,[`frequency`],e.frequency),e.ips!==void 0&&o(d,[`ips`],e.ips),e.ports!==void 0&&o(d,[`ports`],e.ports),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/scans/config`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function Br(e){return e.positional(`config-id`,{type:`string`,description:`Defines the Config 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 Vr={command:`delete <config-id>`,describe:`Delete scan configurations`,builder:Br,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one scans config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/scans/config/${t[`config-id`]==null?`<config-id>`:encodeURIComponent(String(t[`config-id`]))}`,pathParams:{"config-id":String(t[`config-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
18
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.scans.config.delete(o,t[`config-id`])),{successLabel:`Deleted`})}};function Hr(e){return e.positional(`config-id`,{type:`string`,description:`Defines the Config ID.`,demandOption:!0}).option(`frequency`,{type:`number`,description:`Defines the number of days between each scan (0 = One-off scan).`}).option(`ips`,{type:`string`,array:!0,description:`Defines a list of IP addresses or CIDR blocks to scan. The maximum number of total IP addresses allowed is 5000.`}).option(`ports`,{type:`string`,array:!0,description:`Defines a list of ports to scan. Valid values are:"default", "all", or a comma-separated list of ports or range of ports (e.g. ["1-80", "443"]). "default" scans the 100 most commonly open ports.`}).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 Ur={command:`edit <config-id>`,describe:`Update a scan configuration`,builder:Hr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one scans config edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/scans/config/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"config-id":String(e[`config-id`]??``)},bodyKind:`json`,body:{frequency:e.frequency,ips:e.ips,ports:e.ports,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/scans/config/${encodeURIComponent(String(e[`config-id`]))}`,{body:n})),{successLabel:`Updated`});return}let d={};e.frequency!==void 0&&o(d,[`frequency`],e.frequency),e.ips!==void 0&&o(d,[`ips`],e.ips),e.ports!==void 0&&o(d,[`ports`],e.ports),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/scans/config/${encodeURIComponent(String(e[`config-id`]))}`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Updated`})}};function Wr(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Gr={command:`list`,describe:`List scan configurations`,builder:Wr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one scans config list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/scans/config`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.scans.config.list(i)),{successLabel:`Loaded`})}},Kr={command:`config`,describe:`Scan URLs, IPs, and domains for threat intelligence indicators`,builder:e=>e.command(zr).command(Vr).command(Ur).command(Gr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function qr(e){return e.positional(`config-id`,{type:`string`,description:`Defines the Config ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Jr={command:`get <config-id>`,describe:`Get open ports scan results`,builder:qr,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one scans results get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/scans/results/${e[`config-id`]==null?`<config-id>`:encodeURIComponent(String(e[`config-id`]))}`,pathParams:{"config-id":String(e[`config-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.scans.results.get(i,e[`config-id`])),{successLabel:`Loaded`})}},Yr={command:`results`,describe:`Scan URLs, IPs, and domains for threat intelligence indicators`,builder:e=>e.command(Jr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Xr={command:`scans`,describe:`Operations for scans`,builder:e=>e.command(Kr).command(Yr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Zr(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query attackers from. If not provided, uses the default dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Qr={command:`list`,describe:`Lists known threat attackers tracked in Cloudforce One threat intelligence.`,builder:Zr,handler:async e=>{let t={datasetIds:e[`dataset-ids`]};if(e.dryRun){l({command:`cf cloudforce-one threat-events attackers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/attackers`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.threatEvents.attackers.list(o,t)),{successLabel:`Loaded`})}},$r={command:`attackers`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Qr).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ei(e){return e.option(`dataset-id`,{type:`string`,description:`The datasetId field`}).option(`include-created-events`,{type:`boolean`,description:`When true, response includes array of created event UUIDs and shard IDs. Useful for tracking which events were created and where.`}).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 ti={command:`bulk-create`,describe:"The `datasetId` parameter must be defined. To list existing datasets (and their IDs) in your account, use the [`List Datasets`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/list/) endpoint.",builder:ei,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events bulk-create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/create/bulk`,pathParams:{},bodyKind:`json`,body:{"dataset-id":e[`dataset-id`],"include-created-events":e[`include-created-events`],body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/create/bulk`,{body:t})),{successLabel:`Created`});return}e[`dataset-id`]===void 0&&(e[`dataset-id`]=await t(`dataset-id`,`The datasetId field`));let m={};e[`dataset-id`]!==void 0&&o(m,[`datasetId`],d(e[`dataset-id`],`dataset-id`,`text`)),e[`include-created-events`]!==void 0&&o(m,[`includeCreatedEvents`],e[`include-created-events`]),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/create/bulk`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function ni(e){return e.option(`kill-chain`,{type:`number`,description:`The killChain field`}).option(`mitre-attack`,{type:`string`,array:!0,description:`The mitreAttack field`}).option(`mitre-capec`,{type:`string`,array:!0,description:`The mitreCapec field`}).option(`name`,{type:`string`,description:`The name field`}).option(`shortname`,{type:`string`,description:`The shortname field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ri={command:`create`,describe:`Creates a new threat event category in Cloudforce One for organizing and classifying threat events.`,builder:ni,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events categories create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/categories/create`,pathParams:{},bodyKind:`json`,body:{"kill-chain":e[`kill-chain`],"mitre-attack":e[`mitre-attack`],"mitre-capec":e[`mitre-capec`],name:e.name,shortname:e.shortname,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/categories/create`,{body:t})),{successLabel:`Created`});return}if(e[`kill-chain`]===void 0)throw Error(`--kill-chain is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await t(`name`,`The name field`));let m={};e[`kill-chain`]!==void 0&&o(m,[`killChain`],e[`kill-chain`]),e[`mitre-attack`]!==void 0&&o(m,[`mitreAttack`],e[`mitre-attack`]),e[`mitre-capec`]!==void 0&&o(m,[`mitreCapec`],e[`mitre-capec`]),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),e.shortname!==void 0&&o(m,[`shortname`],d(e.shortname,`shortname`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/categories/create`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function ii(e){return e.positional(`category-id`,{type:`string`,description:`Category UUID.`,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 ai={command:`delete <category-id>`,describe:`Removes a threat event category from Cloudforce One.`,builder:ii,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one threat-events categories delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/categories/${t[`category-id`]==null?`<category-id>`:encodeURIComponent(String(t[`category-id`]))}`,pathParams:{"category-id":String(t[`category-id`]??``)},bodyKind:`none`});return}let i=await r(t),o=t.local?p:await n(i);if(t.accountId=o,!await e({force:!!t.force})){process.stderr.write(`Aborted.
19
- `);return}c(await u(`Deleting`,async()=>i.cloudforceOne.threatEvents.categories.delete(o,t[`category-id`])),{successLabel:`Deleted`})}};function oi(e){return e.positional(`category-id`,{type:`string`,description:`Category UUID.`,demandOption:!0}).option(`kill-chain`,{type:`number`,description:`The killChain field`}).option(`mitre-attack`,{type:`string`,array:!0,description:`The mitreAttack field`}).option(`mitre-capec`,{type:`string`,array:!0,description:`The mitreCapec field`}).option(`name`,{type:`string`,description:`The name field`}).option(`shortname`,{type:`string`,description:`The shortname field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const si={command:`edit <category-id>`,describe:`Partially updates a threat event category in Cloudforce One, modifying specific fields without replacing the entire category.`,builder:oi,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events categories edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/categories/${e[`category-id`]==null?`<category-id>`:encodeURIComponent(String(e[`category-id`]))}`,pathParams:{"category-id":String(e[`category-id`]??``)},bodyKind:`json`,body:{"kill-chain":e[`kill-chain`],"mitre-attack":e[`mitre-attack`],"mitre-capec":e[`mitre-capec`],name:e.name,shortname:e.shortname,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/categories/${encodeURIComponent(String(e[`category-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e[`kill-chain`]!==void 0&&o(f,[`killChain`],e[`kill-chain`]),e[`mitre-attack`]!==void 0&&o(f,[`mitreAttack`],e[`mitre-attack`]),e[`mitre-capec`]!==void 0&&o(f,[`mitreCapec`],e[`mitre-capec`]),e.name!==void 0&&o(f,[`name`],d(e.name,`name`,`text`)),e.shortname!==void 0&&o(f,[`shortname`],d(e.shortname,`shortname`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/categories/${encodeURIComponent(String(e[`category-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}};function ci(e){return e.positional(`category-id`,{type:`string`,description:`Category UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const li={command:`get <category-id>`,describe:`Retrieves details for a specific threat event category.`,builder:ci,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events categories get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/categories/${e[`category-id`]==null?`<category-id>`:encodeURIComponent(String(e[`category-id`]))}`,pathParams:{"category-id":String(e[`category-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.threatEvents.categories.get(i,e[`category-id`])),{successLabel:`Loaded`})}};function ui(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query categories from. If not provided, uses the default dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const di={command:`list`,describe:`Lists all threat event categories configured for classifying and organizing threat events.`,builder:ui,handler:async e=>{let t={datasetIds:e[`dataset-ids`]};if(e.dryRun){l({command:`cf cloudforce-one threat-events categories list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/categories`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.threatEvents.categories.list(o,t)),{successLabel:`Loaded`})}},fi={command:`categories`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(ri).command(ai).command(si).command(li).command(di).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const mi={command:`list`,describe:`Lists countries referenced in Cloudforce One threat intelligence data.`,builder:pi,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events countries list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/countries`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.threatEvents.countries.list(i)),{successLabel:`Loaded`})}},hi={command:`countries`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(mi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function gi(e){return e.option(`attacker`,{type:`string`,description:`The attacker field`}).option(`attacker-country`,{type:`string`,description:`The attackerCountry field`}).option(`category`,{type:`string`,description:`The category field`}).option(`dataset-id`,{type:`string`,description:`The datasetId field`}).option(`date`,{type:`string`,description:`The date field`}).option(`event`,{type:`string`,description:`The event field`}).option(`indicator`,{type:`string`,description:`The indicator field`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`insight`,{type:`string`,description:`The insight field`}).option(`raw-source`,{type:`string`,description:`The raw.source field`}).option(`raw-tlp`,{type:`string`,description:`The raw.tlp field`}).option(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`target-country`,{type:`string`,description:`The targetCountry field`}).option(`target-industry`,{type:`string`,description:`The targetIndustry field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _i={command:`create`,describe:"To create a dataset, see the [`Create Dataset`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/create/) endpoint. When `datasetId` parameter is unspecified, it will be created in a default dataset named `Cloudforce One Threat Events`.",builder:gi,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/create`,pathParams:{},bodyKind:`json`,body:{attacker:e.attacker,"attacker-country":e[`attacker-country`],category:e.category,"dataset-id":e[`dataset-id`],date:e.date,event:e.event,indicator:e.indicator,"indicator-type":e[`indicator-type`],insight:e.insight,"raw-source":e[`raw-source`],"raw-tlp":e[`raw-tlp`],tags:e.tags,"target-country":e[`target-country`],"target-industry":e[`target-industry`],tlp:e.tlp,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/create`,{body:t})),{successLabel:`Created`});return}e.category===void 0&&(e.category=await t(`category`,`The category field`)),e.date===void 0&&(e.date=await t(`date`,`The date field`)),e.event===void 0&&(e.event=await t(`event`,`The event field`)),e.tlp===void 0&&(e.tlp=await t(`tlp`,`The tlp field`));let m={};e.attacker!==void 0&&o(m,[`attacker`],d(e.attacker,`attacker`,`text`)),e[`attacker-country`]!==void 0&&o(m,[`attackerCountry`],d(e[`attacker-country`],`attacker-country`,`text`)),e.category!==void 0&&o(m,[`category`],d(e.category,`category`,`text`)),e[`dataset-id`]!==void 0&&o(m,[`datasetId`],d(e[`dataset-id`],`dataset-id`,`text`)),e.date!==void 0&&o(m,[`date`],d(e.date,`date`,`text`)),e.event!==void 0&&o(m,[`event`],d(e.event,`event`,`text`)),e.indicator!==void 0&&o(m,[`indicator`],d(e.indicator,`indicator`,`text`)),e[`indicator-type`]!==void 0&&o(m,[`indicatorType`],d(e[`indicator-type`],`indicator-type`,`text`)),e.insight!==void 0&&o(m,[`insight`],d(e.insight,`insight`,`text`)),e[`raw-source`]!==void 0&&o(m,[`raw`,`source`],d(e[`raw-source`],`raw-source`,`text`)),e[`raw-tlp`]!==void 0&&o(m,[`raw`,`tlp`],d(e[`raw-tlp`],`raw-tlp`,`text`)),e.tags!==void 0&&o(m,[`tags`],e.tags),e[`target-country`]!==void 0&&o(m,[`targetCountry`],d(e[`target-country`],`target-country`,`text`)),e[`target-industry`]!==void 0&&o(m,[`targetIndustry`],d(e[`target-industry`],`target-industry`,`text`)),e.tlp!==void 0&&o(m,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/create`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function vi(e){return e.option(`is-public`,{type:`boolean`,description:`If true, then anyone can search the dataset. If false, then its limited to the account.`}).option(`name`,{type:`string`,description:`Used to describe the dataset within the account context.`}).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 yi={command:`create`,describe:`Creates a new threat event dataset in Cloudforce One for organizing related threat events.`,builder:vi,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events datasets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/create`,pathParams:{},bodyKind:`json`,body:{"is-public":e[`is-public`],name:e.name,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/create`,{body:t})),{successLabel:`Created`});return}if(e[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await t(`name`,`Used to describe the dataset within the account context.`));let m={};e[`is-public`]!==void 0&&o(m,[`isPublic`],e[`is-public`]),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/dataset/create`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}};function bi(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`is-public`,{type:`boolean`,description:`If true, then anyone can search the dataset. If false, then its limited to the account.`}).option(`name`,{type:`string`,description:`Used to describe the dataset within the account context.`}).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 xi={command:`edit <dataset-id>`,describe:`Partially updates a threat event dataset in Cloudforce One, modifying specific fields without replacing the entire dataset configuration.`,builder:bi,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events datasets edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`json`,body:{"is-public":e[`is-public`],name:e.name,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Updating`,async()=>i.patch(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}`,{body:t})),{successLabel:`Updated`});return}if(e[`is-public`]===void 0)throw Error(`--is-public is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await t(`name`,`Used to describe the dataset within the account context.`));let m={};e[`is-public`]!==void 0&&o(m,[`isPublic`],e[`is-public`]),e.name!==void 0&&o(m,[`name`],d(e.name,`name`,`text`)),c(await u(`Updating`,async()=>i.patch(`/accounts/${f}/cloudforce-one/events/dataset/${encodeURIComponent(String(e[`dataset-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}};function Si(e){return e.positional(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ci={command:`get <dataset-id>`,describe:`Retrieves details for a specific threat event dataset.`,builder:Si,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events datasets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}`,pathParams:{"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.threatEvents.datasets.get(i,e[`dataset-id`])),{successLabel:`Loaded`})}};function wi(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ti={command:`list`,describe:`Lists all threat event datasets configured in Cloudforce One.`,builder:wi,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events datasets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/dataset`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.threatEvents.datasets.list(i)),{successLabel:`Loaded`})}};function Ei(e){return e.positional(`event-id`,{type:`string`,description:`Event ID.`,demandOption:!0}).option(`dataset-id`,{type:`string`,description:`Dataset ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Di={command:`raw <event-id>`,describe:`Retrieves the raw data associated with an event. Searches across all shards in the dataset.`,builder:Ei,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events datasets raw`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/raw/${e[`dataset-id`]==null?`<dataset-id>`:encodeURIComponent(String(e[`dataset-id`]))}/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``),"dataset-id":String(e[`dataset-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.threatEvents.datasets.raw(i,e[`event-id`],e[`dataset-id`])),{successLabel:`Loaded`})}},Oi={command:`datasets`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(yi).command(xi).command(Ci).command(Ti).command(Di).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ki(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`attacker`,{type:`string`,description:`The attacker field`}).option(`attacker-country`,{type:`string`,description:`The attackerCountry field`}).option(`category`,{type:`string`,description:`The category field`}).option(`created-at`,{type:`string`,description:`The createdAt field`}).option(`dataset-id`,{type:`string`,description:`Dataset ID containing the event to update.`}).option(`date`,{type:`string`,description:`The date field`}).option(`event`,{type:`string`,description:`The event field`}).option(`indicator`,{type:`string`,description:`The indicator field`}).option(`indicator-type`,{type:`string`,description:`The indicatorType field`}).option(`insight`,{type:`string`,description:`The insight field`}).option(`raw-source`,{type:`string`,description:`The raw.source field`}).option(`raw-tlp`,{type:`string`,description:`The raw.tlp field`}).option(`target-country`,{type:`string`,description:`The targetCountry field`}).option(`target-industry`,{type:`string`,description:`The targetIndustry field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ai={command:`edit <event-id>`,describe:`Partially updates a threat event in Cloudforce One, modifying specific fields without replacing the entire event.`,builder:ki,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`json`,body:{attacker:e.attacker,"attacker-country":e[`attacker-country`],category:e.category,"created-at":e[`created-at`],"dataset-id":e[`dataset-id`],date:e.date,event:e.event,indicator:e.indicator,"indicator-type":e[`indicator-type`],insight:e.insight,"raw-source":e[`raw-source`],"raw-tlp":e[`raw-tlp`],"target-country":e[`target-country`],"target-industry":e[`target-industry`],tlp:e.tlp,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Updating`,async()=>i.patch(`/accounts/${f}/cloudforce-one/events/${encodeURIComponent(String(e[`event-id`]))}`,{body:t})),{successLabel:`Updated`});return}e[`dataset-id`]===void 0&&(e[`dataset-id`]=await t(`dataset-id`,`Dataset ID containing the event to update.`));let m={};e.attacker!==void 0&&o(m,[`attacker`],d(e.attacker,`attacker`,`text`)),e[`attacker-country`]!==void 0&&o(m,[`attackerCountry`],d(e[`attacker-country`],`attacker-country`,`text`)),e.category!==void 0&&o(m,[`category`],d(e.category,`category`,`text`)),e[`created-at`]!==void 0&&o(m,[`createdAt`],d(e[`created-at`],`created-at`,`text`)),e[`dataset-id`]!==void 0&&o(m,[`datasetId`],d(e[`dataset-id`],`dataset-id`,`text`)),e.date!==void 0&&o(m,[`date`],d(e.date,`date`,`text`)),e.event!==void 0&&o(m,[`event`],d(e.event,`event`,`text`)),e.indicator!==void 0&&o(m,[`indicator`],d(e.indicator,`indicator`,`text`)),e[`indicator-type`]!==void 0&&o(m,[`indicatorType`],d(e[`indicator-type`],`indicator-type`,`text`)),e.insight!==void 0&&o(m,[`insight`],d(e.insight,`insight`,`text`)),e[`raw-source`]!==void 0&&o(m,[`raw`,`source`],d(e[`raw-source`],`raw-source`,`text`)),e[`raw-tlp`]!==void 0&&o(m,[`raw`,`tlp`],d(e[`raw-tlp`],`raw-tlp`,`text`)),e[`target-country`]!==void 0&&o(m,[`targetCountry`],d(e[`target-country`],`target-country`,`text`)),e[`target-industry`]!==void 0&&o(m,[`targetIndustry`],d(e[`target-industry`],`target-industry`,`text`)),e.tlp!==void 0&&o(m,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Updating`,async()=>i.patch(`/accounts/${f}/cloudforce-one/events/${encodeURIComponent(String(e[`event-id`]))}`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Updated`})}};function ji(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Mi={command:`create <event-id>`,describe:`Adds a tag to a threat event in Cloudforce One for classification and filtering.`,builder:ji,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events event-tags create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/event_tag/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/create`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`json`,body:{tags:e.tags,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/event_tag/${encodeURIComponent(String(e[`event-id`]))}/create`,{body:n})),{successLabel:`Created`});return}if(e.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let d={};e.tags!==void 0&&o(d,[`tags`],e.tags),c(await u(`Creating`,async()=>t.post(`/accounts/${i}/cloudforce-one/events/event_tag/${encodeURIComponent(String(e[`event-id`]))}/create`,{body:Object.keys(d).length>0?d:void 0})),{successLabel:`Created`})}};function Ni(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`tags`,{type:`string`,array:!0,description:`The tags field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Pi={command:`delete <event-id>`,describe:`Removes a tag from a threat event in Cloudforce One.`,builder:Ni,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one threat-events event-tags delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/event_tag/${t[`event-id`]==null?`<event-id>`:encodeURIComponent(String(t[`event-id`]))}`,pathParams:{"event-id":String(t[`event-id`]??``)},bodyKind:`json`,body:{tags:t.tags,body:t.body}});return}let i=await r(t),d=t.local?p:await n(i);if(t.accountId=d,!await e({force:!!t.force})){process.stderr.write(`Aborted.
20
- `);return}if(t.body){let e=s(t.body);c(await u(`Deleting`,async()=>i.delete(`/accounts/${d}/cloudforce-one/events/event_tag/${encodeURIComponent(String(t[`event-id`]))}`,{body:e})),{successLabel:`Deleted`});return}if(t.tags===void 0)throw Error(`--tags is required (or pass --body with this field set).`);let f={};t.tags!==void 0&&o(f,[`tags`],t.tags),c(await u(`Deleting`,async()=>i.delete(`/accounts/${d}/cloudforce-one/events/event_tag/${encodeURIComponent(String(t[`event-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Deleted`})}},Fi={command:`event-tags`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Mi).command(Pi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ii(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Li={command:`get <event-id>`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/events/:event_id instead.`,builder:Ii,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.threatEvents.get(i,e[`event-id`])),{successLabel:`Loaded`})}};function Ri(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const zi={command:`list`,describe:`This Method is deprecated. Please use /events/dataset/:dataset_id/indicatorTypes instead.`,builder:Ri,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events indicator-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/indicatorTypes`,pathParams:{},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.threatEvents.indicatorTypes.list(i)),{successLabel:`Loaded`})}},Bi={command:`indicator-types`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(zi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Vi(e){return e.option(`cursor`,{type:`string`,description:`Cursor for pagination. When provided, filters are embedded in the cursor so you only need to pass cursor and pageSize. Returned in the previous response's result_info.cursor field. Use cursor-based pagination for deep pagination (beyond 100,000 records) or for optimal performance.`}).option(`search`,{type:`string`,description:`Search`}).option(`page`,{type:`number`,description:`Page number (1-indexed) for offset-based pagination. Limited to offset of 100,000 records. For deep pagination, use cursor-based pagination instead.`}).option(`page-size`,{type:`number`,description:`Number of results per page. Maximum 25,000.`}).option(`order-by`,{type:`string`,description:`OrderBy`}).option(`order`,{type:`string`,description:`Order`,choices:[`asc`,`desc`]}).option(`dataset-id`,{type:`string`,description:`Dataset IDs to query events from (array of UUIDs), or special value 'all' or '*' to query all event datasets for the account. If not provided, uses the default dataset.`}).option(`force-refresh`,{type:`boolean`,description:`ForceRefresh`}).option(`format`,{type:`string`,description:`Format`,choices:[`json`,`stix2`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Hi={command:`list`,describe:"Use `datasetId=all` or `datasetId=*` to query all event datasets for the account (limited to 10). When `datasetId` is unspecified, events are listed from the default Cloudforce One Threat Events dataset. To list existing datasets, use the [`List Datasets`](https://developers.cloudflare.com/api/resources/cloudforce_one/subresources/threat_events/subresources/datasets/methods/list/) endpoint.",builder:Vi,handler:async e=>{let t={cursor:e.cursor,search:e.search,page:e.page,pageSize:e[`page-size`],orderBy:e[`order-by`],order:e.order,datasetId:e[`dataset-id`],forceRefresh:e[`force-refresh`],format:e.format};if(e.dryRun){l({command:`cf cloudforce-one threat-events list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.threatEvents.list(o,t)),{successLabel:`Loaded`})}};function Ui(e){return e.positional(`raw-id`,{type:`string`,description:`Raw Event UUID.`,demandOption:!0}).option(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`source`,{type:`string`,description:`The source field`}).option(`tlp`,{type:`string`,description:`The tlp field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Wi={command:`edit <raw-id>`,describe:`Partially updates raw threat event data in Cloudforce One, modifying specific fields of the event.`,builder:Ui,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events raw edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/raw/${e[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(e[`raw-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``),"raw-id":String(e[`raw-id`]??``)},bodyKind:`json`,body:{source:e.source,tlp:e.tlp,body:e.body}});return}let t=await r(e),i=e.local?p:await n(t);if(e.accountId=i,e.body){let n=s(e.body);c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/${encodeURIComponent(String(e[`event-id`]))}/raw/${encodeURIComponent(String(e[`raw-id`]))}`,{body:n})),{successLabel:`Updated`});return}let f={};e.source!==void 0&&o(f,[`source`],d(e.source,`source`,`text`)),e.tlp!==void 0&&o(f,[`tlp`],d(e.tlp,`tlp`,`text`)),c(await u(`Updating`,async()=>t.patch(`/accounts/${i}/cloudforce-one/events/${encodeURIComponent(String(e[`event-id`]))}/raw/${encodeURIComponent(String(e[`raw-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Updated`})}};function Gi(e){return e.positional(`raw-id`,{type:`string`,description:`Raw Event UUID.`,demandOption:!0}).option(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ki={command:`get <raw-id>`,describe:`Retrieves raw threat event data for a specific event in Cloudforce One.`,builder:Gi,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events raw get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/${e[`event-id`]==null?`<event-id>`:encodeURIComponent(String(e[`event-id`]))}/raw/${e[`raw-id`]==null?`<raw-id>`:encodeURIComponent(String(e[`raw-id`]))}`,pathParams:{"event-id":String(e[`event-id`]??``),"raw-id":String(e[`raw-id`]??``)},bodyKind:`none`});return}let t=await r(e),i=e.local?p:await n(t);e.accountId=i,c(await u(`Loading`,async()=>t.cloudforceOne.threatEvents.raw.get(i,e[`event-id`],e[`raw-id`])),{successLabel:`Loaded`})}},qi={command:`raw`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Wi).command(Ki).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ji(e){return e.positional(`event-id`,{type:`string`,description:`Event UUID.`,demandOption:!0}).option(`events`,{type:`string`,array:!0,description:`The events field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Yi={command:`delete <event-id>`,describe:`Removes a reference link between related threat events in Cloudforce One.`,builder:Ji,handler:async t=>{if(t.dryRun){l({command:`cf cloudforce-one threat-events relate delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/relate/${t[`event-id`]==null?`<event-id>`:encodeURIComponent(String(t[`event-id`]))}`,pathParams:{"event-id":String(t[`event-id`]??``)},bodyKind:`json`,body:{events:t.events,body:t.body}});return}let i=await r(t),d=t.local?p:await n(i);if(t.accountId=d,!await e({force:!!t.force})){process.stderr.write(`Aborted.
21
- `);return}if(t.body){let e=s(t.body);c(await u(`Deleting`,async()=>i.delete(`/accounts/${d}/cloudforce-one/events/relate/${encodeURIComponent(String(t[`event-id`]))}`,{body:e})),{successLabel:`Deleted`});return}if(t.events===void 0)throw Error(`--events is required (or pass --body with this field set).`);let f={};t.events!==void 0&&o(f,[`events`],t.events),c(await u(`Deleting`,async()=>i.delete(`/accounts/${d}/cloudforce-one/events/relate/${encodeURIComponent(String(t[`event-id`]))}`,{body:Object.keys(f).length>0?f:void 0})),{successLabel:`Deleted`})}},Xi={command:`relate`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Yi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Zi(e){return e.option(`active-duration`,{type:`string`,description:`The activeDuration field`}).option(`actor-category`,{type:`string`,description:`The actorCategory field`}).option(`alias-group-names`,{type:`string`,array:!0,description:`The aliasGroupNames field`}).option(`alias-group-names-internal`,{type:`string`,array:!0,description:`The aliasGroupNamesInternal field`}).option(`analytic-priority`,{type:`number`,description:`The analyticPriority field`}).option(`attribution-confidence`,{type:`string`,description:`The attributionConfidence field`}).option(`attribution-organization`,{type:`string`,description:`The attributionOrganization field`}).option(`category-uuid`,{type:`string`,description:`The categoryUuid field`}).option(`external-reference-links`,{type:`string`,array:!0,description:`The externalReferenceLinks field`}).option(`internal-description`,{type:`string`,description:`The internalDescription field`}).option(`motive`,{type:`string`,description:`The motive field`}).option(`opsec-level`,{type:`string`,description:`The opsecLevel field`}).option(`origin-country-iso`,{type:`string`,description:`The originCountryISO field`}).option(`priority`,{type:`number`,description:`The priority field`}).option(`sophistication-level`,{type:`string`,description:`The sophisticationLevel field`}).option(`value`,{type:`string`,description:`The value field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Qi={command:`create`,describe:`Creates a new tag to be used accross threat events.`,builder:Zi,handler:async e=>{if(e.dryRun){l({command:`cf cloudforce-one threat-events tags create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/tags/create`,pathParams:{},bodyKind:`json`,body:{"active-duration":e[`active-duration`],"actor-category":e[`actor-category`],"alias-group-names":e[`alias-group-names`],"alias-group-names-internal":e[`alias-group-names-internal`],"analytic-priority":e[`analytic-priority`],"attribution-confidence":e[`attribution-confidence`],"attribution-organization":e[`attribution-organization`],"category-uuid":e[`category-uuid`],"external-reference-links":e[`external-reference-links`],"internal-description":e[`internal-description`],motive:e.motive,"opsec-level":e[`opsec-level`],"origin-country-iso":e[`origin-country-iso`],priority:e.priority,"sophistication-level":e[`sophistication-level`],value:e.value,body:e.body}});return}let i=await r(e),f=e.local?p:await n(i);if(e.accountId=f,e.body){let t=s(e.body);c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/tags/create`,{body:t})),{successLabel:`Created`});return}e.value===void 0&&(e.value=await t(`value`,`The value field`));let m={};e[`active-duration`]!==void 0&&o(m,[`activeDuration`],d(e[`active-duration`],`active-duration`,`text`)),e[`actor-category`]!==void 0&&o(m,[`actorCategory`],d(e[`actor-category`],`actor-category`,`text`)),e[`alias-group-names`]!==void 0&&o(m,[`aliasGroupNames`],e[`alias-group-names`]),e[`alias-group-names-internal`]!==void 0&&o(m,[`aliasGroupNamesInternal`],e[`alias-group-names-internal`]),e[`analytic-priority`]!==void 0&&o(m,[`analyticPriority`],e[`analytic-priority`]),e[`attribution-confidence`]!==void 0&&o(m,[`attributionConfidence`],d(e[`attribution-confidence`],`attribution-confidence`,`text`)),e[`attribution-organization`]!==void 0&&o(m,[`attributionOrganization`],d(e[`attribution-organization`],`attribution-organization`,`text`)),e[`category-uuid`]!==void 0&&o(m,[`categoryUuid`],d(e[`category-uuid`],`category-uuid`,`text`)),e[`external-reference-links`]!==void 0&&o(m,[`externalReferenceLinks`],e[`external-reference-links`]),e[`internal-description`]!==void 0&&o(m,[`internalDescription`],d(e[`internal-description`],`internal-description`,`text`)),e.motive!==void 0&&o(m,[`motive`],d(e.motive,`motive`,`text`)),e[`opsec-level`]!==void 0&&o(m,[`opsecLevel`],d(e[`opsec-level`],`opsec-level`,`text`)),e[`origin-country-iso`]!==void 0&&o(m,[`originCountryISO`],d(e[`origin-country-iso`],`origin-country-iso`,`text`)),e.priority!==void 0&&o(m,[`priority`],e.priority),e[`sophistication-level`]!==void 0&&o(m,[`sophisticationLevel`],d(e[`sophistication-level`],`sophistication-level`,`text`)),e.value!==void 0&&o(m,[`value`],d(e.value,`value`,`text`)),c(await u(`Creating`,async()=>i.post(`/accounts/${f}/cloudforce-one/events/tags/create`,{body:Object.keys(m).length>0?m:void 0})),{successLabel:`Created`})}},$i={command:`tags`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(Qi).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ea(e){return e.option(`dataset-ids`,{type:`string`,description:`Array of dataset IDs to query target industries from. If not provided, uses the default dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ta={command:`list`,describe:`Retrieves the catalog of industry classifications used in Cloudforce One threat intelligence.`,builder:ea,handler:async e=>{let t={datasetIds:e[`dataset-ids`]};if(e.dryRun){l({command:`cf cloudforce-one threat-events target-industries list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${a()??`<account-id>`}/cloudforce-one/events/targetIndustries`,pathParams:{},query:t,bodyKind:`none`});return}let i=await r(e),o=e.local?p:await n(i);e.accountId=o,c(await u(`Loading`,async()=>i.cloudforceOne.threatEvents.targetIndustries.list(o,t)),{successLabel:`Loaded`})}},na={command:`target-industries`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(ta).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ra={command:`threat-events`,describe:`Threat event feed — structured intelligence on attacks, campaigns, and indicators of compromise`,builder:e=>e.command(ti).command(_i).command(Ai).command(Li).command(Hi).command($r).command(fi).command(hi).command(Oi).command(Fi).command(Bi).command(qi).command(Xi).command($i).command(na).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ia={command:`cloudforce-one`,describe:`Threat intelligence platform — request investigations, scan indicators, and track threat events`,builder:e=>e.command(te).command(gn).command(fr).command(Lr).command(Xr).command(ra).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ia as default};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{r as e}from"./chunk-DH-VkVmc.mjs";import{J as t}from"./dist-DNBSHor6.mjs";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{join as o}from"node:path";var s=e({getConfigDir:()=>u,getConfigFile:()=>d,loadConfig:()=>p,saveConfig:()=>m,updateConfig:()=>h});function c(){return t({appName:`cf`,useLegacyHomeDir:!1})}function l(){return o(c(),`config.json`)}function u(){return c()}function d(){return l()}function f(){let e=c();n(e)||r(e,{recursive:!0,mode:448})}function p(){try{let e=l();if(!n(e))return{};let t=i(e,`utf-8`);return JSON.parse(t)}catch{return{}}}function m(e){f();let t=JSON.stringify(e,null,2);a(l(),t,{mode:384})}function h(e){let t=p(),n={...t,...e};e.completions&&t.completions&&(n.completions={...t.completions,...e.completions}),e.defaults&&t.defaults&&(n.defaults={...t.defaults,...e.defaults}),m(n)}export{m as a,p as i,u as n,d as r,s as t};